From 0e05d3b30abdca76201f3382679addc87df2e5a1 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Fri, 20 Jan 2017 12:06:25 +0300 Subject: [PATCH 01/86] compiler: 1.1-20170119.231846-374 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 422a44c3a4b..6db9416d62a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin_version=1.1-M03 #kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-SNAPSHOT -kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170116.100209-359 \ No newline at end of file +kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170119.231846-374 \ No newline at end of file From 1c878e484396d1ab8d46ee3edef3ae82061a440e Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 20 Jan 2017 13:31:01 +0300 Subject: [PATCH 02/86] Improve object init order. (#187) --- backend.native/tests/build.gradle | 5 +++++ backend.native/tests/runtime/basic/initializers5.kt | 8 ++++++++ runtime/src/main/cpp/Memory.cpp | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 backend.native/tests/runtime/basic/initializers5.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 55147a82d03..33cb0df9721 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -834,6 +834,11 @@ task initializers4(type: RunKonanTest) { source = "runtime/basic/initializers4.kt" } +task initializers5(type: RunKonanTest) { + goldValue = "42\n" + source = "runtime/basic/initializers5.kt" +} + task expression_as_statement(type: RunKonanTest) { goldValue = "Ok\n" source = "codegen/basics/expression_as_statement.kt" diff --git a/backend.native/tests/runtime/basic/initializers5.kt b/backend.native/tests/runtime/basic/initializers5.kt new file mode 100644 index 00000000000..1c801347fee --- /dev/null +++ b/backend.native/tests/runtime/basic/initializers5.kt @@ -0,0 +1,8 @@ +object A { + val a = 42 + val b = A.a +} + +fun main(args : Array) { + println(A.b) +} \ No newline at end of file diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index c8da8601f31..7c37af313fb 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -440,9 +440,9 @@ OBJ_GETTER(InitInstance, AllocInstance(type_info, hint, OBJ_RESULT); ObjHeader* object = *OBJ_RESULT; + UpdateGlobalRef(location, object); try { ctor(object); - UpdateGlobalRef(location, object); #if CONCURRENT // TODO: locking or smth lock-free in MT case? #endif From eb6ba1cfa5d0fa5c6e374779e1dee83951fb4622 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 20 Jan 2017 13:31:47 +0300 Subject: [PATCH 03/86] Fix primitive type globals initialization. (#189) --- .../org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 5 +++-- backend.native/tests/build.gradle | 3 +-- runtime/src/main/kotlin/kotlin/Array.kt | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index bd8d8d19a45..4a2777441a3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -597,11 +597,12 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid context.log("visitField : ${ir2string(expression)}") val descriptor = expression.descriptor if (descriptor.containingDeclaration is PackageFragmentDescriptor) { - val globalProperty = LLVMAddGlobal(context.llvmModule, codegen.getLLVMType(descriptor.type), descriptor.symbolName) + val type = codegen.getLLVMType(descriptor.type) + val globalProperty = LLVMAddGlobal(context.llvmModule, type, descriptor.symbolName) if (expression.initializer!!.expression is IrConst<*>) { LLVMSetInitializer(globalProperty, evaluateExpression(expression.initializer!!.expression)) } else { - LLVMSetInitializer(globalProperty, codegen.kNullObjHeaderPtr) + LLVMSetInitializer(globalProperty, LLVMConstNull(type)) context.llvm.fileInitializers.add(expression) } return diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 33cb0df9721..0a436dd72f3 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -829,8 +829,7 @@ task initializers3(type: RunKonanTest) { } task initializers4(type: RunKonanTest) { - disabled = true - goldValue = "fixme\n" + goldValue = "1073741824\ntrue\n" source = "runtime/basic/initializers4.kt" } diff --git a/runtime/src/main/kotlin/kotlin/Array.kt b/runtime/src/main/kotlin/kotlin/Array.kt index 6bb2387e3fe..7b02c11f628 100644 --- a/runtime/src/main/kotlin/kotlin/Array.kt +++ b/runtime/src/main/kotlin/kotlin/Array.kt @@ -46,6 +46,8 @@ private class IteratorImpl(val collection: Array) : Iterator { } } +fun arrayOf(vararg elements: T) : Array = elements + public fun > Array.toCollection(destination: C): C { for (item in this) { destination.add(item) From 97b5c60455f630dcb93b5ba42e5056a1bfd05955 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 19 Jan 2017 13:37:16 +0700 Subject: [PATCH 04/86] backend: support `IrField` located directly at `IrClass` --- .../kotlin/backend/konan/llvm/ContextUtils.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index a792110a4d7..16c1b28264c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.IrField import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.name.FqName @@ -76,10 +77,14 @@ internal interface ContextUtils { val irClass = context.ir.moduleIndex.classes[this.classId] if (irClass != null) { - val irProperties = irClass.declarations + val declarations = irClass.declarations - return irProperties.mapNotNull { - (it as? IrProperty)?.backingField?.descriptor + return declarations.mapNotNull { + when (it) { + is IrProperty -> it.backingField?.descriptor + is IrField -> it.descriptor + else -> null + } } } else { val properties = this.unsubstitutedMemberScope. From 40eea333ce254b2d50a0f274daa8a292e9de75bd Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 19 Jan 2017 13:37:38 +0700 Subject: [PATCH 05/86] backend: build ModuleIndex for codegen after lowering --- .../src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt | 2 ++ .../src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt | 4 +++- .../org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt | 2 +- .../org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 2 +- .../jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt index f8d603f44bd..ad78da2e2da 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.analyzer.AnalysisResult import org.jetbrains.kotlin.backend.konan.llvm.emitLLVM import org.jetbrains.kotlin.backend.konan.util.profile import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.backend.konan.ir.ModuleIndex import org.jetbrains.kotlin.cli.common.CLICompiler import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport @@ -67,6 +68,7 @@ public fun runTopLevelPhases(konanConfig: KonanConfig, environment: KotlinCoreEn phaser.phase(KonanPhase.BACKEND) { phaser.phase(KonanPhase.LOWER) { KonanLower(context).lower() + context.ir.moduleIndexForCodegen = ModuleIndex(context.ir.irModule) } phaser.phase(KonanPhase.BITCODE) { emitLLVM(context) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt index 9e72f50942b..02ba74f77c3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt @@ -8,5 +8,7 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor internal class Ir(val context: Context, val irModule: IrModuleFragment) { val propertiesWithBackingFields = mutableSetOf() - val moduleIndex = ModuleIndex(irModule) + val originalModuleIndex = ModuleIndex(irModule) + + lateinit var moduleIndexForCodegen: ModuleIndex } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index 16c1b28264c..fc0f65ee207 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -75,7 +75,7 @@ internal interface ContextUtils { // In this function we check the presence of the backing filed // two ways: first we check IR, then we check the annotation. - val irClass = context.ir.moduleIndex.classes[this.classId] + val irClass = context.ir.moduleIndexForCodegen.classes[this.classId] if (irClass != null) { val declarations = irClass.declarations diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 4a2777441a3..fea79580d6f 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -388,7 +388,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid LLVMSetInitializer(objectPtr, codegen.kNullObjHeaderPtr) } } - val irOfCurrentClass = context.ir.moduleIndex.classes[classDescriptor.classId] + val irOfCurrentClass = context.ir.moduleIndexForCodegen.classes[classDescriptor.classId] irOfCurrentClass!!.acceptChildrenVoid(object : IrElementVisitorVoid { override fun visitElement(element: IrElement) { element.acceptChildrenVoid(this) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt index 4e0d9f7433e..533802e0b84 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt @@ -24,7 +24,8 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoid( val functionDescriptor = expression.descriptor as FunctionDescriptor if (!functionDescriptor.isInline) return super.visitCall(expression) // Function is not to be inlined - do nothing. - val functionDeclaration = context.ir.moduleIndex.functions[functionDescriptor] // Get FunctionDeclaration by FunctionDescriptor. + val functionDeclaration = context.ir.originalModuleIndex + .functions[functionDescriptor] // Get FunctionDeclaration by FunctionDescriptor. if (functionDeclaration == null) return super.visitCall(expression) // Function is declared in another module. val copyFuncDeclaration = functionDeclaration.accept(DeepCopyIrTree(), null) as IrFunction // Create copy of the function. From 28f1f5a180dfea19cb790209568bb979f51b5cab Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Tue, 17 Jan 2017 15:47:41 +0700 Subject: [PATCH 06/86] backend: import LocalFunctionsLowering again --- .../common/lower/LocalFunctionsLowering.kt | 374 ++++++++++++++++++ 1 file changed, 374 insertions(+) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt new file mode 100644 index 00000000000..b6b504774e4 --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt @@ -0,0 +1,374 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.backend.common.lower + +import org.jetbrains.kotlin.backend.common.AbstractClosureAnnotator +import org.jetbrains.kotlin.backend.common.BackendContext +import org.jetbrains.kotlin.backend.common.Closure +import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrDeclaration +import org.jetbrains.kotlin.ir.declarations.IrDeclarationContainer +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.util.transformFlat +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.descriptorUtil.parents +import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf +import org.jetbrains.kotlin.types.KotlinType +import java.util.* + +class LocalFunctionsLowering(val context: BackendContext): DeclarationContainerLoweringPass { + override fun lower(irDeclarationContainer: IrDeclarationContainer) { + irDeclarationContainer.declarations.transformFlat { memberDeclaration -> + if (memberDeclaration is IrFunction) + LocalFunctionsTransformer(memberDeclaration).lowerLocalFunctions() + else + null + } + } + + private class LocalFunctionContext(val declaration: IrFunction) { + lateinit var closure: Closure + + val closureParametersCount: Int get() = closure.capturedValues.size + + lateinit var transformedDescriptor: FunctionDescriptor + + val old2new: MutableMap = HashMap() + + var index: Int = -1 + + override fun toString(): String = + "LocalFunctionContext for ${declaration.descriptor}" + } + + private inner class LocalFunctionsTransformer(val memberFunction: IrFunction) { + val localFunctions: MutableMap = LinkedHashMap() + val new2old: MutableMap = HashMap() + + fun lowerLocalFunctions(): List? { + collectLocalFunctions() + if (localFunctions.isEmpty()) return null + + collectClosures() + + transformDescriptors() + + rewriteBodies() + + return collectRewrittenDeclarations() + } + + private fun collectRewrittenDeclarations(): ArrayList = + ArrayList(localFunctions.size + 1).apply { + add(memberFunction) + + localFunctions.values.mapTo(this) { + val original = it.declaration + IrFunctionImpl( + original.startOffset, original.endOffset, original.origin, + it.transformedDescriptor, + original.body + ) + } + } + + private inner class FunctionBodiesRewriter(val localFunctionContext: LocalFunctionContext?) : IrElementTransformerVoid() { + + override fun visitClass(declaration: IrClass): IrStatement { + // ignore local classes for now + return declaration + } + + override fun visitFunction(declaration: IrFunction): IrStatement { + // replace local function definition with an empty composite + return IrCompositeImpl(declaration.startOffset, declaration.endOffset, context.builtIns.unitType) + } + + override fun visitGetValue(expression: IrGetValue): IrExpression { + val remapped = localFunctionContext?.let { it.old2new[expression.descriptor] } + return if (remapped == null) + expression + else + IrGetValueImpl(expression.startOffset, expression.endOffset, remapped, expression.origin) + } + + override fun visitCall(expression: IrCall): IrExpression { + expression.transformChildrenVoid(this) + + val oldCallee = expression.descriptor.original + val localFunctionData = localFunctions[oldCallee] ?: return expression + + val newCallee = localFunctionData.transformedDescriptor + + val newCall = createNewCall(expression, newCallee).fillArguments(localFunctionData, expression) + + return newCall + } + + private fun T.fillArguments(calleeContext: LocalFunctionContext, oldExpression: IrMemberAccessExpression): T { + val closureParametersCount = calleeContext.closureParametersCount + + mapValueParametersIndexed { index, newValueParameterDescriptor -> + val capturedValueDescriptor = new2old[newValueParameterDescriptor] ?: + throw AssertionError("Non-mapped parameter $newValueParameterDescriptor") + if (index >= closureParametersCount) + oldExpression.getValueArgument(capturedValueDescriptor as ValueParameterDescriptor) + else { + val remappedValueDescriptor = localFunctionContext?.let { it.old2new[capturedValueDescriptor] } + IrGetValueImpl(oldExpression.startOffset, oldExpression.endOffset, + remappedValueDescriptor ?: capturedValueDescriptor) + } + + } + + dispatchReceiver = oldExpression.dispatchReceiver + extensionReceiver = oldExpression.extensionReceiver + + return this + } + + override fun visitCallableReference(expression: IrCallableReference): IrExpression { + expression.transformChildrenVoid(this) + + val oldCallee = expression.descriptor.original + val localFunctionData = localFunctions[oldCallee] ?: return expression + val newCallee = localFunctionData.transformedDescriptor + + val newCallableReference = IrCallableReferenceImpl( + expression.startOffset, expression.endOffset, + expression.type, // TODO functional type for transformed descriptor + newCallee, + remapTypeArguments(expression, newCallee), + expression.origin + ).fillArguments(localFunctionData, expression) + + return newCallableReference + } + + override fun visitReturn(expression: IrReturn): IrExpression { + expression.transformChildrenVoid(this) + + val oldReturnTarget = expression.returnTarget + val localFunctionData = localFunctions[oldReturnTarget] ?: return expression + val newReturnTarget = localFunctionData.transformedDescriptor + + return IrReturnImpl(expression.startOffset, expression.endOffset, newReturnTarget, expression.value) + } + } + + private fun rewriteFunctionDeclaration(irFunction: IrFunction, localFunctionContext: LocalFunctionContext?) { + irFunction.transformChildrenVoid(FunctionBodiesRewriter(localFunctionContext)) + } + + private fun rewriteBodies() { + localFunctions.values.forEach { + rewriteFunctionDeclaration(it.declaration, it) + } + + rewriteFunctionDeclaration(memberFunction, null) + } + + private fun createNewCall(oldCall: IrCall, newCallee: FunctionDescriptor) = + if (oldCall is IrCallWithShallowCopy) + oldCall.shallowCopy(oldCall.origin, newCallee, oldCall.superQualifier) + else + IrCallImpl( + oldCall.startOffset, oldCall.endOffset, + newCallee, + remapTypeArguments(oldCall, newCallee), + oldCall.origin, oldCall.superQualifier + ) + + private fun remapTypeArguments(oldExpression: IrMemberAccessExpression, newCallee: FunctionDescriptor): Map? { + val oldCallee = oldExpression.descriptor + + return if (oldCallee.typeParameters.isEmpty()) + null + else oldCallee.typeParameters.associateBy( + { newCallee.typeParameters[it.index] }, + { oldExpression.getTypeArgument(it)!! } + ) + } + + private fun transformDescriptors() { + localFunctions.values.forEach { + it.transformedDescriptor = createTransformedDescriptor(it) + } + } + + private fun suggestLocalName(descriptor: DeclarationDescriptor): String { + val localFunctionContext = localFunctions[descriptor] + return if (localFunctionContext != null && localFunctionContext.index >= 0) + "lambda-${localFunctionContext.index}" + else + descriptor.name.asString() + } + + private fun generateNameForLiftedFunction(functionDescriptor: FunctionDescriptor): Name = + Name.identifier( + functionDescriptor.parentsWithSelf + .takeWhile { it is FunctionDescriptor } + .toList().reversed() + .map { suggestLocalName(it) } + .joinToString(separator = "$") + ) + + private fun createTransformedDescriptor(localFunctionContext: LocalFunctionContext): FunctionDescriptor { + val oldDescriptor = localFunctionContext.declaration.descriptor + + val memberOwner = memberFunction.descriptor.containingDeclaration + val newDescriptor = SimpleFunctionDescriptorImpl.create( + memberOwner, + oldDescriptor.annotations, + generateNameForLiftedFunction(oldDescriptor), + CallableMemberDescriptor.Kind.SYNTHESIZED, + oldDescriptor.source + ) + + val closureParametersCount = localFunctionContext.closureParametersCount + val newValueParametersCount = closureParametersCount + oldDescriptor.valueParameters.size + + val newDispatchReceiverParameter = + if (memberOwner is ClassDescriptor && oldDescriptor.dispatchReceiverParameter != null) + memberOwner.thisAsReceiverParameter + else + null + + // Do not substitute type parameters for now. + val newTypeParameters = oldDescriptor.typeParameters + + val newValueParameters = ArrayList(newValueParametersCount).apply { + localFunctionContext.closure.capturedValues.mapIndexedTo(this) { i, capturedValueDescriptor -> + createUnsubstitutedCapturedValueParameter(newDescriptor, capturedValueDescriptor, i).apply { + localFunctionContext.recordRemapped(capturedValueDescriptor, this) + } + } + + oldDescriptor.valueParameters.mapIndexedTo(this) { i, oldValueParameterDescriptor -> + createUnsubstitutedParameter(newDescriptor, oldValueParameterDescriptor, closureParametersCount + i).apply { + localFunctionContext.recordRemapped(oldValueParameterDescriptor, this) + } + } + } + + newDescriptor.initialize( + oldDescriptor.extensionReceiverParameter?.type, + newDispatchReceiverParameter, + newTypeParameters, + newValueParameters, + oldDescriptor.returnType, + Modality.FINAL, + Visibilities.PRIVATE + ) + + oldDescriptor.extensionReceiverParameter?.let { + localFunctionContext.recordRemapped(it, newDescriptor.extensionReceiverParameter!!) + } + + return newDescriptor + } + + private fun LocalFunctionContext.recordRemapped(oldDescriptor: ValueDescriptor, newDescriptor: ParameterDescriptor): ParameterDescriptor { + old2new[oldDescriptor] = newDescriptor + new2old[newDescriptor] = oldDescriptor + return newDescriptor + } + + private fun suggestNameForCapturedValueParameter(valueDescriptor: ValueDescriptor): Name = + if (valueDescriptor.name.isSpecial) { + val oldNameStr = valueDescriptor.name.asString() + Name.identifier("$" + oldNameStr.substring(1, oldNameStr.length - 1)) + } + else + valueDescriptor.name + + private fun createUnsubstitutedCapturedValueParameter( + newParameterOwner: CallableMemberDescriptor, + valueDescriptor: ValueDescriptor, + index: Int + ): ValueParameterDescriptor = + ValueParameterDescriptorImpl( + newParameterOwner, null, index, + valueDescriptor.annotations, + suggestNameForCapturedValueParameter(valueDescriptor), + valueDescriptor.type, + false, false, false, null, valueDescriptor.source + ) + + private fun createUnsubstitutedParameter( + newParameterOwner: CallableMemberDescriptor, + valueParameterDescriptor: ValueParameterDescriptor, + newIndex: Int + ): ValueParameterDescriptor = + valueParameterDescriptor.copy(newParameterOwner, valueParameterDescriptor.name, newIndex) + + + private fun collectClosures() { + memberFunction.acceptChildrenVoid(object : AbstractClosureAnnotator() { + override fun visitClass(declaration: IrClass) { + // ignore local classes for now + return + } + + override fun recordFunctionClosure(functionDescriptor: FunctionDescriptor, closure: Closure) { + localFunctions[functionDescriptor]?.closure = closure + } + + override fun recordClassClosure(classDescriptor: ClassDescriptor, closure: Closure) { + // ignore local classes for now + } + }) + } + + private fun collectLocalFunctions() { + memberFunction.acceptChildrenVoid(object : IrElementVisitorVoid { + var lambdasCount = 0 + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitFunction(declaration: IrFunction) { + declaration.acceptChildrenVoid(this) + val localFunctionContext = LocalFunctionContext(declaration) + localFunctions[declaration.descriptor] = localFunctionContext + if (declaration.descriptor.name.isSpecial) { + localFunctionContext.index = lambdasCount++ + } + } + + override fun visitClass(declaration: IrClass) { + // ignore local classes for now + } + }) + } + } + +} \ No newline at end of file From ead5f93a908a4b94926b4ef49f74d99b260804b9 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 19 Jan 2017 15:29:49 +0700 Subject: [PATCH 07/86] backend: rename Local{Functions => Declarations}Lowering --- .../{LocalFunctionsLowering.kt => LocalDeclarationsLowering.kt} | 2 +- .../src/org/jetbrains/kotlin/backend/konan/KonanLower.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/{LocalFunctionsLowering.kt => LocalDeclarationsLowering.kt} (99%) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt similarity index 99% rename from backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt rename to backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index b6b504774e4..115b2de54d9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalFunctionsLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -43,7 +43,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf import org.jetbrains.kotlin.types.KotlinType import java.util.* -class LocalFunctionsLowering(val context: BackendContext): DeclarationContainerLoweringPass { +class LocalDeclarationsLowering(val context: BackendContext): DeclarationContainerLoweringPass { override fun lower(irDeclarationContainer: IrDeclarationContainer) { irDeclarationContainer.declarations.transformFlat { memberDeclaration -> if (memberDeclaration is IrFunction) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index 67ebc05209e..16b9031c6c7 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -31,7 +31,7 @@ internal class KonanLower(val context: Context) { SharedVariablesLowering(context).runOnFilePostfix(irFile) } phaser.phase(KonanPhase.LOWER_LOCAL_FUNCTIONS) { - LocalFunctionsLowering(context).runOnFilePostfix(irFile) + LocalDeclarationsLowering(context).runOnFilePostfix(irFile) } phaser.phase(KonanPhase.LOWER_CALLABLES) { CallableReferenceLowering(context).runOnFilePostfix(irFile) From 26e107589350de6187a491137883a5a9ff2186ae Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 19 Jan 2017 13:36:14 +0700 Subject: [PATCH 08/86] backend: lower local classes --- .../common/lower/LocalDeclarationsLowering.kt | 773 +++++++++++++++--- .../kotlin/backend/common/lower/LowerUtils.kt | 56 +- 2 files changed, 708 insertions(+), 121 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index 115b2de54d9..f05dc2d7bde 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -21,15 +21,12 @@ import org.jetbrains.kotlin.backend.common.BackendContext import org.jetbrains.kotlin.backend.common.Closure import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl -import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.impl.* import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrDeclaration -import org.jetbrains.kotlin.ir.declarations.IrDeclarationContainer -import org.jetbrains.kotlin.ir.declarations.IrFunction -import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.util.transformFlat @@ -45,48 +42,135 @@ import java.util.* class LocalDeclarationsLowering(val context: BackendContext): DeclarationContainerLoweringPass { override fun lower(irDeclarationContainer: IrDeclarationContainer) { + if (irDeclarationContainer is IrDeclaration && + irDeclarationContainer.descriptor.parents.any { it is CallableDescriptor }) { + + // Lowering of non-local declarations handles all local declarations inside. + // This declaration is local and shouldn't be considered. + return + } + + // Continuous numbering across all declarations in the container. + lambdasCount = 0 + objectsCount = 0 + irDeclarationContainer.declarations.transformFlat { memberDeclaration -> if (memberDeclaration is IrFunction) - LocalFunctionsTransformer(memberDeclaration).lowerLocalFunctions() + LocalDeclarationsTransformer(memberDeclaration).lowerLocalDeclarations() else null } } - private class LocalFunctionContext(val declaration: IrFunction) { + private var lambdasCount = 0 + private var objectsCount = 0 + + private abstract class LocalContext { + /** + * @return the expression to get the value for given descriptor, or `null` if [IrGetValue] should be used. + */ + abstract fun irGet(startOffset: Int, endOffset: Int, descriptor: ValueDescriptor): IrExpression? + } + + private abstract class LocalContextWithClosureAsParameters : LocalContext() { + + abstract val declaration: IrFunction + open val descriptor: FunctionDescriptor + get() = declaration.descriptor + + abstract val transformedDescriptor: FunctionDescriptor + + val capturedValueToParameter: MutableMap = HashMap() + + override fun irGet(startOffset: Int, endOffset: Int, descriptor: ValueDescriptor): IrExpression? { + val newDescriptor = capturedValueToParameter[descriptor] ?: return null + + return IrGetValueImpl(startOffset, endOffset, newDescriptor) + } + } + + private class LocalFunctionContext(override val declaration: IrFunction) : LocalContextWithClosureAsParameters() { lateinit var closure: Closure - val closureParametersCount: Int get() = closure.capturedValues.size - - lateinit var transformedDescriptor: FunctionDescriptor - - val old2new: MutableMap = HashMap() + override lateinit var transformedDescriptor: FunctionDescriptor var index: Int = -1 override fun toString(): String = - "LocalFunctionContext for ${declaration.descriptor}" + "LocalFunctionContext for $descriptor" } - private inner class LocalFunctionsTransformer(val memberFunction: IrFunction) { - val localFunctions: MutableMap = LinkedHashMap() - val new2old: MutableMap = HashMap() + private class LocalClassConstructorContext(override val declaration: IrConstructor) : LocalContextWithClosureAsParameters() { + override val descriptor: ClassConstructorDescriptor + get() = declaration.descriptor - fun lowerLocalFunctions(): List? { - collectLocalFunctions() - if (localFunctions.isEmpty()) return null + override lateinit var transformedDescriptor: ClassConstructorDescriptor + + override fun toString(): String = + "LocalClassConstructorContext for $descriptor" + } + + private class LocalClassContext(val declaration: IrClass) : LocalContext() { + lateinit var closure: Closure + + lateinit var transformedDescriptor: ClassDescriptorImpl + + val capturedValueToField: MutableMap = HashMap() + + var index: Int = -1 + + override fun irGet(startOffset: Int, endOffset: Int, descriptor: ValueDescriptor): IrExpression? { + val fieldDescriptor = capturedValueToField[descriptor] ?: return null + + return IrGetFieldImpl(startOffset, endOffset, fieldDescriptor, + receiver = IrGetValueImpl(startOffset, endOffset, transformedDescriptor.thisAsReceiverParameter) + ) + } + + override fun toString(): String = + "LocalClassContext for ${declaration.descriptor}" + } + + private inner class LocalDeclarationsTransformer(val memberFunction: IrFunction) { + val localFunctions: MutableMap = LinkedHashMap() + val localClasses: MutableMap = LinkedHashMap() + val localClassConstructors: MutableMap = LinkedHashMap() + val localClassMembers: MutableSet = LinkedHashSet() + + val transformedDescriptors = mutableMapOf() + + val CallableDescriptor.transformed: CallableDescriptor? + get() = transformedDescriptors[this] as CallableDescriptor? + + val CallableMemberDescriptor.transformed: CallableMemberDescriptor? + get() = transformedDescriptors[this] as CallableMemberDescriptor? + + val FunctionDescriptor.transformed: FunctionDescriptor? + get() = transformedDescriptors[this] as FunctionDescriptor? + + val PropertyDescriptor.transformed: PropertyDescriptor? + get() = transformedDescriptors[this] as PropertyDescriptor? + + val oldParameterToNew: MutableMap = HashMap() + val newParameterToOld: MutableMap = HashMap() + val newParameterToCaptured: MutableMap = HashMap() + + fun lowerLocalDeclarations(): List? { + collectLocalDeclarations() + if (localFunctions.isEmpty() && localClasses.isEmpty()) return null collectClosures() transformDescriptors() - rewriteBodies() + rewriteDeclarations() - return collectRewrittenDeclarations() + val result = collectRewrittenDeclarations() + return result } private fun collectRewrittenDeclarations(): ArrayList = - ArrayList(localFunctions.size + 1).apply { + ArrayList(localFunctions.size + localClasses.size + 1).apply { add(memberFunction) localFunctions.values.mapTo(this) { @@ -97,53 +181,137 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain original.body ) } + + localClasses.values.mapTo(this) { + val original = it.declaration + IrClassImpl( + original.startOffset, original.endOffset, original.origin, + it.transformedDescriptor, + original.declarations + ) + } } - private inner class FunctionBodiesRewriter(val localFunctionContext: LocalFunctionContext?) : IrElementTransformerVoid() { + private inner class FunctionBodiesRewriter(val localContext: LocalContext?) : IrElementTransformerVoid() { override fun visitClass(declaration: IrClass): IrStatement { - // ignore local classes for now - return declaration - } - - override fun visitFunction(declaration: IrFunction): IrStatement { - // replace local function definition with an empty composite + // Replace local class definition with an empty composite. return IrCompositeImpl(declaration.startOffset, declaration.endOffset, context.builtIns.unitType) } + override fun visitProperty(declaration: IrProperty): IrStatement { + declaration.transformChildrenVoid(this) + val newDescriptor = declaration.descriptor.transformed ?: return declaration + + return IrPropertyImpl( + declaration.startOffset, declaration.endOffset, + declaration.origin, declaration.isDelegated, newDescriptor, + declaration.backingField, + declaration.getter, declaration.setter + ) + } + + override fun visitField(declaration: IrField): IrStatement { + declaration.transformChildrenVoid(this) + val newDescriptor = declaration.descriptor.transformed ?: return declaration + + return IrFieldImpl( + declaration.startOffset, declaration.endOffset, declaration.origin, + newDescriptor, + declaration.initializer + ) + } + + override fun visitGetField(expression: IrGetField): IrExpression { + expression.transformChildrenVoid(this) + val newDescriptor = expression.descriptor.transformed ?: return expression + + return IrGetFieldImpl( + expression.startOffset, expression.endOffset, newDescriptor, + expression.receiver, expression.origin, expression.superQualifier + ) + } + + override fun visitSetField(expression: IrSetField): IrExpression { + expression.transformChildrenVoid(this) + val newDescriptor = expression.descriptor.transformed ?: return expression + + return IrSetFieldImpl( + expression.startOffset, expression.endOffset, newDescriptor, + expression.receiver, expression.value, + expression.origin, expression.superQualifier + ) + } + + override fun visitFunction(declaration: IrFunction): IrStatement { + if (declaration.descriptor in localFunctions) { + // Replace local function definition with an empty composite. + return IrCompositeImpl(declaration.startOffset, declaration.endOffset, context.builtIns.unitType) + } else if (declaration.descriptor in localClassMembers){ + declaration.transformChildrenVoid(this) + + val transformedDescriptor = declaration.descriptor.transformed!! + + return IrFunctionImpl(declaration.startOffset, declaration.endOffset, declaration.origin, + transformedDescriptor, declaration.body) + } else { + throw AssertionError("the function is neither local itself nor member of a local class") + } + } + + override fun visitConstructor(declaration: IrConstructor): IrStatement { + // Body is transformed separately. + + val transformedDescriptor = localClassConstructors[declaration.descriptor]!!.transformedDescriptor + + return IrConstructorImpl(declaration.startOffset, declaration.endOffset, declaration.origin, + transformedDescriptor, declaration.body!!) + } + override fun visitGetValue(expression: IrGetValue): IrExpression { - val remapped = localFunctionContext?.let { it.old2new[expression.descriptor] } - return if (remapped == null) - expression - else - IrGetValueImpl(expression.startOffset, expression.endOffset, remapped, expression.origin) + val descriptor = expression.descriptor + + localContext?.irGet(expression.startOffset, expression.endOffset, descriptor)?.let { + return it + } + + oldParameterToNew[descriptor]?.let { + return IrGetValueImpl(expression.startOffset, expression.endOffset, it) + } + + return expression } override fun visitCall(expression: IrCall): IrExpression { expression.transformChildrenVoid(this) val oldCallee = expression.descriptor.original - val localFunctionData = localFunctions[oldCallee] ?: return expression + val newCallee = oldCallee.transformed ?: return expression - val newCallee = localFunctionData.transformedDescriptor - - val newCall = createNewCall(expression, newCallee).fillArguments(localFunctionData, expression) + val newCall = createNewCall(expression, newCallee).fillArguments(expression) return newCall } - private fun T.fillArguments(calleeContext: LocalFunctionContext, oldExpression: IrMemberAccessExpression): T { - val closureParametersCount = calleeContext.closureParametersCount + private fun T.fillArguments(oldExpression: IrMemberAccessExpression): T { - mapValueParametersIndexed { index, newValueParameterDescriptor -> - val capturedValueDescriptor = new2old[newValueParameterDescriptor] ?: - throw AssertionError("Non-mapped parameter $newValueParameterDescriptor") - if (index >= closureParametersCount) - oldExpression.getValueArgument(capturedValueDescriptor as ValueParameterDescriptor) - else { - val remappedValueDescriptor = localFunctionContext?.let { it.old2new[capturedValueDescriptor] } - IrGetValueImpl(oldExpression.startOffset, oldExpression.endOffset, - remappedValueDescriptor ?: capturedValueDescriptor) + mapValueParameters { newValueParameterDescriptor -> + val oldParameter = newParameterToOld[newValueParameterDescriptor] + + if (oldParameter != null) { + oldExpression.getValueArgument(oldParameter as ValueParameterDescriptor) + } else { + // The callee expects captured value as argument. + val capturedValueDescriptor = + newParameterToCaptured[newValueParameterDescriptor] ?: + throw AssertionError("Non-mapped parameter $newValueParameterDescriptor") + + localContext?.irGet( + oldExpression.startOffset, oldExpression.endOffset, + capturedValueDescriptor + ) ?: + // Captured value is directly available for the caller. + IrGetValueImpl(oldExpression.startOffset, oldExpression.endOffset, capturedValueDescriptor) } } @@ -158,8 +326,7 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain expression.transformChildrenVoid(this) val oldCallee = expression.descriptor.original - val localFunctionData = localFunctions[oldCallee] ?: return expression - val newCallee = localFunctionData.transformedDescriptor + val newCallee = oldCallee.transformed ?: return expression val newCallableReference = IrCallableReferenceImpl( expression.startOffset, expression.endOffset, @@ -167,7 +334,7 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain newCallee, remapTypeArguments(expression, newCallee), expression.origin - ).fillArguments(localFunctionData, expression) + ).fillArguments(expression) return newCallableReference } @@ -176,26 +343,77 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain expression.transformChildrenVoid(this) val oldReturnTarget = expression.returnTarget - val localFunctionData = localFunctions[oldReturnTarget] ?: return expression - val newReturnTarget = localFunctionData.transformedDescriptor + val newReturnTarget = oldReturnTarget.transformed ?: return expression return IrReturnImpl(expression.startOffset, expression.endOffset, newReturnTarget, expression.value) } - } - private fun rewriteFunctionDeclaration(irFunction: IrFunction, localFunctionContext: LocalFunctionContext?) { - irFunction.transformChildrenVoid(FunctionBodiesRewriter(localFunctionContext)) - } - - private fun rewriteBodies() { - localFunctions.values.forEach { - rewriteFunctionDeclaration(it.declaration, it) + override fun visitDeclarationReference(expression: IrDeclarationReference): IrExpression { + if (expression.descriptor in transformedDescriptors) { + TODO() + } + return super.visitDeclarationReference(expression) } - rewriteFunctionDeclaration(memberFunction, null) + override fun visitDeclaration(declaration: IrDeclaration): IrStatement { + if (declaration.descriptor in transformedDescriptors) { + TODO() + } + return super.visitDeclaration(declaration) + } } - private fun createNewCall(oldCall: IrCall, newCallee: FunctionDescriptor) = + private fun rewriteFunctionBody(irFunction: IrFunction, localContext: LocalContext?) { + irFunction.transformChildrenVoid(FunctionBodiesRewriter(localContext)) + } + + private object DECLARATION_ORIGIN_FIELD_FOR_CAPTURED_VALUE : + IrDeclarationOriginImpl("FIELD_FOR_CAPTURED_VALUE") {} + + private fun rewriteClassMembers(irClass: IrClass, localClassContext: LocalClassContext) { + irClass.transformChildrenVoid(FunctionBodiesRewriter(localClassContext)) + + val primaryConstructor = irClass.descriptor.unsubstitutedPrimaryConstructor ?: + TODO("local classes without primary constructor") + + val primaryConstructorContext = localClassConstructors[primaryConstructor]!! + + localClassContext.capturedValueToField.forEach { capturedValue, fieldDescriptor -> + + val capturedValueExpression = + primaryConstructorContext.irGet(irClass.startOffset, irClass.endOffset, capturedValue)!! + + irClass.declarations.add( + IrFieldImpl( + irClass.startOffset, irClass.endOffset, + DECLARATION_ORIGIN_FIELD_FOR_CAPTURED_VALUE, + fieldDescriptor, + IrExpressionBodyImpl( + irClass.startOffset, irClass.endOffset, + capturedValueExpression + ) + ) + ) + } + } + + private fun rewriteDeclarations() { + localFunctions.values.forEach { + rewriteFunctionBody(it.declaration, it) + } + + localClassConstructors.values.forEach { + rewriteFunctionBody(it.declaration, it) + } + + localClasses.values.forEach { + rewriteClassMembers(it.declaration, it) + } + + rewriteFunctionBody(memberFunction, null) + } + + private fun createNewCall(oldCall: IrCall, newCallee: CallableDescriptor) = if (oldCall is IrCallWithShallowCopy) oldCall.shallowCopy(oldCall.origin, newCallee, oldCall.superQualifier) else @@ -206,7 +424,7 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain oldCall.origin, oldCall.superQualifier ) - private fun remapTypeArguments(oldExpression: IrMemberAccessExpression, newCallee: FunctionDescriptor): Map? { + private fun remapTypeArguments(oldExpression: IrMemberAccessExpression, newCallee: CallableDescriptor): Map? { val oldCallee = oldExpression.descriptor return if (oldCallee.typeParameters.isEmpty()) @@ -219,64 +437,78 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain private fun transformDescriptors() { localFunctions.values.forEach { - it.transformedDescriptor = createTransformedDescriptor(it) + createLiftedDescriptor(it) + } + + localClasses.values.forEach { + createLiftedDescriptor(it) + } + + localClassConstructors.values.forEach { + createTransformedConstructorDescriptor(it) + } + + localClassMembers.forEach { + createTransformedMemberDescriptor(it) + } + + localClasses.values.forEach { + initializeClassDescriptor(it) } } private fun suggestLocalName(descriptor: DeclarationDescriptor): String { - val localFunctionContext = localFunctions[descriptor] - return if (localFunctionContext != null && localFunctionContext.index >= 0) - "lambda-${localFunctionContext.index}" - else - descriptor.name.asString() + localFunctions[descriptor]?.let { + if (it.index >= 0) + return "lambda-${it.index}" + } + + localClasses[descriptor]?.let { + if (it.index >= 0) + return "object-${it.index}" + } + + return descriptor.name.asString() } - private fun generateNameForLiftedFunction(functionDescriptor: FunctionDescriptor): Name = + private fun generateNameForLiftedDeclaration(descriptor: DeclarationDescriptor, + newOwner: DeclarationDescriptor): Name = Name.identifier( - functionDescriptor.parentsWithSelf - .takeWhile { it is FunctionDescriptor } + descriptor.parentsWithSelf + .takeWhile { it != newOwner } .toList().reversed() .map { suggestLocalName(it) } .joinToString(separator = "$") ) - private fun createTransformedDescriptor(localFunctionContext: LocalFunctionContext): FunctionDescriptor { - val oldDescriptor = localFunctionContext.declaration.descriptor + private fun createLiftedDescriptor(localFunctionContext: LocalFunctionContext) { + val oldDescriptor = localFunctionContext.descriptor val memberOwner = memberFunction.descriptor.containingDeclaration val newDescriptor = SimpleFunctionDescriptorImpl.create( memberOwner, oldDescriptor.annotations, - generateNameForLiftedFunction(oldDescriptor), + generateNameForLiftedDeclaration(oldDescriptor, memberOwner), CallableMemberDescriptor.Kind.SYNTHESIZED, oldDescriptor.source ) - val closureParametersCount = localFunctionContext.closureParametersCount - val newValueParametersCount = closureParametersCount + oldDescriptor.valueParameters.size + localFunctionContext.transformedDescriptor = newDescriptor + transformedDescriptors[oldDescriptor] = newDescriptor - val newDispatchReceiverParameter = - if (memberOwner is ClassDescriptor && oldDescriptor.dispatchReceiverParameter != null) - memberOwner.thisAsReceiverParameter - else - null + if (oldDescriptor.dispatchReceiverParameter != null) { + throw AssertionError("local functions must not have dispatch receiver") + } + + val newDispatchReceiverParameter = null // Do not substitute type parameters for now. val newTypeParameters = oldDescriptor.typeParameters - val newValueParameters = ArrayList(newValueParametersCount).apply { - localFunctionContext.closure.capturedValues.mapIndexedTo(this) { i, capturedValueDescriptor -> - createUnsubstitutedCapturedValueParameter(newDescriptor, capturedValueDescriptor, i).apply { - localFunctionContext.recordRemapped(capturedValueDescriptor, this) - } - } + // TODO: consider using fields to access the closure of enclosing class. + val capturedValues = localFunctionContext.closure.capturedValues - oldDescriptor.valueParameters.mapIndexedTo(this) { i, oldValueParameterDescriptor -> - createUnsubstitutedParameter(newDescriptor, oldValueParameterDescriptor, closureParametersCount + i).apply { - localFunctionContext.recordRemapped(oldValueParameterDescriptor, this) - } - } - } + val newValueParameters = createTransformedValueParameters(localFunctionContext, capturedValues) newDescriptor.initialize( oldDescriptor.extensionReceiverParameter?.type, @@ -289,19 +521,282 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain ) oldDescriptor.extensionReceiverParameter?.let { - localFunctionContext.recordRemapped(it, newDescriptor.extensionReceiverParameter!!) + recordRemappedParameter(it, newDescriptor.extensionReceiverParameter!!) + } + } + + private fun createTransformedValueParameters(localContext: LocalContextWithClosureAsParameters, + capturedValues: List + ): List { + + val oldDescriptor = localContext.descriptor + val newDescriptor = localContext.transformedDescriptor + + val closureParametersCount = capturedValues.size + val newValueParametersCount = closureParametersCount + oldDescriptor.valueParameters.size + + val newValueParameters = ArrayList(newValueParametersCount).apply { + capturedValues.mapIndexedTo(this) { i, capturedValueDescriptor -> + createUnsubstitutedCapturedValueParameter(newDescriptor, capturedValueDescriptor, i).apply { + localContext.recordCapturedAsParameter(capturedValueDescriptor, this) + } + } + + oldDescriptor.valueParameters.mapIndexedTo(this) { i, oldValueParameterDescriptor -> + createUnsubstitutedParameter(newDescriptor, oldValueParameterDescriptor, closureParametersCount + i).apply { + recordRemappedParameter(oldValueParameterDescriptor, this) + } + } + } + return newValueParameters + } + + private fun createTransformedMemberDescriptor(oldDescriptor: MemberDescriptor) { + when (oldDescriptor) { + is PropertyDescriptor -> createTransformedMemberPropertyDescriptor(oldDescriptor) + is PropertyAccessorDescriptor -> { + // Transformed along with the property. + } + is FunctionDescriptor -> createTransformedMemberFunctionDescriptor(oldDescriptor) + + else -> TODO(oldDescriptor.toString()) + } + } + + private fun createTransformedMemberFunctionDescriptor(oldDescriptor: FunctionDescriptor) { + val memberOwner = localClasses[oldDescriptor.containingDeclaration]!!.transformedDescriptor + + val copyBuilder = oldDescriptor.newCopyBuilder() + + copyBuilder.setOwner(memberOwner) + copyBuilder.setDispatchReceiverParameter(memberOwner.thisAsReceiverParameter) + + val newDescriptor = copyBuilder.build()!! + + recordTransformedMemberDescriptor(oldDescriptor, newDescriptor) + } + + private fun createTransformedMemberPropertyDescriptor(oldDescriptor: PropertyDescriptor) { + val memberOwner = localClasses[oldDescriptor.containingDeclaration]!!.transformedDescriptor + + val newDescriptor = PropertyDescriptorImpl.create( + memberOwner, + oldDescriptor.annotations, + oldDescriptor.modality, + oldDescriptor.visibility, + oldDescriptor.isVar, + oldDescriptor.name, + oldDescriptor.kind, + oldDescriptor.source, + oldDescriptor.isLateInit, + oldDescriptor.isConst, + oldDescriptor.isHeader, + oldDescriptor.isImpl, + oldDescriptor.isExternal + ) + + val newDispatchReceiver = memberOwner.thisAsReceiverParameter + + newDescriptor.setType(oldDescriptor.type, oldDescriptor.typeParameters, + newDispatchReceiver, oldDescriptor.extensionReceiverParameter?.type) + + val oldGetter = oldDescriptor.getter + val newGetter = if (oldGetter == null) { + null + } else { + PropertyGetterDescriptorImpl( + newDescriptor, oldGetter.annotations, + oldGetter.modality, oldGetter.visibility, oldGetter.isDefault, + oldGetter.isExternal, oldGetter.isInline, oldGetter.kind, + /* original = */ oldGetter, + oldGetter.source + ).apply { + this.initialize(oldGetter.returnType) + recordTransformedMemberDescriptor(oldGetter, this) + } } - return newDescriptor + val oldSetter = oldDescriptor.setter + val newSetter = if (oldSetter == null) { + null + } else { + PropertySetterDescriptorImpl( + newDescriptor, oldSetter.annotations, + oldSetter.modality, oldSetter.visibility, oldSetter.isDefault, + oldSetter.isExternal, oldSetter.isInline, oldSetter.kind, + /* original = */ oldSetter, + oldSetter.source + ).apply { + val parameter = PropertySetterDescriptorImpl.createSetterParameter(this, + oldSetter.valueParameters.single().type) + + this.initialize(parameter) + recordTransformedMemberDescriptor(oldSetter, this) + } + } + + newDescriptor.initialize(newGetter, newSetter) + + recordTransformedMemberDescriptor(oldDescriptor, newDescriptor) } - private fun LocalFunctionContext.recordRemapped(oldDescriptor: ValueDescriptor, newDescriptor: ParameterDescriptor): ParameterDescriptor { - old2new[oldDescriptor] = newDescriptor - new2old[newDescriptor] = oldDescriptor - return newDescriptor + private fun recordTransformedMemberDescriptor(oldDescriptor: CallableDescriptor, + newDescriptor: CallableDescriptor + ) { + + transformedDescriptors[oldDescriptor] = newDescriptor + + if (oldDescriptor.valueParameters.size != newDescriptor.valueParameters.size) throw AssertionError() + + oldDescriptor.valueParameters.forEach { + recordRemappedParameter(it, newDescriptor.valueParameters[it.index]) + } + + val oldDispatchReceiverParameter = oldDescriptor.dispatchReceiverParameter ?: + throw AssertionError("members of local classes must have dispatch receiver") + + recordRemappedParameter(oldDispatchReceiverParameter, newDescriptor.dispatchReceiverParameter!!) + + oldDescriptor.extensionReceiverParameter?.let { + recordRemappedParameter(it, newDescriptor.extensionReceiverParameter!!) + } } - private fun suggestNameForCapturedValueParameter(valueDescriptor: ValueDescriptor): Name = + private fun createTransformedConstructorDescriptor(localFunctionContext: LocalClassConstructorContext) { + val oldDescriptor = localFunctionContext.descriptor + val localClassContext = localClasses[oldDescriptor.containingDeclaration]!! + val newDescriptor = ClassConstructorDescriptorImpl.create( + localClassContext.transformedDescriptor, + Annotations.EMPTY, oldDescriptor.isPrimary, oldDescriptor.source) + + localFunctionContext.transformedDescriptor = newDescriptor + transformedDescriptors[oldDescriptor] = newDescriptor + + // Do not substitute type parameters for now. + val newTypeParameters = oldDescriptor.typeParameters + + val capturedValues = localClassContext.closure.capturedValues + + val newValueParameters = createTransformedValueParameters(localFunctionContext, capturedValues) + + newDescriptor.initialize( + newValueParameters, + Visibilities.PRIVATE, + newTypeParameters + ) + + oldDescriptor.dispatchReceiverParameter?.let { + recordRemappedParameter(it, newDescriptor.dispatchReceiverParameter!!) + } + + oldDescriptor.extensionReceiverParameter?.let { + throw AssertionError("constructors can't have extension receiver") + } + } + + private fun createLiftedDescriptor(localClassContext: LocalClassContext) { + val irClass = localClassContext.declaration + val oldDescriptor = irClass.descriptor + + val memberOwner = memberFunction.descriptor.containingDeclaration + val newDescriptor = ClassDescriptorImpl(memberOwner, + generateNameForLiftedDeclaration(oldDescriptor, memberOwner), + oldDescriptor.modality, + oldDescriptor.kind, + oldDescriptor.typeConstructor.supertypes, + oldDescriptor.source, + oldDescriptor.isExternal) + + localClassContext.transformedDescriptor = newDescriptor + transformedDescriptors[oldDescriptor] = newDescriptor + + createFieldsForCapturedValues(localClassContext) + } + + private fun createFieldsForCapturedValues(localClassContext: LocalClassContext) { + val newDescriptor = localClassContext.transformedDescriptor + + localClassContext.closure.capturedValues.forEach { capturedValue -> + val fieldDescriptor = PropertyDescriptorImpl.create( + newDescriptor, + Annotations.EMPTY, + Modality.FINAL, + Visibilities.PRIVATE, + /* isVar = */ false, + suggestNameForCapturedValue(capturedValue), + CallableMemberDescriptor.Kind.SYNTHESIZED, + SourceElement.NO_SOURCE, + /* lateInit = */ false, + /* isConst = */ false, + /* isHeader = */ false, + /* isImpl = */ false, + /* isExternal = */ false) + + fieldDescriptor.initialize(/* getter = */ null, /* setter = */ null) + + val extensionReceiverParameter: ReceiverParameterDescriptor? = null + + fieldDescriptor.setType( + capturedValue.type, + emptyList(), + newDescriptor.thisAsReceiverParameter, + extensionReceiverParameter) + + localClassContext.capturedValueToField[capturedValue] = fieldDescriptor + } + } + + private fun initializeClassDescriptor(localClassContext: LocalClassContext) { + val oldDescriptor = localClassContext.declaration.descriptor + + val constructors = oldDescriptor.constructors.map { + localClassConstructors[it]!!.transformedDescriptor + }.toSet() + + val newPrimaryConstructor = oldDescriptor.unsubstitutedPrimaryConstructor?.let { + localClassConstructors[it]!!.transformedDescriptor + } + + val newDescriptor = localClassContext.transformedDescriptor + + val oldContributedDescriptors = oldDescriptor.unsubstitutedMemberScope.getContributedDescriptors() + val callableMembers = oldContributedDescriptors + .filterIsInstance() + .filter { it.kind.isReal } + .map { it.transformed ?: TODO(it.toString()) } + + val otherMembers = oldContributedDescriptors.filter { it !is CallableMemberDescriptor } + + val fakeOverrides = computeOverrides(newDescriptor, callableMembers) + val newUnsubstitutedMemberScope = SimpleMemberScope(otherMembers + callableMembers + fakeOverrides) + + newDescriptor.initialize(newUnsubstitutedMemberScope, constructors, newPrimaryConstructor) + } + + private fun LocalContextWithClosureAsParameters.recordCapturedAsParameter( + oldDescriptor: ValueDescriptor, + newDescriptor: ValueParameterDescriptor + ) { + + capturedValueToParameter[oldDescriptor] = newDescriptor + newParameterToCaptured[newDescriptor] = oldDescriptor + + } + + private fun MutableMap.putAbsentOrSame(key: K, value: V) { + val current = this.getOrPut(key, { value }) + + if (current != value) { + error("$current != $value") + } + } + + private fun recordRemappedParameter(oldDescriptor: ParameterDescriptor, newDescriptor: ParameterDescriptor) { + oldParameterToNew.putAbsentOrSame(oldDescriptor, newDescriptor) + newParameterToOld.putAbsentOrSame(newDescriptor, oldDescriptor) + } + + private fun suggestNameForCapturedValue(valueDescriptor: ValueDescriptor): Name = if (valueDescriptor.name.isSpecial) { val oldNameStr = valueDescriptor.name.asString() Name.identifier("$" + oldNameStr.substring(1, oldNameStr.length - 1)) @@ -317,7 +812,7 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain ValueParameterDescriptorImpl( newParameterOwner, null, index, valueDescriptor.annotations, - suggestNameForCapturedValueParameter(valueDescriptor), + suggestNameForCapturedValue(valueDescriptor), valueDescriptor.type, false, false, false, null, valueDescriptor.source ) @@ -332,40 +827,80 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain private fun collectClosures() { memberFunction.acceptChildrenVoid(object : AbstractClosureAnnotator() { - override fun visitClass(declaration: IrClass) { - // ignore local classes for now - return - } - override fun recordFunctionClosure(functionDescriptor: FunctionDescriptor, closure: Closure) { localFunctions[functionDescriptor]?.closure = closure } override fun recordClassClosure(classDescriptor: ClassDescriptor, closure: Closure) { - // ignore local classes for now + localClasses[classDescriptor]?.closure = closure } }) } - private fun collectLocalFunctions() { + private fun collectLocalDeclarations() { memberFunction.acceptChildrenVoid(object : IrElementVisitorVoid { - var lambdasCount = 0 override fun visitElement(element: IrElement) { element.acceptChildrenVoid(this) } + private fun DeclarationDescriptor.isClassMember() = when (this.containingDeclaration) { + is CallableDescriptor -> false + is ClassDescriptor -> true + else -> TODO(this.toString()) + } + + override fun visitProperty(declaration: IrProperty) { + declaration.acceptChildrenVoid(this) + + val descriptor = declaration.descriptor + assert (descriptor.isClassMember()) + localClassMembers.add(descriptor) + } + override fun visitFunction(declaration: IrFunction) { declaration.acceptChildrenVoid(this) - val localFunctionContext = LocalFunctionContext(declaration) - localFunctions[declaration.descriptor] = localFunctionContext - if (declaration.descriptor.name.isSpecial) { - localFunctionContext.index = lambdasCount++ + + val descriptor = declaration.descriptor + + if (descriptor.isClassMember()) { + localClassMembers.add(descriptor) + } else { + val localFunctionContext = LocalFunctionContext(declaration) + + localFunctions[descriptor] = localFunctionContext + + if (descriptor.name.isSpecial) { + localFunctionContext.index = lambdasCount++ + } } + + } + + override fun visitConstructor(declaration: IrConstructor) { + declaration.acceptChildrenVoid(this) + + val descriptor = declaration.descriptor + assert (descriptor.isClassMember()) + + localClassConstructors[descriptor] = LocalClassConstructorContext(declaration) } override fun visitClass(declaration: IrClass) { - // ignore local classes for now + declaration.acceptChildrenVoid(this) + + val descriptor = declaration.descriptor + + if (descriptor.isClassMember()) { + assert (descriptor.isInner) + localClassMembers.add(descriptor) + } else { + val localClassContext = LocalClassContext(declaration) + localClasses[descriptor] = localClassContext + if (descriptor.name.isSpecial) { + localClassContext.index = objectsCount++ + } + } } }) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt index 63af6735eb1..3451ad801eb 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt @@ -1,13 +1,20 @@ package org.jetbrains.kotlin.backend.common.lower import org.jetbrains.kotlin.backend.common.BackendContext -import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.incremental.components.LookupLocation import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.NonReportingOverrideStrategy +import org.jetbrains.kotlin.resolve.OverridingUtil +import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter +import org.jetbrains.kotlin.resolve.scopes.MemberScopeImpl import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.utils.Printer class IrLoweringContext(backendContext: BackendContext) : IrGeneratorContext(backendContext.irBuiltIns) @@ -33,4 +40,49 @@ inline fun FunctionIrGenerator.irBlock(expression: IrExpression, origin: IrState this.irBlock(expression.startOffset, expression.endOffset, origin, resultType, body) inline fun FunctionIrGenerator.irBlockBody(irElement: IrElement, body: IrBlockBodyBuilder.() -> Unit) = - this.irBlockBody(irElement.startOffset, irElement.endOffset, body) \ No newline at end of file + this.irBlockBody(irElement.startOffset, irElement.endOffset, body) + +fun computeOverrides(current: ClassDescriptor, functionsFromCurrent: List): List { + + val result = mutableListOf() + + val allSuperDescriptors = current.typeConstructor.supertypes + .flatMap { it.memberScope.getContributedDescriptors() } + .filterIsInstance() + + for ((name, group) in allSuperDescriptors.groupBy { it.name }) { + OverridingUtil.generateOverridesInFunctionGroup( + name, + /* membersFromSupertypes = */ group, + /* membersFromCurrent = */ functionsFromCurrent.filter { it.name == name }, + current, + object : NonReportingOverrideStrategy() { + override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) { + result.add(fakeOverride) + } + + override fun conflict(fromSuper: CallableMemberDescriptor, fromCurrent: CallableMemberDescriptor) { + error("Conflict in scope of $current: $fromSuper vs $fromCurrent") + } + } + ) + } + + return result +} + +class SimpleMemberScope(val members: List) : MemberScopeImpl() { + + override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = TODO() + + override fun getContributedVariables(name: Name, location: LookupLocation): Collection = TODO() + + override fun getContributedFunctions(name: Name, location: LookupLocation): Collection = TODO() + + override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, + nameFilter: (Name) -> Boolean): Collection = + members.filter { kindFilter.accepts(it) && nameFilter(it.name) } + + override fun printScopeStructure(p: Printer) = TODO("not implemented") + +} \ No newline at end of file From d5988297b1eba302e1e1dfe928a8cb4245742957 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 20 Jan 2017 13:04:35 +0700 Subject: [PATCH 09/86] backend/tests: add objectExpression{1,2,3} --- backend.native/tests/build.gradle | 15 +++++++++++++++ .../tests/codegen/objectExpression/1.kt | 13 +++++++++++++ .../tests/codegen/objectExpression/2.kt | 17 +++++++++++++++++ .../tests/codegen/objectExpression/3.kt | 17 +++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 backend.native/tests/codegen/objectExpression/1.kt create mode 100644 backend.native/tests/codegen/objectExpression/2.kt create mode 100644 backend.native/tests/codegen/objectExpression/3.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 0a436dd72f3..00ed3811ce4 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -814,6 +814,21 @@ task lambda13(type: RunKonanTest) { source = "codegen/lambda/lambda13.kt" } +task objectExpression1(type: RunKonanTest) { + goldValue = "aabb\n" + source = "codegen/objectExpression/1.kt" +} + +task objectExpression2(type: RunKonanTest) { + goldValue = "a\n" + source = "codegen/objectExpression/2.kt" +} + +task objectExpression3(type: RunKonanTest) { + goldValue = "\n1\n2\n" + source = "codegen/objectExpression/3.kt" +} + task initializers2(type: RunKonanTest) { goldValue = "init globalValue2\n" + "init globalValue3\n" + diff --git a/backend.native/tests/codegen/objectExpression/1.kt b/backend.native/tests/codegen/objectExpression/1.kt new file mode 100644 index 00000000000..60ca50c6ab7 --- /dev/null +++ b/backend.native/tests/codegen/objectExpression/1.kt @@ -0,0 +1,13 @@ +fun main(args: Array) { + val a = "a" + + val x = object { + override fun toString(): String { + return foo(a) + foo("b") + } + + fun foo(s: String) = s + s + } + + println(x.toString()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/objectExpression/2.kt b/backend.native/tests/codegen/objectExpression/2.kt new file mode 100644 index 00000000000..f6050b7496f --- /dev/null +++ b/backend.native/tests/codegen/objectExpression/2.kt @@ -0,0 +1,17 @@ +fun main(args: Array) { + val a = "a" + + val x = object { + override fun toString(): String { + return foo { + a + } + } + + fun foo(lambda: () -> String) = lambda() + } + + print(x) +} + +fun print(x: Any) = println(x.toString()) \ No newline at end of file diff --git a/backend.native/tests/codegen/objectExpression/3.kt b/backend.native/tests/codegen/objectExpression/3.kt new file mode 100644 index 00000000000..36f5ee881d9 --- /dev/null +++ b/backend.native/tests/codegen/objectExpression/3.kt @@ -0,0 +1,17 @@ +fun main(args: Array) { + var cnt = 0 + + var x: Any = "" + + for (i in 0 .. 1) { + print(x) + cnt++ + val y = object { + override fun toString() = cnt.toString() + } + x = y + } + print(x) +} + +fun print(x: Any) = println(x.toString()) \ No newline at end of file From 1b553ebfaffb31f19a59827860c996dfb4b9b417 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 12 Jan 2017 19:43:20 +0700 Subject: [PATCH 10/86] backend/tests: Add blackbox tests from Kotlin JVM Added tests from testData/codegen/box directory. There are blackbox tests in other directories and they are to be added. --- .../annotations/annotatedEnumEntry.kt | 35 ++ .../annotatedLambda/funExpression.kt | 33 ++ .../annotations/annotatedLambda/lambda.kt | 35 ++ .../annotatedLambda/samFunExpression.kt | 49 +++ .../annotations/annotatedLambda/samLambda.kt | 40 +++ .../annotations/annotatedObjectLiteral.kt | 19 + .../annotationWithKotlinProperty.kt | 36 ++ ...ithKotlinPropertyFromInterfaceCompanion.kt | 35 ++ .../annotations/annotationsOnDefault.kt | 40 +++ .../annotations/annotationsOnTypeAliases.kt | 28 ++ .../annotations/defaultParameterValues.kt | 41 +++ .../annotations/delegatedPropertySetter.kt | 32 ++ .../fileClassWithFileAnnotation.kt | 14 + .../annotations/jvmAnnotationFlags.kt | 34 ++ ...otlinPropertyFromClassObjectAsParameter.kt | 48 +++ .../kotlinTopLevelPropertyAsParameter.kt | 44 +++ .../codegen/blackbox/annotations/kt10136.kt | 24 ++ .../nestedClassPropertyAsParameter.kt | 24 ++ .../annotations/parameterWithPrimitiveType.kt | 32 ++ ...rtyWithPropertyInInitializerAsParameter.kt | 19 + .../resolveWithLowPriorityAnnotation.kt | 19 + .../varargInAnnotationParameter.kt | 53 +++ .../blackbox/argumentOrder/arguments.kt | 16 + .../blackbox/argumentOrder/captured.kt | 34 ++ .../argumentOrder/capturedInExtension.kt | 33 ++ .../blackbox/argumentOrder/defaults.kt | 16 + .../blackbox/argumentOrder/extension.kt | 33 ++ .../argumentOrder/extensionInClass.kt | 40 +++ .../codegen/blackbox/argumentOrder/kt9277.kt | 13 + .../blackbox/argumentOrder/lambdaMigration.kt | 21 ++ .../argumentOrder/lambdaMigrationInClass.kt | 25 ++ .../codegen/blackbox/argumentOrder/simple.kt | 24 ++ .../blackbox/argumentOrder/simpleInClass.kt | 26 ++ .../arrays/arrayConstructorsSimple.kt | 26 ++ .../arrays/arrayGetAssignMultiIndex.kt | 11 + .../blackbox/arrays/arrayGetMultiIndex.kt | 11 + .../blackbox/arrays/arrayInstanceOf.kt | 29 ++ .../blackbox/arrays/arrayPlusAssign.kt | 6 + .../blackbox/arrays/arraysAreCloneable.kt | 28 ++ .../codegen/blackbox/arrays/cloneArray.kt | 18 + .../blackbox/arrays/clonePrimitiveArrays.kt | 40 +++ .../arrays/collectionAssignGetMultiIndex.kt | 12 + .../arrays/collectionGetMultiIndex.kt | 11 + .../blackbox/arrays/forEachBooleanArray.kt | 6 + .../blackbox/arrays/forEachByteArray.kt | 6 + .../blackbox/arrays/forEachCharArray.kt | 6 + .../blackbox/arrays/forEachDoubleArray.kt | 6 + .../blackbox/arrays/forEachFloatArray.kt | 6 + .../blackbox/arrays/forEachIntArray.kt | 6 + .../blackbox/arrays/forEachLongArray.kt | 6 + .../blackbox/arrays/forEachShortArray.kt | 6 + .../codegen/blackbox/arrays/hashMap.kt | 9 + .../arrays/inProjectionAsParameter.kt | 9 + .../blackbox/arrays/inProjectionOfArray.kt | 10 + .../blackbox/arrays/inProjectionOfList.kt | 12 + .../codegen/blackbox/arrays/indices.kt | 11 + .../codegen/blackbox/arrays/indicesChar.kt | 11 + .../codegen/blackbox/arrays/iterator.kt | 9 + .../blackbox/arrays/iteratorBooleanArray.kt | 10 + .../blackbox/arrays/iteratorByteArray.kt | 10 + .../arrays/iteratorByteArrayNextByte.kt | 13 + .../blackbox/arrays/iteratorCharArray.kt | 10 + .../blackbox/arrays/iteratorDoubleArray.kt | 10 + .../blackbox/arrays/iteratorFloatArray.kt | 10 + .../blackbox/arrays/iteratorIntArray.kt | 10 + .../blackbox/arrays/iteratorLongArray.kt | 10 + .../arrays/iteratorLongArrayNextLong.kt | 13 + .../blackbox/arrays/iteratorShortArray.kt | 10 + .../codegen/blackbox/arrays/kt1291.kt | 27 ++ .../external/codegen/blackbox/arrays/kt238.kt | 58 +++ .../codegen/blackbox/arrays/kt2997.kt | 77 ++++ .../external/codegen/blackbox/arrays/kt33.kt | 6 + .../codegen/blackbox/arrays/kt3771.kt | 14 + .../codegen/blackbox/arrays/kt4118.kt | 94 +++++ .../codegen/blackbox/arrays/kt4348.kt | 17 + .../codegen/blackbox/arrays/kt4357.kt | 8 + .../external/codegen/blackbox/arrays/kt503.kt | 32 ++ .../external/codegen/blackbox/arrays/kt594.kt | 16 + .../external/codegen/blackbox/arrays/kt602.kt | 6 + .../codegen/blackbox/arrays/kt7009.kt | 6 + .../codegen/blackbox/arrays/kt7288.kt | 32 ++ .../codegen/blackbox/arrays/kt7338.kt | 12 + .../external/codegen/blackbox/arrays/kt779.kt | 3 + .../external/codegen/blackbox/arrays/kt945.kt | 9 + .../external/codegen/blackbox/arrays/kt950.kt | 7 + .../codegen/blackbox/arrays/longAsIndex.kt | 9 + .../blackbox/arrays/multiArrayConstructors.kt | 31 ++ .../blackbox/arrays/multiDecl/MultiDeclFor.kt | 18 + .../MultiDeclForComponentExtensions.kt | 19 + .../MultiDeclForComponentMemberExtensions.kt | 21 ++ ...nentMemberExtensionsInExtensionFunction.kt | 21 ++ .../multiDecl/MultiDeclForValCaptured.kt | 18 + .../int/MultiDeclForComponentExtensions.kt | 16 + ...tiDeclForComponentExtensionsValCaptured.kt | 16 + .../MultiDeclForComponentMemberExtensions.kt | 18 + ...nentMemberExtensionsInExtensionFunction.kt | 18 + .../long/MultiDeclForComponentExtensions.kt | 16 + ...tiDeclForComponentExtensionsValCaptured.kt | 16 + .../MultiDeclForComponentMemberExtensions.kt | 18 + ...nentMemberExtensionsInExtensionFunction.kt | 18 + .../arrays/nonLocalReturnArrayConstructor.kt | 24 ++ .../codegen/blackbox/arrays/nonNullArray.kt | 8 + .../codegen/blackbox/arrays/stdlib.kt | 56 +++ .../codegen/blackbox/binaryOp/bitwiseOp.kt | 67 ++++ .../codegen/blackbox/binaryOp/bitwiseOpAny.kt | 67 ++++ .../blackbox/binaryOp/bitwiseOpNullable.kt | 67 ++++ .../codegen/blackbox/binaryOp/call.kt | 21 ++ .../codegen/blackbox/binaryOp/callAny.kt | 21 ++ .../codegen/blackbox/binaryOp/callNullable.kt | 21 ++ .../binaryOp/compareWithBoxedDouble.kt | 17 + .../blackbox/binaryOp/compareWithBoxedLong.kt | 15 + .../blackbox/binaryOp/divisionByZero.kt | 14 + .../codegen/blackbox/binaryOp/intrinsic.kt | 21 ++ .../codegen/blackbox/binaryOp/intrinsicAny.kt | 21 ++ .../blackbox/binaryOp/intrinsicNullable.kt | 21 ++ .../codegen/blackbox/binaryOp/kt11163.kt | 12 + .../binaryOp/kt6747_identityEquals.kt | 9 + .../codegen/blackbox/binaryOp/overflowChar.kt | 10 + .../codegen/blackbox/binaryOp/overflowInt.kt | 11 + .../codegen/blackbox/binaryOp/overflowLong.kt | 14 + .../blackbox/boxingOptimization/casts.kt | 18 + .../checkcastAndInstanceOf.kt | 26 ++ .../blackbox/boxingOptimization/fold.kt | 14 + .../blackbox/boxingOptimization/foldRange.kt | 11 + .../blackbox/boxingOptimization/kt5493.kt | 8 + .../blackbox/boxingOptimization/kt5588.kt | 10 + .../blackbox/boxingOptimization/kt5844.kt | 29 ++ .../blackbox/boxingOptimization/kt6047.kt | 23 ++ .../blackbox/boxingOptimization/kt6842.kt | 9 + .../blackbox/boxingOptimization/nullCheck.kt | 17 + .../boxingOptimization/progressions.kt | 33 ++ .../boxingOptimization/safeCallWithElvis.kt | 29 ++ .../blackbox/boxingOptimization/simple.kt | 14 + .../simpleUninitializedMerge.kt | 14 + .../boxingOptimization/unsafeRemoving.kt | 35 ++ .../blackbox/boxingOptimization/variables.kt | 23 ++ .../bridges/complexMultiInheritance.kt | 25 ++ .../blackbox/bridges/complexTraitImpl.kt | 33 ++ .../codegen/blackbox/bridges/delegation.kt | 14 + .../blackbox/bridges/delegationComplex.kt | 17 + .../bridges/delegationComplexWithList.kt | 18 + .../blackbox/bridges/delegationProperty.kt | 15 + .../codegen/blackbox/bridges/diamond.kt | 26 ++ .../blackbox/bridges/fakeCovariantOverride.kt | 19 + .../bridges/fakeGenericCovariantOverride.kt | 22 ++ ...eGenericCovariantOverrideWithDelegation.kt | 32 ++ .../bridges/fakeOverrideOfTraitImpl.kt | 31 ++ ...akeOverrideWithSeveralSuperDeclarations.kt | 30 ++ ...keOverrideWithSynthesizedImplementation.kt | 18 + .../blackbox/bridges/genericProperty.kt | 19 + .../codegen/blackbox/bridges/jsName.kt | 59 ++++ .../codegen/blackbox/bridges/jsNative.kt | 44 +++ .../codegen/blackbox/bridges/kt12416.kt | 41 +++ .../codegen/blackbox/bridges/kt1939.kt | 12 + .../codegen/blackbox/bridges/kt1959.kt | 13 + .../codegen/blackbox/bridges/kt2498.kt | 19 + .../codegen/blackbox/bridges/kt2702.kt | 14 + .../codegen/blackbox/bridges/kt2833.kt | 17 + .../codegen/blackbox/bridges/kt2920.kt | 9 + .../codegen/blackbox/bridges/kt318.kt | 24 ++ .../blackbox/bridges/longChainOneBridge.kt | 32 ++ ...anyTypeArgumentsSubstitutedSuccessively.kt | 26 ++ .../blackbox/bridges/methodFromTrait.kt | 17 + .../noBridgeOnMutableCollectionInheritance.kt | 23 ++ .../codegen/blackbox/bridges/objectClone.kt | 23 ++ .../bridges/overrideAbstractProperty.kt | 10 + .../blackbox/bridges/overrideReturnType.kt | 13 + .../bridges/propertyAccessorsWithoutBody.kt | 15 + .../blackbox/bridges/propertyDiamond.kt | 18 + .../blackbox/bridges/propertyInConstructor.kt | 11 + .../blackbox/bridges/propertySetter.kt | 13 + .../codegen/blackbox/bridges/simple.kt | 18 + .../codegen/blackbox/bridges/simpleEnum.kt | 20 ++ .../blackbox/bridges/simpleGenericMethod.kt | 18 + .../codegen/blackbox/bridges/simpleObject.kt | 23 ++ .../blackbox/bridges/simpleReturnType.kt | 17 + .../blackbox/bridges/simpleTraitImpl.kt | 16 + .../blackbox/bridges/simpleUpperBound.kt | 18 + .../blackbox/bridges/strListContains.kt | 52 +++ .../substitutionInSuperClass/abstractFun.kt | 22 ++ .../boundedTypeArguments.kt | 21 ++ .../substitutionInSuperClass/delegation.kt | 18 + .../differentErasureInSuperClass.kt | 15 + .../differentErasureInSuperClassComplex.kt | 35 ++ .../bridges/substitutionInSuperClass/enum.kt | 28 ++ .../substitutionInSuperClass/genericMethod.kt | 22 ++ .../substitutionInSuperClass/object.kt | 30 ++ .../substitutionInSuperClass/property.kt | 15 + .../substitutionInSuperClass/simple.kt | 22 ++ .../substitutionInSuperClass/upperBound.kt | 22 ++ .../bridges/traitImplInheritsTraitImpl.kt | 17 + ...woParentsWithDifferentMethodsTwoBridges.kt | 33 ++ ...oParentsWithDifferentMethodsTwoBridges2.kt | 40 +++ .../twoParentsWithTheSameMethodOneBridge.kt | 24 ++ .../blackbox/builtinStubMethods/Collection.kt | 34 ++ .../blackbox/builtinStubMethods/Iterator.kt | 16 + .../builtinStubMethods/IteratorWithRemove.kt | 14 + .../blackbox/builtinStubMethods/List.kt | 42 +++ .../builtinStubMethods/ListIterator.kt | 28 ++ .../ListWithAllImplementations.kt | 45 +++ .../ListWithAllInheritedImplementations.kt | 47 +++ .../blackbox/builtinStubMethods/Map.kt | 34 ++ .../blackbox/builtinStubMethods/MapEntry.kt | 18 + .../MapEntryWithSetValue.kt | 17 + .../MapWithAllImplementations.kt | 31 ++ .../builtinStubMethods/SubstitutedList.kt | 42 +++ .../builtinStubMethods/abstractMember.kt | 23 ++ .../customReadOnlyIterator.kt | 34 ++ .../delegationToArrayList.kt | 49 +++ .../extendJavaCollections/abstractList.kt | 22 ++ .../extendJavaCollections/abstractMap.kt | 24 ++ .../extendJavaCollections/abstractSet.kt | 18 + .../extendJavaCollections/arrayList.kt | 22 ++ .../extendJavaCollections/hashMap.kt | 18 + .../extendJavaCollections/hashSet.kt | 18 + .../extendJavaCollections/mapEntry.kt | 30 ++ .../builtinStubMethods/immutableRemove.kt | 53 +++ .../implementationInTrait.kt | 32 ++ .../inheritedImplementations.kt | 24 ++ .../manyTypeParametersWithUpperBounds.kt | 33 ++ .../nonTrivialSubstitution.kt | 20 ++ .../nonTrivialUpperBound.kt | 16 + .../builtinStubMethods/substitutedIterable.kt | 31 ++ .../substitutedListWithExtraSuperInterface.kt | 42 +++ .../blackbox/callableReference/bound/array.kt | 11 + .../bound/companionObjectReceiver.kt | 7 + .../bound/enumEntryMember.kt | 17 + .../bound/equals/nullableReceiverInEquals.kt | 37 ++ .../bound/equals/propertyAccessors.kt | 32 ++ .../bound/equals/receiverInEquals.kt | 27 ++ .../bound/equals/reflectionReference.kt | 35 ++ .../callableReference/bound/inline/simple.kt | 5 + .../bound/inline/simpleVal.kt | 8 + .../bound/kCallableNameIntrinsic.kt | 10 + .../callableReference/bound/kt12738.kt | 11 + .../callableReference/bound/kt15446.kt | 15 + .../callableReference/bound/multiCase.kt | 51 +++ .../callableReference/bound/nullReceiver.kt | 4 + .../callableReference/bound/objectReceiver.kt | 5 + .../bound/primitiveReceiver.kt | 26 ++ .../callableReference/bound/simpleFunction.kt | 6 + .../callableReference/bound/simpleProperty.kt | 8 + .../bound/syntheticExtensionOnLHS.kt | 22 ++ .../function/abstractClassMember.kt | 9 + .../function/booleanNotIntrinsic.kt | 8 + .../function/classMemberFromClass.kt | 11 + .../function/classMemberFromExtension.kt | 12 + .../classMemberFromTopLevelStringNoArgs.kt | 8 + ...assMemberFromTopLevelStringOneStringArg.kt | 8 + .../classMemberFromTopLevelUnitNoArgs.kt | 14 + ...classMemberFromTopLevelUnitOneStringArg.kt | 14 + .../function/constructorFromTopLevelNoArgs.kt | 5 + .../constructorFromTopLevelOneStringArg.kt | 3 + .../function/enumValueOfMethod.kt | 12 + .../function/equalsIntrinsic.kt | 6 + .../function/extensionFromClass.kt | 7 + .../function/extensionFromExtension.kt | 7 + .../extensionFromTopLevelStringNoArgs.kt | 8 + ...extensionFromTopLevelStringOneStringArg.kt | 8 + .../extensionFromTopLevelUnitNoArgs.kt | 14 + .../extensionFromTopLevelUnitOneStringArg.kt | 14 + .../function/genericMember.kt | 5 + .../function/getArityViaFunctionImpl.kt | 35 ++ .../function/innerConstructorFromClass.kt | 14 + .../function/innerConstructorFromExtension.kt | 14 + .../innerConstructorFromTopLevelNoArgs.kt | 12 + ...nnerConstructorFromTopLevelOneStringArg.kt | 9 + .../function/javaCollectionsStaticMethod.kt | 16 + .../function/local/captureOuter.kt | 12 + .../function/local/classMember.kt | 8 + .../function/local/closureWithSideEffect.kt | 9 + .../function/local/constructor.kt | 7 + .../local/constructorWithInitializer.kt | 10 + .../function/local/enumExtendsTrait.kt | 11 + .../function/local/extension.kt | 6 + .../function/local/extensionToLocalClass.kt | 5 + .../function/local/extensionToPrimitive.kt | 4 + .../function/local/extensionWithClosure.kt | 11 + .../function/local/genericMember.kt | 8 + .../function/local/localClassMember.kt | 11 + .../function/local/localFunctionName.kt | 8 + .../function/local/localLocal.kt | 10 + .../function/local/recursiveClosure.kt | 7 + .../function/local/simple.kt | 4 + .../function/local/simpleClosure.kt | 7 + .../function/local/simpleWithArg.kt | 4 + .../function/local/unitWithSideEffect.kt | 15 + .../function/nestedConstructorFromClass.kt | 14 + .../nestedConstructorFromTopLevelNoArgs.kt | 7 + ...stedConstructorFromTopLevelOneStringArg.kt | 5 + .../callableReference/function/newArray.kt | 16 + .../function/overloadedFun.kt | 27 ++ .../function/overloadedFunVsVal.kt | 21 ++ .../function/privateClassMember.kt | 7 + .../function/sortListOfStrings.kt | 14 + .../function/topLevelFromClass.kt | 11 + .../function/topLevelFromExtension.kt | 11 + .../topLevelFromTopLevelStringNoArgs.kt | 6 + .../topLevelFromTopLevelStringOneStringArg.kt | 6 + .../topLevelFromTopLevelUnitNoArgs.kt | 11 + .../topLevelFromTopLevelUnitOneStringArg.kt | 11 + .../traitImplMethodWithClassReceiver.kt | 11 + .../callableReference/function/traitMember.kt | 9 + .../property/accessViaSubclass.kt | 9 + .../callableReference/property/delegated.kt | 24 ++ .../property/delegatedMutable.kt | 24 ++ .../property/enumNameOrdinal.kt | 11 + .../property/extensionToArray.kt | 6 + .../property/genericProperty.kt | 21 ++ .../property/invokePropertyReference.kt | 31 ++ .../property/javaBeanConvention.kt | 14 + .../kClassInstanceIsInitializedFirst.kt | 13 + .../callableReference/property/kt12044.kt | 12 + .../kt12982_protectedPropertyReference.kt | 12 + .../callableReference/property/kt14330.kt | 8 + .../callableReference/property/kt14330_2.kt | 14 + .../callableReference/property/kt15447.kt | 12 + .../kt6870_privatePropertyReference.kt | 25 ++ .../property/listOfStringsMapLength.kt | 7 + .../property/localClassVar.kt | 9 + .../property/overriddenInSubclass.kt | 9 + .../property/privateSetterInsideClass.kt | 18 + .../property/privateSetterOutsideClass.kt | 29 ++ .../property/simpleExtension.kt | 12 + .../property/simpleMember.kt | 9 + .../property/simpleMutableExtension.kt | 18 + .../property/simpleMutableMember.kt | 16 + .../property/simpleMutableTopLevel.kt | 12 + .../property/simpleTopLevel.kt | 10 + .../external/codegen/blackbox/casts/as.kt | 11 + .../codegen/blackbox/casts/asForConstants.kt | 41 +++ .../external/codegen/blackbox/casts/asSafe.kt | 11 + .../codegen/blackbox/casts/asSafeFail.kt | 16 + .../blackbox/casts/asSafeForConstants.kt | 30 ++ .../external/codegen/blackbox/casts/asUnit.kt | 1 + .../codegen/blackbox/casts/asWithGeneric.kt | 26 ++ .../codegen/blackbox/casts/castGenericNull.kt | 13 + .../blackbox/casts/functions/asFunKBig.kt | 254 ++++++++++++++ .../blackbox/casts/functions/asFunKSmall.kt | 47 +++ .../blackbox/casts/functions/isFunKBig.kt | 181 ++++++++++ .../blackbox/casts/functions/isFunKSmall.kt | 60 ++++ .../casts/functions/javaTypeIsFunK.kt | 19 + .../casts/functions/reifiedAsFunKBig.kt | 277 +++++++++++++++ .../casts/functions/reifiedAsFunKSmall.kt | 39 +++ .../casts/functions/reifiedIsFunKBig.kt | 195 +++++++++++ .../casts/functions/reifiedIsFunKSmall.kt | 41 +++ .../casts/functions/reifiedSafeAsFunKBig.kt | 288 +++++++++++++++ .../casts/functions/reifiedSafeAsFunKSmall.kt | 44 +++ .../blackbox/casts/functions/safeAsFunKBig.kt | 331 ++++++++++++++++++ .../casts/functions/safeAsFunKSmall.kt | 39 +++ .../casts/intersectionTypeMultipleBounds.kt | 22 ++ ...ctionTypeMultipleBoundsImplicitReceiver.kt | 16 + .../casts/intersectionTypeSmartcast.kt | 27 ++ ...sectionTypeWithMultipleBoundsAsReceiver.kt | 13 + ...tersectionTypeWithoutGenericsAsReceiver.kt | 12 + .../external/codegen/blackbox/casts/is.kt | 11 + .../blackbox/casts/lambdaToUnitCast.kt | 9 + .../binaryExpressionCast.kt | 7 + .../javaBox.kt | 28 ++ .../labeledExpressionCast.kt | 7 + .../parenthesizedExpressionCast.kt | 7 + .../superConstructor.kt | 7 + .../unaryExpressionCast.kt | 7 + .../vararg.kt | 11 + .../casts/mutableCollections/asWithMutable.kt | 126 +++++++ .../casts/mutableCollections/isWithMutable.kt | 111 ++++++ .../mutabilityMarkerInterfaces.kt | 60 ++++ .../reifiedAsWithMutable.kt | 128 +++++++ .../reifiedIsWithMutable.kt | 111 ++++++ .../reifiedSafeAsWithMutable.kt | 139 ++++++++ .../mutableCollections/safeAsWithMutable.kt | 140 ++++++++ .../mutableCollections/weirdMutableCasts.kt | 143 ++++++++ .../external/codegen/blackbox/casts/notIs.kt | 11 + .../codegen/blackbox/casts/unitAsAny.kt | 11 + .../codegen/blackbox/casts/unitAsInt.kt | 20 ++ .../codegen/blackbox/casts/unitAsSafeAny.kt | 11 + .../blackbox/casts/unitNullableCast.kt | 7 + .../bound/javaIntrinsicWithSideEffect.kt | 13 + .../blackbox/classLiteral/bound/primitives.kt | 19 + .../blackbox/classLiteral/bound/sideEffect.kt | 17 + .../blackbox/classLiteral/bound/simple.kt | 8 + .../blackbox/classLiteral/java/java.kt | 63 ++++ .../classLiteral/java/javaObjectType.kt | 53 +++ .../java/javaObjectTypeReified.kt | 27 ++ .../classLiteral/java/javaPrimitiveType.kt | 63 ++++ .../java/javaPrimitiveTypeReified.kt | 34 ++ .../blackbox/classLiteral/java/javaReified.kt | 27 ++ .../blackbox/classLiteral/java/kt11943.kt | 19 + .../java/objectSuperConstructorCall.kt | 21 ++ .../classLiteral/primitiveKClassEquality.kt | 18 + .../boxPrimitiveTypeInClinitOfClassObject.kt | 31 ++ .../classCompanionInitializationWithJava.kt | 33 ++ .../classes/classNamedAsOldPackageFacade.kt | 7 + .../codegen/blackbox/classes/classObject.kt | 11 + .../classes/classObjectAsExtensionReceiver.kt | 7 + .../classes/classObjectAsStaticInitializer.kt | 19 + .../blackbox/classes/classObjectField.kt | 7 + .../blackbox/classes/classObjectInTrait.kt | 12 + .../blackbox/classes/classObjectNotOfEnum.kt | 8 + .../blackbox/classes/classObjectToString.kt | 9 + .../classObjectWithPrivateGenericMember.kt | 15 + .../classes/classObjectsWithParentClasses.kt | 12 + .../defaultObjectSameNamesAsInOuter.kt | 18 + .../codegen/blackbox/classes/delegation2.kt | 24 ++ .../codegen/blackbox/classes/delegation3.kt | 35 ++ .../codegen/blackbox/classes/delegation4.kt | 28 ++ .../blackbox/classes/delegationGenericArg.kt | 12 + .../classes/delegationGenericArgUpperBound.kt | 12 + .../classes/delegationGenericLongArg.kt | 12 + .../blackbox/classes/delegationJava.kt | 16 + .../classes/delegationMethodsWithArgs.kt | 34 ++ .../blackbox/classes/exceptionConstructor.kt | 7 + .../classes/extensionOnNamedClassObject.kt | 12 + .../codegen/blackbox/classes/funDelegation.kt | 17 + .../classes/implementComparableInSubclass.kt | 22 ++ .../blackbox/classes/inheritSetAndHashSet.kt | 9 + .../codegen/blackbox/classes/inheritance.kt | 41 +++ .../blackbox/classes/inheritedInnerClass.kt | 14 + .../blackbox/classes/inheritedMethod.kt | 13 + .../blackbox/classes/initializerBlock.kt | 13 + .../blackbox/classes/initializerBlockDImpl.kt | 18 + .../classes/inner/instantiateInDerived.kt | 40 +++ .../inner/instantiateInDerivedLabeled.kt | 42 +++ .../classes/inner/instantiateInSameClass.kt | 34 ++ .../codegen/blackbox/classes/inner/kt6708.kt | 12 + .../blackbox/classes/inner/properOuter.kt | 16 + .../classes/inner/properSuperLinking.kt | 16 + .../codegen/blackbox/classes/innerClass.kt | 19 + ...nterfaceCompanionInitializationWithJava.kt | 36 ++ .../codegen/blackbox/classes/kt1018.kt | 12 + .../codegen/blackbox/classes/kt1120.kt | 19 + .../codegen/blackbox/classes/kt1134.kt | 9 + .../codegen/blackbox/classes/kt1157.kt | 21 ++ .../codegen/blackbox/classes/kt1247.kt | 6 + .../codegen/blackbox/classes/kt1345.kt | 13 + .../codegen/blackbox/classes/kt1439.kt | 17 + .../codegen/blackbox/classes/kt1535.kt | 22 ++ .../codegen/blackbox/classes/kt1538.kt | 21 ++ .../codegen/blackbox/classes/kt1578.kt | 9 + .../codegen/blackbox/classes/kt1611.kt | 11 + .../codegen/blackbox/classes/kt1721.kt | 6 + .../codegen/blackbox/classes/kt1726.kt | 15 + .../codegen/blackbox/classes/kt1759.kt | 10 + .../codegen/blackbox/classes/kt1891.kt | 14 + .../codegen/blackbox/classes/kt1918.kt | 20 ++ .../codegen/blackbox/classes/kt1976.kt | 8 + .../codegen/blackbox/classes/kt1980.kt | 27 ++ .../codegen/blackbox/classes/kt2224.kt | 44 +++ .../codegen/blackbox/classes/kt2288.kt | 10 + .../codegen/blackbox/classes/kt2384.kt | 15 + .../codegen/blackbox/classes/kt2390.kt | 35 ++ .../codegen/blackbox/classes/kt2391.kt | 19 + .../codegen/blackbox/classes/kt2395.kt | 13 + .../codegen/blackbox/classes/kt2417.kt | 23 ++ .../codegen/blackbox/classes/kt2477.kt | 23 ++ .../codegen/blackbox/classes/kt2480.kt | 13 + .../codegen/blackbox/classes/kt2482.kt | 9 + .../codegen/blackbox/classes/kt2485.kt | 12 + .../codegen/blackbox/classes/kt249.kt | 13 + .../codegen/blackbox/classes/kt2532.kt | 15 + .../codegen/blackbox/classes/kt2566.kt | 15 + .../codegen/blackbox/classes/kt2566_2.kt | 17 + .../codegen/blackbox/classes/kt2607.kt | 9 + .../codegen/blackbox/classes/kt2626.kt | 10 + .../codegen/blackbox/classes/kt2711.kt | 15 + .../codegen/blackbox/classes/kt2784.kt | 10 + .../codegen/blackbox/classes/kt285.kt | 15 + .../codegen/blackbox/classes/kt3001.kt | 11 + .../codegen/blackbox/classes/kt3114.kt | 13 + .../codegen/blackbox/classes/kt3414.kt | 18 + .../codegen/blackbox/classes/kt343.kt | 22 ++ .../codegen/blackbox/classes/kt3546.kt | 25 ++ .../codegen/blackbox/classes/kt454.kt | 5 + .../codegen/blackbox/classes/kt471.kt | 109 ++++++ .../external/codegen/blackbox/classes/kt48.kt | 29 ++ .../codegen/blackbox/classes/kt496.kt | 83 +++++ .../codegen/blackbox/classes/kt500.kt | 29 ++ .../codegen/blackbox/classes/kt501.kt | 22 ++ .../codegen/blackbox/classes/kt504.kt | 17 + .../codegen/blackbox/classes/kt508.kt | 16 + .../codegen/blackbox/classes/kt5347.kt | 44 +++ .../codegen/blackbox/classes/kt6136.kt | 26 ++ .../codegen/blackbox/classes/kt633.kt | 23 ++ .../codegen/blackbox/classes/kt6816.kt | 25 ++ .../codegen/blackbox/classes/kt707.kt | 11 + .../codegen/blackbox/classes/kt723.kt | 8 + .../codegen/blackbox/classes/kt725.kt | 8 + .../codegen/blackbox/classes/kt8011.kt | 19 + .../codegen/blackbox/classes/kt8011a.kt | 52 +++ .../codegen/blackbox/classes/kt903.kt | 23 ++ .../codegen/blackbox/classes/kt940.kt | 17 + .../codegen/blackbox/classes/kt9642.kt | 17 + .../blackbox/classes/namedClassObject.kt | 12 + .../codegen/blackbox/classes/outerThis.kt | 12 + .../classes/overloadBinaryOperator.kt | 23 ++ .../blackbox/classes/overloadPlusAssign.kt | 24 ++ .../classes/overloadPlusAssignReturn.kt | 28 ++ .../classes/overloadPlusToPlusAssign.kt | 28 ++ .../blackbox/classes/overloadUnaryOperator.kt | 27 ++ .../blackbox/classes/privateOuterFunctions.kt | 35 ++ .../blackbox/classes/privateOuterProperty.kt | 31 ++ .../codegen/blackbox/classes/privateToThis.kt | 11 + .../blackbox/classes/propertyDelegation.kt | 33 ++ .../blackbox/classes/propertyInInitializer.kt | 16 + .../blackbox/classes/rightHandOverride.kt | 20 ++ .../blackbox/classes/sealedInSameFile.kt | 38 ++ .../codegen/blackbox/classes/selfcreate.kt | 14 + .../codegen/blackbox/classes/simpleBox.kt | 8 + .../superConstructorCallWithComplexArg.kt | 19 + .../blackbox/classes/typedDelegation.kt | 31 ++ .../closures/captureExtensionReceiver.kt | 40 +++ .../captureFunctionInProperty.kt | 15 + .../captureOuterProperty/inFunction.kt | 13 + .../captureOuterProperty/inProperty.kt | 13 + .../inPropertyDeepObjectChain.kt | 18 + .../inPropertyFromSuperClass.kt | 15 + .../inPropertyFromSuperSuperClass.kt | 17 + .../closures/captureOuterProperty/kt4176.kt | 17 + .../closures/captureOuterProperty/kt4656.kt | 16 + .../closures/capturedLocalGenericFun.kt | 14 + .../localFunInsideLocalFun.kt | 13 + ...calFunInsideLocalFunDifferentSignatures.kt | 13 + .../propertyAndFunctionNameClash.kt | 35 ++ .../closureInsideClosure/threeLevels.kt | 17 + .../threeLevelsDifferentSignatures.kt | 16 + .../varAsFunInsideLocalFun.kt | 15 + .../closures/closureInsideConstrucor.kt | 14 + .../blackbox/closures/closureOnTopLevel1.kt | 24 ++ .../blackbox/closures/closureOnTopLevel2.kt | 22 ++ .../blackbox/closures/closureWithParameter.kt | 7 + .../closures/closureWithParameterAndBoxing.kt | 7 + .../closures/doubleEnclosedLocalVariable.kt | 8 + .../closures/enclosingLocalVariable.kt | 8 + .../blackbox/closures/enclosingThis.kt | 12 + .../blackbox/closures/extensionClosure.kt | 13 + .../codegen/blackbox/closures/kt10044.kt | 41 +++ .../codegen/blackbox/closures/kt11634.kt | 27 ++ .../codegen/blackbox/closures/kt11634_2.kt | 27 ++ .../codegen/blackbox/closures/kt11634_3.kt | 27 ++ .../codegen/blackbox/closures/kt11634_4.kt | 28 ++ .../codegen/blackbox/closures/kt2151.kt | 11 + .../codegen/blackbox/closures/kt3152.kt | 14 + .../codegen/blackbox/closures/kt3523.kt | 18 + .../codegen/blackbox/closures/kt3738.kt | 19 + .../codegen/blackbox/closures/kt3905.kt | 5 + .../codegen/blackbox/closures/kt4106.kt | 15 + .../codegen/blackbox/closures/kt4137.kt | 13 + .../codegen/blackbox/closures/kt5589.kt | 5 + .../blackbox/closures/localClassFunClosure.kt | 8 + .../closures/localClassLambdaClosure.kt | 8 + .../closures/localFunctionInFunction.kt | 14 + .../closures/localFunctionInInitializer.kt | 12 + .../blackbox/closures/localGenericFun.kt | 12 + .../codegen/blackbox/closures/localReturn.kt | 19 + .../closures/localReturnWithAutolabel.kt | 19 + .../codegen/blackbox/closures/noRefToOuter.kt | 22 ++ .../blackbox/closures/recursiveClosure.kt | 7 + .../blackbox/closures/simplestClosure.kt | 7 + .../closures/simplestClosureAndBoxing.kt | 7 + .../closures/subclosuresWithinInitializers.kt | 24 ++ .../blackbox/closures/underscoreParameters.kt | 3 + .../blackbox/collections/charSequence.kt | 70 ++++ .../implementCollectionThroughKotlin.kt | 97 +++++ .../collections/inSetWithSmartCast.kt | 15 + .../collections/irrelevantImplCharSequence.kt | 31 ++ .../irrelevantImplCharSequenceKotlin.kt | 33 ++ .../collections/irrelevantImplMutableList.kt | 115 ++++++ .../irrelevantImplMutableListKotlin.kt | 105 ++++++ .../irrelevantImplMutableListSubstitution.kt | 115 ++++++ .../irrelevantRemoveAtOverrideInJava.kt | 112 ++++++ .../irrelevantSizeOverrideInJava.kt | 46 +++ .../blackbox/collections/mutableList.kt | 101 ++++++ .../collections/noStubsInJavaSuperClass.kt | 69 ++++ .../collections/platformValueContains.kt | 54 +++ .../blackbox/collections/readOnlyList.kt | 60 ++++ .../blackbox/collections/readOnlyMap.kt | 44 +++ .../blackbox/collections/removeAtInt.kt | 106 ++++++ .../codegen/blackbox/collections/strList.kt | 101 ++++++ .../collections/toArrayInJavaClass.kt | 35 ++ .../dataClassEqualsHashCodeToString.kt | 13 + .../blackbox/constants/constantsInWhen.kt | 18 + .../codegen/blackbox/constants/float.kt | 18 + .../codegen/blackbox/constants/kt9532.kt | 33 ++ .../codegen/blackbox/constants/long.kt | 10 + .../blackbox/constants/privateConst.kt | 7 + .../blackbox/controlStructures/bottles.kt | 9 + .../breakFromOuter.kt | 15 + .../breakInDoWhile.kt | 10 + .../breakContinueInExpressions/breakInExpr.kt | 9 + .../continueInDoWhile.kt | 6 + .../continueInExpr.kt | 7 + .../inlineWithStack.kt | 17 + .../innerLoopWithStack.kt | 9 + .../breakContinueInExpressions/kt14581.kt | 11 + .../breakContinueInExpressions/kt9022And.kt | 9 + .../breakContinueInExpressions/kt9022Or.kt | 9 + .../breakContinueInExpressions/popSizes.kt | 13 + .../breakContinueInExpressions/tryFinally1.kt | 12 + .../breakContinueInExpressions/tryFinally2.kt | 13 + .../whileTrueBreak.kt | 4 + .../controlStructures/breakInFinally.kt | 11 + .../compareBoxedIntegerToZero.kt | 8 + .../controlStructures/conditionOfEmptyIf.kt | 13 + .../controlStructures/continueInExpr.kt | 16 + .../controlStructures/continueInFor.kt | 123 +++++++ .../continueInForCondition.kt | 12 + .../controlStructures/continueInWhile.kt | 16 + .../controlStructures/continueToLabelInFor.kt | 123 +++++++ .../blackbox/controlStructures/doWhile.kt | 15 + .../blackbox/controlStructures/doWhileFib.kt | 12 + .../controlStructures/doWhileWithContinue.kt | 21 ++ .../controlStructures/emptyDoWhile.kt | 9 + .../blackbox/controlStructures/emptyFor.kt | 19 + .../blackbox/controlStructures/emptyWhile.kt | 9 + .../controlStructures/factorialTest.kt | 44 +++ .../controlStructures/finallyOnEmptyReturn.kt | 14 + .../controlStructures/forArrayList.kt | 11 + .../forArrayListMultiDecl.kt | 12 + .../forInSmartCastToArray.kt | 14 + .../blackbox/controlStructures/forIntArray.kt | 14 + .../forLoopMemberExtensionAll.kt | 26 ++ .../forLoopMemberExtensionHasNext.kt | 26 ++ .../forLoopMemberExtensionNext.kt | 29 ++ .../controlStructures/forNullableIntArray.kt | 15 + .../controlStructures/forPrimitiveIntArray.kt | 14 + .../blackbox/controlStructures/forUserType.kt | 117 +++++++ .../inRangeConditionsInWhen.kt | 8 + .../blackbox/controlStructures/kt12908.kt | 20 ++ .../blackbox/controlStructures/kt12908_2.kt | 20 ++ .../blackbox/controlStructures/kt1441.kt | 16 + .../blackbox/controlStructures/kt14839.kt | 10 + .../blackbox/controlStructures/kt1688.kt | 10 + .../blackbox/controlStructures/kt1742.kt | 7 + .../blackbox/controlStructures/kt1899.kt | 5 + .../blackbox/controlStructures/kt2147.kt | 9 + .../blackbox/controlStructures/kt2259.kt | 10 + .../blackbox/controlStructures/kt2291.kt | 6 + .../blackbox/controlStructures/kt237.kt | 44 +++ .../blackbox/controlStructures/kt2416.kt | 16 + .../blackbox/controlStructures/kt2423.kt | 53 +++ .../blackbox/controlStructures/kt2577.kt | 12 + .../blackbox/controlStructures/kt2597.kt | 10 + .../blackbox/controlStructures/kt299.kt | 21 ++ .../blackbox/controlStructures/kt3087.kt | 26 ++ .../blackbox/controlStructures/kt3203_1.kt | 19 + .../blackbox/controlStructures/kt3203_2.kt | 20 ++ .../blackbox/controlStructures/kt3273.kt | 21 ++ .../blackbox/controlStructures/kt3280.kt | 24 ++ .../blackbox/controlStructures/kt3574.kt | 12 + .../blackbox/controlStructures/kt416.kt | 4 + .../blackbox/controlStructures/kt513.kt | 24 ++ .../blackbox/controlStructures/kt628.kt | 48 +++ .../blackbox/controlStructures/kt769.kt | 14 + .../blackbox/controlStructures/kt772.kt | 25 ++ .../blackbox/controlStructures/kt773.kt | 25 ++ .../blackbox/controlStructures/kt8148.kt | 32 ++ .../controlStructures/kt8148_break.kt | 36 ++ .../controlStructures/kt8148_continue.kt | 37 ++ .../blackbox/controlStructures/kt870.kt | 5 + .../controlStructures/kt9022Return.kt | 29 ++ .../blackbox/controlStructures/kt9022Throw.kt | 12 + .../blackbox/controlStructures/kt910.kt | 21 ++ .../blackbox/controlStructures/kt958.kt | 3 + .../blackbox/controlStructures/longRange.kt | 8 + .../blackbox/controlStructures/quicksort.kt | 41 +++ .../returnsNothing/ifElse.kt | 14 + .../returnsNothing/inlineMethod.kt | 12 + .../returnsNothing/propertyGetter.kt | 16 + .../returnsNothing/tryCatch.kt | 12 + .../controlStructures/returnsNothing/when.kt | 14 + .../controlStructures/tryCatchFinallyChain.kt | 19 + .../tryCatchInExpressions/catch.kt | 2 + .../tryCatchInExpressions/complexChain.kt | 52 +++ .../tryCatchInExpressions/deadTryCatch.kt | 26 ++ .../tryCatchInExpressions/differentTypes.kt | 11 + .../tryCatchInExpressions/expectException.kt | 35 ++ .../tryCatchInExpressions/finally.kt | 2 + .../tryCatchInExpressions/inlineTryCatch.kt | 17 + .../tryCatchInExpressions/inlineTryExpr.kt | 14 + .../tryCatchInExpressions/inlineTryFinally.kt | 22 ++ .../tryCatchInExpressions/kt8608.kt | 30 ++ .../tryCatchInExpressions/kt9644try.kt | 21 ++ .../multipleCatchBlocks.kt | 20 ++ .../tryCatchInExpressions/splitTry.kt | 25 ++ .../tryCatchInExpressions/splitTryCorner1.kt | 11 + .../tryCatchInExpressions/splitTryCorner2.kt | 22 ++ .../tryCatchInExpressions/try.kt | 2 + .../tryCatchInExpressions/tryAfterTry.kt | 4 + .../tryCatchInExpressions/tryAndBreak.kt | 19 + .../tryCatchInExpressions/tryAndContinue.kt | 17 + .../tryCatchInExpressions/tryInsideCatch.kt | 8 + .../tryCatchInExpressions/tryInsideTry.kt | 10 + .../unmatchedInlineMarkers.kt | 17 + .../blackbox/coroutines/asyncIterator.kt | 121 +++++++ .../codegen/blackbox/coroutines/await.kt | 115 ++++++ .../blackbox/coroutines/beginWithException.kt | 36 ++ .../beginWithExceptionNoHandleException.kt | 32 ++ .../blackbox/coroutines/coercionToUnit.kt | 47 +++ .../coroutines/controlFlow/breakFinally.kt | 55 +++ .../coroutines/controlFlow/breakStatement.kt | 51 +++ .../controlFlow/doWhileStatement.kt | 42 +++ .../coroutines/controlFlow/forContinue.kt | 32 ++ .../coroutines/controlFlow/forStatement.kt | 31 ++ .../coroutines/controlFlow/ifStatement.kt | 76 ++++ .../controlFlow/returnFromFinally.kt | 46 +++ .../coroutines/controlFlow/switchLikeWhen.kt | 35 ++ .../coroutines/controlFlow/throwFromCatch.kt | 59 ++++ .../controlFlow/throwInTryWithHandleResult.kt | 43 +++ .../coroutines/controlFlow/whileStatement.kt | 42 +++ .../controllerAccessFromInnerLambda.kt | 42 +++ .../coroutines/defaultParametersInSuspend.kt | 46 +++ .../blackbox/coroutines/dispatchResume.kt | 69 ++++ .../blackbox/coroutines/emptyClosure.kt | 31 ++ .../blackbox/coroutines/falseUnitCoercion.kt | 29 ++ .../codegen/blackbox/coroutines/generate.kt | 59 ++++ .../blackbox/coroutines/handleException.kt | 80 +++++ .../coroutines/handleResultCallEmptyBody.kt | 19 + .../handleResultNonUnitExpression.kt | 29 ++ .../coroutines/handleResultSuspended.kt | 29 ++ .../blackbox/coroutines/illegalState.kt | 63 ++++ .../coroutines/inlineSuspendFunction.kt | 44 +++ .../coroutines/inlinedTryCatchFinally.kt | 160 +++++++++ .../coroutines/innerSuspensionCalls.kt | 40 +++ .../coroutines/instanceOfContinuation.kt | 34 ++ .../intLikeVarSpilling/complicatedMerge.kt | 34 ++ .../intLikeVarSpilling/i2bResult.kt | 33 ++ .../loadFromBooleanArray.kt | 32 ++ .../intLikeVarSpilling/loadFromByteArray.kt | 32 ++ .../intLikeVarSpilling/noVariableInTable.kt | 32 ++ .../intLikeVarSpilling/sameIconst1ManyVars.kt | 35 ++ .../intLikeVarSpilling/usedInArrayStore.kt | 79 +++++ .../intLikeVarSpilling/usedInMethodCall.kt | 82 +++++ .../intLikeVarSpilling/usedInPutfield.kt | 69 ++++ .../intLikeVarSpilling/usedInVarStore.kt | 58 +++ .../blackbox/coroutines/iterateOverArray.kt | 34 ++ .../codegen/blackbox/coroutines/kt12958.kt | 37 ++ .../coroutines/lastExpressionIsLoop.kt | 54 +++ .../blackbox/coroutines/lastStatementInc.kt | 43 +++ .../coroutines/lastStementAssignment.kt | 45 +++ .../blackbox/coroutines/lastUnitExpression.kt | 29 ++ .../inlineFunctionWithOptionalParam.kt | 30 ++ .../blackbox/coroutines/multiModule/simple.kt | 33 ++ .../coroutines/multipleInvokeCalls.kt | 101 ++++++ .../multipleInvokeCallsInsideInlineLambda1.kt | 90 +++++ .../multipleInvokeCallsInsideInlineLambda2.kt | 92 +++++ .../multipleInvokeCallsInsideInlineLambda3.kt | 90 +++++ .../blackbox/coroutines/nestedTryCatch.kt | 114 ++++++ .../blackbox/coroutines/noSuspensionPoints.kt | 26 ++ .../nonLocalReturnFromInlineLambda.kt | 46 +++ .../nonLocalReturnFromInlineLambdaDeep.kt | 51 +++ .../blackbox/coroutines/returnByLabel.kt | 30 ++ .../codegen/blackbox/coroutines/simple.kt | 22 ++ .../blackbox/coroutines/simpleException.kt | 29 ++ .../coroutines/simpleWithHandleResult.kt | 39 +++ .../coroutines/stackUnwinding/exception.kt | 21 ++ .../stackUnwinding/inlineSuspendFunction.kt | 37 ++ .../coroutines/stackUnwinding/simple.kt | 21 ++ .../stackUnwinding/suspendInCycle.kt | 48 +++ .../coroutines/statementLikeLastExpression.kt | 30 ++ .../blackbox/coroutines/suspendDelegation.kt | 26 ++ .../coroutines/suspendFromInlineLambda.kt | 36 ++ .../suspendFunctionTypeCall/manyParameters.kt | 30 ++ .../suspendFunctionTypeCall/simple.kt | 36 ++ .../blackbox/coroutines/suspendInCycle.kt | 40 +++ .../suspendInTheMiddleOfObjectConstruction.kt | 98 ++++++ .../tryCatchFinallyWithHandleResult.kt | 177 ++++++++++ .../coroutines/tryCatchWithHandleResult.kt | 151 ++++++++ .../tryFinallyInsideInlineLambda.kt | 34 ++ .../coroutines/tryFinallyWithHandleResult.kt | 98 ++++++ .../unitTypeReturn/coroutineNonLocalReturn.kt | 46 +++ .../unitTypeReturn/coroutineReturn.kt | 42 +++ .../unitTypeReturn/suspendNonLocalReturn.kt | 34 ++ .../unitTypeReturn/suspendReturn.kt | 27 ++ .../coroutines/varValueConflictsWithTable.kt | 41 +++ .../varValueConflictsWithTableSameSort.kt | 41 +++ .../blackbox/dataClasses/arrayParams.kt | 10 + .../blackbox/dataClasses/changingVarParam.kt | 8 + .../copy/constructorWithDefaultParam.kt | 29 ++ .../copy/copyInObjectNestedDataClass.kt | 17 + .../blackbox/dataClasses/copy/kt12708.kt | 13 + .../blackbox/dataClasses/copy/kt3033.kt | 10 + .../copy/valInConstructorParams.kt | 29 ++ .../copy/varInConstructorParams.kt | 29 ++ .../dataClasses/copy/withGenericParameter.kt | 14 + .../blackbox/dataClasses/doubleParam.kt | 31 ++ .../dataClasses/equals/alreadyDeclared.kt | 8 + .../equals/alreadyDeclaredWrongSignature.kt | 37 ++ .../dataClasses/equals/genericarray.kt | 8 + .../blackbox/dataClasses/equals/intarray.kt | 8 + .../blackbox/dataClasses/equals/nullother.kt | 11 + .../dataClasses/equals/sameinstance.kt | 7 + .../blackbox/dataClasses/floatParam.kt | 31 ++ .../blackbox/dataClasses/genericParam.kt | 12 + .../dataClasses/hashCode/alreadyDeclared.kt | 7 + .../hashCode/alreadyDeclaredWrongSignature.kt | 22 ++ .../blackbox/dataClasses/hashCode/array.kt | 9 + .../blackbox/dataClasses/hashCode/boolean.kt | 5 + .../blackbox/dataClasses/hashCode/byte.kt | 7 + .../blackbox/dataClasses/hashCode/char.kt | 7 + .../blackbox/dataClasses/hashCode/double.kt | 7 + .../blackbox/dataClasses/hashCode/float.kt | 7 + .../dataClasses/hashCode/genericNull.kt | 7 + .../blackbox/dataClasses/hashCode/int.kt | 7 + .../blackbox/dataClasses/hashCode/long.kt | 7 + .../blackbox/dataClasses/hashCode/null.kt | 16 + .../blackbox/dataClasses/hashCode/short.kt | 7 + .../codegen/blackbox/dataClasses/kt5002.kt | 18 + .../blackbox/dataClasses/mixedParams.kt | 8 + .../blackbox/dataClasses/multiDeclaration.kt | 7 + .../dataClasses/multiDeclarationFor.kt | 17 + .../nonTrivialFinalMemberInSuperClass.kt | 17 + .../nonTrivialMemberInSuperClass.kt | 19 + .../blackbox/dataClasses/privateValParams.kt | 13 + .../dataClasses/toString/alreadyDeclared.kt | 7 + .../toString/alreadyDeclaredWrongSignature.kt | 22 ++ .../dataClasses/toString/arrayParams.kt | 17 + .../dataClasses/toString/changingVarParam.kt | 11 + .../dataClasses/toString/genericParam.kt | 11 + .../dataClasses/toString/mixedParams.kt | 7 + .../dataClasses/toString/unitComponent.kt | 6 + .../blackbox/dataClasses/twoValParams.kt | 6 + .../blackbox/dataClasses/twoVarParams.kt | 9 + .../blackbox/dataClasses/unitComponent.kt | 6 + .../deadCodeElimination/emptyVariableRange.kt | 14 + .../intersectingVariableRange.kt | 13 + .../intersectingVariableRangeInFinally.kt | 12 + .../blackbox/deadCodeElimination/kt14357.kt | 10 + .../constructor/annotation.kt | 11 + .../checkIfConstructorIsSynthetic.kt | 11 + .../defaultArguments/constructor/defArgs1.kt | 8 + .../constructor/defArgs1InnerClass.kt | 14 + .../defaultArguments/constructor/defArgs2.kt | 13 + .../constructor/doubleDefArgs1InnerClass.kt | 14 + .../defaultArguments/constructor/enum.kt | 11 + .../constructor/enumWithOneDefArg.kt | 10 + .../constructor/enumWithTwoDefArgs.kt | 14 + .../constructor/enumWithTwoDoubleDefArgs.kt | 14 + .../defaultArguments/constructor/kt2852.kt | 7 + .../defaultArguments/constructor/kt3060.kt | 10 + .../defaultArguments/constructor/manyArgs.kt | 216 ++++++++++++ .../convention/incWithDefaultInGetter.kt | 26 ++ .../defaultArguments/convention/kt9140.kt | 11 + .../plusAssignWithDefaultInGetter.kt | 31 ++ .../function/abstractClass.kt | 16 + .../function/covariantOverride.kt | 10 + .../function/covariantOverrideGeneric.kt | 10 + .../function/extensionFunctionManyArgs.kt | 205 +++++++++++ .../function/extentionFunction.kt | 9 + .../function/extentionFunctionDouble.kt | 9 + .../extentionFunctionDoubleTwoArgs.kt | 11 + .../extentionFunctionInClassObject.kt | 17 + .../function/extentionFunctionInObject.kt | 15 + .../extentionFunctionWithOneDefArg.kt | 9 + .../defaultArguments/function/funInTrait.kt | 14 + .../function/innerExtentionFunction.kt | 15 + .../function/innerExtentionFunctionDouble.kt | 15 + .../innerExtentionFunctionDoubleTwoArgs.kt | 17 + .../innerExtentionFunctionManyArgs.kt | 211 +++++++++++ .../defaultArguments/function/kt5232.kt | 14 + .../function/memberFunctionManyArgs.kt | 208 +++++++++++ .../function/mixingNamedAndPositioned.kt | 16 + .../function/topLevelManyArgs.kt | 205 +++++++++++ .../defaultArguments/function/trait.kt | 14 + .../blackbox/defaultArguments/kt6382.kt | 16 + .../private/memberExtensionFunction.kt | 9 + .../private/memberFunction.kt | 11 + .../private/primaryConstructor.kt | 16 + .../private/secondaryConstructor.kt | 16 + .../blackbox/defaultArguments/protected.kt | 23 ++ .../defaultArguments/signature/kt2789.kt | 23 ++ .../defaultArguments/signature/kt9428.kt | 23 ++ .../defaultArguments/signature/kt9924.kt | 13 + .../defaultArguments/simpleFromOtherFile.kt | 7 + .../defaultArguments/superCallCheck.kt | 30 ++ ...accessTopLevelDelegatedPropertyInClinit.kt | 15 + .../capturePropertyInClosure.kt | 23 ++ .../delegatedProperty/castGetReturnType.kt | 13 + .../delegatedProperty/castSetParameter.kt | 26 ++ .../delegatedProperty/delegateAsInnerClass.kt | 19 + .../delegateByOtherProperty.kt | 20 ++ .../delegateByTopLevelFun.kt | 21 ++ .../delegateByTopLevelProperty.kt | 21 ++ .../delegateForExtProperty.kt | 14 + .../delegateForExtPropertyInClass.kt | 20 ++ .../delegateWithPrivateSet.kt | 13 + .../extensionDelegatesWithSameNames.kt | 14 + .../extensionPropertyAndExtensionGetValue.kt | 13 + .../delegatedProperty/genericDelegate.kt | 20 ++ .../delegatedProperty/getAsExtensionFun.kt | 14 + .../getAsExtensionFunInClass.kt | 13 + .../blackbox/delegatedProperty/inClassVal.kt | 13 + .../blackbox/delegatedProperty/inClassVar.kt | 19 + .../blackbox/delegatedProperty/inTrait.kt | 17 + .../delegatedProperty/inferredPropertyType.kt | 20 ++ .../blackbox/delegatedProperty/kt4138.kt | 37 ++ .../blackbox/delegatedProperty/kt6722.kt | 14 + .../blackbox/delegatedProperty/kt9712.kt | 24 ++ .../local/capturedLocalVal.kt | 14 + .../local/capturedLocalValNoInline.kt | 14 + .../local/capturedLocalVar.kt | 20 ++ .../local/capturedLocalVarNoInline.kt | 20 ++ .../delegatedProperty/local/inlineGetValue.kt | 12 + .../local/inlineOperators.kt | 19 + .../delegatedProperty/local/kt12891.kt | 5 + .../delegatedProperty/local/kt13557.kt | 14 + .../delegatedProperty/local/localVal.kt | 12 + .../local/localValNoExplicitType.kt | 12 + .../delegatedProperty/local/localVar.kt | 19 + .../local/localVarNoExplicitType.kt | 19 + .../privateSetterKPropertyIsNotMutable.kt | 37 ++ .../blackbox/delegatedProperty/privateVar.kt | 22 ++ .../propertyMetadataShouldBeCached.kt | 50 +++ .../protectedVarWithPrivateSet.kt | 16 + .../provideDelegate/differentReceivers.kt | 27 ++ .../provideDelegate/evaluationOrder.kt | 25 ++ .../provideDelegate/evaluationOrderVar.kt | 38 ++ .../provideDelegate/extensionDelegated.kt | 16 + .../provideDelegate/generic.kt | 31 ++ .../provideDelegate/hostCheck.kt | 14 + .../provideDelegate/inClass.kt | 29 ++ .../provideDelegate/inlineProvideDelegate.kt | 25 ++ .../provideDelegate/jvmStaticInObject.kt | 31 ++ .../provideDelegate/kt15437.kt | 12 + .../provideDelegate/local.kt | 25 ++ .../provideDelegate/localCaptured.kt | 25 ++ .../localDifferentReceivers.kt | 33 ++ .../provideDelegate/memberExtension.kt | 15 + .../provideDelegate/propertyMetadata.kt | 26 ++ .../delegatedProperty/setAsExtensionFun.kt | 20 ++ .../setAsExtensionFunInClass.kt | 20 ++ .../stackOverflowOnCallFromGetValue.kt | 57 +++ .../blackbox/delegatedProperty/topLevelVal.kt | 11 + .../blackbox/delegatedProperty/topLevelVar.kt | 16 + .../delegatedProperty/twoPropByOneDelegete.kt | 22 ++ .../delegatedProperty/useKPropertyLater.kt | 45 +++ .../useReflectionOnKProperty.kt | 19 + .../delegatedProperty/valInInnerClass.kt | 15 + .../delegatedProperty/varInInnerClass.kt | 21 ++ .../blackbox/delegation/delegationToVal.kt | 49 +++ .../codegen/blackbox/delegation/kt8154.kt | 19 + .../extensionComponents.kt | 21 ++ .../destructuringDeclInLambdaParam/generic.kt | 11 + .../destructuringDeclInLambdaParam/inline.kt | 5 + .../otherParameters.kt | 11 + .../destructuringDeclInLambdaParam/simple.kt | 5 + .../stdlibUsages.kt | 16 + .../underscoreNames.kt | 9 + .../withIndexed.kt | 13 + .../diagnostics/functions/inference/kt6176.kt | 25 ++ .../functions/inference/kt6176.txt | 6 + .../invoke/onObjects/invokeOnClassObject1.kt | 8 + .../invoke/onObjects/invokeOnClassObject1.txt | 18 + .../invoke/onObjects/invokeOnClassObject2.kt | 11 + .../invoke/onObjects/invokeOnClassObject2.txt | 24 ++ .../invokeOnClassObjectOfNestedClass1.kt | 9 + .../invokeOnClassObjectOfNestedClass1.txt | 25 ++ .../invokeOnClassObjectOfNestedClass2.kt | 11 + .../invokeOnClassObjectOfNestedClass2.txt | 25 ++ .../invoke/onObjects/invokeOnEnum1.kt | 8 + .../invoke/onObjects/invokeOnEnum1.txt | 25 ++ .../invoke/onObjects/invokeOnEnum2.kt | 8 + .../invoke/onObjects/invokeOnEnum2.txt | 25 ++ .../invoke/onObjects/invokeOnImportedEnum1.kt | 10 + .../onObjects/invokeOnImportedEnum1.txt | 25 ++ .../invoke/onObjects/invokeOnImportedEnum2.kt | 10 + .../onObjects/invokeOnImportedEnum2.txt | 25 ++ .../invoke/onObjects/invokeOnObject1.kt | 5 + .../invoke/onObjects/invokeOnObject1.txt | 11 + .../invoke/onObjects/invokeOnObject2.kt | 5 + .../invoke/onObjects/invokeOnObject2.txt | 11 + .../functions/tailRecursion/defaultArgs.kt | 15 + .../functions/tailRecursion/defaultArgs.txt | 4 + .../tailRecursion/defaultArgsOverridden.kt | 14 + .../tailRecursion/defaultArgsOverridden.txt | 19 + .../tailRecursion/extensionTailCall.kt | 13 + .../tailRecursion/extensionTailCall.txt | 4 + .../tailRecursion/functionWithNoTails.kt | 11 + .../tailRecursion/functionWithNoTails.txt | 4 + .../functionWithNonTailRecursions.kt | 20 ++ .../functionWithNonTailRecursions.txt | 4 + .../functionWithoutAnnotation.kt | 14 + .../functionWithoutAnnotation.txt | 4 + .../functions/tailRecursion/infixCall.kt | 10 + .../functions/tailRecursion/infixCall.txt | 4 + .../tailRecursion/infixRecursiveCall.kt | 14 + .../tailRecursion/infixRecursiveCall.txt | 4 + .../functions/tailRecursion/insideElvis.kt | 13 + .../functions/tailRecursion/insideElvis.txt | 4 + .../tailRecursion/labeledThisReferences.kt | 30 ++ .../tailRecursion/labeledThisReferences.txt | 21 ++ .../functions/tailRecursion/loops.kt | 17 + .../functions/tailRecursion/loops.txt | 4 + .../tailRecursion/multilevelBlocks.kt | 18 + .../tailRecursion/multilevelBlocks.txt | 4 + .../tailRecursion/realIteratorFoldl.kt | 14 + .../tailRecursion/realIteratorFoldl.txt | 4 + .../tailRecursion/realStringEscape.kt | 17 + .../tailRecursion/realStringEscape.txt | 5 + .../tailRecursion/realStringRepeat.kt | 10 + .../tailRecursion/realStringRepeat.txt | 4 + .../tailRecursion/recursiveCallInLambda.kt | 17 + .../tailRecursion/recursiveCallInLambda.txt | 5 + .../recursiveCallInLocalFunction.kt | 13 + .../recursiveCallInLocalFunction.txt | 4 + .../tailRecursion/recursiveInnerFunction.kt | 13 + .../tailRecursion/recursiveInnerFunction.txt | 4 + .../functions/tailRecursion/returnIf.kt | 15 + .../functions/tailRecursion/returnIf.txt | 4 + .../functions/tailRecursion/returnInCatch.kt | 14 + .../functions/tailRecursion/returnInCatch.txt | 4 + .../tailRecursion/returnInFinally.kt | 14 + .../tailRecursion/returnInFinally.txt | 4 + .../tailRecursion/returnInIfInFinally.kt | 18 + .../tailRecursion/returnInIfInFinally.txt | 4 + .../tailRecursion/returnInParentheses.kt | 11 + .../tailRecursion/returnInParentheses.txt | 4 + .../functions/tailRecursion/returnInTry.kt | 14 + .../functions/tailRecursion/returnInTry.txt | 4 + .../functions/tailRecursion/simpleBlock.kt | 14 + .../functions/tailRecursion/simpleBlock.txt | 4 + .../functions/tailRecursion/simpleReturn.kt | 14 + .../functions/tailRecursion/simpleReturn.txt | 4 + .../tailRecursion/simpleReturnWithElse.kt | 15 + .../tailRecursion/simpleReturnWithElse.txt | 4 + .../functions/tailRecursion/sum.kt | 13 + .../functions/tailRecursion/sum.txt | 4 + .../tailCallInBlockInParentheses.kt | 13 + .../tailCallInBlockInParentheses.txt | 4 + .../tailRecursion/tailCallInParentheses.kt | 11 + .../tailRecursion/tailCallInParentheses.txt | 4 + .../tailRecursion/tailRecursionInFinally.kt | 18 + .../tailRecursion/tailRecursionInFinally.txt | 4 + .../functions/tailRecursion/thisReferences.kt | 26 ++ .../tailRecursion/thisReferences.txt | 13 + .../functions/tailRecursion/unitBlocks.kt | 24 ++ .../functions/tailRecursion/unitBlocks.txt | 4 + .../tailRecursion/whenWithCondition.kt | 11 + .../tailRecursion/whenWithCondition.txt | 4 + .../tailRecursion/whenWithInRange.kt | 16 + .../tailRecursion/whenWithInRange.txt | 4 + .../functions/tailRecursion/whenWithIs.kt | 17 + .../functions/tailRecursion/whenWithIs.txt | 4 + .../tailRecursion/whenWithoutCondition.kt | 12 + .../tailRecursion/whenWithoutCondition.txt | 4 + .../blackbox/diagnostics/vararg/kt4172.kt | 15 + .../blackbox/diagnostics/vararg/kt4172.txt | 13 + .../codegen/blackbox/elvis/genericNull.kt | 8 + .../elvis/kt6694ExactAnnotationForElvis.kt | 19 + .../codegen/blackbox/elvis/nullNullOk.kt | 1 + .../codegen/blackbox/elvis/primitive.kt | 6 + .../blackbox/enum/abstractMethodInEnum.kt | 9 + .../blackbox/enum/abstractNestedClass.kt | 10 + .../blackbox/enum/asReturnExpression.kt | 14 + .../blackbox/enum/classForEnumEntry.kt | 35 ++ .../blackbox/enum/companionObjectInEnum.kt | 22 ++ .../codegen/blackbox/enum/emptyConstructor.kt | 11 + .../blackbox/enum/emptyEnumValuesValueOf.kt | 13 + .../blackbox/enum/enumInheritedFromTrait.kt | 16 + .../codegen/blackbox/enum/enumShort.kt | 11 + .../blackbox/enum/enumWithLambdaParameter.kt | 19 + .../codegen/blackbox/enum/inPackage.kt | 14 + .../codegen/blackbox/enum/inclassobj.kt | 15 + .../external/codegen/blackbox/enum/inner.kt | 7 + .../enum/innerWithExistingClassObject.kt | 8 + .../external/codegen/blackbox/enum/kt1119.kt | 12 + .../external/codegen/blackbox/enum/kt2350.kt | 7 + .../external/codegen/blackbox/enum/kt9711.kt | 13 + .../codegen/blackbox/enum/kt9711_2.kt | 21 ++ .../codegen/blackbox/enum/modifierFlags.kt | 30 ++ .../blackbox/enum/noClassForSimpleEnum.kt | 17 + .../codegen/blackbox/enum/objectInEnum.kt | 20 ++ .../external/codegen/blackbox/enum/ordinal.kt | 8 + .../external/codegen/blackbox/enum/simple.kt | 12 + .../codegen/blackbox/enum/sortEnumEntries.kt | 18 + .../blackbox/enum/superCallInEnumLiteral.kt | 18 + .../codegen/blackbox/enum/toString.kt | 6 + .../external/codegen/blackbox/enum/valueof.kt | 22 ++ .../codegen/blackbox/evaluate/char.kt | 17 + .../codegen/blackbox/evaluate/divide.kt | 25 ++ .../codegen/blackbox/evaluate/intrinsics.kt | 34 ++ .../codegen/blackbox/evaluate/kt9443.kt | 20 ++ .../codegen/blackbox/evaluate/maxValue.kt | 34 ++ .../codegen/blackbox/evaluate/maxValueByte.kt | 28 ++ .../codegen/blackbox/evaluate/maxValueInt.kt | 28 ++ .../codegen/blackbox/evaluate/minus.kt | 34 ++ .../external/codegen/blackbox/evaluate/mod.kt | 34 ++ .../codegen/blackbox/evaluate/multiply.kt | 34 ++ .../blackbox/evaluate/parenthesized.kt | 34 ++ .../codegen/blackbox/evaluate/plus.kt | 34 ++ .../blackbox/evaluate/simpleCallBinary.kt | 31 ++ .../codegen/blackbox/evaluate/unaryMinus.kt | 34 ++ .../codegen/blackbox/evaluate/unaryPlus.kt | 34 ++ .../codegen/blackbox/exclExcl/genericNull.kt | 12 + .../codegen/blackbox/exclExcl/primitive.kt | 5 + .../extensionFunctions/executionOrder.kt | 19 + .../blackbox/extensionFunctions/kt1061.kt | 7 + .../blackbox/extensionFunctions/kt1249.kt | 12 + .../blackbox/extensionFunctions/kt1290.kt | 14 + .../blackbox/extensionFunctions/kt1776.kt | 20 ++ .../blackbox/extensionFunctions/kt1953.kt | 9 + .../extensionFunctions/kt1953_class.kt | 14 + .../blackbox/extensionFunctions/kt3285.kt | 32 ++ .../blackbox/extensionFunctions/kt3298.kt | 13 + .../blackbox/extensionFunctions/kt3646.kt | 14 + .../blackbox/extensionFunctions/kt3969.kt | 19 + .../blackbox/extensionFunctions/kt4228.kt | 14 + .../blackbox/extensionFunctions/kt475.kt | 17 + .../blackbox/extensionFunctions/kt5467.kt | 20 ++ .../blackbox/extensionFunctions/kt606.kt | 34 ++ .../blackbox/extensionFunctions/kt865.kt | 17 + .../blackbox/extensionFunctions/nested2.kt | 8 + .../blackbox/extensionFunctions/shared.kt | 13 + .../blackbox/extensionFunctions/simple.kt | 5 + .../thisMethodInObjectLiteral.kt | 15 + .../blackbox/extensionFunctions/virtual.kt | 24 ++ .../blackbox/extensionFunctions/whenFail.kt | 27 ++ .../accessorForPrivateSetter.kt | 21 ++ .../genericValForPrimitiveType.kt | 39 +++ .../genericValMultipleUpperBounds.kt | 13 + .../genericVarForPrimitiveType.kt | 40 +++ .../blackbox/extensionProperties/inClass.kt | 12 + .../inClassLongTypeInReceiver.kt | 28 ++ .../extensionProperties/inClassWithGetter.kt | 14 + .../inClassWithPrivateGetter.kt | 14 + .../inClassWithPrivateSetter.kt | 19 + .../extensionProperties/inClassWithSetter.kt | 19 + .../blackbox/extensionProperties/kt9897.kt | 41 +++ .../extensionProperties/kt9897_topLevel.kt | 38 ++ .../blackbox/extensionProperties/topLevel.kt | 6 + .../topLevelLongTypeInReceiver.kt | 22 ++ .../blackbox/external/jvmStaticExternal.kt | 37 ++ .../external/jvmStaticExternalPrivate.kt | 27 ++ .../blackbox/external/withDefaultArg.kt | 44 +++ .../blackbox/fakeOverride/diamondFunction.kt | 31 ++ .../codegen/blackbox/fakeOverride/function.kt | 35 ++ .../blackbox/fakeOverride/propertyGetter.kt | 37 ++ .../blackbox/fakeOverride/propertySetter.kt | 18 + .../fieldRename/constructorAndClassObject.kt | 16 + .../codegen/blackbox/fieldRename/delegates.kt | 28 ++ .../fieldRename/genericPropertyWithItself.kt | 14 + .../blackbox/finally/finallyAndFinally.kt | 39 +++ .../codegen/blackbox/finally/kt3549.kt | 41 +++ .../codegen/blackbox/finally/kt3706.kt | 16 + .../codegen/blackbox/finally/kt3867.kt | 46 +++ .../codegen/blackbox/finally/kt3874.kt | 35 ++ .../codegen/blackbox/finally/kt3894.kt | 36 ++ .../codegen/blackbox/finally/kt4134.kt | 15 + .../blackbox/finally/loopAndFinally.kt | 69 ++++ .../codegen/blackbox/finally/notChainCatch.kt | 98 ++++++ .../codegen/blackbox/finally/tryFinally.kt | 45 +++ .../codegen/blackbox/finally/tryLoopTry.kt | 36 ++ .../codegen/blackbox/fullJdk/charBuffer.kt | 13 + .../codegen/blackbox/fullJdk/classpath.kt | 18 + .../codegen/blackbox/fullJdk/ifInWhile.kt | 15 + .../fullJdk/intCountDownLatchExtension.kt | 25 ++ .../codegen/blackbox/fullJdk/kt434.kt | 17 + .../fullJdk/native/nativePropertyAccessors.kt | 54 +++ .../blackbox/fullJdk/native/simpleNative.kt | 20 ++ .../blackbox/fullJdk/native/topLevel.kt | 22 ++ .../platformTypeAssertionStackTrace.kt | 24 ++ .../blackbox/fullJdk/regressions/kt1770.kt | 22 ++ .../blackbox/functions/coerceVoidToArray.kt | 16 + .../blackbox/functions/coerceVoidToObject.kt | 16 + .../blackbox/functions/dataLocalVariable.kt | 8 + .../codegen/blackbox/functions/defaultargs.kt | 12 + .../blackbox/functions/defaultargs1.kt | 10 + .../blackbox/functions/defaultargs2.kt | 34 ++ .../blackbox/functions/defaultargs3.kt | 15 + .../blackbox/functions/defaultargs4.kt | 19 + .../blackbox/functions/defaultargs5.kt | 13 + .../blackbox/functions/defaultargs6.kt | 7 + .../blackbox/functions/defaultargs7.kt | 5 + .../codegen/blackbox/functions/ea33909.kt | 7 + .../fakeDescriptorWithSeveralOverridenOne.kt | 23 ++ .../functionExpression/functionExpression.kt | 32 ++ .../functionExpressionWithThisReference.kt | 34 ++ .../functionLiteralExpression.kt | 27 ++ .../underscoreParameters.kt | 3 + .../blackbox/functions/functionNtoString.kt | 38 ++ .../functions/functionNtoStringGeneric.kt | 26 ++ .../functions/functionNtoStringNoReflect.kt | 36 ++ .../blackbox/functions/infixRecursiveCall.kt | 8 + .../invoke/castFunctionToExtension.kt | 14 + .../functions/invoke/extensionInvokeOnExpr.kt | 21 ++ ...InCompanionObjectWithFunctionalArgument.kt | 14 + ...plicitInvokeWithFunctionLiteralArgument.kt | 10 + .../blackbox/functions/invoke/invoke.kt | 28 ++ .../invoke/invokeOnExprByConvention.kt | 20 ++ .../invoke/invokeOnSyntheticProperty.kt | 20 ++ .../blackbox/functions/invoke/kt3189.kt | 15 + .../blackbox/functions/invoke/kt3190.kt | 26 ++ .../blackbox/functions/invoke/kt3297.kt | 17 + .../functions/invoke/kt3450getAndInvoke.kt | 13 + .../functions/invoke/kt3631invokeOnString.kt | 5 + .../blackbox/functions/invoke/kt3772.kt | 21 ++ .../functions/invoke/kt3821invokeOnThis.kt | 8 + .../functions/invoke/kt3822invokeOnThis.kt | 11 + .../codegen/blackbox/functions/kt1038.kt | 64 ++++ .../codegen/blackbox/functions/kt1199.kt | 30 ++ .../codegen/blackbox/functions/kt1413.kt | 26 ++ .../codegen/blackbox/functions/kt1649_1.kt | 18 + .../codegen/blackbox/functions/kt1649_2.kt | 18 + .../codegen/blackbox/functions/kt1739.kt | 14 + .../codegen/blackbox/functions/kt2270.kt | 6 + .../codegen/blackbox/functions/kt2271.kt | 3 + .../codegen/blackbox/functions/kt2280.kt | 7 + .../codegen/blackbox/functions/kt2481.kt | 14 + .../codegen/blackbox/functions/kt2716.kt | 11 + .../codegen/blackbox/functions/kt2739.kt | 10 + .../codegen/blackbox/functions/kt2929.kt | 7 + .../codegen/blackbox/functions/kt3214.kt | 33 ++ .../codegen/blackbox/functions/kt3313.kt | 7 + .../codegen/blackbox/functions/kt3573.kt | 12 + .../codegen/blackbox/functions/kt3724.kt | 24 ++ .../codegen/blackbox/functions/kt395.kt | 12 + .../codegen/blackbox/functions/kt785.kt | 13 + .../codegen/blackbox/functions/kt873.kt | 11 + .../blackbox/functions/localFunction.kt | 46 +++ .../localFunctions/callInlineLocalInLambda.kt | 15 + .../localFunctions/definedWithinLambda.kt | 16 + .../definedWithinLambdaInnerUsage1.kt | 16 + .../definedWithinLambdaInnerUsage2.kt | 17 + .../functions/localFunctions/kt2895.kt | 15 + .../functions/localFunctions/kt3308.kt | 5 + .../functions/localFunctions/kt3978.kt | 10 + .../functions/localFunctions/kt4119.kt | 12 + .../functions/localFunctions/kt4119_2.kt | 19 + .../functions/localFunctions/kt4514.kt | 9 + .../functions/localFunctions/kt4777.kt | 17 + .../functions/localFunctions/kt4783.kt | 18 + .../functions/localFunctions/kt4784.kt | 20 ++ .../functions/localFunctions/kt4989.kt | 31 ++ .../localExtensionOnNullableParameter.kt | 21 ++ .../localFunctionInConstructor.kt | 15 + .../localReturnInsideFunctionExpression.kt | 10 + .../blackbox/functions/nothisnoclosure.kt | 16 + .../blackbox/functions/prefixRecursiveCall.kt | 8 + .../blackbox/functions/recursiveCompareTo.kt | 11 + .../functions/recursiveIncrementCall.kt | 12 + .../codegen/blackbox/hashPMap/empty.kt | 27 ++ .../codegen/blackbox/hashPMap/manyNumbers.kt | 52 +++ .../blackbox/hashPMap/rewriteWithDifferent.kt | 33 ++ .../blackbox/hashPMap/rewriteWithEqual.kt | 33 ++ .../blackbox/hashPMap/simplePlusGet.kt | 29 ++ .../blackbox/hashPMap/simplePlusMinus.kt | 28 ++ .../codegen/blackbox/ieee754/anyToReal.kt | 15 + .../blackbox/ieee754/comparableTypeCast.kt | 14 + .../codegen/blackbox/ieee754/dataClass.kt | 9 + .../codegen/blackbox/ieee754/equalsDouble.kt | 22 ++ .../codegen/blackbox/ieee754/equalsFloat.kt | 22 ++ .../blackbox/ieee754/equalsNullableDouble.kt | 30 ++ .../blackbox/ieee754/explicitCompareCall.kt | 20 ++ .../blackbox/ieee754/explicitEqualsCall.kt | 21 ++ .../codegen/blackbox/ieee754/generic.kt | 18 + .../codegen/blackbox/ieee754/greaterDouble.kt | 20 ++ .../codegen/blackbox/ieee754/greaterFloat.kt | 20 ++ .../codegen/blackbox/ieee754/inline.kt | 49 +++ .../codegen/blackbox/ieee754/lessDouble.kt | 20 ++ .../codegen/blackbox/ieee754/lessFloat.kt | 20 ++ .../blackbox/ieee754/nullableAnyToReal.kt | 15 + .../codegen/blackbox/ieee754/safeCall.kt | 14 + .../ieee754/smartCastToDifferentTypes.kt | 14 + .../external/codegen/blackbox/ieee754/when.kt | 21 ++ .../codegen/blackbox/ieee754/whenNoSubject.kt | 26 ++ .../blackbox/increment/arrayElement.kt | 69 ++++ .../increment/assignPlusOnSmartCast.kt | 8 + .../augmentedAssignmentWithComplexRhs.kt | 35 ++ .../blackbox/increment/classNaryGetSet.kt | 15 + .../blackbox/increment/classWithGetSet.kt | 117 +++++++ .../codegen/blackbox/increment/extOnLong.kt | 8 + .../increment/genericClassWithGetSet.kt | 77 ++++ .../blackbox/increment/memberExtOnLong.kt | 14 + .../blackbox/increment/mutableListElement.kt | 83 +++++ .../codegen/blackbox/increment/nullable.kt | 69 ++++ .../postfixIncrementDoubleSmartCast.kt | 10 + .../increment/postfixIncrementOnClass.kt | 12 + .../postfixIncrementOnClassSmartCast.kt | 11 + .../postfixIncrementOnShortSmartCast.kt | 8 + .../increment/postfixIncrementOnSmartCast.kt | 9 + .../postfixNullableClassIncrement.kt | 11 + .../increment/postfixNullableIncrement.kt | 10 + .../increment/prefixIncrementOnClass.kt | 12 + .../prefixIncrementOnClassSmartCast.kt | 11 + .../increment/prefixIncrementOnSmartCast.kt | 8 + .../increment/prefixNullableClassIncrement.kt | 11 + .../increment/prefixNullableIncrement.kt | 10 + .../blackbox/innerNested/createNestedClass.kt | 13 + .../innerNested/createdNestedInOuterMember.kt | 14 + .../blackbox/innerNested/extensionFun.kt | 31 ++ .../blackbox/innerNested/extensionToNested.kt | 9 + .../blackbox/innerNested/importNestedClass.kt | 18 + .../blackbox/innerNested/innerGeneric.kt | 11 + .../innerNested/innerGenericClassFromJava.kt | 26 ++ .../blackbox/innerNested/innerJavaClass.kt | 22 ++ .../blackbox/innerNested/innerLabeledThis.kt | 11 + .../blackbox/innerNested/innerSimple.kt | 7 + .../codegen/blackbox/innerNested/kt3132.kt | 13 + .../codegen/blackbox/innerNested/kt3927.kt | 23 ++ .../codegen/blackbox/innerNested/kt5363.kt | 13 + .../codegen/blackbox/innerNested/kt6804.kt | 13 + .../innerNested/nestedClassInObject.kt | 10 + .../blackbox/innerNested/nestedClassObject.kt | 12 + .../innerNested/nestedEnumConstant.kt | 8 + .../blackbox/innerNested/nestedGeneric.kt | 12 + .../blackbox/innerNested/nestedInPackage.kt | 10 + .../blackbox/innerNested/nestedObjects.kt | 9 + .../blackbox/innerNested/nestedSimple.kt | 7 + .../innerNested/protectedNestedClass.kt | 25 ++ .../protectedNestedClassFromJava.kt | 34 ++ .../deepInnerHierarchy.kt | 13 + .../deepLocalHierarchy.kt | 17 + ...innerExtendsInnerViaSecondaryConstuctor.kt | 17 + ...innerExtendsInnerWithProperOuterCapture.kt | 17 + .../superConstructorCall/innerExtendsOuter.kt | 15 + .../superConstructorCall/kt11833_1.kt | 17 + .../superConstructorCall/kt11833_2.kt | 19 + .../localClassOuterDiffersFromInnerOuter.kt | 17 + .../superConstructorCall/localExtendsInner.kt | 21 ++ .../localExtendsLocalWithClosure.kt | 11 + ...localWithClosureExtendsLocalWithClosure.kt | 16 + .../objectExtendsClassDefaultArgument.kt | 9 + .../objectExtendsClassVararg.kt | 8 + .../objectExtendsInner.kt | 12 + .../objectExtendsInnerDefaultArgument.kt | 12 + ...jectExtendsInnerOfLocalVarargAndDefault.kt | 17 + .../objectExtendsInnerOfLocalWithCapture.kt | 15 + .../objectExtendsLocalCaptureInSuperCall.kt | 11 + .../objectExtendsLocalWithClosure.kt | 14 + .../objectOuterDiffersFromInnerOuter.kt | 16 + .../swap/swapRefToSharedVarInt.kt | 11 + .../swap/swapRefToSharedVarLong.kt | 13 + .../codegen/blackbox/intrinsics/charToInt.kt | 8 + .../intrinsics/defaultObjectMapping.kt | 23 ++ .../codegen/blackbox/intrinsics/ea35953.kt | 6 + .../blackbox/intrinsics/incWithLabel.kt | 8 + .../codegen/blackbox/intrinsics/kt10131.kt | 7 + .../codegen/blackbox/intrinsics/kt10131a.kt | 7 + .../codegen/blackbox/intrinsics/kt12125.kt | 17 + .../codegen/blackbox/intrinsics/kt12125_2.kt | 16 + .../blackbox/intrinsics/kt12125_inc.kt | 15 + .../blackbox/intrinsics/kt12125_inc_2.kt | 20 ++ .../codegen/blackbox/intrinsics/kt5937.kt | 34 ++ .../intrinsics/longRangeWithExplicitDot.kt | 6 + .../blackbox/intrinsics/prefixIncDec.kt | 29 ++ .../intrinsics/rangeFromCollection.kt | 6 + .../intrinsics/stringFromCollection.kt | 7 + .../codegen/blackbox/intrinsics/throwable.kt | 25 ++ .../intrinsics/throwableCallableReference.kt | 33 ++ .../intrinsics/throwableParamOrder.kt | 20 ++ .../codegen/blackbox/intrinsics/tostring.kt | 28 ++ .../generics/allWildcardsOnClass.kt | 51 +++ ...ntOverrideWithDeclarationSiteProjection.kt | 50 +++ .../generics/invariantArgumentsNoWildcard.kt | 24 ++ .../blackbox/javaInterop/lambdaInstanceOf.kt | 26 ++ .../extensionReceiverParameter.kt | 32 ++ .../javaInterop/notNullAssertions/mapPut.kt | 10 + .../objectMethods/cloneCallsConstructor.kt | 14 + .../objectMethods/cloneCallsSuper.kt | 14 + .../cloneCallsSuperAndModifies.kt | 19 + .../javaInterop/objectMethods/cloneHashSet.kt | 12 + .../objectMethods/cloneHierarchy.kt | 32 ++ .../cloneableClassWithoutClone.kt | 14 + .../codegen/blackbox/jdk/arrayList.kt | 12 + .../external/codegen/blackbox/jdk/hashMap.kt | 14 + .../blackbox/jdk/iteratingOverHashMap.kt | 24 ++ .../external/codegen/blackbox/jdk/kt1397.kt | 11 + .../blackbox/jvmField/captureClassFields.kt | 21 ++ .../blackbox/jvmField/capturePackageFields.kt | 18 + .../blackbox/jvmField/checkNoAccessors.kt | 40 +++ .../blackbox/jvmField/classFieldReference.kt | 45 +++ .../blackbox/jvmField/classFieldReflection.kt | 48 +++ .../blackbox/jvmField/constructorProperty.kt | 22 ++ .../codegen/blackbox/jvmField/publicField.kt | 28 ++ .../blackbox/jvmField/simpleMemberProperty.kt | 22 ++ .../codegen/blackbox/jvmField/superCall.kt | 22 ++ .../codegen/blackbox/jvmField/superCall2.kt | 25 ++ .../jvmField/topLevelFieldReference.kt | 28 ++ .../jvmField/topLevelFieldReflection.kt | 32 ++ .../codegen/blackbox/jvmField/visibility.kt | 71 ++++ .../blackbox/jvmField/writeFieldReference.kt | 30 ++ .../blackbox/jvmName/callableReference.kt | 14 + .../blackbox/jvmName/clashingErasure.kt | 19 + .../codegen/blackbox/jvmName/classMembers.kt | 121 +++++++ .../blackbox/jvmName/fakeJvmNameInJava.kt | 26 ++ .../jvmName/fileFacades/differentFiles.kt | 25 ++ .../fileFacades/javaAnnotationOnFileFacade.kt | 23 ++ .../blackbox/jvmName/fileFacades/simple.kt | 20 ++ .../codegen/blackbox/jvmName/functionName.kt | 14 + .../blackbox/jvmName/multifileClass.kt | 14 + .../jvmName/multifileClassWithLocalClass.kt | 16 + .../jvmName/multifileClassWithLocalGeneric.kt | 22 ++ .../jvmName/propertyAccessorsUseSite.kt | 30 ++ .../codegen/blackbox/jvmName/propertyName.kt | 17 + .../blackbox/jvmName/renamedFileClass.kt | 13 + .../blackbox/jvmOverloads/companionObject.kt | 17 + .../blackbox/jvmOverloads/defaultsNotAtEnd.kt | 16 + .../blackbox/jvmOverloads/doubleParameters.kt | 16 + .../blackbox/jvmOverloads/extensionMethod.kt | 16 + .../codegen/blackbox/jvmOverloads/generics.kt | 22 ++ .../blackbox/jvmOverloads/innerClass.kt | 15 + .../jvmOverloads/multipleDefaultParameters.kt | 16 + .../jvmOverloads/nonDefaultParameter.kt | 16 + .../jvmOverloads/primaryConstructor.kt | 13 + .../blackbox/jvmOverloads/privateClass.kt | 10 + .../jvmOverloads/secondaryConstructor.kt | 17 + .../codegen/blackbox/jvmOverloads/simple.kt | 16 + .../blackbox/jvmOverloads/simpleJavaCall.kt | 22 ++ .../codegen/blackbox/jvmOverloads/varargs.kt | 16 + .../codegen/blackbox/jvmStatic/annotations.kt | 61 ++++ .../codegen/blackbox/jvmStatic/closure.kt | 51 +++ .../blackbox/jvmStatic/companionObject.kt | 54 +++ .../codegen/blackbox/jvmStatic/convention.kt | 36 ++ .../codegen/blackbox/jvmStatic/default.kt | 18 + .../blackbox/jvmStatic/enumCompanion.kt | 46 +++ .../blackbox/jvmStatic/explicitObject.kt | 37 ++ .../codegen/blackbox/jvmStatic/funAccess.kt | 21 ++ .../jvmStatic/importStaticMemberFromObject.kt | 35 ++ .../codegen/blackbox/jvmStatic/inline.kt | 18 + .../jvmStatic/inlinePropertyAccessors.kt | 18 + .../blackbox/jvmStatic/kt9897_static.kt | 46 +++ .../codegen/blackbox/jvmStatic/object.kt | 52 +++ .../codegen/blackbox/jvmStatic/postfixInc.kt | 50 +++ .../codegen/blackbox/jvmStatic/prefixInc.kt | 50 +++ .../blackbox/jvmStatic/privateMethod.kt | 19 + .../blackbox/jvmStatic/privateSetter.kt | 27 ++ .../blackbox/jvmStatic/propertyAccess.kt | 50 +++ .../jvmStatic/propertyAccessorsCompanion.kt | 23 ++ .../jvmStatic/propertyAccessorsObject.kt | 21 ++ .../blackbox/jvmStatic/propertyAsDefault.kt | 14 + .../codegen/blackbox/jvmStatic/simple.kt | 47 +++ .../blackbox/jvmStatic/syntheticAccessor.kt | 20 ++ .../blackbox/labels/labeledDeclarations.kt | 16 + .../blackbox/labels/propertyAccessor.kt | 11 + .../labels/propertyAccessorFunctionLiteral.kt | 13 + .../propertyAccessorInnerExtensionFun.kt | 28 ++ .../blackbox/labels/propertyAccessorObject.kt | 19 + .../labels/propertyInClassAccessor.kt | 17 + .../exceptionInFieldInitializer.kt | 32 ++ .../codegen/blackbox/lazyCodegen/ifElse.kt | 34 ++ .../codegen/blackbox/lazyCodegen/increment.kt | 31 ++ .../optimizations/negateConstantCompare.kt | 7 + .../lazyCodegen/optimizations/negateFalse.kt | 7 + .../optimizations/negateFalseVar.kt | 8 + .../optimizations/negateFalseVarChain.kt | 8 + .../optimizations/negateObjectComp.kt | 9 + .../optimizations/negateObjectComp2.kt | 9 + .../lazyCodegen/optimizations/negateTrue.kt | 7 + .../optimizations/negateTrueVar.kt | 8 + .../optimizations/noOptimization.kt | 28 ++ .../blackbox/lazyCodegen/safeAssign.kt | 10 + .../blackbox/lazyCodegen/safeAssignComplex.kt | 34 ++ .../blackbox/lazyCodegen/safeCallAndArray.kt | 11 + .../codegen/blackbox/lazyCodegen/toString.kt | 12 + .../lazyCodegen/tryCatchExpression.kt | 13 + .../codegen/blackbox/lazyCodegen/when.kt | 15 + .../anonymousObjectInInitializer.kt | 13 + .../anonymousObjectInParameterInitializer.kt | 9 + .../localClasses/closureOfInnerLocalClass.kt | 28 ++ .../closureOfLambdaInLocalClass.kt | 38 ++ .../closureWithSelfInstantiation.kt | 78 +++++ .../localClasses/inExtensionFunction.kt | 17 + .../localClasses/inExtensionProperty.kt | 18 + .../localClasses/inLocalExtensionFunction.kt | 24 ++ .../localClasses/inLocalExtensionProperty.kt | 23 ++ .../localClasses/innerClassInLocalClass.kt | 17 + .../innerOfLocalCaptureExtensionReceiver.kt | 15 + .../codegen/blackbox/localClasses/kt2700.kt | 17 + .../codegen/blackbox/localClasses/kt2873.kt | 15 + .../codegen/blackbox/localClasses/kt3210.kt | 32 ++ .../codegen/blackbox/localClasses/kt3389.kt | 14 + .../codegen/blackbox/localClasses/kt3584.kt | 13 + .../codegen/blackbox/localClasses/kt4174.kt | 25 ++ .../blackbox/localClasses/localClass.kt | 12 + .../localClassCaptureExtensionReceiver.kt | 14 + .../localClasses/localClassInInitializer.kt | 19 + .../localClassInParameterInitializer.kt | 17 + .../blackbox/localClasses/localDataClass.kt | 17 + ...calExtendsInnerAndReferencesOuterMember.kt | 14 + .../blackbox/localClasses/noclosure.kt | 11 + .../codegen/blackbox/localClasses/object.kt | 7 + .../ownClosureOfInnerLocalClass.kt | 24 ++ .../blackbox/localClasses/withclosure.kt | 8 + .../codegen/blackbox/mangling/field.kt | 23 ++ .../external/codegen/blackbox/mangling/fun.kt | 27 ++ .../blackbox/mangling/internalOverride.kt | 29 ++ .../mangling/internalOverrideSuperCall.kt | 21 ++ .../blackbox/mangling/noOverrideWithJava.kt | 24 ++ .../blackbox/mangling/publicOverride.kt | 29 ++ .../mangling/publicOverrideSuperCall.kt | 21 ++ .../blackbox/multiDecl/ComplexInitializer.kt | 12 + .../codegen/blackbox/multiDecl/SimpleVals.kt | 9 + .../multiDecl/SimpleValsExtensions.kt | 10 + .../multiDecl/SimpleVarsExtensions.kt | 10 + .../blackbox/multiDecl/UnderscoreNames.kt | 14 + .../multiDecl/ValCapturedInFunctionLiteral.kt | 13 + .../multiDecl/ValCapturedInLocalFunction.kt | 13 + .../multiDecl/ValCapturedInObjectLiteral.kt | 16 + .../multiDecl/VarCapturedInFunctionLiteral.kt | 15 + .../multiDecl/VarCapturedInLocalFunction.kt | 15 + .../multiDecl/VarCapturedInObjectLiteral.kt | 17 + .../codegen/blackbox/multiDecl/component.kt | 19 + .../multiDecl/forIterator/MultiDeclFor.kt | 21 ++ .../MultiDeclForComponentExtensions.kt | 22 ++ .../MultiDeclForComponentMemberExtensions.kt | 24 ++ ...nentMemberExtensionsInExtensionFunction.kt | 24 ++ .../forIterator/MultiDeclForValCaptured.kt | 21 ++ .../MultiDeclForComponentExtensions.kt | 19 + ...tiDeclForComponentExtensionsValCaptured.kt | 19 + .../MultiDeclForComponentMemberExtensions.kt | 21 ++ ...nentMemberExtensionsInExtensionFunction.kt | 21 ++ .../multiDecl/forRange/MultiDeclFor.kt | 34 ++ .../MultiDeclForComponentExtensions.kt | 34 ++ .../MultiDeclForComponentMemberExtensions.kt | 38 ++ ...nentMemberExtensionsInExtensionFunction.kt | 37 ++ .../forRange/MultiDeclForValCaptured.kt | 34 ++ .../multiDecl/forRange/UnderscoreNames.kt | 43 +++ .../UnderscoreNamesDontCallComponent.kt | 15 + .../forRange/explicitRangeTo/MultiDeclFor.kt | 34 ++ .../MultiDeclForComponentExtensions.kt | 34 ++ .../MultiDeclForComponentMemberExtensions.kt | 38 ++ ...nentMemberExtensionsInExtensionFunction.kt | 37 ++ .../MultiDeclForValCaptured.kt | 34 ++ .../int/MultiDeclForComponentExtensions.kt | 15 + ...tiDeclForComponentExtensionsValCaptured.kt | 15 + .../MultiDeclForComponentMemberExtensions.kt | 17 + ...nentMemberExtensionsInExtensionFunction.kt | 17 + .../long/MultiDeclForComponentExtensions.kt | 15 + ...tiDeclForComponentExtensionsValCaptured.kt | 15 + .../MultiDeclForComponentMemberExtensions.kt | 17 + ...nentMemberExtensionsInExtensionFunction.kt | 17 + .../explicitRangeToWithDot/MultiDeclFor.kt | 34 ++ .../MultiDeclForComponentExtensions.kt | 34 ++ .../MultiDeclForComponentMemberExtensions.kt | 38 ++ ...nentMemberExtensionsInExtensionFunction.kt | 37 ++ .../MultiDeclForValCaptured.kt | 34 ++ .../int/MultiDeclForComponentExtensions.kt | 15 + ...tiDeclForComponentExtensionsValCaptured.kt | 15 + .../MultiDeclForComponentMemberExtensions.kt | 17 + ...nentMemberExtensionsInExtensionFunction.kt | 17 + .../long/MultiDeclForComponentExtensions.kt | 23 ++ ...tiDeclForComponentExtensionsValCaptured.kt | 15 + .../MultiDeclForComponentMemberExtensions.kt | 17 + ...nentMemberExtensionsInExtensionFunction.kt | 17 + .../int/MultiDeclForComponentExtensions.kt | 15 + ...tiDeclForComponentExtensionsValCaptured.kt | 15 + .../MultiDeclForComponentMemberExtensions.kt | 17 + ...nentMemberExtensionsInExtensionFunction.kt | 17 + .../long/MultiDeclForComponentExtensions.kt | 15 + ...tiDeclForComponentExtensionsValCaptured.kt | 15 + .../MultiDeclForComponentMemberExtensions.kt | 17 + ...nentMemberExtensionsInExtensionFunction.kt | 17 + .../blackbox/multiDecl/kt9828_hashMap.kt | 11 + .../blackbox/multiDecl/returnInElvis.kt | 22 ++ ...allMultifileClassMemberFromOtherPackage.kt | 26 ++ .../callsToMultifileClassFromOtherPackage.kt | 27 ++ ...onstPropertyReferenceFromMultifileClass.kt | 28 ++ ...ineMultifileClassMemberFromOtherPackage.kt | 25 ++ .../multifileClassPartsInitialization.kt | 38 ++ .../multifileClassWith2Files.kt | 26 ++ .../multifileClassWithCrossCall.kt | 31 ++ .../multifileClassWithPrivate.kt | 31 ++ .../optimized/callableRefToFun.kt | 16 + .../callableRefToInternalValInline.kt | 19 + .../optimized/callableRefToPrivateVal.kt | 20 ++ .../optimized/callableRefToVal.kt | 16 + .../multifileClasses/optimized/calls.kt | 32 ++ .../optimized/deferredStaticInitialization.kt | 42 +++ .../optimized/delegatedVal.kt | 16 + .../optimized/initializePrivateVal.kt | 18 + .../optimized/initializePublicVal.kt | 16 + .../optimized/overlappingFuns.kt | 30 ++ .../optimized/overlappingVals.kt | 30 ++ .../valAccessFromInlineFunCalledFromJava.kt | 30 ++ .../valAccessFromInlinedToDifferentPackage.kt | 22 ++ .../optimized/valWithAccessor.kt | 20 ++ .../multifileClasses/privateConstVal.kt | 26 ++ .../samePartNameDifferentFacades.kt | 25 ++ .../blackbox/nonLocalReturns/kt6895.kt | 26 ++ .../blackbox/nonLocalReturns/kt9644let.kt | 12 + .../codegen/blackbox/nonLocalReturns/use.kt | 177 ++++++++++ .../nonLocalReturns/useWithException.kt | 190 ++++++++++ .../blackbox/objectIntrinsics/objects.kt | 94 +++++ .../anonymousObjectPropertyInitialization.kt | 14 + ...classCallsProtectedInheritedByCompanion.kt | 11 + .../codegen/blackbox/objects/flist.kt | 53 +++ .../blackbox/objects/initializationOrder.kt | 16 + .../codegen/blackbox/objects/kt1047.kt | 16 + .../codegen/blackbox/objects/kt11117.kt | 16 + .../codegen/blackbox/objects/kt1136.kt | 50 +++ .../codegen/blackbox/objects/kt1186.kt | 28 ++ .../codegen/blackbox/objects/kt1600.kt | 8 + .../codegen/blackbox/objects/kt1737.kt | 16 + .../codegen/blackbox/objects/kt2398.kt | 18 + .../codegen/blackbox/objects/kt2663.kt | 10 + .../codegen/blackbox/objects/kt2663_2.kt | 13 + .../codegen/blackbox/objects/kt2675.kt | 16 + .../codegen/blackbox/objects/kt2719.kt | 9 + .../codegen/blackbox/objects/kt2822.kt | 7 + .../codegen/blackbox/objects/kt3238.kt | 15 + .../codegen/blackbox/objects/kt3684.kt | 16 + .../codegen/blackbox/objects/kt4086.kt | 12 + .../codegen/blackbox/objects/kt535.kt | 24 ++ .../codegen/blackbox/objects/kt560.kt | 31 ++ .../codegen/blackbox/objects/kt694.kt | 18 + ...localFunctionInObjectInitializer_kt4516.kt | 17 + .../blackbox/objects/methodOnObject.kt | 5 + ...DerivedClassCallsProtectedFromCompanion.kt | 10 + .../objects/nestedObjectWithSuperclass.kt | 18 + ...ectExtendsInnerAndReferencesOuterMember.kt | 12 + .../objects/objectInLocalAnonymousObject.kt | 10 + .../objects/objectInitialization_kt5523.kt | 6 + .../codegen/blackbox/objects/objectLiteral.kt | 18 + .../objects/objectLiteralInClosure.kt | 17 + .../objectVsClassInitialization_kt5291.kt | 24 ++ .../blackbox/objects/objectWithSuperclass.kt | 16 + .../objects/objectWithSuperclassAndTrait.kt | 21 ++ .../privateExtensionFromInitializer_kt4543.kt | 16 + ...FunctionFromClosureInInitializer_kt5582.kt | 20 ++ .../blackbox/objects/receiverInConstructor.kt | 7 + .../codegen/blackbox/objects/safeAccess.kt | 7 + .../codegen/blackbox/objects/simpleObject.kt | 7 + .../blackbox/objects/thisInConstructor.kt | 10 + .../objects/useAnonymousObjectAsIterator.kt | 18 + .../blackbox/objects/useImportedMember.kt | 50 +++ .../objects/useImportedMemberFromCompanion.kt | 52 +++ .../annotatedAssignment.kt | 13 + .../assignmentOperations.kt | 36 ++ .../augmentedAssignmentWithArrayLHS.kt | 33 ++ .../operatorConventions/compareTo/boolean.kt | 13 + .../compareTo/comparable.kt | 16 + .../compareTo/doubleInt.kt | 10 + .../compareTo/doubleLong.kt | 10 + .../compareTo/extensionArray.kt | 16 + .../compareTo/extensionObject.kt | 14 + .../compareTo/intDouble.kt | 10 + .../operatorConventions/compareTo/intLong.kt | 10 + .../compareTo/longDouble.kt | 10 + .../operatorConventions/compareTo/longInt.kt | 10 + .../operatorConventions/incDecOnObject.kt | 41 +++ .../blackbox/operatorConventions/kt14201.kt | 15 + .../blackbox/operatorConventions/kt14201_2.kt | 27 ++ .../blackbox/operatorConventions/kt4152.kt | 29 ++ .../blackbox/operatorConventions/kt4987.kt | 9 + .../operatorConventions/nestedMaps.kt | 13 + .../operatorConventions/operatorSetLambda.kt | 16 + .../operatorConventions/overloadedSet.kt | 11 + .../percentAsModOnBigIntegerWithoutRem.kt | 11 + .../remAssignmentOperation.kt | 17 + .../remOverModOperation.kt | 18 + .../package/boxPrimitiveTypeInClinit.kt | 27 ++ .../codegen/blackbox/package/checkCast.kt | 15 + .../blackbox/package/incrementProperty.kt | 14 + .../blackbox/package/initializationOrder.kt | 17 + .../codegen/blackbox/package/invokespecial.kt | 48 +++ .../codegen/blackbox/package/mainInFiles.kt | 44 +++ .../nullablePrimitiveNoFieldInitializer.kt | 11 + ...eLocalClassNotImportedWithDefaultImport.kt | 24 ++ .../package/packageQualifiedMethod.kt | 6 + .../privateTopLevelPropAndVarInInner.kt | 4 + .../platformTypes/primitives/assign.kt | 8 + .../platformTypes/primitives/compareTo.kt | 9 + .../blackbox/platformTypes/primitives/dec.kt | 14 + .../blackbox/platformTypes/primitives/div.kt | 7 + .../platformTypes/primitives/equals.kt | 7 + .../platformTypes/primitives/hashCode.kt | 7 + .../primitives/identityEquals.kt | 16 + .../blackbox/platformTypes/primitives/inc.kt | 14 + .../platformTypes/primitives/minus.kt | 7 + .../blackbox/platformTypes/primitives/mod.kt | 7 + .../blackbox/platformTypes/primitives/not.kt | 7 + .../platformTypes/primitives/notEquals.kt | 7 + .../blackbox/platformTypes/primitives/plus.kt | 7 + .../platformTypes/primitives/plusAssign.kt | 10 + .../platformTypes/primitives/rangeTo.kt | 10 + .../platformTypes/primitives/times.kt | 7 + .../platformTypes/primitives/toShort.kt | 7 + .../platformTypes/primitives/toString.kt | 7 + .../platformTypes/primitives/unaryMinus.kt | 7 + .../platformTypes/primitives/unaryPlus.kt | 7 + .../primitiveTypes/comparisonWithNaN.kt | 61 ++++ .../comparisonWithNullCallsFun.kt | 13 + .../blackbox/primitiveTypes/ea35963.kt | 6 + .../primitiveTypes/equalsHashCodeToString.kt | 60 ++++ .../primitiveTypes/incrementByteCharShort.kt | 22 ++ .../primitiveTypes/intLiteralIsNotNull.kt | 1 + .../codegen/blackbox/primitiveTypes/kt1054.kt | 17 + .../codegen/blackbox/primitiveTypes/kt1055.kt | 6 + .../codegen/blackbox/primitiveTypes/kt1093.kt | 8 + .../blackbox/primitiveTypes/kt13023.kt | 20 ++ .../blackbox/primitiveTypes/kt14868.kt | 6 + .../codegen/blackbox/primitiveTypes/kt1508.kt | 6 + .../codegen/blackbox/primitiveTypes/kt1634.kt | 4 + .../codegen/blackbox/primitiveTypes/kt2251.kt | 39 +++ .../codegen/blackbox/primitiveTypes/kt2269.kt | 13 + .../codegen/blackbox/primitiveTypes/kt2275.kt | 5 + .../codegen/blackbox/primitiveTypes/kt239.kt | 5 + .../codegen/blackbox/primitiveTypes/kt242.kt | 19 + .../codegen/blackbox/primitiveTypes/kt243.kt | 11 + .../codegen/blackbox/primitiveTypes/kt248.kt | 7 + .../codegen/blackbox/primitiveTypes/kt2768.kt | 17 + .../codegen/blackbox/primitiveTypes/kt2794.kt | 6 + .../codegen/blackbox/primitiveTypes/kt3078.kt | 7 + .../codegen/blackbox/primitiveTypes/kt3517.kt | 6 + .../codegen/blackbox/primitiveTypes/kt3576.kt | 9 + .../codegen/blackbox/primitiveTypes/kt3613.kt | 6 + .../codegen/blackbox/primitiveTypes/kt4097.kt | 15 + .../codegen/blackbox/primitiveTypes/kt4098.kt | 10 + .../codegen/blackbox/primitiveTypes/kt4210.kt | 16 + .../codegen/blackbox/primitiveTypes/kt4251.kt | 5 + .../codegen/blackbox/primitiveTypes/kt446.kt | 5 + .../codegen/blackbox/primitiveTypes/kt518.kt | 15 + .../primitiveTypes/kt6590_identityEquals.kt | 15 + .../codegen/blackbox/primitiveTypes/kt665.kt | 12 + .../codegen/blackbox/primitiveTypes/kt684.kt | 32 ++ .../codegen/blackbox/primitiveTypes/kt711.kt | 1 + .../codegen/blackbox/primitiveTypes/kt737.kt | 5 + .../codegen/blackbox/primitiveTypes/kt752.kt | 15 + .../codegen/blackbox/primitiveTypes/kt753.kt | 14 + .../codegen/blackbox/primitiveTypes/kt756.kt | 15 + .../codegen/blackbox/primitiveTypes/kt757.kt | 12 + .../codegen/blackbox/primitiveTypes/kt828.kt | 15 + .../codegen/blackbox/primitiveTypes/kt877.kt | 9 + .../codegen/blackbox/primitiveTypes/kt882.kt | 7 + .../codegen/blackbox/primitiveTypes/kt887.kt | 5 + .../codegen/blackbox/primitiveTypes/kt935.kt | 33 ++ .../primitiveTypes/nullAsNullableIntIsNull.kt | 9 + .../primitiveTypes/nullableCharBoolean.kt | 9 + .../codegen/blackbox/primitiveTypes/number.kt | 36 ++ .../blackbox/primitiveTypes/rangeTo.kt | 62 ++++ .../primitiveTypes/substituteIntForGeneric.kt | 11 + .../primitiveTypes/unboxComparable.kt | 5 + .../blackbox/private/arrayConvention.kt | 21 ++ .../codegen/blackbox/private/kt9855.kt | 15 + .../blackbox/privateConstructors/base.kt | 9 + .../blackbox/privateConstructors/captured.kt | 10 + .../blackbox/privateConstructors/companion.kt | 11 + .../blackbox/privateConstructors/inline.kt | 11 + .../blackbox/privateConstructors/inner.kt | 15 + .../blackbox/privateConstructors/kt4860.kt | 12 + .../blackbox/privateConstructors/secondary.kt | 9 + .../blackbox/privateConstructors/synthetic.kt | 31 ++ .../privateConstructors/withArguments.kt | 13 + .../privateConstructors/withDefault.kt | 11 + .../privateConstructors/withLinkedClasses.kt | 12 + .../privateConstructors/withLinkedObjects.kt | 13 + .../privateConstructors/withVarargs.kt | 13 + .../properties/accessToPrivateProperty.kt | 52 +++ .../properties/accessToPrivateSetter.kt | 16 + .../augmentedAssignmentsAndIncrements.kt | 147 ++++++++ .../classArtificialFieldInsideNested.kt | 15 + .../properties/classFieldInsideLambda.kt | 6 + .../classFieldInsideLocalInSetter.kt | 18 + .../properties/classFieldInsideNested.kt | 14 + .../properties/classObjectProperties.kt | 58 +++ ...classPrivateArtificialFieldInsideNested.kt | 15 + .../blackbox/properties/collectionSize.kt | 24 ++ .../properties/commonPropertiesKJK.kt | 112 ++++++ .../properties/companionFieldInsideLambda.kt | 8 + .../properties/companionObjectAccessor.kt | 30 ++ .../companionObjectPropertiesFromJava.kt | 53 +++ .../properties/companionPrivateField.kt | 10 + .../companionPrivateFieldInsideLambda.kt | 10 + .../blackbox/properties/const/constFlags.kt | 52 +++ .../const/constValInAnnotationDefault.kt | 15 + .../properties/const/interfaceCompanion.kt | 23 ++ .../codegen/blackbox/properties/field.kt | 10 + .../blackbox/properties/fieldInClass.kt | 6 + .../blackbox/properties/fieldInsideField.kt | 13 + .../blackbox/properties/fieldInsideLambda.kt | 4 + .../blackbox/properties/fieldInsideNested.kt | 12 + .../blackbox/properties/fieldSimple.kt | 4 + .../blackbox/properties/generalAccess.kt | 54 +++ .../properties/javaPropertyBoxedGetter.kt | 33 ++ .../properties/javaPropertyBoxedSetter.kt | 31 ++ .../codegen/blackbox/properties/kt10715.kt | 17 + .../codegen/blackbox/properties/kt10729.kt | 20 ++ .../codegen/blackbox/properties/kt1159.kt | 22 ++ .../codegen/blackbox/properties/kt1165.kt | 13 + .../codegen/blackbox/properties/kt1168.kt | 15 + .../codegen/blackbox/properties/kt1170.kt | 16 + .../codegen/blackbox/properties/kt12200.kt | 33 ++ .../codegen/blackbox/properties/kt1398.kt | 10 + .../codegen/blackbox/properties/kt1417.kt | 9 + .../blackbox/properties/kt1482_2279.kt | 24 ++ .../codegen/blackbox/properties/kt1714.kt | 26 ++ .../blackbox/properties/kt1714_minimal.kt | 13 + .../codegen/blackbox/properties/kt1892.kt | 5 + .../codegen/blackbox/properties/kt2331.kt | 14 + .../codegen/blackbox/properties/kt257.kt | 20 ++ .../codegen/blackbox/properties/kt2655.kt | 20 ++ .../codegen/blackbox/properties/kt2786.kt | 13 + .../codegen/blackbox/properties/kt2892.kt | 16 + .../codegen/blackbox/properties/kt3118.kt | 12 + .../codegen/blackbox/properties/kt3524.kt | 5 + .../codegen/blackbox/properties/kt3551.kt | 23 ++ .../codegen/blackbox/properties/kt3556.kt | 10 + .../codegen/blackbox/properties/kt3930.kt | 16 + .../codegen/blackbox/properties/kt4140.kt | 16 + .../codegen/blackbox/properties/kt4252.kt | 23 ++ .../codegen/blackbox/properties/kt4252_2.kt | 30 ++ .../codegen/blackbox/properties/kt4340.kt | 36 ++ .../codegen/blackbox/properties/kt4373.kt | 14 + .../codegen/blackbox/properties/kt4383.kt | 21 ++ .../codegen/blackbox/properties/kt613.kt | 15 + .../codegen/blackbox/properties/kt8928.kt | 16 + .../codegen/blackbox/properties/kt9603.kt | 11 + .../blackbox/properties/lateinit/accessor.kt | 20 ++ .../properties/lateinit/accessorException.kt | 24 ++ .../properties/lateinit/exceptionField.kt | 21 ++ .../properties/lateinit/exceptionGetter.kt | 16 + .../blackbox/properties/lateinit/override.kt | 21 ++ .../properties/lateinit/overrideException.kt | 24 ++ .../properties/lateinit/privateSetter.kt | 12 + .../lateinit/privateSetterFromLambda.kt | 12 + .../blackbox/properties/lateinit/simpleVar.kt | 9 + .../properties/lateinit/visibility.kt | 34 ++ .../primitiveOverrideDefaultAccessor.kt | 11 + .../primitiveOverrideDelegateAccessor.kt | 20 ++ .../privatePropertyInConstructor.kt | 18 + .../privatePropertyWithoutBackingField.kt | 17 + .../properties/protectedJavaFieldInInline.kt | 22 ++ .../properties/protectedJavaProperty.kt | 40 +++ .../protectedJavaPropertyInCompanion.kt | 48 +++ .../properties/substituteJavaSuperField.kt | 22 ++ ...ExtensionPropertiesWithoutBackingFields.kt | 9 + .../properties/typeInferredFromGetter.kt | 7 + .../blackbox/publishedApi/noMangling.kt | 15 + .../codegen/blackbox/publishedApi/simple.kt | 16 + .../codegen/blackbox/publishedApi/topLevel.kt | 10 + .../ranges/contains/inComparableRange.kt | 50 +++ .../ranges/contains/inExtensionRange.kt | 21 ++ .../blackbox/ranges/contains/inIntRange.kt | 28 ++ .../contains/inOptimizableDoubleRange.kt | 39 +++ .../contains/inOptimizableFloatRange.kt | 39 +++ .../ranges/contains/inOptimizableIntRange.kt | 32 ++ .../ranges/contains/inOptimizableLongRange.kt | 32 ++ .../contains/inRangeWithCustomContains.kt | 27 ++ .../contains/inRangeWithImplicitReceiver.kt | 22 ++ .../inRangeWithNonmatchingArguments.kt | 15 + .../ranges/contains/inRangeWithSmartCast.kt | 29 ++ .../ranges/contains/rangeContainsString.kt | 5 + .../blackbox/ranges/expression/emptyDownto.kt | 57 +++ .../blackbox/ranges/expression/emptyRange.kt | 57 +++ .../expression/inexactDownToMinValue.kt | 71 ++++ .../ranges/expression/inexactSteppedDownTo.kt | 57 +++ .../ranges/expression/inexactSteppedRange.kt | 57 +++ .../ranges/expression/inexactToMaxValue.kt | 71 ++++ .../expression/maxValueMinusTwoToMaxValue.kt | 71 ++++ .../ranges/expression/maxValueToMaxValue.kt | 71 ++++ .../ranges/expression/maxValueToMinValue.kt | 71 ++++ .../ranges/expression/oneElementDownTo.kt | 57 +++ .../ranges/expression/oneElementRange.kt | 57 +++ .../blackbox/ranges/expression/openRange.kt | 57 +++ .../expression/progressionDownToMinValue.kt | 71 ++++ .../progressionMaxValueMinusTwoToMaxValue.kt | 71 ++++ .../progressionMaxValueToMaxValue.kt | 71 ++++ .../progressionMaxValueToMinValue.kt | 71 ++++ .../progressionMinValueToMinValue.kt | 71 ++++ .../ranges/expression/reversedBackSequence.kt | 57 +++ .../expression/reversedEmptyBackSequence.kt | 57 +++ .../ranges/expression/reversedEmptyRange.kt | 57 +++ .../reversedInexactSteppedDownTo.kt | 57 +++ .../ranges/expression/reversedRange.kt | 47 +++ .../expression/reversedSimpleSteppedRange.kt | 57 +++ .../ranges/expression/simpleDownTo.kt | 57 +++ .../blackbox/ranges/expression/simpleRange.kt | 57 +++ .../simpleRangeWithNonConstantEnds.kt | 57 +++ .../ranges/expression/simpleSteppedDownTo.kt | 57 +++ .../ranges/expression/simpleSteppedRange.kt | 57 +++ .../forByteProgressionWithIntIncrement.kt | 9 + .../ranges/forInDownTo/forIntInDownTo.kt | 13 + .../forInDownTo/forIntInNonOptimizedDownTo.kt | 14 + .../ranges/forInDownTo/forLongInDownTo.kt | 13 + .../forInDownTo/forNullableIntInDownTo.kt | 13 + .../forInIndices/forInCharSequenceIndices.kt | 16 + .../forInCollectionImplicitReceiverIndices.kt | 19 + .../forInIndices/forInCollectionIndices.kt | 13 + .../forInIndices/forInNonOptimizedIndices.kt | 18 + .../forInIndices/forInObjectArrayIndices.kt | 13 + .../forInPrimitiveArrayIndices.kt | 13 + .../forNullableIntInArrayIndices.kt | 16 + .../forNullableIntInCollectionIndices.kt | 16 + .../kt12983_forInGenericArrayIndices.kt | 22 ++ .../kt12983_forInGenericCollectionIndices.kt | 22 ++ .../kt12983_forInSpecificArrayIndices.kt | 22 ++ .../kt12983_forInSpecificCollectionIndices.kt | 22 ++ .../ranges/forInIndices/kt13241_Array.kt | 21 ++ .../forInIndices/kt13241_CharSequence.kt | 18 + .../ranges/forInIndices/kt13241_Collection.kt | 18 + .../ranges/forInRangeWithImplicitReceiver.kt | 17 + .../codegen/blackbox/ranges/forIntRange.kt | 15 + ...rNullableIntInRangeWithImplicitReceiver.kt | 20 ++ .../blackbox/ranges/literal/emptyDownto.kt | 52 +++ .../blackbox/ranges/literal/emptyRange.kt | 52 +++ .../ranges/literal/inexactDownToMinValue.kt | 66 ++++ .../ranges/literal/inexactSteppedDownTo.kt | 52 +++ .../ranges/literal/inexactSteppedRange.kt | 52 +++ .../ranges/literal/inexactToMaxValue.kt | 66 ++++ .../literal/maxValueMinusTwoToMaxValue.kt | 66 ++++ .../ranges/literal/maxValueToMaxValue.kt | 66 ++++ .../ranges/literal/maxValueToMinValue.kt | 66 ++++ .../ranges/literal/oneElementDownTo.kt | 52 +++ .../ranges/literal/oneElementRange.kt | 52 +++ .../blackbox/ranges/literal/openRange.kt | 52 +++ .../literal/progressionDownToMinValue.kt | 66 ++++ .../progressionMaxValueMinusTwoToMaxValue.kt | 66 ++++ .../literal/progressionMaxValueToMaxValue.kt | 66 ++++ .../literal/progressionMaxValueToMinValue.kt | 66 ++++ .../literal/progressionMinValueToMinValue.kt | 66 ++++ .../ranges/literal/reversedBackSequence.kt | 52 +++ .../literal/reversedEmptyBackSequence.kt | 52 +++ .../ranges/literal/reversedEmptyRange.kt | 52 +++ .../literal/reversedInexactSteppedDownTo.kt | 52 +++ .../blackbox/ranges/literal/reversedRange.kt | 43 +++ .../literal/reversedSimpleSteppedRange.kt | 52 +++ .../blackbox/ranges/literal/simpleDownTo.kt | 52 +++ .../blackbox/ranges/literal/simpleRange.kt | 52 +++ .../literal/simpleRangeWithNonConstantEnds.kt | 52 +++ .../ranges/literal/simpleSteppedDownTo.kt | 52 +++ .../ranges/literal/simpleSteppedRange.kt | 52 +++ .../multiAssignmentIterationOverIntRange.kt | 23 ++ .../progressionExpression.kt | 12 + .../nullableLoopParameter/rangeExpression.kt | 12 + .../nullableLoopParameter/rangeLiteral.kt | 11 + .../blackbox/ranges/safeCallRangeTo.kt | 31 ++ .../annotationRetentionAnnotation.kt | 19 + .../annotations/annotationsOnJavaMembers.kt | 32 ++ .../reflection/annotations/findAnnotation.kt | 21 ++ .../annotations/propertyAccessors.kt | 20 ++ .../propertyWithoutBackingField.kt | 14 + .../reflection/annotations/retentions.kt | 23 ++ .../annotations/simpleClassAnnotation.kt | 14 + .../simpleConstructorAnnotation.kt | 18 + .../annotations/simpleFunAnnotation.kt | 12 + .../annotations/simpleParamAnnotation.kt | 13 + .../annotations/simpleValAnnotation.kt | 14 + .../bound/companionObjectPropertyAccessors.kt | 53 +++ .../call/bound/extensionFunction.kt | 12 + .../call/bound/extensionPropertyAccessors.kt | 45 +++ .../call/bound/innerClassConstructor.kt | 16 + .../call/bound/javaInstanceField.kt | 40 +++ .../call/bound/javaInstanceMethod.kt | 35 ++ ...mStaticCompanionObjectPropertyAccessors.kt | 53 +++ .../call/bound/jvmStaticObjectFunction.kt | 19 + .../bound/jvmStaticObjectPropertyAccessors.kt | 51 +++ .../reflection/call/bound/memberFunction.kt | 14 + .../call/bound/memberPropertyAccessors.kt | 50 +++ .../reflection/call/bound/objectFunction.kt | 19 + .../call/bound/objectPropertyAccessors.kt | 51 +++ .../reflection/call/callInstanceJavaMethod.kt | 35 ++ .../reflection/call/callPrivateJavaMethod.kt | 40 +++ .../reflection/call/callStaticJavaMethod.kt | 26 ++ .../call/cannotCallEnumConstructor.kt | 20 ++ .../call/disallowNullValueForNotNullField.kt | 48 +++ .../reflection/call/equalsHashCodeToString.kt | 30 ++ .../reflection/call/exceptionHappened.kt | 21 ++ .../blackbox/reflection/call/fakeOverride.kt | 15 + .../call/fakeOverrideSubstituted.kt | 15 + .../call/incorrectNumberOfArguments.kt | 108 ++++++ .../reflection/call/innerClassConstructor.kt | 13 + .../blackbox/reflection/call/jvmStatic.kt | 22 ++ .../jvmStaticInObjectIncorrectReceiver.kt | 47 +++ .../reflection/call/localClassMember.kt | 12 + .../reflection/call/memberOfGenericClass.kt | 17 + .../reflection/call/privateProperty.kt | 22 ++ .../reflection/call/propertyAccessors.kt | 52 +++ ...GetterAndGetFunctionDifferentReturnType.kt | 12 + .../blackbox/reflection/call/returnUnit.kt | 29 ++ .../reflection/call/simpleConstructor.kt | 11 + .../reflection/call/simpleMemberFunction.kt | 21 ++ .../call/simpleTopLevelFunctions.kt | 32 ++ .../callBy/boundExtensionFunction.kt | 13 + .../callBy/boundExtensionPropertyAcessor.kt | 12 + .../callBy/boundJvmStaticInObject.kt | 19 + .../reflection/callBy/companionObject.kt | 34 ++ .../callBy/defaultAndNonDefaultIntertwined.kt | 20 ++ .../reflection/callBy/extensionFunction.kt | 14 + .../callBy/jvmStaticInCompanionObject.kt | 37 ++ .../reflection/callBy/jvmStaticInObject.kt | 33 ++ .../callBy/manyArgumentsOnlyOneDefault.kt | 102 ++++++ .../reflection/callBy/manyMaskArguments.kt | 100 ++++++ .../callBy/nonDefaultParameterOmitted.kt | 26 ++ .../blackbox/reflection/callBy/nullValue.kt | 15 + ...thodIsInvokedWhenNoDefaultValuesAreUsed.kt | 24 ++ .../callBy/primitiveDefaultValues.kt | 31 ++ .../callBy/privateMemberFunction.kt | 32 ++ .../reflection/callBy/simpleConstructor.kt | 8 + .../reflection/callBy/simpleMemberFunciton.kt | 13 + .../callBy/simpleTopLevelFunction.kt | 8 + .../classLiterals/annotationClassLiteral.kt | 12 + .../reflection/classLiterals/arrays.kt | 17 + .../classLiterals/builtinClassLiterals.kt | 31 ++ .../reflection/classLiterals/genericArrays.kt | 33 ++ .../reflection/classLiterals/genericClass.kt | 11 + .../classLiterals/reifiedTypeClassLiteral.kt | 33 ++ .../classLiterals/simpleClassLiteral.kt | 8 + .../reflection/classes/classSimpleName.kt | 17 + .../reflection/classes/companionObject.kt | 51 +++ .../reflection/classes/createInstance.kt | 76 ++++ .../reflection/classes/declaredMembers.kt | 53 +++ .../blackbox/reflection/classes/jvmName.kt | 45 +++ .../classes/localClassSimpleName.kt | 41 +++ .../reflection/classes/nestedClasses.kt | 62 ++++ .../reflection/classes/nestedClassesJava.kt | 26 ++ .../reflection/classes/objectInstance.kt | 36 ++ .../classes/primitiveKClassEquality.kt | 18 + .../reflection/classes/qualifiedName.kt | 41 +++ .../reflection/classes/starProjectedType.kt | 26 ++ .../constructors/annotationClass.kt | 24 ++ .../classesWithoutConstructors.kt | 21 ++ .../constructors/constructorName.kt | 13 + .../constructors/primaryConstructor.kt | 57 +++ .../constructors/simpleGetConstructors.kt | 34 ++ .../createAnnotation/annotationType.kt | 14 + .../createAnnotation/arrayOfKClasses.kt | 16 + .../reflection/createAnnotation/callByJava.kt | 81 +++++ .../createAnnotation/callByKotlin.kt | 53 +++ .../reflection/createAnnotation/callJava.kt | 93 +++++ .../reflection/createAnnotation/callKotlin.kt | 38 ++ .../createJdkAnnotationInstance.kt | 18 + .../createAnnotation/enumKClassAnnotation.kt | 50 +++ .../equalsHashCodeToString.kt | 49 +++ .../floatingPointParameters.kt | 66 ++++ .../createAnnotation/parameterNamedEquals.kt | 18 + .../createAnnotation/primitivesAndArrays.kt | 85 +++++ .../anonymousObjectInInlinedLambda.kt | 25 ++ .../reflection/enclosing/classInLambda.kt | 23 ++ .../enclosing/functionExpressionInProperty.kt | 21 ++ .../blackbox/reflection/enclosing/kt11969.kt | 63 ++++ .../blackbox/reflection/enclosing/kt6368.kt | 28 ++ .../kt6691_lambdaInSamConstructor.kt | 29 ++ .../enclosing/lambdaInClassObject.kt | 30 ++ .../enclosing/lambdaInConstructor.kt | 22 ++ .../reflection/enclosing/lambdaInFunction.kt | 20 ++ .../reflection/enclosing/lambdaInLambda.kt | 22 ++ .../lambdaInLocalClassConstructor.kt | 31 ++ .../enclosing/lambdaInLocalClassSuperCall.kt | 26 ++ .../enclosing/lambdaInLocalFunction.kt | 22 ++ .../enclosing/lambdaInMemberFunction.kt | 25 ++ .../lambdaInMemberFunctionInLocalClass.kt | 24 ++ .../lambdaInMemberFunctionInNestedClass.kt | 26 ++ .../enclosing/lambdaInObjectDeclaration.kt | 26 ++ .../enclosing/lambdaInObjectExpression.kt | 32 ++ .../lambdaInObjectLiteralSuperCall.kt | 26 ++ .../reflection/enclosing/lambdaInPackage.kt | 22 ++ .../enclosing/lambdaInPropertyGetter.kt | 21 ++ .../enclosing/lambdaInPropertySetter.kt | 27 ++ .../enclosing/localClassInTopLevelFunction.kt | 14 + .../reflection/enclosing/objectInLambda.kt | 22 ++ .../functions/declaredVsInheritedFunctions.kt | 80 +++++ .../functions/functionFromStdlib.kt | 10 + .../functionReferenceErasedToKFunction.kt | 32 ++ .../functions/genericOverriddenFunction.kt | 19 + .../functions/instanceOfFunction.kt | 39 +++ .../functions/javaClassGetFunctions.kt | 31 ++ .../functions/javaMethodsSmokeTest.kt | 50 +++ .../reflection/functions/platformName.kt | 9 + .../functions/privateMemberFunction.kt | 27 ++ .../functions/simpleGetFunctions.kt | 26 ++ .../reflection/functions/simpleNames.kt | 21 ++ .../genericSignature/covariantOverride.kt | 21 ++ .../defaultImplsGenericSignature.kt | 47 +++ .../functionLiteralGenericSignature.kt | 36 ++ .../genericBackingFieldSignature.kt | 86 +++++ .../genericMethodSignature.kt | 65 ++++ .../reflection/genericSignature/kt11121.kt | 28 ++ .../reflection/genericSignature/kt5112.kt | 31 ++ .../reflection/genericSignature/kt6106.kt | 31 ++ .../isInstance/isInstanceCastAndSafeCast.kt | 61 ++++ .../reflection/kClassInAnnotation/array.kt | 21 ++ .../kClassInAnnotation/arrayInJava.kt | 26 ++ .../reflection/kClassInAnnotation/basic.kt | 18 + .../kClassInAnnotation/basicInJava.kt | 23 ++ .../kClassInAnnotation/checkcast.kt | 15 + .../reflection/kClassInAnnotation/vararg.kt | 21 ++ .../kClassInAnnotation/varargInJava.kt | 26 ++ .../parameterNamesAndNullability.kt | 48 +++ .../reflection/mapping/constructor.kt | 40 +++ .../reflection/mapping/extensionProperty.kt | 32 ++ .../fakeOverrides/javaFieldGetterSetter.kt | 26 ++ .../mapping/fakeOverrides/javaMethod.kt | 20 ++ .../blackbox/reflection/mapping/functions.kt | 32 ++ .../reflection/mapping/inlineReifiedFun.kt | 23 ++ .../jvmStatic/companionObjectFunction.kt | 38 ++ .../mapping/jvmStatic/objectFunction.kt | 25 ++ .../mappedClassIsEqualToClassLiteral.kt | 17 + .../reflection/mapping/memberProperty.kt | 28 ++ .../reflection/mapping/propertyAccessors.kt | 39 +++ .../mapping/propertyAccessorsWithJvmName.kt | 28 ++ .../reflection/mapping/syntheticFields.kt | 19 + .../mapping/topLevelFunctionOtherFile.kt | 28 ++ .../reflection/mapping/topLevelProperty.kt | 30 ++ .../types/annotationConstructorParameters.kt | 51 +++ .../reflection/mapping/types/array.kt | 34 ++ .../reflection/mapping/types/constructors.kt | 25 ++ .../mapping/types/genericArrayElementType.kt | 37 ++ .../mapping/types/innerGenericTypeArgument.kt | 31 ++ .../mapping/types/memberFunctions.kt | 28 ++ .../mapping/types/overrideAnyWithPrimitive.kt | 28 ++ .../types/parameterizedTypeArgument.kt | 25 ++ .../mapping/types/parameterizedTypes.kt | 45 +++ .../mapping/types/propertyAccessors.kt | 29 ++ .../mapping/types/rawTypeArgument.kt | 21 ++ .../reflection/mapping/types/supertypes.kt | 34 ++ .../mapping/types/topLevelFunctions.kt | 20 ++ .../mapping/types/typeParameters.kt | 24 ++ .../blackbox/reflection/mapping/types/unit.kt | 26 ++ .../mapping/types/withNullability.kt | 23 ++ ...llableReferencesEqualToCallablesFromAPI.kt | 25 ++ .../methodsFromAny/classToString.kt | 33 ++ .../extensionPropertyReceiverToString.kt | 91 +++++ .../methodsFromAny/functionEqualsHashCode.kt | 36 ++ .../methodsFromAny/functionToString.kt | 29 ++ .../methodsFromAny/memberExtensionToString.kt | 24 ++ .../parametersEqualsHashCode.kt | 31 ++ .../methodsFromAny/parametersToString.kt | 33 ++ .../methodsFromAny/propertyEqualsHashCode.kt | 34 ++ .../methodsFromAny/propertyToString.kt | 31 ++ .../methodsFromAny/typeEqualsHashCode.kt | 33 ++ .../typeParametersEqualsHashCode.kt | 42 +++ .../methodsFromAny/typeParametersToString.kt | 18 + .../reflection/methodsFromAny/typeToString.kt | 40 +++ .../typeToStringInnerGeneric.kt | 19 + .../reflection/modifiers/callableModality.kt | 54 +++ .../modifiers/callableVisibility.kt | 58 +++ .../reflection/modifiers/classModality.kt | 59 ++++ .../reflection/modifiers/classVisibility.kt | 32 ++ .../blackbox/reflection/modifiers/classes.kt | 46 +++ .../reflection/modifiers/functions.kt | 62 ++++ .../reflection/modifiers/javaVisibility.kt | 36 ++ .../reflection/modifiers/properties.kt | 25 ++ .../reflection/modifiers/typeParameters.kt | 18 + .../callFunctionsInMultifileClass.kt | 35 ++ .../callPropertiesInMultifileClass.kt | 45 +++ .../javaFieldForVarAndConstVal.kt | 75 ++++ .../noReflectAtRuntime/javaClass.kt | 36 ++ .../methodsFromAny/callableReferences.kt | 34 ++ .../methodsFromAny/classReference.kt | 27 ++ .../noReflectAtRuntime/primitiveJavaClass.kt | 23 ++ .../noReflectAtRuntime/propertyGetSetName.kt | 16 + .../noReflectAtRuntime/propertyInstanceof.kt | 37 ++ .../reifiedTypeJavaClass.kt | 25 ++ .../noReflectAtRuntime/simpleClassLiterals.kt | 17 + .../parameters/boundInnerClassConstructor.kt | 27 ++ .../parameters/boundObjectMemberReferences.kt | 26 ++ .../reflection/parameters/boundReferences.kt | 35 ++ .../parameters/findParameterByName.kt | 27 ++ .../functionParameterNameAndIndex.kt | 36 ++ ...anceExtensionReceiverAndValueParameters.kt | 39 +++ .../reflection/parameters/isMarkedNullable.kt | 23 ++ .../reflection/parameters/isOptional.kt | 29 ++ .../parameters/javaAnnotationConstructor.kt | 30 ++ .../parameters/javaParametersHaveNoNames.kt | 22 ++ .../blackbox/reflection/parameters/kinds.kt | 23 ++ .../reflection/parameters/propertySetter.kt | 29 ++ .../properties/accessors/accessorNames.kt | 35 ++ .../accessors/extensionPropertyAccessors.kt | 23 ++ .../properties/accessors/memberExtensions.kt | 25 ++ .../accessors/memberPropertyAccessors.kt | 20 ++ .../accessors/topLevelPropertyAccessors.kt | 19 + .../reflection/properties/allVsDeclared.kt | 28 ++ .../callPrivatePropertyFromGetProperties.kt | 24 ++ .../declaredVsInheritedProperties.kt | 70 ++++ .../properties/fakeOverridesInSubclass.kt | 20 ++ ...nericClassLiteralPropertyReceiverIsStar.kt | 15 + .../properties/genericOverriddenProperty.kt | 20 ++ .../reflection/properties/genericProperty.kt | 14 + ...getExtensionPropertiesMutableVsReadonly.kt | 31 ++ .../getPropertiesMutableVsReadonly.kt | 24 ++ .../reflection/properties/invokeKProperty.kt | 12 + .../javaPropertyInheritedInKotlin.kt | 20 ++ .../reflection/properties/javaStaticField.kt | 36 ++ .../kotlinPropertyInheritedInJava.kt | 52 +++ .../memberAndMemberExtensionWithSameName.kt | 28 ++ .../mutatePrivateJavaInstanceField.kt | 22 ++ .../mutatePrivateJavaStaticField.kt | 22 ++ .../noConflictOnKotlinGetterAndJavaField.kt | 35 ++ .../overrideKotlinPropertyByJavaMethod.kt | 42 +++ .../reflection/properties/privateClassVal.kt | 33 ++ .../reflection/properties/privateClassVar.kt | 35 ++ .../privateFakeOverrideFromSuperclass.kt | 13 + .../properties/privateJvmStaticVarInObject.kt | 30 ++ ...vatePropertyCallIsAccessibleOnAccessors.kt | 46 +++ .../properties/privateToThisAccessors.kt | 22 ++ .../propertyOfNestedClassAndArrayType.kt | 25 ++ .../properties/protectedClassVar.kt | 34 ++ .../properties/publicClassValAccessible.kt | 17 + .../referenceToJavaFieldOfKotlinSubclass.kt | 18 + .../properties/simpleGetProperties.kt | 28 ++ .../getMembersOfStandardJavaClasses.kt | 25 ++ .../supertypes/builtInClassSupertypes.kt | 47 +++ .../supertypes/genericSubstitution.kt | 28 ++ .../supertypes/isSubclassOfIsSuperclassOf.kt | 52 +++ .../reflection/supertypes/primitives.kt | 22 ++ .../reflection/supertypes/simpleSupertypes.kt | 52 +++ .../typeParameters/declarationSiteVariance.kt | 26 ++ .../typeParameters/typeParametersAndNames.kt | 39 +++ .../reflection/typeParameters/upperBounds.kt | 62 ++++ .../reflection/types/classifierIsClass.kt | 28 ++ .../types/classifierIsTypeParameter.kt | 26 ++ .../types/classifiersOfBuiltInTypes.kt | 115 ++++++ .../reflection/types/createType/equality.kt | 43 +++ .../types/createType/innerGeneric.kt | 29 ++ .../types/createType/simpleCreateType.kt | 21 ++ .../types/createType/typeParameter.kt | 32 ++ .../createType/wrongNumberOfArguments.kt | 52 +++ .../reflection/types/innerGenericArguments.kt | 35 ++ .../reflection/types/jvmErasureOfClass.kt | 23 ++ .../types/jvmErasureOfTypeParameter.kt | 48 +++ .../types/platformTypeClassifier.kt | 39 +++ .../types/platformTypeNotEqualToKotlinType.kt | 25 ++ .../reflection/types/platformTypeToString.kt | 27 ++ .../types/subtyping/platformType.kt | 35 ++ .../types/subtyping/simpleGenericTypes.kt | 33 ++ .../types/subtyping/simpleSubtypeSupertype.kt | 68 ++++ .../types/subtyping/typeProjection.kt | 44 +++ .../reflection/types/typeArguments.kt | 45 +++ .../reflection/types/useSiteVariance.kt | 29 ++ .../reflection/types/withNullability.kt | 33 ++ .../codegen/blackbox/regressions/Kt1149.kt | 19 + .../blackbox/regressions/Kt1619Test.kt | 19 + .../blackbox/regressions/Kt2495Test.kt | 17 + .../blackbox/regressions/arrayLengthNPE.kt | 13 + .../blackbox/regressions/collections.kt | 154 ++++++++ .../commonSupertypeContravariant.kt | 11 + .../commonSupertypeContravariant2.kt | 9 + .../blackbox/regressions/doubleMerge.kt | 10 + .../blackbox/regressions/floatMerge.kt | 10 + .../codegen/blackbox/regressions/generic.kt | 21 ++ .../regressions/getGenericInterfaces.kt | 28 ++ .../blackbox/regressions/hashCodeNPE.kt | 13 + .../internalTopLevelOtherPackage.kt | 9 + .../codegen/blackbox/regressions/kt10143.kt | 33 ++ .../codegen/blackbox/regressions/kt10934.kt | 38 ++ .../codegen/blackbox/regressions/kt1172.kt | 16 + .../codegen/blackbox/regressions/kt1202.kt | 122 +++++++ .../codegen/blackbox/regressions/kt13381.kt | 12 + .../codegen/blackbox/regressions/kt1406.kt | 29 ++ .../codegen/blackbox/regressions/kt14447.kt | 22 ++ .../codegen/blackbox/regressions/kt1515.kt | 33 ++ .../codegen/blackbox/regressions/kt1528.kt | 10 + .../codegen/blackbox/regressions/kt1568.kt | 9 + .../codegen/blackbox/regressions/kt1779.kt | 20 ++ .../codegen/blackbox/regressions/kt1800.kt | 30 ++ .../codegen/blackbox/regressions/kt1845.kt | 12 + .../codegen/blackbox/regressions/kt1932.kt | 28 ++ .../codegen/blackbox/regressions/kt2017.kt | 6 + .../codegen/blackbox/regressions/kt2060.kt | 28 ++ .../codegen/blackbox/regressions/kt2210.kt | 8 + .../codegen/blackbox/regressions/kt2246.kt | 9 + .../codegen/blackbox/regressions/kt2318.kt | 16 + .../codegen/blackbox/regressions/kt2509.kt | 12 + .../codegen/blackbox/regressions/kt2593.kt | 13 + .../codegen/blackbox/regressions/kt274.kt | 18 + .../codegen/blackbox/regressions/kt3046.kt | 25 ++ .../codegen/blackbox/regressions/kt3107.kt | 17 + .../codegen/blackbox/regressions/kt3421.kt | 9 + .../codegen/blackbox/regressions/kt344.kt | 200 +++++++++++ .../codegen/blackbox/regressions/kt3442.kt | 8 + .../codegen/blackbox/regressions/kt3587.kt | 10 + .../codegen/blackbox/regressions/kt3850.kt | 7 + .../codegen/blackbox/regressions/kt3903.kt | 11 + .../codegen/blackbox/regressions/kt4142.kt | 16 + .../codegen/blackbox/regressions/kt4259.kt | 11 + .../codegen/blackbox/regressions/kt4262.kt | 15 + .../codegen/blackbox/regressions/kt4281.kt | 16 + .../codegen/blackbox/regressions/kt5056.kt | 6 + .../codegen/blackbox/regressions/kt528.kt | 132 +++++++ .../codegen/blackbox/regressions/kt529.kt | 113 ++++++ .../codegen/blackbox/regressions/kt533.kt | 150 ++++++++ .../codegen/blackbox/regressions/kt5395.kt | 13 + .../codegen/blackbox/regressions/kt5445.kt | 30 ++ .../codegen/blackbox/regressions/kt5445_2.kt | 27 ++ .../regressions/kt5786_privateWithDefault.kt | 14 + .../codegen/blackbox/regressions/kt5953.kt | 13 + .../codegen/blackbox/regressions/kt6153.kt | 15 + .../codegen/blackbox/regressions/kt6434.kt | 33 ++ .../codegen/blackbox/regressions/kt6434_2.kt | 9 + .../codegen/blackbox/regressions/kt6485.kt | 25 ++ .../codegen/blackbox/regressions/kt715.kt | 19 + .../codegen/blackbox/regressions/kt7401.kt | 10 + .../codegen/blackbox/regressions/kt789.kt | 8 + .../codegen/blackbox/regressions/kt864.kt | 26 ++ .../codegen/blackbox/regressions/kt998.kt | 36 ++ .../regressions/nestedIntersection.kt | 19 + .../objectCaptureOuterConstructorProperty.kt | 29 ++ .../regressions/referenceToSelfInLocal.kt | 22 ++ .../blackbox/regressions/typeCastException.kt | 33 ++ .../codegen/blackbox/reified/DIExample.kt | 29 ++ .../blackbox/reified/anonymousObject.kt | 24 ++ .../reified/anonymousObjectNoPropagate.kt | 41 +++ .../anonymousObjectReifiedSupertype.kt | 25 ++ .../reified/approximateCapturedTypes.kt | 25 ++ .../reified/arraysReification/instanceOf.kt | 27 ++ .../arraysReification/instanceOfArrays.kt | 40 +++ .../reified/arraysReification/jClass.kt | 18 + .../reified/arraysReification/jaggedArray.kt | 15 + .../arraysReification/jaggedArrayOfNulls.kt | 18 + .../reified/arraysReification/jaggedDeep.kt | 17 + .../blackbox/reified/asOnPlatformType.kt | 35 ++ .../codegen/blackbox/reified/checkcast.kt | 22 ++ .../codegen/blackbox/reified/copyToArray.kt | 17 + .../blackbox/reified/defaultJavaClass.kt | 22 ++ .../blackbox/reified/filterIsInstance.kt | 21 ++ .../blackbox/reified/innerAnonymousObject.kt | 32 ++ .../codegen/blackbox/reified/instanceof.kt | 16 + .../blackbox/reified/isOnPlatformType.kt | 35 ++ .../codegen/blackbox/reified/javaClass.kt | 17 + .../codegen/blackbox/reified/nestedReified.kt | 47 +++ .../reified/nestedReifiedSignature.kt | 37 ++ .../codegen/blackbox/reified/newArrayInt.kt | 16 + .../nonInlineableLambdaInReifiedFunction.kt | 22 ++ .../reified/recursiveInnerAnonymousObject.kt | 40 +++ .../blackbox/reified/recursiveNewArray.kt | 21 ++ .../reified/recursiveNonInlineableLambda.kt | 27 ++ .../codegen/blackbox/reified/reifiedChain.kt | 36 ++ .../reified/reifiedInlineFunOfObject.kt | 26 ++ .../reifiedInlineFunOfObjectWithinReified.kt | 33 ++ .../reifiedInlineIntoNonInlineableLambda.kt | 33 ++ .../codegen/blackbox/reified/safecast.kt | 19 + .../blackbox/reified/sameIndexRecursive.kt | 25 ++ .../codegen/blackbox/reified/spreads.kt | 26 ++ .../codegen/blackbox/reified/varargs.kt | 28 ++ .../codegen/blackbox/safeCall/genericNull.kt | 8 + .../codegen/blackbox/safeCall/kt1572.kt | 23 ++ .../codegen/blackbox/safeCall/kt232.kt | 13 + .../codegen/blackbox/safeCall/kt245.kt | 32 ++ .../codegen/blackbox/safeCall/kt247.kt | 38 ++ .../codegen/blackbox/safeCall/kt3430.kt | 6 + .../codegen/blackbox/safeCall/kt4733.kt | 27 ++ .../codegen/blackbox/safeCall/primitive.kt | 8 + .../blackbox/safeCall/safeCallOnLong.kt | 6 + .../blackbox/sam/constructors/comparator.kt | 8 + .../sam/constructors/filenameFilter.kt | 16 + .../sam/constructors/nonLiteralComparator.kt | 9 + .../constructors/nonLiteralFilenameFilter.kt | 17 + .../sam/constructors/nonLiteralRunnable.kt | 9 + .../sam/constructors/nonTrivialRunnable.kt | 13 + .../blackbox/sam/constructors/runnable.kt | 9 + .../constructors/runnableAccessingClosure1.kt | 10 + .../constructors/runnableAccessingClosure2.kt | 13 + .../constructors/samWrappersDifferentFiles.kt | 26 ++ .../sam/constructors/sameWrapperClass.kt | 10 + .../sam/constructors/syntheticVsReal.kt | 14 + .../codegen/blackbox/sealed/objects.kt | 11 + .../codegen/blackbox/sealed/simple.kt | 11 + .../accessToCompanion.kt | 15 + .../accessToNestedObject.kt | 16 + .../basicNoPrimaryManySinks.kt | 35 ++ .../basicNoPrimaryOneSink.kt | 41 +++ .../secondaryConstructors/basicPrimary.kt | 39 +++ .../callFromLocalSubClass.kt | 15 + .../callFromPrimaryWithNamedArgs.kt | 11 + .../callFromPrimaryWithOptionalArgs.kt | 11 + .../secondaryConstructors/callFromSubClass.kt | 12 + .../clashingDefaultConstructors.kt | 35 ++ .../secondaryConstructors/dataClasses.kt | 53 +++ .../secondaryConstructors/defaultArgs.kt | 34 ++ .../defaultParametersNotDuplicated.kt | 15 + .../delegateWithComplexExpression.kt | 46 +++ .../delegatedThisWithLambda.kt | 9 + .../delegationWithPrimary.kt | 17 + .../blackbox/secondaryConstructors/enums.kt | 62 ++++ .../secondaryConstructors/generics.kt | 23 ++ .../secondaryConstructors/innerClasses.kt | 79 +++++ .../innerClassesInheritance.kt | 66 ++++ .../secondaryConstructors/localClasses.kt | 77 ++++ .../secondaryConstructors/superCallPrimary.kt | 53 +++ .../superCallSecondary.kt | 64 ++++ .../blackbox/secondaryConstructors/varargs.kt | 31 ++ .../secondaryConstructors/withGenerics.kt | 37 ++ .../withNonLocalReturn.kt | 24 ++ .../secondaryConstructors/withPrimary.kt | 41 +++ .../secondaryConstructors/withReturn.kt | 18 + .../secondaryConstructors/withReturnUnit.kt | 18 + .../secondaryConstructors/withVarargs.kt | 34 ++ .../secondaryConstructors/withoutPrimary.kt | 41 +++ .../codegen/blackbox/smap/chainCalls.kt | 86 +++++ .../codegen/blackbox/smap/infixCalls.kt | 66 ++++ .../blackbox/smap/simpleCallWithParams.kt | 110 ++++++ .../blackbox/smartCasts/falseSmartCast.kt | 17 + .../smartCasts/genericIntersection.kt | 9 + .../codegen/blackbox/smartCasts/genericSet.kt | 13 + .../smartCasts/implicitExtensionReceiver.kt | 7 + .../smartCasts/implicitMemberReceiver.kt | 20 ++ .../blackbox/smartCasts/implicitReceiver.kt | 13 + .../smartCasts/implicitReceiverInWhen.kt | 11 + .../blackbox/smartCasts/implicitToGrandSon.kt | 13 + .../smartCasts/lambdaArgumentWithoutType.kt | 15 + .../blackbox/smartCasts/nullSmartCast.kt | 8 + .../blackbox/smartCasts/smartCastInsideIf.kt | 15 + .../blackbox/smartCasts/whenSmartCast.kt | 9 + .../specialBuiltins/bridgeNotEmptyMap.kt | 37 ++ .../blackbox/specialBuiltins/bridges.kt | 104 ++++++ .../specialBuiltins/collectionImpl.kt | 97 +++++ .../specialBuiltins/commonBridgesTarget.kt | 25 ++ .../blackbox/specialBuiltins/emptyList.kt | 34 ++ .../blackbox/specialBuiltins/emptyMap.kt | 22 ++ .../specialBuiltins/emptyStringMap.kt | 21 ++ .../blackbox/specialBuiltins/entrySetSOE.kt | 14 + .../specialBuiltins/enumAsOrdinaled.kt | 16 + .../specialBuiltins/explicitSuperCall.kt | 10 + .../irrelevantRemoveAtOverride.kt | 104 ++++++ .../codegen/blackbox/specialBuiltins/maps.kt | 41 +++ .../noSpecialBridgeInSuperClass.kt | 59 ++++ .../specialBuiltins/notEmptyListAny.kt | 46 +++ .../blackbox/specialBuiltins/notEmptyMap.kt | 35 ++ .../specialBuiltins/redundantStubForSize.kt | 28 ++ .../removeAtTwoSpecialBridges.kt | 96 +++++ .../blackbox/specialBuiltins/throwable.kt | 10 + .../blackbox/specialBuiltins/throwableImpl.kt | 21 ++ .../specialBuiltins/valuesInsideEnum.kt | 8 + .../statics/anonymousInitializerIObject.kt | 11 + .../anonymousInitializerInClassObject.kt | 13 + .../codegen/blackbox/statics/fields.kt | 28 ++ .../codegen/blackbox/statics/functions.kt | 36 ++ .../blackbox/statics/hidePrivateByPublic.kt | 33 ++ .../blackbox/statics/incInClassObject.kt | 73 ++++ .../codegen/blackbox/statics/incInObject.kt | 71 ++++ .../statics/inheritedPropertyInClassObject.kt | 13 + .../statics/inheritedPropertyInObject.kt | 8 + .../statics/inlineCallsStaticMethod.kt | 30 ++ .../codegen/blackbox/statics/kt8089.kt | 21 ++ .../statics/protectedSamConstructor.kt | 30 ++ .../blackbox/statics/protectedStatic.kt | 38 ++ .../blackbox/statics/protectedStatic2.kt | 61 ++++ .../statics/protectedStaticAndInline.kt | 29 ++ .../blackbox/statics/syntheticAccessor.kt | 12 + .../storeStackBeforeInline/differentTypes.kt | 16 + .../storeStackBeforeInline/primitiveMerge.kt | 18 + .../blackbox/storeStackBeforeInline/simple.kt | 18 + .../unreachableMarker.kt | 26 ++ .../storeStackBeforeInline/withLambda.kt | 15 + .../codegen/blackbox/strings/ea35743.kt | 6 + .../codegen/blackbox/strings/forInString.kt | 13 + .../codegen/blackbox/strings/interpolation.kt | 9 + .../codegen/blackbox/strings/kt2592.kt | 7 + .../codegen/blackbox/strings/kt3571.kt | 6 + .../codegen/blackbox/strings/kt3652.kt | 9 + .../strings/kt5389_stringBuilderGet.kt | 4 + .../codegen/blackbox/strings/kt5956.kt | 15 + .../codegen/blackbox/strings/kt881.kt | 6 + .../codegen/blackbox/strings/kt889.kt | 12 + .../codegen/blackbox/strings/kt894.kt | 11 + .../strings/multilineStringsWithTemplates.kt | 31 ++ .../codegen/blackbox/strings/rawStrings.kt | 6 + .../strings/rawStringsWithManyQuotes.kt | 28 ++ .../blackbox/strings/stringBuilderAppend.kt | 19 + .../strings/stringPlusOnlyWorksOnString.kt | 7 + .../blackbox/super/basicmethodSuperClass.kt | 15 + .../blackbox/super/basicmethodSuperTrait.kt | 14 + .../codegen/blackbox/super/basicproperty.kt | 24 ++ .../codegen/blackbox/super/enclosedFun.kt | 31 ++ .../codegen/blackbox/super/enclosedVar.kt | 22 ++ .../blackbox/super/innerClassLabeledSuper.kt | 38 ++ .../blackbox/super/innerClassLabeledSuper2.kt | 44 +++ .../super/innerClassLabeledSuperProperty.kt | 38 ++ .../super/innerClassLabeledSuperProperty2.kt | 43 +++ .../super/innerClassQualifiedFunctionCall.kt | 46 +++ .../innerClassQualifiedPropertyAccess.kt | 45 +++ .../codegen/blackbox/super/kt14243.kt | 18 + .../codegen/blackbox/super/kt14243_2.kt | 20 ++ .../codegen/blackbox/super/kt14243_class.kt | 20 ++ .../codegen/blackbox/super/kt14243_prop.kt | 21 ++ .../codegen/blackbox/super/kt3492ClassFun.kt | 19 + .../blackbox/super/kt3492ClassProperty.kt | 15 + .../codegen/blackbox/super/kt3492TraitFun.kt | 19 + .../blackbox/super/kt3492TraitProperty.kt | 16 + .../external/codegen/blackbox/super/kt4173.kt | 18 + .../codegen/blackbox/super/kt4173_2.kt | 20 ++ .../codegen/blackbox/super/kt4173_3.kt | 27 ++ .../external/codegen/blackbox/super/kt4982.kt | 21 ++ .../blackbox/super/multipleSuperTraits.kt | 13 + .../codegen/blackbox/super/traitproperty.kt | 31 ++ .../blackbox/super/unqualifiedSuper.kt | 66 ++++ .../unqualifiedSuperWithDeeperHierarchies.kt | 63 ++++ .../super/unqualifiedSuperWithMethodsOfAny.kt | 25 ++ .../blackbox/synchronized/changeMonitor.kt | 28 ++ .../exceptionInMonitorExpression.kt | 20 ++ .../codegen/blackbox/synchronized/finally.kt | 33 ++ .../blackbox/synchronized/longValue.kt | 15 + .../synchronized/nestedDifferentObjects.kt | 18 + .../blackbox/synchronized/nestedSameObject.kt | 16 + .../blackbox/synchronized/nonLocalReturn.kt | 182 ++++++++++ .../blackbox/synchronized/objectValue.kt | 15 + .../codegen/blackbox/synchronized/sync.kt | 39 +++ .../codegen/blackbox/synchronized/value.kt | 15 + .../codegen/blackbox/synchronized/wait.kt | 22 ++ .../accessorForProtected.kt | 38 ++ .../accessorForProtectedInvokeVirtual.kt | 68 ++++ .../blackbox/syntheticAccessors/kt10047.kt | 36 ++ .../blackbox/syntheticAccessors/kt9717.kt | 12 + .../kt9717DifferentPackages.kt | 23 ++ .../blackbox/syntheticAccessors/kt9958.kt | 30 ++ .../syntheticAccessors/kt9958Interface.kt | 32 ++ .../syntheticAccessors/protectedFromLambda.kt | 28 ++ .../syntheticAccessorNames.kt | 46 +++ .../blackbox/toArray/kt3177-toTypedArray.kt | 14 + .../blackbox/toArray/returnToTypedArray.kt | 10 + .../codegen/blackbox/toArray/toArray.kt | 23 ++ .../blackbox/toArray/toArrayAlreadyPresent.kt | 40 +++ .../blackbox/toArray/toArrayShouldBePublic.kt | 50 +++ .../toArray/toArrayShouldBePublicWithJava.kt | 68 ++++ .../codegen/blackbox/toArray/toTypedArray.kt | 15 + .../noPrivateNoAccessorsInMultiFileFacade.kt | 25 ++ .../noPrivateNoAccessorsInMultiFileFacade2.kt | 30 ++ .../topLevelPrivate/privateInInlineNested.kt | 19 + .../topLevelPrivate/privateVisibility.kt | 21 ++ .../topLevelPrivate/syntheticAccessor.kt | 11 + .../syntheticAccessorInMultiFile.kt | 18 + .../abstractClassInheritsFromInterface.kt | 22 ++ .../traits/diamondPropertyAccessors.kt | 26 ++ .../codegen/blackbox/traits/genericMethod.kt | 21 ++ .../traits/indirectlyInheritPropertyGetter.kt | 10 + .../blackbox/traits/inheritJavaInterface.kt | 23 ++ .../codegen/blackbox/traits/inheritedFun.kt | 10 + .../codegen/blackbox/traits/inheritedVar.kt | 14 + .../blackbox/traits/interfaceDefaultImpls.kt | 23 ++ .../codegen/blackbox/traits/kt1936.kt | 23 ++ .../codegen/blackbox/traits/kt1936_1.kt | 13 + .../codegen/blackbox/traits/kt2260.kt | 9 + .../codegen/blackbox/traits/kt2399.kt | 44 +++ .../codegen/blackbox/traits/kt2541.kt | 7 + .../codegen/blackbox/traits/kt3315.kt | 10 + .../codegen/blackbox/traits/kt3500.kt | 18 + .../codegen/blackbox/traits/kt3579.kt | 8 + .../codegen/blackbox/traits/kt3579_2.kt | 10 + .../codegen/blackbox/traits/kt5393.kt | 17 + .../blackbox/traits/kt5393_property.kt | 20 ++ .../codegen/blackbox/traits/multiple.kt | 21 ++ .../blackbox/traits/noPrivateDelegation.kt | 19 + .../blackbox/traits/syntheticAccessor.kt | 21 ++ ...raitImplDelegationWithCovariantOverride.kt | 18 + .../blackbox/traits/traitImplDiamond.kt | 18 + .../traits/traitImplGenericDelegation.kt | 22 ++ .../traits/traitWithPrivateExtension.kt | 28 ++ .../blackbox/traits/traitWithPrivateMember.kt | 26 ++ .../traitWithPrivateMemberAccessFromLambda.kt | 26 ++ .../codegen/blackbox/typeInfo/asInLoop.kt | 13 + .../blackbox/typeInfo/ifOrWhenSpecialCall.kt | 26 ++ .../typeInfo/implicitSmartCastThis.kt | 13 + .../codegen/blackbox/typeInfo/inheritance.kt | 11 + .../codegen/blackbox/typeInfo/kt2811.kt | 25 ++ .../blackbox/typeInfo/primitiveTypeInfo.kt | 13 + .../blackbox/typeInfo/smartCastThis.kt | 11 + .../typeMapping/enhancedPrimitives.kt | 16 + .../typeMapping/genericTypeWithNothing.kt | 86 +++++ .../codegen/blackbox/typeMapping/kt2831.kt | 16 + .../codegen/blackbox/typeMapping/kt309.kt | 15 + .../codegen/blackbox/typeMapping/kt3286.kt | 13 + .../codegen/blackbox/typeMapping/kt3863.kt | 19 + .../codegen/blackbox/typeMapping/kt3976.kt | 20 ++ .../codegen/blackbox/typeMapping/nothing.kt | 5 + .../blackbox/typeMapping/nullableNothing.kt | 5 + .../typeParameterMultipleBounds.kt | 34 ++ .../typealias/genericTypeAliasConstructor.kt | 6 + .../innerClassTypeAliasConstructor.kt | 10 + ...erClassTypeAliasConstructorInSupertypes.kt | 12 + .../codegen/blackbox/typealias/simple.kt | 7 + .../blackbox/typealias/typeAliasAsBareType.kt | 11 + .../blackbox/typealias/typeAliasCompanion.kt | 9 + .../typealias/typeAliasConstructor.kt | 5 + .../typealias/typeAliasConstructorAccessor.kt | 10 + .../typeAliasConstructorInSuperCall.kt | 10 + .../typeAliasInAnonymousObjectType.kt | 7 + .../blackbox/typealias/typeAliasObject.kt | 15 + .../typealias/typeAliasObjectCallable.kt | 9 + .../typeAliasSecondaryConstructor.kt | 11 + .../external/codegen/blackbox/unaryOp/call.kt | 17 + .../codegen/blackbox/unaryOp/callNullable.kt | 17 + .../blackbox/unaryOp/callWithCommonType.kt | 8 + .../codegen/blackbox/unaryOp/intrinsic.kt | 17 + .../blackbox/unaryOp/intrinsicNullable.kt | 17 + .../codegen/blackbox/unaryOp/longOverflow.kt | 5 + .../codegen/blackbox/unit/UnitValue.kt | 8 + .../unit/closureReturnsNullableUnit.kt | 8 + .../external/codegen/blackbox/unit/ifElse.kt | 31 ++ .../external/codegen/blackbox/unit/kt3634.kt | 8 + .../external/codegen/blackbox/unit/kt4212.kt | 23 ++ .../external/codegen/blackbox/unit/kt4265.kt | 14 + .../codegen/blackbox/unit/nullableUnit.kt | 20 ++ .../blackbox/unit/nullableUnitInWhen1.kt | 12 + .../blackbox/unit/nullableUnitInWhen2.kt | 12 + .../blackbox/unit/nullableUnitInWhen3.kt | 12 + .../codegen/blackbox/unit/unitClassObject.kt | 11 + .../codegen/blackbox/vararg/kt1978.kt | 10 + .../external/codegen/blackbox/vararg/kt581.kt | 17 + .../codegen/blackbox/vararg/kt6192.kt | 93 +++++ .../codegen/blackbox/vararg/kt796_797.kt | 8 + .../blackbox/vararg/spreadCopiesArray.kt | 29 ++ .../blackbox/vararg/varargInFunParam.kt | 69 ++++ .../codegen/blackbox/vararg/varargInJava.kt | 34 ++ .../vararg/varargsAndFunctionLiterals.kt | 16 + .../codegen/blackbox/when/callProperty.kt | 12 + .../codegen/blackbox/when/emptyWhen.kt | 7 + .../blackbox/when/enumOptimization/bigEnum.kt | 52 +++ .../when/enumOptimization/duplicatingItems.kt | 27 ++ .../enumOptimization/enumInsideClassObject.kt | 31 ++ .../when/enumOptimization/expression.kt | 39 +++ .../functionLiteralInTopLevel.kt | 17 + .../enumOptimization/manyWhensWithinClass.kt | 52 +++ .../when/enumOptimization/nonConstantEnum.kt | 16 + .../when/enumOptimization/nullability.kt | 42 +++ .../when/enumOptimization/nullableEnum.kt | 14 + .../when/enumOptimization/subjectAny.kt | 28 ++ .../when/enumOptimization/withoutElse.kt | 43 +++ .../blackbox/when/exceptionOnNoMatch.kt | 14 + .../blackbox/when/exhaustiveBoolean.kt | 4 + .../blackbox/when/exhaustiveBreakContinue.kt | 14 + .../when/exhaustiveWhenInitialization.kt | 10 + .../blackbox/when/exhaustiveWhenReturn.kt | 8 + .../when/implicitExhaustiveAndReturn.kt | 9 + .../integralWhenWithNoInlinedConstants.kt | 28 ++ .../external/codegen/blackbox/when/is.kt | 11 + .../external/codegen/blackbox/when/kt2457.kt | 8 + .../external/codegen/blackbox/when/kt2466.kt | 9 + .../external/codegen/blackbox/when/kt5307.kt | 11 + .../external/codegen/blackbox/when/kt5448.kt | 22 ++ .../codegen/blackbox/when/longInRange.kt | 9 + .../when/matchNotNullAgainstNullable.kt | 7 + .../codegen/blackbox/when/multipleEntries.kt | 12 + .../codegen/blackbox/when/noElseExhaustive.kt | 9 + .../when/noElseExhaustiveStatement.kt | 12 + .../when/noElseExhaustiveUnitExpected.kt | 14 + .../blackbox/when/noElseInStatement.kt | 7 + .../codegen/blackbox/when/noElseNoMatch.kt | 8 + .../codegen/blackbox/when/nullableWhen.kt | 13 + .../external/codegen/blackbox/when/range.kt | 29 ++ .../blackbox/when/sealedWhenInitialization.kt | 15 + .../stringOptimization/duplicatingItems.kt | 21 ++ .../duplicatingItemsSameHashCode.kt | 29 ++ .../when/stringOptimization/expression.kt | 22 ++ .../when/stringOptimization/nullability.kt | 43 +++ .../when/stringOptimization/sameHashCode.kt | 28 ++ .../when/stringOptimization/statement.kt | 40 +++ .../blackbox/when/switchOptimizationDense.kt | 24 ++ .../switchOptimizationMultipleConditions.kt | 17 + .../blackbox/when/switchOptimizationSparse.kt | 17 + .../when/switchOptimizationStatement.kt | 35 ++ .../blackbox/when/switchOptimizationTypes.kt | 56 +++ .../when/switchOptimizationUnordered.kt | 17 + .../codegen/blackbox/when/typeDisjunction.kt | 15 + .../when/whenArgumentIsEvaluatedOnlyOnce.kt | 13 + 2643 files changed, 66666 insertions(+) create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/resolveWithLowPriorityAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/kt9277.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigration.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigrationInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/arrayConstructorsSimple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/arrayGetAssignMultiIndex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/arrayGetMultiIndex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/arrayPlusAssign.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/collectionAssignGetMultiIndex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/collectionGetMultiIndex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachBooleanArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachByteArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachCharArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachDoubleArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachFloatArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachIntArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachLongArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/forEachShortArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/hashMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/inProjectionAsParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/indices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/indicesChar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iterator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorBooleanArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorCharArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorDoubleArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorFloatArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorIntArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/iteratorShortArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt1291.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt238.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt2997.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt33.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt3771.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt4118.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt4348.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt4357.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt503.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt594.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt602.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt7009.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt779.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt945.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/kt950.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/longAsIndex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiArrayConstructors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/nonNullArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/stdlib.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOp.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/call.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/callAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/callNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/intrinsic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/kt11163.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/kt6747_identityEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/overflowChar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/overflowInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/overflowLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/casts.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/fold.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/foldRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5493.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5588.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5844.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6842.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/nullCheck.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/progressions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/safeCallWithElvis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/simpleUninitializedMerge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/unsafeRemoving.kt create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/variables.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/complexMultiInheritance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/complexTraitImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/delegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/delegationComplex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/delegationComplexWithList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/delegationProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/diamond.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/fakeCovariantOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverrideWithDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideOfTraitImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSeveralSuperDeclarations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSynthesizedImplementation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/genericProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/jsName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/jsNative.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt12416.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt1939.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt1959.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt2498.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt2702.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt2833.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt2920.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/kt318.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/longChainOneBridge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/manyTypeArgumentsSubstitutedSuccessively.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/methodFromTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/noBridgeOnMutableCollectionInheritance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/objectClone.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/overrideAbstractProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/overrideReturnType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/propertyAccessorsWithoutBody.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/propertyDiamond.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/propertyInConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/propertySetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simpleEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simpleGenericMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simpleObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simpleReturnType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simpleTraitImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/simpleUpperBound.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/strListContains.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/abstractFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/boundedTypeArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/delegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/enum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/genericMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/object.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/property.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/upperBound.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/traitImplInheritsTraitImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithTheSameMethodOneBridge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/customReadOnlyIterator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/delegationToArrayList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/arrayList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/mapEntry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/manyTypeParametersWithUpperBounds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/array.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/companionObjectReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simpleVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/multiCase.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/nullReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/objectReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/primitiveReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/syntheticExtensionOnLHS.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/abstractClassMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/genericMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/captureOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/classMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/closureWithSideEffect.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructorWithInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/enumExtendsTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/extension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToPrimitive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionWithClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/genericMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/localClassMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/localLocal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/recursiveClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleWithArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/unitWithSideEffect.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/privateClassMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/sortListOfStrings.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/traitImplMethodWithClassReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/traitMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/accessViaSubclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/delegated.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/delegatedMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/enumNameOrdinal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/extensionToArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/genericProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/invokePropertyReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/javaBeanConvention.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kClassInstanceIsInitializedFirst.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kt12044.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kt12982_protectedPropertyReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kt15447.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/localClassVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/overriddenInSubclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterInsideClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/simpleExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableTopLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/simpleTopLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/as.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/asSafe.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/asSafeFail.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/asUnit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/castGenericNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBounds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/intersectionTypeSmartcast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithoutGenericsAsReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/is.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/superConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/vararg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/asWithMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/isWithMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedAsWithMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedIsWithMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedSafeAsWithMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/safeAsWithMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/notIs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/casts/unitNullableCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/boxPrimitiveTypeInClinitOfClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classCompanionInitializationWithJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classNamedAsOldPackageFacade.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectAsExtensionReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectAsStaticInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectInTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectNotOfEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectWithPrivateGenericMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/classObjectsWithParentClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/defaultObjectSameNamesAsInOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegation2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegation3.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegation4.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegationGenericArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegationGenericArgUpperBound.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegationGenericLongArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/delegationMethodsWithArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/exceptionConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/extensionOnNamedClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/funDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/implementComparableInSubclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inheritSetAndHashSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inheritance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inheritedInnerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inheritedMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/initializerBlock.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/initializerBlockDImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerived.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerivedLabeled.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInSameClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/kt6708.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/properOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/properSuperLinking.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/innerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/interfaceCompanionInitializationWithJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1018.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1120.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1134.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1157.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1247.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1345.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1439.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1535.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1538.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1578.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1611.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1721.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1726.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1759.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1891.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1918.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1976.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt1980.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2224.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2288.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2384.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2390.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2391.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2395.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2417.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2477.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2480.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2482.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2485.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt249.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2532.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2566.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2566_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2607.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2626.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2711.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt2784.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt285.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt3001.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt3114.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt3414.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt343.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt3546.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt454.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt471.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt48.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt496.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt500.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt501.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt504.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt508.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt5347.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt6136.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt633.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt6816.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt707.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt723.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt725.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt8011.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt8011a.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt903.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt940.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/kt9642.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/namedClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/outerThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/overloadBinaryOperator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssign.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssignReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/overloadPlusToPlusAssign.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/overloadUnaryOperator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/privateOuterFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/privateOuterProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/privateToThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/propertyDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/propertyInInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/rightHandOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/sealedInSameFile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/selfcreate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/simpleBox.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/superConstructorCallWithComplexArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/classes/typedDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureExtensionReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/captureFunctionInProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyDeepObjectChain.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4176.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4656.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/capturedLocalGenericFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/propertyAndFunctionNameClash.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevels.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/varAsFunInsideLocalFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideConstrucor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureWithParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureWithParameterAndBoxing.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/doubleEnclosedLocalVariable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/enclosingLocalVariable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/enclosingThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/extensionClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt10044.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt11634.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt11634_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt11634_3.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt11634_4.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt2151.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt3152.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt3523.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt3738.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt3905.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt4106.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt4137.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/kt5589.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localClassFunClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localClassLambdaClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localFunctionInFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localFunctionInInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localGenericFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/localReturnWithAutolabel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/recursiveClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/simplestClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/simplestClosureAndBoxing.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/subclosuresWithinInitializers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/closures/underscoreParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/charSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/implementCollectionThroughKotlin.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/inSetWithSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListSubstitution.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantRemoveAtOverrideInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/irrelevantSizeOverrideInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/mutableList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/platformValueContains.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/readOnlyList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/readOnlyMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/removeAtInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/strList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/compatibility/dataClassEqualsHashCodeToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/constants/constantsInWhen.kt create mode 100644 backend.native/tests/external/codegen/blackbox/constants/float.kt create mode 100644 backend.native/tests/external/codegen/blackbox/constants/kt9532.kt create mode 100644 backend.native/tests/external/codegen/blackbox/constants/long.kt create mode 100644 backend.native/tests/external/codegen/blackbox/constants/privateConst.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/bottles.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInDoWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInExpr.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInDoWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInExpr.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/inlineWithStack.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt14581.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022And.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022Or.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/popSizes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/whileTrueBreak.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakInFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/compareBoxedIntegerToZero.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/conditionOfEmptyIf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/continueInExpr.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/continueInFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/continueInForCondition.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/continueInWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/continueToLabelInFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/doWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/doWhileFib.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/doWhileWithContinue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/emptyDoWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/emptyFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/emptyWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/factorialTest.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/finallyOnEmptyReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forArrayList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forArrayListMultiDecl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forInSmartCastToArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forIntArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionHasNext.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forNullableIntArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forPrimitiveIntArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/inRangeConditionsInWhen.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt12908.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt12908_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt1441.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt14839.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt1688.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt1742.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt1899.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2147.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2259.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2291.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2416.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2423.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2577.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt2597.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt299.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt3087.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt3273.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt3280.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt416.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt513.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt628.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt772.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt773.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt870.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt910.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/kt958.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/longRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/quicksort.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/ifElse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/inlineMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/propertyGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/tryCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/when.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchFinallyChain.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/catch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/complexChain.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/deadTryCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/expectException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/finally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryExpr.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt8608.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt9644try.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/try.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAfterTry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndBreak.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndContinue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideTry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/asyncIterator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/await.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/beginWithException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/beginWithExceptionNoHandleException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/coercionToUnit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/doWhileStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forContinue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/ifStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/returnFromFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/switchLikeWhen.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwFromCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwInTryWithHandleResult.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/whileStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controllerAccessFromInnerLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/defaultParametersInSuspend.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/dispatchResume.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/emptyClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/falseUnitCoercion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/generate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/handleException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/handleResultCallEmptyBody.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/handleResultNonUnitExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/handleResultSuspended.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/illegalState.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/inlineSuspendFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/inlinedTryCatchFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/innerSuspensionCalls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/instanceOfContinuation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/complicatedMerge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/i2bResult.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromByteArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/noVariableInTable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInArrayStore.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInMethodCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInPutfield.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInVarStore.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/iterateOverArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/kt12958.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/lastExpressionIsLoop.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/lastStatementInc.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/lastStementAssignment.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/lastUnitExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multiModule/inlineFunctionWithOptionalParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multiModule/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCalls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda3.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/nestedTryCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/noSuspensionPoints.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambdaDeep.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/returnByLabel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/simpleException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/simpleWithHandleResult.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/exception.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/inlineSuspendFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/suspendInCycle.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/statementLikeLastExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendFromInlineLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/manyParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendInCycle.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendInTheMiddleOfObjectConstruction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/tryCatchFinallyWithHandleResult.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/tryCatchWithHandleResult.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyInsideInlineLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyWithHandleResult.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTableSameSort.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/arrayParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/changingVarParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/constructorWithDefaultParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/copyInObjectNestedDataClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt12708.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt3033.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/valInConstructorParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/varInConstructorParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/withGenericParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclared.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/genericarray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/intarray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/nullother.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/sameinstance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/genericParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclared.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/boolean.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/byte.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/char.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/double.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/float.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/genericNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/int.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/long.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/null.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/short.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/mixedParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclaration.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclarationFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialFinalMemberInSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialMemberInSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/privateValParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclared.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/changingVarParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/genericParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/mixedParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/unitComponent.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/twoValParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/twoVarParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/unitComponent.kt create mode 100644 backend.native/tests/external/codegen/blackbox/deadCodeElimination/emptyVariableRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRangeInFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/deadCodeElimination/kt14357.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/annotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1InnerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/doubleDefArgs1InnerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithOneDefArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDefArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt2852.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt3060.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/convention/incWithDefaultInGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/convention/kt9140.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/convention/plusAssignWithDefaultInGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/abstractClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverrideGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extensionFunctionManyArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionWithOneDefArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/funInTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionManyArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/kt5232.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/memberFunctionManyArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/mixingNamedAndPositioned.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/topLevelManyArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/trait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/kt6382.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/private/primaryConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/private/secondaryConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/protected.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt2789.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9428.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9924.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/simpleFromOtherFile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/capturePropertyInClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/castGetReturnType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/castSetParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateAsInnerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByOtherProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtPropertyInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateWithPrivateSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionDelegatesWithSameNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionPropertyAndExtensionGetValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/genericDelegate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFunInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/inTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/inferredPropertyType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/kt4138.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/kt6722.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/kt9712.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalValNoInline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVarNoInline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineGetValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineOperators.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt12891.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt13557.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localValNoExplicitType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVarNoExplicitType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/privateVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/protectedVarWithPrivateSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/differentReceivers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrder.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrderVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/extensionDelegated.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/generic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/hostCheck.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inlineProvideDelegate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/kt15437.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/local.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localDifferentReceivers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/memberExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/propertyMetadata.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFunInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/twoPropByOneDelegete.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/useKPropertyLater.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/valInInnerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/varInInnerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/delegation/kt8154.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/extensionComponents.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/generic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/inline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/otherParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/stdlibUsages.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/underscoreNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/withIndexed.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.txt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.kt create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.txt create mode 100644 backend.native/tests/external/codegen/blackbox/elvis/genericNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/elvis/kt6694ExactAnnotationForElvis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/elvis/nullNullOk.kt create mode 100644 backend.native/tests/external/codegen/blackbox/elvis/primitive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/abstractMethodInEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/abstractNestedClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/asReturnExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/companionObjectInEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/emptyEnumValuesValueOf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/enumInheritedFromTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/enumShort.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/enumWithLambdaParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/inPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/inclassobj.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/inner.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/innerWithExistingClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/kt1119.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/kt2350.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/kt9711.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/objectInEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/ordinal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/sortEnumEntries.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/superCallInEnumLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/toString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/enum/valueof.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/char.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/divide.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/kt9443.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/minus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/mod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/plus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/exclExcl/genericNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/exclExcl/primitive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/executionOrder.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1061.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1249.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1290.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1776.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953_class.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3285.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3298.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3969.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt4228.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt475.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt5467.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/kt865.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/nested2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/shared.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/thisMethodInObjectLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/virtual.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/accessorForPrivateSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/genericValForPrimitiveType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/genericVarForPrimitiveType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/inClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/inClassLongTypeInReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897_topLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/topLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/topLevelLongTypeInReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fakeOverride/diamondFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fakeOverride/function.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fakeOverride/propertyGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fakeOverride/propertySetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fieldRename/constructorAndClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fieldRename/delegates.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fieldRename/genericPropertyWithItself.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/finallyAndFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/kt3549.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/kt3706.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/kt3867.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/kt3874.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/kt3894.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/kt4134.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/loopAndFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/notChainCatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/tryFinally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/finally/tryLoopTry.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/charBuffer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/classpath.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/ifInWhile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/intCountDownLatchExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/kt434.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/platformTypeAssertionStackTrace.kt create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/coerceVoidToArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/coerceVoidToObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs3.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs4.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs5.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs6.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/defaultargs7.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/ea33909.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/fakeDescriptorWithSeveralOverridenOne.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpressionWithThisReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionLiteralExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionExpression/underscoreParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/infixRecursiveCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/extensionInvokeOnExpr.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/invoke.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnExprByConvention.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3189.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3297.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3450getAndInvoke.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3631invokeOnString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3772.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3821invokeOnThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt1038.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt1199.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt1413.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt1649_1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt1649_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt1739.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2270.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2271.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2280.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2481.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2716.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2739.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt2929.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt3214.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt3313.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt3573.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt3724.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt395.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt785.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/kt873.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/callInlineLocalInLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt2895.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3308.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3978.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4514.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4783.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4784.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/localExtensionOnNullableParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/localFunctionInConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localReturnInsideFunctionExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/nothisnoclosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/prefixRecursiveCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/recursiveCompareTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/functions/recursiveIncrementCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/anyToReal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/equalsDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/equalsFloat.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/equalsNullableDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/generic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/greaterDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/greaterFloat.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/inline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/lessDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/lessFloat.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/nullableAnyToReal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/when.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/whenNoSubject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/arrayElement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/assignPlusOnSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/augmentedAssignmentWithComplexRhs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/classNaryGetSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/classWithGetSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/extOnLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/genericClassWithGetSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/memberExtOnLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/mutableListElement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/nullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixIncrementDoubleSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClassSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnShortSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixNullableClassIncrement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/postfixNullableIncrement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClassSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/prefixNullableClassIncrement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/increment/prefixNullableIncrement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/createNestedClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/createdNestedInOuterMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/extensionFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/extensionToNested.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/importNestedClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/innerGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/innerGenericClassFromJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/innerJavaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/innerLabeledThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/innerSimple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/kt3132.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/kt3927.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/kt5363.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/kt6804.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedClassInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedEnumConstant.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedInPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedObjects.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/nestedSimple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClassFromJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepInnerHierarchy.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepLocalHierarchy.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsInner.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassVararg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInner.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/charToInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/ea35953.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/incWithLabel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt12125.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/longRangeWithExplicitDot.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/prefixIncDec.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/rangeFromCollection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/stringFromCollection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/mapPut.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHashSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHierarchy.kt create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jdk/arrayList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jdk/hashMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jdk/iteratingOverHashMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jdk/kt1397.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/labels/labeledDeclarations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/labels/propertyAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/labels/propertyAccessorFunctionLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/labels/propertyAccessorInnerExtensionFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/labels/propertyAccessorObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/labels/propertyInClassAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/exceptionInFieldInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/ifElse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/increment.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateConstantCompare.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVarChain.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrueVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/noOptimization.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssign.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssignComplex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/safeCallAndArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/toString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/tryCatchExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/when.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInParameterInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/closureOfInnerLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/closureOfLambdaInLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/closureWithSelfInstantiation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/inExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/inExtensionProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/innerClassInLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/innerOfLocalCaptureExtensionReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/kt2700.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/kt2873.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/kt3210.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/kt3389.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/kt3584.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/kt4174.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/localClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/localClassCaptureExtensionReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/localClassInInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/localClassInParameterInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/localDataClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/localExtendsInnerAndReferencesOuterMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/noclosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/object.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/ownClosureOfInnerLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/withclosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/field.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/fun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/internalOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/internalOverrideSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/publicOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/publicOverrideSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/ComplexInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/SimpleValsExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVarsExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/UnderscoreNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInFunctionLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInLocalFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInObjectLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInFunctionLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInLocalFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInObjectLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/component.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/kt9828_hashMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/returnInElvis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt create mode 100644 backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt6895.kt create mode 100644 backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt9644let.kt create mode 100644 backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt create mode 100644 backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objectIntrinsics/objects.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/anonymousObjectPropertyInitialization.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/classCallsProtectedInheritedByCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/flist.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/initializationOrder.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt1047.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt11117.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt1136.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt1186.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt1600.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt1737.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt2398.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt2663.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt2675.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt2719.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt2822.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt3238.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt3684.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt4086.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt535.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt560.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/kt694.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/localFunctionInObjectInitializer_kt4516.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/methodOnObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/nestedDerivedClassCallsProtectedFromCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/nestedObjectWithSuperclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectExtendsInnerAndReferencesOuterMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectInLocalAnonymousObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectInitialization_kt5523.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectLiteralInClosure.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectVsClassInitialization_kt5291.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclassAndTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/privateExtensionFromInitializer_kt4543.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/privateFunctionFromClosureInInitializer_kt5582.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/receiverInConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/safeAccess.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/simpleObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/thisInConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/useAnonymousObjectAsIterator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/useImportedMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/objects/useImportedMemberFromCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/annotatedAssignment.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/assignmentOperations.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/augmentedAssignmentWithArrayLHS.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/comparable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longDouble.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/incDecOnObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/kt4152.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/nestedMaps.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/operatorSetLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/overloadedSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/remAssignmentOperation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/remOverModOperation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/boxPrimitiveTypeInClinit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/checkCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/incrementProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/invokespecial.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/nullablePrimitiveNoFieldInitializer.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/packageLocalClassNotImportedWithDefaultImport.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/packageQualifiedMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/package/privateTopLevelPropAndVarInInner.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/assign.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/compareTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/dec.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/div.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/equals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/hashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/inc.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/minus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/mod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/not.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/notEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plusAssign.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/rangeTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/times.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toShort.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryMinus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryPlus.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNullCallsFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/ea35963.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/equalsHashCodeToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/incrementByteCharShort.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/intLiteralIsNotNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1054.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1055.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1093.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt13023.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt14868.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1508.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1634.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2251.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2269.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2275.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt239.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt242.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt248.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2768.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2794.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3078.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3517.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3576.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3613.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4097.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4098.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4210.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4251.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt446.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt518.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt6590_identityEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt665.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt711.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt737.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt828.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt877.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt882.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt887.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/nullAsNullableIntIsNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/nullableCharBoolean.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/rangeTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/unboxComparable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/private/arrayConvention.kt create mode 100644 backend.native/tests/external/codegen/blackbox/private/kt9855.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/base.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/captured.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/companion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/inline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/inner.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/kt4860.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/secondary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/withArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/withDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedObjects.kt create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/withVarargs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/accessToPrivateProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/augmentedAssignmentsAndIncrements.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/classArtificialFieldInsideNested.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLocalInSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/classFieldInsideNested.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/classObjectProperties.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/classPrivateArtificialFieldInsideNested.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/companionFieldInsideLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/companionPrivateField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/companionPrivateFieldInsideLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/field.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/fieldInClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/fieldInsideField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/fieldInsideLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/fieldInsideNested.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/fieldSimple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/generalAccess.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt10715.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt10729.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1159.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1165.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1168.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1170.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt12200.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1398.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1417.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1714.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1714_minimal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt1892.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt2331.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt257.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt2655.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt2786.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt2892.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt3118.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt3524.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt3551.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt3556.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt3930.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt4140.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt4252.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt4252_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt4340.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt4373.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt4383.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt613.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt8928.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/kt9603.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/accessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/override.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetterFromLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/simpleVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDefaultAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDelegateAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/privatePropertyInConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/privatePropertyWithoutBackingField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt create mode 100644 backend.native/tests/external/codegen/blackbox/properties/typeInferredFromGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt create mode 100644 backend.native/tests/external/codegen/blackbox/publishedApi/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/publishedApi/topLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/rangeContainsString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/emptyDownto.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/emptyRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/openRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/reversedBackSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyBackSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/reversedInexactSteppedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/reversedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/reversedSimpleSteppedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/simpleDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRangeWithNonConstantEnds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forByteProgressionWithIntIncrement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forLongInDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forNullableIntInDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCharSequenceIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInNonOptimizedIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInObjectArrayIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInPrimitiveArrayIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInArrayIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInCollectionIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_CharSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Collection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInRangeWithImplicitReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forIntRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/emptyDownto.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/emptyRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/openRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/reversedBackSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyBackSequence.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/reversedInexactSteppedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/reversedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/reversedSimpleSteppedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/simpleDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRangeWithNonConstantEnds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedDownTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/progressionExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/simpleClassLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/localClassSimpleName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/javaMethodsSmokeTest.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/rawTypeArgument.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyGetSetName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyInstanceof.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeClassifier.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeToString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/Kt1149.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/Kt1619Test.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/Kt2495Test.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/arrayLengthNPE.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/collections.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/doubleMerge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/floatMerge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/generic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/hashCodeNPE.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/internalTopLevelOtherPackage.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt10143.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt10934.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1202.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt13381.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1406.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt14447.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1528.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1779.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1800.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1845.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2017.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2060.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2210.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2509.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt274.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3107.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3421.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt344.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3442.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3587.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3850.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt3903.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt4142.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt4281.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt5056.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt528.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt529.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt533.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt5395.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt5786_privateWithDefault.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt5953.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt6153.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt6434_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt715.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt7401.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt789.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt864.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/kt998.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/objectCaptureOuterConstructorProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/DIExample.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedDeep.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/checkcast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/copyToArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/instanceof.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/javaClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/reifiedChain.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/safecast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/spreads.kt create mode 100644 backend.native/tests/external/codegen/blackbox/reified/varargs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/genericNull.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/kt1572.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/kt245.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/kt247.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/kt3430.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/kt4733.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/primitive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/safeCallOnLong.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/comparator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralComparator.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralRunnable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/nonTrivialRunnable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/runnable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/syntheticVsReal.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sealed/objects.kt create mode 100644 backend.native/tests/external/codegen/blackbox/sealed/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToNestedObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryManySinks.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryOneSink.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicPrimary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromLocalSubClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithNamedArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromSubClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/clashingDefaultConstructors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/dataClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultArgs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultParametersNotDuplicated.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegateWithComplexExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegatedThisWithLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegationWithPrimary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/enums.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/generics.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClassesInheritance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/localClasses.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallPrimary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallSecondary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/varargs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withGenerics.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withPrimary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturnUnit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withVarargs.kt create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/withoutPrimary.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smap/chainCalls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smap/infixCalls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smap/simpleCallWithParams.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/falseSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/genericIntersection.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/genericSet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/implicitExtensionReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/implicitMemberReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiver.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiverInWhen.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/implicitToGrandSon.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/nullSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/smartCastInsideIf.kt create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/whenSmartCast.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/bridges.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/commonBridgesTarget.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyStringMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/entrySetSOE.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/enumAsOrdinaled.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/explicitSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/irrelevantRemoveAtOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/maps.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/noSpecialBridgeInSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/redundantStubForSize.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/removeAtTwoSpecialBridges.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/throwable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/throwableImpl.kt create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/valuesInsideEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerIObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerInClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/fields.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/functions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/incInClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/incInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/kt8089.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt create mode 100644 backend.native/tests/external/codegen/blackbox/statics/syntheticAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/differentTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/primitiveMerge.kt create mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/unreachableMarker.kt create mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/withLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/ea35743.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/forInString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/interpolation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt2592.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt3571.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt3652.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt5389_stringBuilderGet.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt5956.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt881.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt889.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/kt894.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/multilineStringsWithTemplates.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/rawStrings.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/rawStringsWithManyQuotes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt create mode 100644 backend.native/tests/external/codegen/blackbox/strings/stringPlusOnlyWorksOnString.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/basicmethodSuperClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/basicmethodSuperTrait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/basicproperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/enclosedFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/enclosedVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedFunctionCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedPropertyAccess.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt14243.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt14243_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt14243_class.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt14243_prop.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt3492ClassFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt3492ClassProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt3492TraitFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt3492TraitProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt4173.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt4173_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt4173_3.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/kt4982.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/multipleSuperTraits.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/traitproperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/unqualifiedSuper.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithDeeperHierarchies.kt create mode 100644 backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithMethodsOfAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/finally.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/sync.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/value.kt create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/wait.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtected.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtectedInvokeVirtual.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt10047.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717DifferentPackages.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958Interface.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/protectedFromLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/kt3177-toTypedArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/returnToTypedArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/toArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/toArrayAlreadyPresent.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublicWithJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateInInlineNested.kt create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/genericMethod.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/indirectlyInheritPropertyGetter.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/inheritedFun.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/inheritedVar.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt1936.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt1936_1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt2260.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt2399.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt2541.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt3315.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt3500.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt3579.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt3579_2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt5393.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/kt5393_property.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/multiple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/syntheticAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/traitImplDelegationWithCovariantOverride.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/traitImplGenericDelegation.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateExtension.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMember.kt create mode 100644 backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMemberAccessFromLambda.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/ifOrWhenSpecialCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/implicitSmartCastThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/inheritance.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/kt2811.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/primitiveTypeInfo.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/smartCastThis.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/kt2831.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/kt3286.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/kt3863.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/kt3976.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/nothing.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/nullableNothing.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/genericTypeAliasConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructorInSupertypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/simple.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasAsBareType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasCompanion.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorAccessor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorInSuperCall.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasInAnonymousObjectType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasObjectCallable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/typeAliasSecondaryConstructor.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/call.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/callNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/callWithCommonType.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/intrinsic.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/intrinsicNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/longOverflow.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/closureReturnsNullableUnit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/ifElse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/kt3634.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/kt4212.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/kt4265.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/nullableUnit.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen1.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen2.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen3.kt create mode 100644 backend.native/tests/external/codegen/blackbox/unit/unitClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/kt1978.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/kt581.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/kt6192.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/kt796_797.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/spreadCopiesArray.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/varargInFunParam.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/varargsAndFunctionLiterals.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/callProperty.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/emptyWhen.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/bigEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/duplicatingItems.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/enumInsideClassObject.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/expression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/functionLiteralInTopLevel.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/manyWhensWithinClass.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/nonConstantEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullability.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullableEnum.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/subjectAny.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/withoutElse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/exceptionOnNoMatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/exhaustiveBoolean.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/exhaustiveBreakContinue.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenInitialization.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/implicitExhaustiveAndReturn.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/is.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/kt2457.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/kt2466.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/kt5307.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/kt5448.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/longInRange.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/matchNotNullAgainstNullable.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/multipleEntries.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/noElseExhaustive.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveUnitExpected.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/noElseInStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/noElseNoMatch.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/nullableWhen.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/range.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/sealedWhenInitialization.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItems.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/expression.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/nullability.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/statement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/switchOptimizationDense.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/switchOptimizationMultipleConditions.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/switchOptimizationSparse.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/switchOptimizationStatement.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/switchOptimizationTypes.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/switchOptimizationUnordered.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/typeDisjunction.kt create mode 100644 backend.native/tests/external/codegen/blackbox/when/whenArgumentIsEvaluatedOnlyOnce.kt diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt new file mode 100644 index 00000000000..94de7d80a76 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KT-5665 + +@Retention(AnnotationRetention.RUNTIME) +annotation class First + +@Retention(AnnotationRetention.RUNTIME) +annotation class Second(val value: String) + +enum class E { + @First + E1 { + fun foo() = "something" + }, + + @Second("OK") + E2 +} + +fun box(): String { + val e = E::class.java + + val e1 = e.getDeclaredField(E.E1.toString()).getAnnotations() + if (e1.size != 1) return "Fail E1 size: ${e1.toList()}" + if (e1[0].annotationClass.java != First::class.java) return "Fail E1: ${e1.toList()}" + + val e2 = e.getDeclaredField(E.E2.toString()).getAnnotations() + if (e2.size != 1) return "Fail E2 size: ${e2.toList()}" + if (e2[0].annotationClass.java != Second::class.java) return "Fail E2: ${e2.toList()}" + + return (e2[0] as Second).value +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt new file mode 100644 index 00000000000..2371d050fbe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import java.lang.reflect.Method +import kotlin.test.assertEquals + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) + +fun foo0(block: () -> Unit) = block.javaClass +fun foo1(block: (String) -> Unit) = block.javaClass + +fun testMethod(method: Method, name: String) { + assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") + + for ((index, annotations) in method.getParameterAnnotations().withIndex()) { + val ann = annotations.filterIsInstance().single() + assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") + } +} + +fun testClass(clazz: Class<*>, name: String) { + val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } + testMethod(invokes, name) +} + +fun box(): String { + testClass(foo0( @Ann("OK") fun() {} ), "1") + testClass(foo1( @Ann("OK") fun(@Ann("OK0") x: String) {} ), "2") + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt new file mode 100644 index 00000000000..deb25de9a0c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import java.lang.reflect.Method +import kotlin.test.assertEquals + +@Target(AnnotationTarget.FUNCTION) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) + +fun foo0(block: () -> Unit) = block.javaClass + +fun testMethod(method: Method, name: String) { + assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") + + for ((index, annotations) in method.getParameterAnnotations().withIndex()) { + val ann = annotations.filterIsInstance().single() + assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") + } +} + +fun testClass(clazz: Class<*>, name: String) { + val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } + testMethod(invokes, name) +} + +fun box(): String { + testClass(foo0(@Ann("OK") { }), "1") + testClass(foo0( @Ann("OK") { }), "2") + + testClass(foo0() @Ann("OK") { }, "3") + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt new file mode 100644 index 00000000000..01fc57353ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt @@ -0,0 +1,49 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class Test { + public static Class apply(Runnable x) { + return x.getClass(); + } + + public static interface ABC { + void apply(String x1, String x2); + } + + public static Class applyABC(ABC x) { + return x.getClass(); + } +} + +// FILE: test.kt + +import java.lang.reflect.Method +import kotlin.test.assertEquals + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) + +fun testMethod(method: Method, name: String) { + assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") + + for ((index, annotations) in method.getParameterAnnotations().withIndex()) { + val ann = annotations.filterIsInstance().single() + assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") + } +} + +fun testClass(clazz: Class<*>, name: String) { + val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } + testMethod(invokes, name) +} + +fun box(): String { + testClass(Test.apply(@Ann("OK") fun(){}), "1") + + testClass(Test.applyABC(@Ann("OK") fun(@Ann("OK0") x: String, @Ann("OK1") y: String){}), "2") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt new file mode 100644 index 00000000000..10f0a77f6b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class Test { + public static Class apply(Runnable x) { + return x.getClass(); + } +} + +// FILE: test.kt + +import java.lang.reflect.Method +import kotlin.test.assertEquals + +@Target(AnnotationTarget.FUNCTION) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) + +fun testMethod(method: Method, name: String) { + assertEquals("OK", method.getAnnotation(Ann::class.java).x, "On method of test named `$name`") + + for ((index, annotations) in method.getParameterAnnotations().withIndex()) { + val ann = annotations.filterIsInstance().single() + assertEquals("OK$index", ann.x, "On parameter $index of test named `$name`") + } +} + +fun testClass(clazz: Class<*>, name: String) { + val invokes = clazz.getDeclaredMethods().single() { !it.isBridge() } + testMethod(invokes, name) +} + +fun box(): String { + testClass(Test.apply(@Ann("OK") {}), "1") + testClass(Test.apply @Ann("OK") {}, "2") + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt new file mode 100644 index 00000000000..1330899c02c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +annotation class Ann(val v: String = "???") +@Ann open class My +fun box(): String { + val v = @Ann("OK") object: My() {} + val klass = v.javaClass + + val annotations = klass.annotations.toList() + // Ann, kotlin.Metadata + if (annotations.size != 2) return "Fail annotations size is ${annotations.size}: $annotations" + val annotation = annotations.filterIsInstance().firstOrNull() + ?: return "Fail no @Ann: $annotations" + + return annotation.v +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt new file mode 100644 index 00000000000..446a67e91ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: JavaClass.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +public class JavaClass { + + @Retention(RetentionPolicy.RUNTIME) + @interface Foo { + int value(); + } + + @Foo(KotlinClass.FOO_INT) + public String test() throws NoSuchMethodException { + return KotlinClass.FOO_STRING + + JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); + } +} + +// FILE: kotlinClass.kt + +class KotlinClass { + companion object { + const val FOO_INT: Int = 10 + @JvmField val FOO_STRING: String = "OK" + } +} + +fun box(): String { + val test = JavaClass().test() + return if (test == "OK10") "OK" else "fail : $test" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt new file mode 100644 index 00000000000..800662eb8af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +public class JavaClass { + + @Retention(RetentionPolicy.RUNTIME) + @interface Foo { + int value(); + } + + @Foo(KotlinInterface.FOO_INT) + public String test() throws NoSuchMethodException { + return KotlinInterface.FOO_STRING + + JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); + } +} + +// FILE: KotlinInterface.kt + +interface KotlinInterface { + companion object { + const val FOO_INT: Int = 10 + const val FOO_STRING: String = "OK" + } +} + +fun box(): String { + val test = JavaClass().test() + return if (test == "OK10") "OK" else "fail : $test" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt new file mode 100644 index 00000000000..af44539ed67 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: Int) +class A { + @Ann(1) fun foo(x: Int, y: Int = 2, z: Int) {} + + @Ann(1) constructor(x: Int, y: Int = 2, z: Int) +} + +class B @Ann(1) constructor(x: Int, y: Int = 2, z: Int) {} + +fun test(name: String, annotations: Array) { + assertEquals(1, annotations.filterIsInstance().single().x, "$name[0]") +} + +fun box(): String { + val foo = A::class.java.getDeclaredMethods().first { it.getName() == "foo" } + test("foo", foo.getDeclaredAnnotations()) + + val fooDefault = A::class.java.getDeclaredMethods().first { it.getName() == "foo\$default" } + test("foo", foo.getDeclaredAnnotations()) + + val (secondary, secondaryDefault) = A::class.java.getDeclaredConstructors().partition { it.getParameterTypes().size == 3 } + + test("secondary", secondary[0].getDeclaredAnnotations()) + test("secondary\$default", secondaryDefault[0].getDeclaredAnnotations()) + + val (primary, primaryDefault) = B::class.java.getConstructors().partition { it.getParameterTypes().size == 3 } + + test("primary", primary[0].getDeclaredAnnotations()) + test("primary\$default", primaryDefault[0].getDeclaredAnnotations()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt new file mode 100644 index 00000000000..3e49c7af76d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import kotlin.annotation.AnnotationTarget.* +import kotlin.annotation.AnnotationRetention.* +import java.lang.Class + +@Target(TYPEALIAS) +@Retention(RUNTIME) +annotation class Ann(val x: Int) + +@Ann(2) +typealias TA = Any + +fun Class<*>.assertHasDeclaredMethodWithAnn() { + if (!declaredMethods.any { it.isSynthetic && it.getAnnotation(Ann::class.java) != null }) { + throw java.lang.AssertionError("Class ${this.simpleName} has no declared method with annotation @Ann") + } +} + +fun box(): String { + Class.forName("AnnotationsOnTypeAliasesKt").assertHasDeclaredMethodWithAnn() + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt b/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt new file mode 100644 index 00000000000..fca68cd7665 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt @@ -0,0 +1,41 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val i: Int = 1, + val s: String = "a", + val a: Ann2 = Ann2(), + val e: MyEnum = MyEnum.A, + val c: KClass<*> = A::class, + val ia: IntArray = intArrayOf(1, 2), + val sa: Array = arrayOf("a", "b") +) + +fun box(): String { + val ann = MyClass::class.java.getAnnotation(Ann::class.java) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" + if (ann.s != "a") return "fail: annotation parameter s should be \"a\", but was ${ann.s}" + val annSimpleName = ann.a.annotationClass.java.getSimpleName() + if (annSimpleName != "Ann2") return "fail: annotation parameter a should be of class Ann2, but was $annSimpleName" + if (ann.e != MyEnum.A) return "fail: annotation parameter e should be MyEnum.A, but was ${ann.e}" + if (ann.c.java != A::class.java) return "fail: annotation parameter c should be of class A, but was ${ann.c}" + if (ann.ia[0] != 1 || ann.ia[1] != 2) return "fail: annotation parameter ia should be [1, 2], but was ${ann.ia}" + if (ann.sa[0] != "a" || ann.sa[1] != "b") return "fail: annotation parameter ia should be [\"a\", \"b\"], but was ${ann.sa}" + return "OK" +} + +annotation class Ann2 + +enum class MyEnum { + A +} + +class A + +@Ann class MyClass diff --git a/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt b/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt new file mode 100644 index 00000000000..8b2ccb17d17 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KProperty + +@Retention(AnnotationRetention.RUNTIME) +annotation class First + +class MyClass() { + public var x: String by Delegate() + @First set +} + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): String { + return "OK" + } + + operator fun setValue(t: Any?, p: KProperty<*>, i: String) {} +} + +fun box(): String { + val e = MyClass::class.java + + val e1 = e.getDeclaredMethod("setX", String::class.java).getAnnotations() + if (e1.size != 1) return "Fail E1 size: ${e1.toList()}" + if (e1[0].annotationClass.java != First::class.java) return "Fail: ${e1.toList()}" + + return MyClass().x +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt b/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt new file mode 100644 index 00000000000..d975f9cf8c1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:StringHolder("OK") +@file:JvmName("FileClass") + +@Target(AnnotationTarget.FILE) +@Retention(AnnotationRetention.RUNTIME) +public annotation class StringHolder(val value: String) + +fun box(): String = + Class.forName("FileClass").getAnnotation(StringHolder::class.java)?.value ?: "null" diff --git a/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt b/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt new file mode 100644 index 00000000000..91dc2705c9d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import java.lang.reflect.Modifier +import kotlin.reflect.KProperty + +class CustomDelegate { + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name +} + +class C { + @Volatile var vol = 1 + @Transient val tra = 1 + @delegate:Transient val del: String by CustomDelegate() + + @Strictfp fun str() {} + @Synchronized fun sync() {} +} + +fun box(): String { + val c = C::class.java + + if (c.getDeclaredField("vol").getModifiers() and Modifier.VOLATILE == 0) return "Fail: volatile" + if (c.getDeclaredField("tra").getModifiers() and Modifier.TRANSIENT == 0) return "Fail: transient" + if (c.getDeclaredField("del\$delegate").getModifiers() and Modifier.TRANSIENT == 0) return "Fail: delegate transient" + + if (c.getDeclaredMethod("str").getModifiers() and Modifier.STRICT == 0) return "Fail: strict" + if (c.getDeclaredMethod("sync").getModifiers() and Modifier.SYNCHRONIZED == 0) return "Fail: synchronized" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt new file mode 100644 index 00000000000..2aa20e7956e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str) class MyClass + +fun box(): String { + val ann = MyClass::class.java.getAnnotation(Ann::class.java) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.d != 2.toDouble()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.l != 2.toLong()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.b != 2.toByte()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (!ann.bool) return "fail: annotation parameter i should be true, but was ${ann.i}" + if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}" + if (ann.str != "str") return "fail: annotation parameter i should be str, but was ${ann.i}" + return "OK" +} + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val i: Int, + val s: Short, + val f: Float, + val d: Double, + val l: Long, + val b: Byte, + val bool: Boolean, + val c: Char, + val str: String +) + +class Foo { + companion object { + const val i: Int = 2 + const val s: Short = 2 + const val f: Float = 2.0.toFloat() + const val d: Double = 2.0 + const val l: Long = 2 + const val b: Byte = 2 + const val bool: Boolean = true + const val c: Char = 'c' + const val str: String = "str" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt new file mode 100644 index 00000000000..fbd36775d01 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Ann(i, s, f, d, l, b, bool, c, str) class MyClass + +fun box(): String { + val ann = MyClass::class.java.getAnnotation(Ann::class.java) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.i != 2) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.s != 2.toShort()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.f != 2.toFloat()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.d != 2.toDouble()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.l != 2.toLong()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (ann.b != 2.toByte()) return "fail: annotation parameter i should be 2, but was ${ann.i}" + if (!ann.bool) return "fail: annotation parameter i should be true, but was ${ann.i}" + if (ann.c != 'c') return "fail: annotation parameter i should be c, but was ${ann.i}" + if (ann.str != "str") return "fail: annotation parameter i should be str, but was ${ann.i}" + return "OK" +} + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val i: Int, + val s: Short, + val f: Float, + val d: Double, + val l: Long, + val b: Byte, + val bool: Boolean, + val c: Char, + val str: String +) + +const val i: Int = 2 +const val s: Short = 2 +const val f: Float = 2.0.toFloat() +const val d: Double = 2.0 +const val l: Long = 2 +const val b: Byte = 2 +const val bool: Boolean = true +const val c: Char = 'c' +const val str: String = "str" diff --git a/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt b/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt new file mode 100644 index 00000000000..79e06313c63 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +annotation class A + +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.RUNTIME) +annotation class B(val items: Array = arrayOf(A())) + +@B +class C + +fun box(): String { + val bClass = B::class.java + val cClass = C::class.java + + val items = cClass.getAnnotation(bClass).items + assert(items.size == 1) { "Expected: [A()], got ${items.asList()}" } + assert(items[0] is A) { "Expected: [A()], got ${items.asList()}" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt new file mode 100644 index 00000000000..72369ea0378 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Ann(A.B.i) class MyClass + +fun box(): String { + val ann = MyClass::class.java.getAnnotation(Ann::class.java) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" + return "OK" +} + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val i: Int) + +class A { + class B { + companion object { + const val i = 1 + } + } +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt b/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt new file mode 100644 index 00000000000..f3a8d612cb5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val b: Byte, + val s: Short, + val i: Int, + val f: Float, + val d: Double, + val l: Long, + val c: Char, + val bool: Boolean +) + +fun box(): String { + val ann = MyClass::class.java.getAnnotation(Ann::class.java) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.b != 1.toByte()) return "fail: annotation parameter b should be 1, but was ${ann.b}" + if (ann.s != 1.toShort()) return "fail: annotation parameter s should be 1, but was ${ann.s}" + if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" + if (ann.f != 1.toFloat()) return "fail: annotation parameter f should be 1, but was ${ann.f}" + if (ann.d != 1.0) return "fail: annotation parameter d should be 1, but was ${ann.d}" + if (ann.l != 1.toLong()) return "fail: annotation parameter l should be 1, but was ${ann.l}" + if (ann.c != 'c') return "fail: annotation parameter c should be 1, but was ${ann.c}" + if (!ann.bool) return "fail: annotation parameter bool should be 1, but was ${ann.bool}" + return "OK" +} + +@Ann(1, 1, 1, 1.0.toFloat(), 1.0, 1, 'c', true) class MyClass diff --git a/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt new file mode 100644 index 00000000000..af730102904 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Ann(i) class MyClass + +fun box(): String { + val ann = MyClass::class.java.getAnnotation(Ann::class.java) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" + return "OK" +} + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val i: Int) + +const val i2: Int = 1 +const val i: Int = i2 diff --git a/backend.native/tests/external/codegen/blackbox/annotations/resolveWithLowPriorityAnnotation.kt b/backend.native/tests/external/codegen/blackbox/annotations/resolveWithLowPriorityAnnotation.kt new file mode 100644 index 00000000000..9b51c9fdb51 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/resolveWithLowPriorityAnnotation.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@kotlin.internal.LowPriorityInOverloadResolution +fun foo(i: Int) = 1 + +fun foo(a: Any) = 2 + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@kotlin.internal.LowPriorityInOverloadResolution +fun bar(a: String?) = 3 + +fun bar(a: Any) = 4 + +fun box(): String { + if (foo(1) != 2) return "fail1" + if (bar(null) != 3) return "fail2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt new file mode 100644 index 00000000000..405deb725a9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt @@ -0,0 +1,53 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(vararg val p: Int) + +@Ann() class MyClass1 +@Ann(1) class MyClass2 +@Ann(1, 2) class MyClass3 + +@Ann(*intArrayOf()) class MyClass4 +@Ann(*intArrayOf(1)) class MyClass5 +@Ann(*intArrayOf(1, 2)) class MyClass6 + +@Ann(p = 1) class MyClass7 + +@Ann(p = *intArrayOf()) class MyClass8 +@Ann(p = *intArrayOf(1)) class MyClass9 +@Ann(p = *intArrayOf(1, 2)) class MyClass10 + +fun box(): String { + test(MyClass1::class.java, "") + test(MyClass2::class.java, "1") + test(MyClass3::class.java, "12") + + test(MyClass4::class.java, "") + test(MyClass5::class.java, "1") + test(MyClass6::class.java, "12") + + test(MyClass7::class.java, "1") + + test(MyClass8::class.java, "") + test(MyClass9::class.java, "1") + test(MyClass10::class.java, "12") + + return "OK" +} + +fun test(klass: Class<*>, expected: String) { + val ann = klass.getAnnotation(Ann::class.java) + if (ann == null) throw AssertionError("fail: cannot find Ann on ${klass}") + + var result = "" + for (i in ann.p) { + result += i + } + + if (result != expected) { + throw AssertionError("fail: expected = ${expected}, actual = ${result}") + } +} diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt new file mode 100644 index 00000000000..11146076909 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + + +fun test(a: String, b: String): String { + return a + b; +} + +fun box(): String { + var res = ""; + val call = test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) + + if (res != "KO" || call != "OK") return "fail: $res != KO or $call != OK" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt new file mode 100644 index 00000000000..35d8c0e02b7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var invokeOrder = ""; + val expectedResult = "0_1_9" + val expectedInvokeOrder = "1_0_9" + var l = 1L + var i = 0 + val captured = 9L + + var result = test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + invokeOrder = ""; + result = test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "$captured"; "$captured"}, a = {invokeOrder+="0_"; i}()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = test(c = {invokeOrder += "$captured"; "$captured"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}, b = {invokeOrder += "1_"; l}()) + if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult" + + return "OK" +} + +fun test(a: Int, b: Long, c: () -> String): String { + return { "${a}_${b}_${c()}"} () +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt new file mode 100644 index 00000000000..dd65cd1c28f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var invokeOrder = ""; + val expectedResult = "1.0_0_1_9" + val expectedInvokeOrder = "1_0_9" + var l = 1L + var i = 0 + val captured = 9L + + var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"}) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + invokeOrder = ""; + result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "${captured}"; "${captured}"}, a = {invokeOrder+="0_"; i}()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = 1.0.test(c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + invokeOrder = ""; + result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}()) + if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult" + + return "OK" +} + +fun Double.test(a: Int, b: Long, c: () -> String): String { + return { "${this}_${a}_${b}_${c()}"} () +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt new file mode 100644 index 00000000000..17a94380c82 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +var invokeOrder: String = "" + +fun test(x: Double = { invokeOrder += "x"; 1.0 }(), a: String, y: Long = { invokeOrder += "y"; 1 }(), b: String): String { + return "" + x + a + b + y; +} + +fun box(): String { + val funResult = test(b = { invokeOrder += "K"; "K" }(), a = { invokeOrder += "O"; "O" }()) + + if (invokeOrder != "KOxy" || funResult != "1.0OK1") return "fail: $invokeOrder != KOxy or $funResult != 1.0OK1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt new file mode 100644 index 00000000000..c298929042c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var invokeOrder = ""; + val expectedResult = "1.0_0_1_L" + val expectedInvokeOrder = "1_0_L" + var l = 1L + var i = 0 + + var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + invokeOrder = ""; + result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "L"; "L"}, a = {invokeOrder+="0_"; i}()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = 1.0.test(c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}()) + if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult" + + return "OK" +} + +fun Double.test(a: Int, b: Long, c: () -> String): String { + return "${this}_${a}_${b}_${c()}" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt new file mode 100644 index 00000000000..98e666e8c79 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + return Z().test() +} + +class Z { + fun Double.test(a: Int, b: Long, c: () -> String): String { + return "${this}_${a}_${b}_${c()}" + } + + + fun test(): String { + var invokeOrder = ""; + val expectedResult = "1.0_0_1_L" + val expectedInvokeOrder = "1_0_L" + var l = 1L + var i = 0 + + var result = 1.0.test(b = { invokeOrder += "1_"; l }(), a = { invokeOrder += "0_"; i }(), c = { invokeOrder += "L"; "L" }) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + invokeOrder = ""; + result = 1.0.test(b = { invokeOrder += "1_"; l }(), c = { invokeOrder += "L"; "L" }, a = { invokeOrder += "0_"; i }()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = 1.0.test(c = { invokeOrder += "L"; "L" }, b = { invokeOrder += "1_"; l }(), a = { invokeOrder += "0_"; i }()) + if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult" + + + invokeOrder = ""; + result = 1.0.test(a = { invokeOrder += "0_"; i }(), c = { invokeOrder += "L"; "L" }, b = { invokeOrder += "1_"; l }()) + if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult" + + return "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/kt9277.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/kt9277.kt new file mode 100644 index 00000000000..eb08fb7b719 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/kt9277.kt @@ -0,0 +1,13 @@ +// KT-9277 Unexpected NullPointerException in an invocaton with named arguments + +fun box(): String { + foo(null) + + return "OK" +} + +fun foo(x : Int?){ + bar(z = x ?: return, y = x) +} + +fun bar(y : Int, z : Int) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigration.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigration.kt new file mode 100644 index 00000000000..6ef53bff6ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigration.kt @@ -0,0 +1,21 @@ +fun box(): String { + var res = ""; + var call = test(a = {res += "K"; "K"}(), b = {res+="O"; "O"}(), c = {res += "L"; "L"}) + if (res != "KOL" || call != "KOL") return "fail 1: $res != KOL or $call != KOL" + + res = ""; + call = test(a = {res += "K"; "K"}(), c = {res += "L"; "L"}, b = {res+="O"; "O"}()) + if (res != "KOL" || call != "KOL") return "fail 2: $res != KOL or $call != KOL" + + + res = ""; + call = test(c = {res += "L"; "L"}, a = {res += "K"; "K"}(), b = {res+="O"; "O"}()) + if (res != "KOL" || call != "KOL") return "fail 3: $res != KOL or $call != KOL" + + return "OK" + +} + +fun test(a: String, b: String, c: () -> String): String { + return a + b + c(); +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigrationInClass.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigrationInClass.kt new file mode 100644 index 00000000000..7100b035e29 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/lambdaMigrationInClass.kt @@ -0,0 +1,25 @@ +fun box(): String { + var res = ""; + var call = Z("Z").test(a = {res += "K"; "K"}(), b = {res+="O"; "O"}(), c = {res += "L"; "L"}) + if (res != "KOL" || call != "KOLZ") return "fail 1: $res != KOL or $call != KOLZ" + + res = ""; + call = Z("Z").test(a = {res += "K"; "K"}(), c = {res += "L"; "L"}, b = {res+="O"; "O"}()) + if (res != "KOL" || call != "KOLZ") return "fail 2: $res != KOL or $call != KOLZ" + + + res = ""; + call = Z("Z").test(c = {res += "L"; "L"}, a = {res += "K"; "K"}(), b = {res+="O"; "O"}()) + if (res != "KOL" || call != "KOLZ") return "fail 3: $res != KOL or $call != KOLZ" + + return "OK" + +} + +class Z(val p: String) { + + fun test(a: String, b: String, c: () -> String): String { + return a + b + c() + p; + } + +} diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt new file mode 100644 index 00000000000..60f7f292cbf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var res = ""; + var call = test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"}) + if (res != "KOL" || call != "OKL") return "fail 1: $res != KOL or $call != OKL" + + res = ""; + call = test(b = {res += "K"; "K"}(), c = {res += "L"; "L"}, a = {res+="O"; "O"}()) + if (res != "KOL" || call != "OKL") return "fail 2: $res != KOL or $call != OKL" + + + res = ""; + call = test(c = {res += "L"; "L"}, b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) + if (res != "KOL" || call != "OKL") return "fail 3: $res != KOL or $call != OKL" + + return "OK" + +} + +fun test(a: String, b: String, c: () -> String): String { + return a + b + c(); +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt new file mode 100644 index 00000000000..faa071bc275 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var res = ""; + var call = Z("Z").test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"}) + if (res != "KOL" || call != "OKLZ") return "fail 1: $res != KOL or $call != OKLZ" + + res = ""; + call = Z("Z").test(b = {res += "K"; "K"}(), c = {res += "L"; "L"}, a = {res+="O"; "O"}()) + if (res != "KOL" || call != "OKLZ") return "fail 2: $res != KOL or $call != OKLZ" + + + res = ""; + call = Z("Z").test(c = {res += "L"; "L"}, b = {res += "K"; "K"}(), a = {res+="O"; "O"}()) + if (res != "KOL" || call != "OKLZ") return "fail 3: $res != KOL or $call != OKLZ" + + return "OK" + +} + +class Z(val p: String) { + fun test(a: String, b: String, c: () -> String): String { + return a + b + c() + p; + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arrayConstructorsSimple.kt b/backend.native/tests/external/codegen/blackbox/arrays/arrayConstructorsSimple.kt new file mode 100644 index 00000000000..bb2fd78e5f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/arrayConstructorsSimple.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun simpleIntArray(): Array = Array(3) { it } +fun simpleDoubleArray(): Array = Array(3) { it.toDouble() + 0.1 } +fun simpleStringArray(): Array = Array(3) { it.toString() } + +fun box(): String { + val ia = simpleIntArray() + assertEquals(0, ia[0]) + assertEquals(1, ia[1]) + assertEquals(2, ia[2]) + + val da = simpleDoubleArray() + assertEquals(0.1, da[0]) + assertEquals(1.1, da[1]) + assertEquals(2.1, da[2]) + + val sa = simpleStringArray() + assertEquals("0", sa[0]) + assertEquals("1", sa[1]) + assertEquals("2", sa[2]) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arrayGetAssignMultiIndex.kt b/backend.native/tests/external/codegen/blackbox/arrays/arrayGetAssignMultiIndex.kt new file mode 100644 index 00000000000..5e8e8bbd546 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/arrayGetAssignMultiIndex.kt @@ -0,0 +1,11 @@ +operator fun Array.get(index1: Int, index2: Int) = this[index1 + index2] +operator fun Array.set(index1: Int, index2: Int, elem: String) { + this[index1 + index2] = elem +} + +fun box(): String { + val s = Array(1, { "" }) + s[1, -1] = "O" + s[2, -2] += "K" + return s[-3, 3] +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arrayGetMultiIndex.kt b/backend.native/tests/external/codegen/blackbox/arrays/arrayGetMultiIndex.kt new file mode 100644 index 00000000000..6898a9b08e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/arrayGetMultiIndex.kt @@ -0,0 +1,11 @@ +operator fun Array.get(index1: Int, index2: Int) = this[index1 + index2] +operator fun Array.set(index1: Int, index2: Int, elem: String) { + this[index1 + index2] = elem +} + +fun box(): String { + val s = Array(1, { "" }) + s[1, -1] = "OK" + return s[-2, 2] +} + diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt b/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt new file mode 100644 index 00000000000..d5323fbbdbb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +//test [], get and iterator calls +fun test(createIntNotLong: Boolean): String { + val a = if (createIntNotLong) IntArray(5) else LongArray(5) + if (a is IntArray) { + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "O" + } else if (a is LongArray) { + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a.get(i) != x.next()) return "Fail $i" + i++ + } + return "K" + } + return "fail" +} + +fun box(): String { + return test(true) + test(false) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arrayPlusAssign.kt b/backend.native/tests/external/codegen/blackbox/arrays/arrayPlusAssign.kt new file mode 100644 index 00000000000..9a243990fd5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/arrayPlusAssign.kt @@ -0,0 +1,6 @@ +fun box(): String { + val s = IntArray(1) + s[0] = 5 + s[0] += 7 + return if (s[0] == 12) "OK" else "Fail ${s[0]}" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt b/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt new file mode 100644 index 00000000000..52075d459d7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(x: Cloneable) = x + +fun box(): String { + foo(arrayOf("")) + foo(intArrayOf()) + foo(longArrayOf()) + foo(shortArrayOf()) + foo(byteArrayOf()) + foo(charArrayOf()) + foo(doubleArrayOf()) + foo(floatArrayOf()) + foo(booleanArrayOf()) + + arrayOf("").clone() + intArrayOf().clone() + longArrayOf().clone() + shortArrayOf().clone() + byteArrayOf().clone() + charArrayOf().clone() + doubleArrayOf().clone() + floatArrayOf().clone() + booleanArrayOf().clone() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt new file mode 100644 index 00000000000..8e29271c7d7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val s = arrayOf("live", "long") + val t: Array = s.clone() + if (!(s contentEquals t)) return "Fail string" + if (s === t) return "Fail string identity" + + val ss = arrayOf(s, s) + val tt: Array> = ss.clone() + if (!(ss contentEquals tt)) return "Fail string[]" + if (ss === tt) return "Fail string[] identity" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt b/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt new file mode 100644 index 00000000000..dc6646587d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val i = intArrayOf(1, 2) + if (!(i contentEquals i.clone())) return "Fail int" + if (i.clone() === i) return "Fail int identity" + + val j = longArrayOf(1L, 2L) + if (!(j contentEquals j.clone())) return "Fail long" + if (j.clone() === j) return "Fail long identity" + + val s = shortArrayOf(1.toShort(), 2.toShort()) + if (!(s contentEquals s.clone())) return "Fail short" + if (s.clone() === s) return "Fail short identity" + + val b = byteArrayOf(1.toByte(), 2.toByte()) + if (!(b contentEquals b.clone())) return "Fail byte" + if (b.clone() === b) return "Fail byte identity" + + val c = charArrayOf('a', 'b') + if (!(c contentEquals c.clone())) return "Fail char" + if (c.clone() === c) return "Fail char identity" + + val d = doubleArrayOf(1.0, -1.0) + if (!(d contentEquals d.clone())) return "Fail double" + if (d.clone() === d) return "Fail double identity" + + val f = floatArrayOf(1f, -1f) + if (!(f contentEquals f.clone())) return "Fail float" + if (f.clone() === f) return "Fail float identity" + + val z = booleanArrayOf(true, false) + if (!(z contentEquals z.clone())) return "Fail boolean" + if (z.clone() === z) return "Fail boolean identity" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/collectionAssignGetMultiIndex.kt b/backend.native/tests/external/codegen/blackbox/arrays/collectionAssignGetMultiIndex.kt new file mode 100644 index 00000000000..974b55f66a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/collectionAssignGetMultiIndex.kt @@ -0,0 +1,12 @@ +operator fun ArrayList.get(index1: Int, index2: Int) = this[index1 + index2] +operator fun ArrayList.set(index1: Int, index2: Int, elem: String) { + this[index1 + index2] = elem +} + +fun box(): String { + val s = ArrayList(1) + s.add("") + s[1, -1] = "O" + s[2, -2] += "K" + return s[2, -2] +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/collectionGetMultiIndex.kt b/backend.native/tests/external/codegen/blackbox/arrays/collectionGetMultiIndex.kt new file mode 100644 index 00000000000..295f860f84a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/collectionGetMultiIndex.kt @@ -0,0 +1,11 @@ +operator fun ArrayList.get(index1: Int, index2: Int) = this[index1 + index2] +operator fun ArrayList.set(index1: Int, index2: Int, elem: String) { + this[index1 + index2] = elem +} + +fun box(): String { + val s = ArrayList(1) + s.add("") + s[1, -1] = "OK" + return s[2, -2] +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachBooleanArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachBooleanArray.kt new file mode 100644 index 00000000000..f0238410cc5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachBooleanArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in BooleanArray(5)) { + if (x != false) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachByteArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachByteArray.kt new file mode 100644 index 00000000000..1ae8205531a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachByteArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in ByteArray(5)) { + if (x != 0.toByte()) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachCharArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachCharArray.kt new file mode 100644 index 00000000000..4b797671175 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachCharArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in CharArray(5)) { + if (x != 0.toChar()) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachDoubleArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachDoubleArray.kt new file mode 100644 index 00000000000..c1a79f222a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachDoubleArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in DoubleArray(5)) { + if (x != 0.toDouble()) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachFloatArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachFloatArray.kt new file mode 100644 index 00000000000..8245beab4ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachFloatArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in FloatArray(5)) { + if (x != 0.toFloat()) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachIntArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachIntArray.kt new file mode 100644 index 00000000000..53ce12dd393 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachIntArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in IntArray(5)) { + if (x != 0) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachLongArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachLongArray.kt new file mode 100644 index 00000000000..6ed0259f765 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachLongArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in LongArray(5)) { + if (x != 0.toLong()) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/forEachShortArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/forEachShortArray.kt new file mode 100644 index 00000000000..a9145d42422 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/forEachShortArray.kt @@ -0,0 +1,6 @@ +fun box(): String { + for (x in ShortArray(5)) { + if (x != 0.toShort()) return "Fail $x" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/hashMap.kt b/backend.native/tests/external/codegen/blackbox/arrays/hashMap.kt new file mode 100644 index 00000000000..9c04d4911d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/hashMap.kt @@ -0,0 +1,9 @@ +operator fun HashMap.set(index: String, elem: Int?) { + this.put(index, elem) +} + +fun box(): String { + val s = HashMap() + s["239"] = 239 + return if (s["239"] == 239) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/inProjectionAsParameter.kt b/backend.native/tests/external/codegen/blackbox/arrays/inProjectionAsParameter.kt new file mode 100644 index 00000000000..d89fdf1f02b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/inProjectionAsParameter.kt @@ -0,0 +1,9 @@ +fun test(y: Array>) { + y[0] = kotlin.arrayOf("OK") +} + +fun box() : String { + val x : Array> = kotlin.arrayOf(kotlin.arrayOf(1)) + test(x) + return x[0][0] as String +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfArray.kt new file mode 100644 index 00000000000..87785a47aaf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val x : Array> = arrayOf(arrayOf(1)) + val y : Array> = x + + if (y.size != 1) return "fail 1" + + y[0] = arrayOf("OK") + + return x[0][0] as String +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfList.kt b/backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfList.kt new file mode 100644 index 00000000000..3a22c9124c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/inProjectionOfList.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME + +fun box(): String { + val x: Array> = arrayOf(listOf(1)) + val y : Array> = x + + if (y.size != 1) return "fail 1" + + y[0] = listOf("OK") + + return x[0][0] as String +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/indices.kt b/backend.native/tests/external/codegen/blackbox/arrays/indices.kt new file mode 100644 index 00000000000..65976591a77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/indices.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME + +fun box(): String { + val a = Array(5, {it}) + val x = a.indices.iterator() + while (x.hasNext()) { + val i = x.next() + if (a[i] != i) return "Fail $i ${a[i]}" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/indicesChar.kt b/backend.native/tests/external/codegen/blackbox/arrays/indicesChar.kt new file mode 100644 index 00000000000..5d3470e389d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/indicesChar.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME + +fun box(): String { + val a = CharArray(5) + val x = a.indices.iterator() + while (x.hasNext()) { + val i = x.next() + if (a[i] != 0.toChar()) return "Fail $i ${a[i]}" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iterator.kt b/backend.native/tests/external/codegen/blackbox/arrays/iterator.kt new file mode 100644 index 00000000000..eb8f84cbb04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iterator.kt @@ -0,0 +1,9 @@ +fun box(): String { + val x = Array(5, { it } ).iterator() + var i = 0 + while (x.hasNext()) { + if (x.next() != i) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorBooleanArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorBooleanArray.kt new file mode 100644 index 00000000000..753381f34f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorBooleanArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = BooleanArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArray.kt new file mode 100644 index 00000000000..259eb5f3200 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = ByteArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt new file mode 100644 index 00000000000..19bf8463026 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val a = ByteArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.nextByte()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorCharArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorCharArray.kt new file mode 100644 index 00000000000..525910d31e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorCharArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = CharArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorDoubleArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorDoubleArray.kt new file mode 100644 index 00000000000..192625f22c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorDoubleArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = DoubleArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorFloatArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorFloatArray.kt new file mode 100644 index 00000000000..4a5b86e694f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorFloatArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = FloatArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorIntArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorIntArray.kt new file mode 100644 index 00000000000..2dd09e3a59c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorIntArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = IntArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArray.kt new file mode 100644 index 00000000000..b1033002764 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = LongArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt new file mode 100644 index 00000000000..74bf8c9f4a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val a = LongArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.nextLong()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorShortArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorShortArray.kt new file mode 100644 index 00000000000..49807e23720 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorShortArray.kt @@ -0,0 +1,10 @@ +fun box(): String { + val a = ShortArray(5) + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt1291.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt1291.kt new file mode 100644 index 00000000000..02b5fd89707 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt1291.kt @@ -0,0 +1,27 @@ +var result = 0 + +fun Iterator.foreach(action: (T) -> Unit) { + while (this.hasNext()) { + (action)(this.next()) + } +} + +fun Iterator.select(f: (In) -> Out) : Iterator { + return Selector(this, f); +} + +class Selector(val source: Iterator, val f: (In) -> Out) : Iterator { + override fun hasNext(): Boolean = source.hasNext() + + override fun next(): Out { + return (f)(source.next()) + } +} + +fun box(): String { + Array(4, { it + 1 }).iterator() + .select({i -> i * 10}) + .foreach({k -> result += k}) + if (result != 10+20+30+40) return "Fail: $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt238.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt238.kt new file mode 100644 index 00000000000..71c935d5c9d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt238.kt @@ -0,0 +1,58 @@ +fun t1 () { + val a1 = arrayOfNulls(1) + a1[0] = "0" //ok + val s = a1[0] //ok +} + +fun t2 () { + val a2 = arrayOfNulls(1) as Array + a2[0] = 0 //ok + var i = a2[0] //ok +} + +fun t3 () { + val a3 = arrayOfNulls(1) + a3[0] = 0 //verify error + var j = a3[0] //ok + var k : Int = a3[0] ?: 5 //ok +} + +fun t4 () { + val b1 = StrangeIntArray(10) + b1[4] = 5 //ok + var i = b1[1] //ok +} + +fun t5 () { + val b2 = StrangeArray(10, 0) + b2.set(4, 5) //ok + b2[4] = 5 //verify error + var i = b2.get(2) //ok + i = b2[1] //verify error +} + +fun t6() { + val b3 = StrangeArray(10, 0) + b3.set(5, 6) //ok + b3[4] = 5 //verify error + val v = b3[1] //ok +} + +fun box() : String { + return "OK" +} + +class StrangeArray(size: Int, private var defaultValue: T) { + operator fun get(index: Int): T = defaultValue + operator fun set(index: Int, v: T) { + defaultValue = v + } +} + +class StrangeIntArray(size: Int) { + private var defaultValue = 0 + operator fun get(index: Int): Int = defaultValue + operator fun set(index: Int, v: Int) { + defaultValue = v + } +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt2997.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt2997.kt new file mode 100644 index 00000000000..f42acc4a2e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt2997.kt @@ -0,0 +1,77 @@ +//KT-2997 Automatically cast error (Array) + +fun foo(a: Any): Int { + if (a is IntArray) { + a.get(0) + a.set(0, 1) + a.iterator() + return a.size + } + if (a is ShortArray) { + a.get(0) + a.set(0, 1) + a.iterator() + return a.size + } + if (a is ByteArray) { + a.get(0) + a.set(0, 1) + a.iterator() + return a.size + } + if (a is FloatArray) { + a.get(0) + a.set(0, 1.toFloat()) + a.iterator() + return a.size + } + if (a is DoubleArray) { + a.get(0) + a.set(0, 1.0) + a.iterator() + return a.size + } + if (a is BooleanArray) { + a.get(0) + a.set(0, false) + a.iterator() + return a.size + } + if (a is CharArray) { + a.get(0) + a.set(0, 'a') + a.iterator() + return a.size + } + if (a is Array<*>) { + if (a.size > 0) a.get(0) + a.iterator() + return a.size + } + + return 0 +} + +fun box(): String { + val iA = IntArray(1) + if (foo(iA) != 1) return "fail int[]" + val sA = ShortArray(1) + if (foo(sA) != 1) return "fail short[]" + val bA = ByteArray(1) + if (foo(bA) != 1) return "fail byte[]" + val fA = FloatArray(1) + if (foo(fA) != 1) return "fail float[]" + val dA = DoubleArray(1) + if (foo(dA) != 1) return "fail double[]" + val boolA = BooleanArray(1) + if (foo(boolA) != 1) return "fail boolean[]" + val cA = CharArray(1) + if (foo(cA) != 1) return "fail char[]" + val oA = arrayOfNulls(1) + if (foo(oA) != 1) return "fail Any[]" + + val sArray = arrayOfNulls(0) + if (foo(sArray) != 0) return "fail String[]" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt33.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt33.kt new file mode 100644 index 00000000000..25941e0f5cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt33.kt @@ -0,0 +1,6 @@ +fun box () : String { + val s = ArrayList() + s.add("foo") + s[0] += "bar" + return if(s[0] == "foobar") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt3771.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt3771.kt new file mode 100644 index 00000000000..60db734b833 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt3771.kt @@ -0,0 +1,14 @@ +fun fill(dest : Array, v : String) { + dest[0] = v +} + +fun box() : String { +//fun main(args : Array) { + val s : String = "bar" + val any : Array = arrayOf(1, "foo", 1.234) + fill(any, s) + /* shouldn't throw +ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String; + */ + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt4118.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt4118.kt new file mode 100644 index 00000000000..979effeed54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt4118.kt @@ -0,0 +1,94 @@ +fun Array.test1(): Array { + val func = { i:Int -> this} + return func(1) +} + +fun Array.test1Nested(): Array { + val func = { i: Int -> { this }()} + return func(1) +} + + +fun Array.test2() : Array { + class Z2() { + fun run(): Array { + return this@test2 + } + } + return Z2().run() +} + +fun Array.test2Nested() : Array { + class Z2() { + fun run(): Array { + class Z3 { + fun run(): Array { + return this@test2Nested; + } + } + return Z3().run() + } + } + return Z2().run() +} + +fun Array.test3(): Array { + fun local(): Array { + return this@test3 + } + return local() +} + +fun Array.test3Nested(): Array { + fun local(): Array { + fun local2(): Array { + return this@test3Nested + } + return local2() + } + return local() +} + + +fun Array.test4() : Array { + return object { + fun run() : Array { + return this@test4 + } + }.run() +} + +fun Array.test4Nested() : Array { + return object { + fun run() : Array { + return object { + fun run() : Array { + return this@test4Nested + } + }.run() + } + }.run() +} + +fun Array.test1(): Array { + val func = { i: Int -> this} + return func(1) +} + + +fun box() : String { + val array = Array(2, { i -> "${i}" }) + if (array != array.test1()) return "fail 1" + if (array != array.test2()) return "fail 2" + if (array != array.test3()) return "fail 3" + if (array != array.test4()) return "fail 4" + + if (array != array.test1Nested()) return "fail 1Nested" + if (array != array.test2Nested()) return "fail 2Nested" + if (array != array.test3Nested()) return "fail 3Nested" + if (array != array.test4Nested()) return "fail 4Nested" + + val array2 = Array(2, { i -> DoubleArray(i) }) + if (array2 != array2.test1()) return "fail on array of double []" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt4348.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt4348.kt new file mode 100644 index 00000000000..4ea639148ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt4348.kt @@ -0,0 +1,17 @@ +operator fun String.get(vararg value: Any) : String { + return if (value[0] == 44 && value[1] == "example") "OK" else "fail" +} + +operator fun Int.get(vararg value: Any) : Int { + return if (value[0] == 44 && value[1] == "example") 1 else 0 +} +fun main(args: Array) { + 12 [44, "example"] +} + +fun box(): String { + if ("foo" [44, "example"] != "OK") return "fail1" + if (11 [44, "example"] != 1) return "fail2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt4357.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt4357.kt new file mode 100644 index 00000000000..95b92765fa4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt4357.kt @@ -0,0 +1,8 @@ +fun box(): String { + val array = intArrayOf(11, 12, 13) + val p = array.get(0) + if (p != 11) return "fail 1: $p" + + val stringArray = arrayOf("OK", "FAIL") + return stringArray.get(0) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt new file mode 100644 index 00000000000..bdad1a98add --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun iarr(vararg a : Int) = a +fun array(vararg a : T) = a + +fun box() : String { + val tests = array( + iarr(6, 5, 4, 3, 2, 1), + iarr(1, 2), + iarr(1, 2, 3), + iarr(1, 2, 3, 4), + iarr(1) + ) + + var n = 0 + + try { + var i = 0 + while (true) { + if (thirdElementIsThree(tests[i++])) + n++ + } + } + catch (e : ArrayIndexOutOfBoundsException) { + // No more tests to process + } + return if(n == 2) "OK" else "fail" +} + +fun thirdElementIsThree(a : IntArray) = + a.size >= 3 && a[2] == 3 diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt594.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt594.kt new file mode 100644 index 00000000000..c67bd1b66e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt594.kt @@ -0,0 +1,16 @@ +package array_test + +fun box() : String { + var array : IntArray? = IntArray(10) + array?.set(0, 3) + if(array?.get(0) != 3) return "fail" + + var a = arrayOfNulls>(5) + var b = arrayOfNulls(1) + b.set(0, "239") + a?.set(0, b) + + if(a?.get(0)?.get(0) != "239") return "fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt new file mode 100644 index 00000000000..6fa4cf73905 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt @@ -0,0 +1,6 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box() = if(arrayOfNulls(10).isArrayOf()) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt7009.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt7009.kt new file mode 100644 index 00000000000..91cf7e4fa5b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt7009.kt @@ -0,0 +1,6 @@ +// WITH_RUNTIME + +fun box() : String { + val value = (1 to doubleArrayOf(1.0)).second[0] + return if (value == 1.0) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt new file mode 100644 index 00000000000..80d330ecd09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun test(b: Boolean): String { + val a = if (b) IntArray(5) else LongArray(5) + if (a is IntArray) { + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" + } else if (a is LongArray) { + val x = a.iterator() + var i = 0 + while (x.hasNext()) { + if (a[i] != x.next()) return "Fail $i" + i++ + } + return "OK" + } + return "fail" +} + +fun box(): String { + if (test(true) != "OK") return "fail 1: ${test(true)}" + + if (test(false) != "OK") return "fail 1: ${test(false)}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt new file mode 100644 index 00000000000..48e9b499598 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun foo(x : Any): String { + return if(x is Array<*> && x.isArrayOf()) (x as Array)[0] else "fail" +} + +fun box(): String { + return foo(arrayOf("OK")) +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt779.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt779.kt new file mode 100644 index 00000000000..a56d1e0874b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt779.kt @@ -0,0 +1,3 @@ +val Array.length : Int get() = this.size + +fun box() = if(arrayOfNulls(10).length == 10) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt945.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt945.kt new file mode 100644 index 00000000000..eaf6c5e61b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt945.kt @@ -0,0 +1,9 @@ +fun box() : String { + val data = Array>(3) { Array(4, {false}) } + for(d in data) { + if(d.size != 4) return "fail" + for(b in d) if (b) return "fail" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt950.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt950.kt new file mode 100644 index 00000000000..f9d26d44d43 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt950.kt @@ -0,0 +1,7 @@ +operator fun MutableMap.set(k : K, v : V) = put(k, v) + +fun box() : String { + val map = HashMap() + map["239"] = "932" + return if(map["239"] == "932") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/longAsIndex.kt b/backend.native/tests/external/codegen/blackbox/arrays/longAsIndex.kt new file mode 100644 index 00000000000..c12d4dca9a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/longAsIndex.kt @@ -0,0 +1,9 @@ +operator fun IntArray.set(index: Long, elem: Int) { this[index.toInt()] = elem } +operator fun IntArray.get(index: Long) = this[index.toInt()] + +fun box(): String { + var l = IntArray(1) + l[0.toLong()] = 4 + l[0.toLong()] += 6 + return if (l[0.toLong()] == 10) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiArrayConstructors.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiArrayConstructors.kt new file mode 100644 index 00000000000..77663265456 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiArrayConstructors.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun stringMultiArray(): Array> = Array(3) { + i -> Array(3) { j -> "$i-$j" } +} + +fun stringNullableMultiArray(): Array> = Array(3) { + i -> if (i == 1) Array(3) { j -> "$i-$j" } as Array else arrayOfNulls(3) +} + +fun box(): String { + val matrix = stringMultiArray() + + for (i in 0..2) { + for (j in 0..2) { + assertEquals("$i-$j", matrix[i][j], "matrix") + } + } + + val matrixNullable = stringNullableMultiArray() + + for (j in 0..2) { + assertEquals(null, matrixNullable[0][j], "nullable") + assertEquals("1-$j", matrixNullable[1][j], "nullable") + assertEquals(null, matrixNullable[2][j], "nullable") + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclFor.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclFor.kt new file mode 100644 index 00000000000..8657604547a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclFor.kt @@ -0,0 +1,18 @@ +class C(val i: Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 +} + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> C(x)}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..056a9f5f793 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentExtensions.kt @@ -0,0 +1,19 @@ +class C(val i: Int) { +} + +operator fun C.component1() = i + 1 +operator fun C.component2() = i + 2 + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> C(x)}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..6a9f6be2409 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,21 @@ +class C(val i: Int) { +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 + + fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val l = Array(3, {x -> C(x)}) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..376aabb2466 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,21 @@ +class C(val i: Int) { +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 +} + +fun M.doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> C(x)}) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForValCaptured.kt new file mode 100644 index 00000000000..f25b504d607 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/MultiDeclForValCaptured.kt @@ -0,0 +1,18 @@ +class C(val i: Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 +} + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val l = Array(3, {x -> C(x)}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..f0687781516 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt @@ -0,0 +1,16 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> x}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..3dda25067f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,16 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val l = Array(3, {x -> x}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..2cf40134bf3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,18 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 + + fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val l = Array(3, {x -> x}) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..9ad2af28556 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,18 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 +} + +fun M.doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> x}) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..0ca7fc49d13 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt @@ -0,0 +1,16 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> x.toLong()}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..3e610b49997 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,16 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val l = Array(3, {x -> x.toLong()}) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..dad12c6d80f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,18 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 + + fun doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val l = Array(3, {x -> x.toLong()}) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..fde531f8d21 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,18 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 +} + +fun M.doTest(l : Array): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = Array(3, {x -> x.toLong()}) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt b/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt new file mode 100644 index 00000000000..350d4cfe176 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun testArray() { + Array(5) { i -> + if (i == 3) return + i.toString() + } + throw AssertionError() +} + +fun testIntArray() { + IntArray(5) { i -> + if (i == 3) return + i + } + throw AssertionError() +} + +fun box(): String { + testArray() + testIntArray() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/arrays/nonNullArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/nonNullArray.kt new file mode 100644 index 00000000000..2e480979e6b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/nonNullArray.kt @@ -0,0 +1,8 @@ +class A() { + class B(val i: Int) { + } + + fun test() = Array (10, { B(it) }) +} + +fun box() = if(A().test()[5].i == 5) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/arrays/stdlib.kt b/backend.native/tests/external/codegen/blackbox/arrays/stdlib.kt new file mode 100644 index 00000000000..41f1090eba1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/stdlib.kt @@ -0,0 +1,56 @@ +interface ISized { + val size : Int +} + +interface javaUtilIterator : Iterator { + fun remove() : Unit { + throw UnsupportedOperationException() + } +} + +class MyIterator(val array : ReadOnlyArray) : javaUtilIterator { + private var index = 0 + + override fun hasNext() : Boolean = index < array.size + + override fun next() : T = array.get(index++) +} + +interface ReadOnlyArray : ISized, Iterable { + operator fun get(index : Int) : T + + override fun iterator() : Iterator = MyIterator(this) +} + +interface WriteOnlyArray : ISized { + operator fun set(index : Int, value : T) : Unit + + operator fun set(from: Int, count: Int, value: T) { + for(i in from..from+count-1) { + set(i, value) + } + } +} + +class MutableArray(length: Int, init : (Int) -> T) : ReadOnlyArray, WriteOnlyArray { + private val array = Array(length, init) + + override fun get(index : Int) : T = array[index] as T + override fun set(index : Int, value : T) : Unit { array[index] = value } + + override val size : Int + get() = array.size +} + +fun box() : String { + var a = MutableArray (4, {0}) + a [0] = 10 + a.set(1, 2, 13) + a [3] = 40 + a.iterator() + a.iterator().hasNext() + for(el in a) { + val fl = el + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOp.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOp.kt new file mode 100644 index 00000000000..7618481db4c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOp.kt @@ -0,0 +1,67 @@ +fun box(): String { + // D = 1101 C = 1100 + // 6 = 0110 5 = 0101 + var iarg1: Int = 0xDC56DC56.toInt() + var iarg2: Int = 0x65DC65DC + var i1 = iarg1 and iarg2 + var i2 = iarg1 or iarg2 + var i3 = iarg1 xor iarg2 + var i4 = iarg1.inv() + var i5 = iarg1 shl 16 + var i6 = iarg1 shr 16 + var i7 = iarg1 ushr 16 + + if (i1 != 0x44544454.toInt()) return "fail: Int.and" + if (i2 != 0xFDDEFDDE.toInt()) return "fail: Int.or" + if (i3 != 0xB98AB98A.toInt()) return "fail: Int.xor" + if (i4 != 0x23A923A9.toInt()) return "fail: Int.inv" + if (i5 != 0xDC560000.toInt()) return "fail: Int.shl" + if (i6 != 0xFFFFDC56.toInt()) return "fail: Int.shr" + if (i7 != 0x0000DC56.toInt()) return "fail: Int.ushr" + + + // TODO: Use long hex constants after KT-4749 is fixed + var larg1: Long = (0xDC56DC56L shl 32) + 0xDC56DC56 // !!!! + var larg2: Long = 0x65DC65DC65DC65DC + var l1 = larg1 and larg2 + var l2 = larg1 or larg2 + var l3 = larg1 xor larg2 + var l4 = larg1.inv() + var l5 = larg1 shl 32 + var l6 = larg1 shr 32 + var l7 = larg1 ushr 32 + + if (l1 != 0x4454445444544454) return "fail: Long.and" + if (l2 != (0xFDDEFDDEL shl 32) + 0xFDDEFDDE) return "fail: Long.or" + if (l3 != (0xB98AB98AL shl 32) + 0xB98AB98A) return "fail: Long.xor" + if (l4 != 0x23A923A923A923A9) return "fail: Long.inv" + if (l5 != (0xDC56DC56L shl 32)/*!!!*/) return "fail: Long.shl" + if (l6 != (0xFFFFFFFFL shl 32) + 0xDC56DC56) return "fail: Long.shr" + if (l7 != (0x00000000L shl 32) + 0xDC56DC56.toLong()) return "fail: Long.ushr" + + var sarg1: Short = 0xDC56.toShort() + var sarg2: Short = 0x65DC.toShort() + var s1 = sarg1 and sarg2 + var s2 = sarg1 or sarg2 + var s3 = sarg1 xor sarg2 + var s4 = sarg1.inv() + + if (s1 != 0x4454.toShort()) return "fail: Short.and" + if (s2 != 0xFDDE.toShort()) return "fail: Short.or" + if (s3 != 0xB98A.toShort()) return "fail: Short.xor" + if (s4 != 0x23A9.toShort()) return "fail: Short.inv" + + var barg1: Byte = 0xDC.toByte() + var barg2: Byte = 0x65.toByte() + var b1 = barg1 and barg2 + var b2 = barg1 or barg2 + var b3 = barg1 xor barg2 + var b4 = barg1.inv() + + if (b1 != 0x44.toByte()) return "fail: Byte.and" + if (b2 != 0xFD.toByte()) return "fail: Byte.or" + if (b3 != 0xB9.toByte()) return "fail: Byte.xor" + if (b4 != 0x23.toByte()) return "fail: Byte.inv" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpAny.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpAny.kt new file mode 100644 index 00000000000..035248d5adb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpAny.kt @@ -0,0 +1,67 @@ +fun box(): String { + // D = 1101 C = 1100 + // 6 = 0110 5 = 0101 + var iarg1: Int = 0xDC56DC56.toInt() + var iarg2: Int = 0x65DC65DC + var i1: Any = iarg1 and iarg2 + var i2: Any = iarg1 or iarg2 + var i3: Any = iarg1 xor iarg2 + var i4: Any = iarg1.inv() + var i5: Any = iarg1 shl 16 + var i6: Any = iarg1 shr 16 + var i7: Any = iarg1 ushr 16 + + if (i1 != 0x44544454.toInt()) return "fail: Int.and" + if (i2 != 0xFDDEFDDE.toInt()) return "fail: Int.or" + if (i3 != 0xB98AB98A.toInt()) return "fail: Int.xor" + if (i4 != 0x23A923A9.toInt()) return "fail: Int.inv" + if (i5 != 0xDC560000.toInt()) return "fail: Int.shl" + if (i6 != 0xFFFFDC56.toInt()) return "fail: Int.shr" + if (i7 != 0x0000DC56.toInt()) return "fail: Int.ushr" + + + // TODO: Use long hex constants after KT-4749 is fixed + var larg1: Long = (0xDC56DC56L shl 32) + 0xDC56DC56 // !!!! + var larg2: Long = 0x65DC65DC65DC65DC + var l1: Any = larg1 and larg2 + var l2: Any = larg1 or larg2 + var l3: Any = larg1 xor larg2 + var l4: Any = larg1.inv() + var l5: Any = larg1 shl 32 + var l6: Any = larg1 shr 32 + var l7: Any = larg1 ushr 32 + + if (l1 != 0x4454445444544454) return "fail: Long.and" + if (l2 != (0xFDDEFDDEL shl 32) + 0xFDDEFDDE) return "fail: Long.or" + if (l3 != (0xB98AB98AL shl 32) + 0xB98AB98A) return "fail: Long.xor" + if (l4 != 0x23A923A923A923A9) return "fail: Long.inv" + if (l5 != (0xDC56DC56L shl 32)/*!!!*/) return "fail: Long.shl" + if (l6 != (0xFFFFFFFFL shl 32) + 0xDC56DC56) return "fail: Long.shr" + if (l7 != (0x00000000L shl 32) + 0xDC56DC56.toLong()) return "fail: Long.ushr" + + var sarg1: Short = 0xDC56.toShort() + var sarg2: Short = 0x65DC.toShort() + var s1: Any = sarg1 and sarg2 + var s2: Any = sarg1 or sarg2 + var s3: Any = sarg1 xor sarg2 + var s4: Any = sarg1.inv() + + if (s1 != 0x4454.toShort()) return "fail: Short.and" + if (s2 != 0xFDDE.toShort()) return "fail: Short.or" + if (s3 != 0xB98A.toShort()) return "fail: Short.xor" + if (s4 != 0x23A9.toShort()) return "fail: Short.inv" + + var barg1: Byte = 0xDC.toByte() + var barg2: Byte = 0x65.toByte() + var b1: Any = barg1 and barg2 + var b2: Any = barg1 or barg2 + var b3: Any = barg1 xor barg2 + var b4: Any = barg1.inv() + + if (b1 != 0x44.toByte()) return "fail: Byte.and" + if (b2 != 0xFD.toByte()) return "fail: Byte.or" + if (b3 != 0xB9.toByte()) return "fail: Byte.xor" + if (b4 != 0x23.toByte()) return "fail: Byte.inv" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpNullable.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpNullable.kt new file mode 100644 index 00000000000..779f86f9315 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/bitwiseOpNullable.kt @@ -0,0 +1,67 @@ +fun box(): String { + // D = 1101 C = 1100 + // 6 = 0110 5 = 0101 + var iarg1: Int = 0xDC56DC56.toInt() + var iarg2: Int = 0x65DC65DC + var i1: Int? = iarg1 and iarg2 + var i2: Int? = iarg1 or iarg2 + var i3: Int? = iarg1 xor iarg2 + var i4: Int? = iarg1.inv() + var i5: Int? = iarg1 shl 16 + var i6: Int? = iarg1 shr 16 + var i7: Int? = iarg1 ushr 16 + + if (i1 != 0x44544454.toInt()) return "fail: Int.and" + if (i2 != 0xFDDEFDDE.toInt()) return "fail: Int.or" + if (i3 != 0xB98AB98A.toInt()) return "fail: Int.xor" + if (i4 != 0x23A923A9.toInt()) return "fail: Int.inv" + if (i5 != 0xDC560000.toInt()) return "fail: Int.shl" + if (i6 != 0xFFFFDC56.toInt()) return "fail: Int.shr" + if (i7 != 0x0000DC56.toInt()) return "fail: Int.ushr" + + + // TODO: Use long hex constants after KT-4749 is fixed + var larg1: Long = (0xDC56DC56L shl 32) + 0xDC56DC56 // !!!! + var larg2: Long = 0x65DC65DC65DC65DC + var l1: Long? = larg1 and larg2 + var l2: Long? = larg1 or larg2 + var l3: Long? = larg1 xor larg2 + var l4: Long? = larg1.inv() + var l5: Long? = larg1 shl 32 + var l6: Long? = larg1 shr 32 + var l7: Long? = larg1 ushr 32 + + if (l1 != 0x4454445444544454) return "fail: Long.and" + if (l2 != (0xFDDEFDDEL shl 32) + 0xFDDEFDDE) return "fail: Long.or" + if (l3 != (0xB98AB98AL shl 32) + 0xB98AB98A) return "fail: Long.xor" + if (l4 != 0x23A923A923A923A9) return "fail: Long.inv" + if (l5 != (0xDC56DC56L shl 32)/*!!!*/) return "fail: Long.shl" + if (l6 != (0xFFFFFFFFL shl 32) + 0xDC56DC56) return "fail: Long.shr" + if (l7 != (0x00000000L shl 32) + 0xDC56DC56.toLong()) return "fail: Long.ushr" + + var sarg1: Short = 0xDC56.toShort() + var sarg2: Short = 0x65DC.toShort() + var s1: Short? = sarg1 and sarg2 + var s2: Short? = sarg1 or sarg2 + var s3: Short? = sarg1 xor sarg2 + var s4: Short? = sarg1.inv() + + if (s1 != 0x4454.toShort()) return "fail: Short.and" + if (s2 != 0xFDDE.toShort()) return "fail: Short.or" + if (s3 != 0xB98A.toShort()) return "fail: Short.xor" + if (s4 != 0x23A9.toShort()) return "fail: Short.inv" + + var barg1: Byte = 0xDC.toByte() + var barg2: Byte = 0x65.toByte() + var b1: Byte? = barg1 and barg2 + var b2: Byte? = barg1 or barg2 + var b3: Byte? = barg1 xor barg2 + var b4: Byte? = barg1.inv() + + if (b1 != 0x44.toByte()) return "fail: Byte.and" + if (b2 != 0xFD.toByte()) return "fail: Byte.or" + if (b3 != 0xB9.toByte()) return "fail: Byte.xor" + if (b4 != 0x23.toByte()) return "fail: Byte.inv" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/call.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/call.kt new file mode 100644 index 00000000000..0f3d0139001 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/call.kt @@ -0,0 +1,21 @@ +fun box(): String { + val a1: Byte = 1.plus(1) + val a2: Short = 1.plus(1) + val a3: Int = 1.plus(1) + val a4: Long = 1.plus(1) + val a5: Double = 1.0.plus(1) + val a6: Float = 1f.plus(1) + val a7: Char = 'A'.plus(1) + val a8: Int = 'B'.minus('A') + + if (a1 != 2.toByte()) return "fail 1" + if (a2 != 2.toShort()) return "fail 2" + if (a3 != 2) return "fail 3" + if (a4 != 2L) return "fail 4" + if (a5 != 2.0) return "fail 5" + if (a6 != 2f) return "fail 6" + if (a7 != 'B') return "fail 7" + if (a8 != 1) return "fail 8" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/callAny.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/callAny.kt new file mode 100644 index 00000000000..7969cb5ec79 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/callAny.kt @@ -0,0 +1,21 @@ +fun box(): String { + val a1: Any = 1.toByte().plus(1) + val a2: Any = 1.toShort().plus(1) + val a3: Any = 1.plus(1) + val a4: Any = 1L.plus(1) + val a5: Any = 1.0.plus(1) + val a6: Any = 1f.plus(1) + val a7: Any = 'A'.plus(1) + val a8: Any = 'B'.minus('A') + + if (a1 !is Int || a1 != 2) return "fail 1" + if (a2 !is Int || a2 != 2) return "fail 2" + if (a3 !is Int || a3 != 2) return "fail 3" + if (a4 !is Long || a4 != 2L) return "fail 4" + if (a5 !is Double || a5 != 2.0) return "fail 5" + if (a6 !is Float || a6 != 2f) return "fail 6" + if (a7 !is Char || a7 != 'B') return "fail 7" + if (a8 !is Int || a8 != 1) return "fail 8" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/callNullable.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/callNullable.kt new file mode 100644 index 00000000000..0167a38ed04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/callNullable.kt @@ -0,0 +1,21 @@ +fun box(): String { + val a1: Byte? = 1.plus(1) + val a2: Short? = 1.plus(1) + val a3: Int? = 1.plus(1) + val a4: Long? = 1.plus(1) + val a5: Double? = 1.0.plus(1) + val a6: Float? = 1f.plus(1) + val a7: Char? = 'A'.plus(1) + val a8: Int? = 'B'.minus('A') + + if (a1!! != 2.toByte()) return "fail 1" + if (a2!! != 2.toShort()) return "fail 2" + if (a3!! != 2) return "fail 3" + if (a4!! != 2L) return "fail 4" + if (a5!! != 2.0) return "fail 5" + if (a6!! != 2f) return "fail 6" + if (a7!! != 'B') return "fail 7" + if (a8!! != 1) return "fail 8" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt new file mode 100644 index 00000000000..bdcbe98664d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt @@ -0,0 +1,17 @@ +// IGNORE_BACKEND: JS +// reason - multifile tests are not supported in JS tests +//FILE: Holder.java + +class Holder { + public Double value; + public Holder(Double value) { this.value = value; } +} + +//FILE: test.kt + +import Holder + +fun box(): String { + val j = Holder(0.99) + return if (j.value > 0) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt new file mode 100644 index 00000000000..14a07fe1eb3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt @@ -0,0 +1,15 @@ +// IGNORE_BACKEND: JS +// reason - multifile tests are not supported in JS tests +//FILE: JavaClass.java + +class JavaClass { + public static Long get() { return 2364137526064485012L; } +} + +//FILE: test.kt + +import JavaClass + +fun box(): String { + return if (JavaClass.get() > 0) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt new file mode 100644 index 00000000000..1daa188f030 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt @@ -0,0 +1,14 @@ +// IGNORE_BACKEND: JS +// reason - no ArithmeticException in JS +fun box(): String { + val a1 = 0 + val a2 = try { 1 / 0 } catch(e: ArithmeticException) { 0 } + val a3 = try { 1 / a1 } catch(e: ArithmeticException) { 0 } + val a4 = try { 1 / a2 } catch(e: ArithmeticException) { 0 } + val a5 = try { 2 * (1 / 0) } catch(e: ArithmeticException) { 0 } + val a6 = try { 2 * 1 / 0 } catch(e: ArithmeticException) { 0 } + + try { val s1 = "${2 * (1 / 0) }" } catch(e: ArithmeticException) { } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsic.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsic.kt new file mode 100644 index 00000000000..7434a7848e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsic.kt @@ -0,0 +1,21 @@ +fun box(): String { + val a1: Byte = 1 + 1 + val a2: Short = 1 + 1 + val a3: Int = 1 + 1 + val a4: Long = 1 + 1 + val a5: Double = 1.0 + 1 + val a6: Float = 1f + 1 + val a7: Char = 'A' + 1 + val a8: Int = 'B' - 'A' + + if (a1 != 2.toByte()) return "fail 1" + if (a2 != 2.toShort()) return "fail 2" + if (a3 != 2) return "fail 3" + if (a4 != 2L) return "fail 4" + if (a5 != 2.0) return "fail 5" + if (a6 != 2f) return "fail 6" + if (a7 != 'B') return "fail 7" + if (a8 != 1) return "fail 8" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicAny.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicAny.kt new file mode 100644 index 00000000000..fd240b08a58 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicAny.kt @@ -0,0 +1,21 @@ +fun box(): String { + val a1: Any = 1.toByte() + 1 + val a2: Any = 1.toShort() + 1 + val a3: Any = 1 + 1 + val a4: Any = 1L + 1 + val a5: Any = 1.0 + 1 + val a6: Any = 1f + 1 + val a7: Any = 'A' + 1 + val a8: Any = 'B' - 'A' + + if (a1 !is Int || a1 != 2) return "fail 1" + if (a2 !is Int || a2 != 2) return "fail 2" + if (a3 !is Int || a3 != 2) return "fail 3" + if (a4 !is Long || a4 != 2L) return "fail 4" + if (a5 !is Double || a5 != 2.0) return "fail 5" + if (a6 !is Float || a6 != 2f) return "fail 6" + if (a7 !is Char || a7 != 'B') return "fail 7" + if (a8 !is Int || a8 != 1) return "fail 8" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicNullable.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicNullable.kt new file mode 100644 index 00000000000..fdfc98f3bb4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/intrinsicNullable.kt @@ -0,0 +1,21 @@ +fun box(): String { + val a1: Byte? = 1 + 1 + val a2: Short? = 1 + 1 + val a3: Int? = 1 + 1 + val a4: Long? = 1 + 1 + val a5: Double? = 1.0 + 1 + val a6: Float? = 1f + 1 + val a7: Char? = 'A' + 1 + val a8: Int? = 'B' - 'A' + + if (a1!! != 2.toByte()) return "fail 1" + if (a2!! != 2.toShort()) return "fail 2" + if (a3!! != 2) return "fail 3" + if (a4!! != 2L) return "fail 4" + if (a5!! != 2.0) return "fail 5" + if (a6!! != 2f) return "fail 6" + if (a7!! != 'B') return "fail 7" + if (a8!! != 1) return "fail 8" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/kt11163.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/kt11163.kt new file mode 100644 index 00000000000..6a20534e140 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/kt11163.kt @@ -0,0 +1,12 @@ +operator fun Int.compareTo(c: Char) = 0 + +fun foo(x: Int, y: Char): String { + if (x < y) { + throw Error() + } + return "${y}K" +} + +fun box(): String { + return foo(42, 'O') +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/kt6747_identityEquals.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/kt6747_identityEquals.kt new file mode 100644 index 00000000000..cf261d60b7a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/kt6747_identityEquals.kt @@ -0,0 +1,9 @@ +class Test { + fun check(a: Any?): String { + if (this === a) return "Fail 1" + if (!(this !== a)) return "Fail 2" + return "OK" + } +} + +fun box(): String = Test().check("String") diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/overflowChar.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/overflowChar.kt new file mode 100644 index 00000000000..0f06f4969fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/overflowChar.kt @@ -0,0 +1,10 @@ +fun box(): String { + val c1: Char = 0.toChar() + val c2 = c1 - 1 + if (c2 < c1) return "fail: 0.toChar() - 1 should overflow to positive." + + val c3 = c2 + 1 + if (c3 > c2) return "fail: FFFF.toChar() + 1 should overflow to zero." + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/overflowInt.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/overflowInt.kt new file mode 100644 index 00000000000..4d5b899987f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/overflowInt.kt @@ -0,0 +1,11 @@ +fun box(): String { + val i1: Int = Int.MAX_VALUE + val i2 = i1 + 1 + if (i2 > i1) return "fail: Int.MAX_VALUE + 1 should overflow to negative." + + val i3: Int = Int.MIN_VALUE + val i4 = i3 - 1 + if (i4 < i3) return "fail: Int.MIN_VALUE - 1 should overflow to positive." + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/overflowLong.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/overflowLong.kt new file mode 100644 index 00000000000..28d37ab1c12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/overflowLong.kt @@ -0,0 +1,14 @@ +fun box(): String { + val a: Long = 2147483647 + 1 + if (a != -2147483648L) return "fail: in this case we should add to ints and than cast the result to long - overflow expected" + + val l1 = Long.MAX_VALUE + val l2 = l1 + 1 + if (l2 > l1) return "fail: Long.MAX_VALUE + 1 should overflow to negative." + + val l3 = Long.MIN_VALUE + val l4 = l3 - 1 + if (l4 < l3) return "fail: Long.MIN_VALUE - 1 should overflow to positive." + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/casts.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/casts.kt new file mode 100644 index 00000000000..47ce676892b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/casts.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x : R?, block : (R?) -> T) : T { + return block(x) +} + +fun box() : String { + assertEquals(1L, foo(1) { x -> x!!.toLong() }) + assertEquals(1.toShort(), foo(1) { x -> x!!.toShort() }) + assertEquals(1.toByte(), foo(1L) { x -> x!!.toByte() }) + assertEquals(1.toShort(), foo(1L) { x -> x!!.toShort() }) + assertEquals('a'.toDouble(), foo('a') { x -> x!!.toDouble() }) + assertEquals(1.0.toByte(), foo(1.0) { x -> x!!.toByte() }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt new file mode 100644 index 00000000000..0bbf5986f68 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x : R, y : R, block : (R) -> T) : T { + val a = x is Number + val b = x is Object + + val b1 = x as Object + + if (a && b) { + return block(x) + } else { + return block(y) + } +} + +fun box() : String { + assertEquals(1, foo(1, 2) { x -> x as Int }) + assertEquals("def", foo("abc", "def") { x -> x as String }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/fold.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/fold.kt new file mode 100644 index 00000000000..7bb1608458b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/fold.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box() : String { + val x = LongArray(5) + for (i in 0..4) { + x[i] = (i + 1).toLong() + } + + assertEquals(15L, x.fold(0L) { x, y -> x + y }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/foldRange.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/foldRange.kt new file mode 100644 index 00000000000..1127090af9e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/foldRange.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + val result = (1..5).fold(0) { x, y -> x + y } + + assertEquals(15, result) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5493.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5493.kt new file mode 100644 index 00000000000..efd7e94a5f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5493.kt @@ -0,0 +1,8 @@ +fun box() : String { + try { + return "OK" + } + finally { + null?.toString() + } +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5588.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5588.kt new file mode 100644 index 00000000000..ece5914c504 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5588.kt @@ -0,0 +1,10 @@ +fun box() : String { + val s = "notA" + val id = when (s) { + "a" -> 1 + else -> null + } + + if (id == null) return "OK" + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5844.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5844.kt new file mode 100644 index 00000000000..acc4da5c729 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt5844.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun test1() { + val u = when (true) { + true -> 42 + else -> 1.0 + } + + assertEquals(42, u) +} + +fun test2() { + val u = 1L.let { + when (it) { + is Long -> if (it.toLong() == 2L) it.toLong() else it * 2L // CompilationException + else -> it.toDouble() + } + } + + assertEquals(2L, u) +} + +fun box(): String { + test1() + test2() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt new file mode 100644 index 00000000000..75714bc8a03 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun checkLongAB5E(x: Long) = assertEquals(0xAB5EL, x) +fun checkDouble1(y: Double) = assertEquals(1.0, y) +fun checkByte10(z: Byte) = assertEquals(10.toByte(), z) + +fun box(): String { + val x = java.lang.Long.valueOf("AB5E", 16) + checkLongAB5E(x) + + val y = java.lang.Double.valueOf("1.0") + checkDouble1(y) + + val z = java.lang.Byte.valueOf("A", 16) + checkByte10(z) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6842.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6842.kt new file mode 100644 index 00000000000..e3162a626a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6842.kt @@ -0,0 +1,9 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + val x = (10L..50).map { it * 40L } + assertEquals(400L, x.first()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/nullCheck.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/nullCheck.kt new file mode 100644 index 00000000000..4ba74af4165 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/nullCheck.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x : R?, y : R?, block : (R?) -> T) : T { + if (x == null) { + return block(x) + } else { + return block(y) + } +} + +fun box() : String { + assertEquals(3, foo(1, 2) { x -> if (x != null) 3 else 4 }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/progressions.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/progressions.kt new file mode 100644 index 00000000000..6892c12e89d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/progressions.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box() : String { + + val result1 = (1..100).count { x -> x % 2 == 0 } + val result2 = (1..100).filter { x -> x % 2 == 0 }.size + assertEquals(result1, 50) + assertEquals(result2, 50) + + val result3 = (1..100).map { x -> 2 * x }.count { x -> x % 2 == 0 } + val result4 = (1..100).map { x -> 2 * x }.filter { x -> x % 2 == 0 }.size + assertEquals(result3, 100) + assertEquals(result4, 100) + + val result5 = (1L..100L).count { x -> x % 2 == 0L } + val result6 = (1L..100L).filter { x -> x % 2 == 0L }.size + assertEquals(result5, 50) + assertEquals(result6, 50) + + val result7 = (1L..100L).map { x -> 2 * x }.count { x -> x % 2 == 0L } + val result8 = (1L..100L).map { x -> 2 * x }.filter { x -> x % 2 == 0L }.size + assertEquals(result7, 100) + assertEquals(result8, 100) + + val result9 = (0..10).reduce { total, next -> total + next } + val result10 = (0L..10L).reduce { total, next -> total + next } + assertEquals(result9, 55) + assertEquals(result10, 55L) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/safeCallWithElvis.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/safeCallWithElvis.kt new file mode 100644 index 00000000000..1ffec309237 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/safeCallWithElvis.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +class A(val x : Int, val y : A?) + +fun check(a : A?) : Int { + return a?.y?.x ?: (a?.x ?: 3) +} + +fun checkLeftAssoc(a : A?) : Int { + return (a?.y?.x ?: a?.x) ?: 3 +} + +fun box() : String { + val a1 = A(2, A(1, null)) + val a2 = A(2, null) + val a3 = null + + assertEquals(1, check(a1)) + assertEquals(2, check(a2)) + assertEquals(3, check(a3)) + + assertEquals(1, checkLeftAssoc(a1)) + assertEquals(2, checkLeftAssoc(a2)) + assertEquals(3, checkLeftAssoc(a3)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/simple.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/simple.kt new file mode 100644 index 00000000000..fbe93a5233a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/simple.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x : R, block : (R) -> R) : R { + return block(x) +} + +fun box() : String { + val result = foo(1) { x -> x + 1 } + assertEquals(2, result) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/simpleUninitializedMerge.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/simpleUninitializedMerge.kt new file mode 100644 index 00000000000..9612abbe1bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/simpleUninitializedMerge.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var result = 0 + if (1 == 1) { + val x: Int? = 1 + result += x!! + } + + assertEquals(1, result) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/unsafeRemoving.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/unsafeRemoving.kt new file mode 100644 index 00000000000..e11a594361d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/unsafeRemoving.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun returningBoxed() : Int? = 1 +fun acceptingBoxed(x : Int?) : Int ? = x + +class A(var x : Int? = null) + +fun box() : String { + assertEquals(1, returningBoxed()) + assertEquals(1, acceptingBoxed(1)) + + val a = A() + a.x = 1 + assertEquals(1, a.x) + + val b = Array(1, { null }) + b[0] = 1 + assertEquals(1, b[0]) + + val x: Int? = 1 + assertEquals(1, x!!.hashCode()) + + val y: Int? = 1000 + val z: Int? = 1000 + val res = y === z + + val c1: Any = if (1 == 1) 0 else "abc" + val c2: Any = if (1 != 1) 0 else "abc" + assertEquals(0, c1) + assertEquals("abc", c2) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/variables.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/variables.kt new file mode 100644 index 00000000000..18f6bf3d71e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/variables.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x : R, block : (R) -> T) : T { + var y = x + var z = y + z = x + return block(z) +} + +fun box() : String { + assertEquals(1, foo(1) { x -> x }) + assertEquals(1f, foo(1f) { x -> x }) + assertEquals(1L, foo(1L) { x -> x }) + assertEquals(1.toDouble(), foo(1.toDouble()) { x -> x }) + assertEquals(1.toShort(), foo(1.toShort()) { x -> x }) + assertEquals(1.toByte(), foo(1.toByte()) { x -> x }) + assertEquals('a', foo('a') { x -> x }) + assertEquals(true, foo(true) { x -> x }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/complexMultiInheritance.kt b/backend.native/tests/external/codegen/blackbox/bridges/complexMultiInheritance.kt new file mode 100644 index 00000000000..227bd67042c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/complexMultiInheritance.kt @@ -0,0 +1,25 @@ +open class A { + open fun foo(): Any = "A" +} + +open class C : A() { + override fun foo(): Int = 222 +} + +interface D { + fun foo(): Number +} + +class E : C(), D + +fun box(): String { + val e = E() + if (e.foo() != 222) return "Fail 1" + val d: D = e + val c: C = e + val a: A = e + if (d.foo() != 222) return "Fail 2" + if (c.foo() != 222) return "Fail 3" + if (a.foo() != 222) return "Fail 4" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/complexTraitImpl.kt b/backend.native/tests/external/codegen/blackbox/bridges/complexTraitImpl.kt new file mode 100644 index 00000000000..ff5edc8750b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/complexTraitImpl.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +abstract class A { + abstract fun foo(): List +} + +interface B { + fun foo(): ArrayList = ArrayList(listOf("B")) +} + +open class C : A(), B { + override fun foo(): ArrayList = super.foo() +} + +interface D { + fun foo(): Collection +} + +class E : D, C() + +fun box(): String { + val e = E() + var r = e.foo()[0] + val d: D = e + val c: C = e + val b: B = e + val a: A = e + r += d.foo().iterator().next() + r += c.foo()[0] + r += b.foo()[0] + r += a.foo()[0] + return if (r == "BBBBB") "OK" else "Fail: $r" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/delegation.kt b/backend.native/tests/external/codegen/blackbox/bridges/delegation.kt new file mode 100644 index 00000000000..29dfbecf8a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/delegation.kt @@ -0,0 +1,14 @@ +interface A { + fun foo(): T +} + +class B : A { + override fun foo() = "OK" +} + +class C(a: A) : A by a + +fun box(): String { + val a: A = C(B()) + return a.foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/delegationComplex.kt b/backend.native/tests/external/codegen/blackbox/bridges/delegationComplex.kt new file mode 100644 index 00000000000..77af8d7e9b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/delegationComplex.kt @@ -0,0 +1,17 @@ +open class Content() { + override fun toString() = "OK" +} + +interface Box { + fun get(): E +} + +interface ContentBox : Box + +object Impl : ContentBox { + override fun get(): Content = Content() +} + +class ContentBoxDelegate() : ContentBox by (Impl as ContentBox) + +fun box() = ContentBoxDelegate().get().toString() diff --git a/backend.native/tests/external/codegen/blackbox/bridges/delegationComplexWithList.kt b/backend.native/tests/external/codegen/blackbox/bridges/delegationComplexWithList.kt new file mode 100644 index 00000000000..caf8be2c5dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/delegationComplexWithList.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +open class Content() { + override fun toString() = "OK" +} + +interface ContentBox : List + +object Impl : ContentBox , AbstractList() { + override fun get(index: Int) = Content() + + override val size: Int + get() = throw UnsupportedOperationException() +} + +class ContentBoxDelegate() : ContentBox by (Impl as ContentBox) + +fun box() = ContentBoxDelegate()[0].toString() diff --git a/backend.native/tests/external/codegen/blackbox/bridges/delegationProperty.kt b/backend.native/tests/external/codegen/blackbox/bridges/delegationProperty.kt new file mode 100644 index 00000000000..8192c4f4532 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/delegationProperty.kt @@ -0,0 +1,15 @@ +interface A { + var result: T +} + +class B(a: A): A by a + +fun box(): String { + val o = object : A { + override var result = "Fail" + } + val b: A = B(o) + b.result = "OK" + if (b.result != "OK") return "Fail" + return b.result +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/diamond.kt b/backend.native/tests/external/codegen/blackbox/bridges/diamond.kt new file mode 100644 index 00000000000..ef1990bf937 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/diamond.kt @@ -0,0 +1,26 @@ +interface A { + fun foo(t: T, u: U) = "A" +} + +interface B : A + +interface C : A + +class Z : B, C { + override fun foo(t: String, u: Int) = "Z" +} + + +fun box(): String { + val z = Z() + val c: C = z + val b: B = z + val a: A = z + return when { + z.foo("", 0) != "Z" -> "Fail #1" + c.foo("", 0) != "Z" -> "Fail #2" + b.foo("", 0) != "Z" -> "Fail #3" + a.foo("", 0) != "Z" -> "Fail #4" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/fakeCovariantOverride.kt b/backend.native/tests/external/codegen/blackbox/bridges/fakeCovariantOverride.kt new file mode 100644 index 00000000000..e62de29d55a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/fakeCovariantOverride.kt @@ -0,0 +1,19 @@ +// KT-4145 + +interface A { + fun foo(): Any +} + +open class B { + fun foo(): String = "A" +} + +open class C: B(), A + +fun box(): String { + val a: A = C() + if (a.foo() != "A") return "Fail 1" + if ((a as B).foo() != "A") return "Fail 2" + if ((a as C).foo() != "A") return "Fail 3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverride.kt b/backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverride.kt new file mode 100644 index 00000000000..ffff9f297e4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverride.kt @@ -0,0 +1,22 @@ +// KT-3985 + +interface Trait { + fun f(): T +} + +open class Class { + fun f(): String = throw UnsupportedOperationException() +} + +class Foo: Class(), Trait { +} + +fun box(): String { + val t: Trait = Foo() + try { + t.f() + } catch (e: UnsupportedOperationException) { + return "OK" + } + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverrideWithDelegation.kt b/backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverrideWithDelegation.kt new file mode 100644 index 00000000000..450ad185175 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/fakeGenericCovariantOverrideWithDelegation.kt @@ -0,0 +1,32 @@ +interface A { + fun foo(t: T): String +} + +interface B { + fun foo(t: Int) = "B" +} + +class Z : B + +class Z1 : A, B by Z() + +class Z2 : B by Z(), A + +fun box(): String { + val z1 = Z1() + val z2 = Z2() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 + + return when { + z1.foo( 0) != "B" -> "Fail #1" + z1a.foo( 0) != "B" -> "Fail #2" + z1b.foo( 0) != "B" -> "Fail #3" + z2.foo( 0) != "B" -> "Fail #4" + z2a.foo( 0) != "B" -> "Fail #5" + z2b.foo( 0) != "B" -> "Fail #6" + else -> "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideOfTraitImpl.kt b/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideOfTraitImpl.kt new file mode 100644 index 00000000000..7827f53a892 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideOfTraitImpl.kt @@ -0,0 +1,31 @@ +var result = "" + +interface D1 { + fun foo(): D1 { + result += "D1" + return this + } +} + +interface F2 : D1 + +interface D3 : F2 { + override fun foo(): D3 { + result += "D3" + return this + } +} + +class D4 : D3 + +fun box(): String { + val x = D4() + x.foo() + val d3: D3 = x + val f2: F2 = x + val d1: D1 = x + d3.foo() + f2.foo() + d1.foo() + return if (result == "D3D3D3D3") "OK" else "Fail: $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSeveralSuperDeclarations.kt b/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSeveralSuperDeclarations.kt new file mode 100644 index 00000000000..c9844928db7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSeveralSuperDeclarations.kt @@ -0,0 +1,30 @@ +interface D1 { + fun foo(): Any +} + +interface D2 { + fun foo(): Number +} + +interface F3 : D1, D2 + +open class D4 { + fun foo(): Int = 42 +} + +class F5 : F3, D4() + +fun box(): String { + val z = F5() + var result = z.foo() + val d4: D4 = z + val f3: F3 = z + val d2: D2 = z + val d1: D1 = z + + result += d4.foo() + result += f3.foo() as Int + result += d2.foo() as Int + result += d1.foo() as Int + return if (result == 5 * 42) "OK" else "Fail: $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSynthesizedImplementation.kt b/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSynthesizedImplementation.kt new file mode 100644 index 00000000000..075bbca0443 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/fakeOverrideWithSynthesizedImplementation.kt @@ -0,0 +1,18 @@ +open class A(val value: String) { + fun component1() = value +} + +interface B { + fun component1(): Any +} + +class C(value: String) : A(value), B + +fun box(): String { + val c = C("OK") + val b: B = c + val a: A = c + if (b.component1() != "OK") return "Fail 1" + if (a.component1() != "OK") return "Fail 2" + return c.component1() +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/genericProperty.kt b/backend.native/tests/external/codegen/blackbox/bridges/genericProperty.kt new file mode 100644 index 00000000000..be4000a62e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/genericProperty.kt @@ -0,0 +1,19 @@ +open class A { + var size: T = 56 as T +} + +interface C { + var size: Int +} + +class B : C, A() + +fun box(): String { + val b = B() + if (b.size != 56) return "fail 1: ${b.size}" + + b.size = 55 + if (b.size != 55) return "fail 2: ${b.size}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/jsName.kt b/backend.native/tests/external/codegen/blackbox/bridges/jsName.kt new file mode 100644 index 00000000000..c024e4eed2e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/jsName.kt @@ -0,0 +1,59 @@ +// TARGET_BACKEND: JS +package foo + +interface A { + @JsName("foo") fun foo(value: Int): String +} + +interface B { + @JsName("bar") fun foo(value: Int): String +} + +open class C : A, B { + override fun foo(value: Int) = "C.foo($value)" +} + +class CDerived : C() { + override fun foo(value: Int) = "CDerived.foo($value)" +} + +open class D { + open fun foo(value: Int) = "D.foo($value)" +} + +class E : D(), A, B + +fun box(): String { + val a: A = C() + assertEquals("C.foo(55)", a.foo(55)) + + val b: B = C() + assertEquals("C.foo(23)", b.foo(23)) + + val a2: A = CDerived() + assertEquals("CDerived.foo(55)", a2.foo(55)) + + val b2: B = CDerived() + assertEquals("CDerived.foo(23)", b2.foo(23)) + + val d: dynamic = C() + assertEquals("C.foo(42)", d.foo(42)) + assertEquals("C.foo(99)", d.bar(99)) + + val d2: dynamic = CDerived() + assertEquals("CDerived.foo(42)", d2.foo(42)) + assertEquals("CDerived.foo(99)", d2.bar(99)) + + val da: A = E() + assertEquals("D.foo(55)", da.foo(55)) + + val db: B = E() + assertEquals("D.foo(23)", db.foo(23)) + + val dd: dynamic = E() + assertEquals("D.foo(42)", dd.foo(42)) + assertEquals("D.foo(99)", dd.bar(99)) + assertEquals("D.foo(88)", dd.`foo_za3lpa$`(88)) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/bridges/jsNative.kt b/backend.native/tests/external/codegen/blackbox/bridges/jsNative.kt new file mode 100644 index 00000000000..b13d97886dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/jsNative.kt @@ -0,0 +1,44 @@ +// TARGET_BACKEND: JS +package foo + +external interface A { + fun foo(value: Int): String +} + +interface B { + fun foo(value: Int): String +} + +class C : A, B { + override fun foo(value: Int) = "C.foo($value)" +} + +open class D { + open fun foo(value: Int) = "D.foo($value)" +} + +class E : D(), A, B + +fun box(): String { + val a: A = C() + assertEquals("C.foo(55)", a.foo(55)) + + val b: B = C() + assertEquals("C.foo(23)", b.foo(23)) + + val d: dynamic = C() + assertEquals("C.foo(42)", d.foo(42)) + assertEquals("C.foo(99)", d.`foo_za3lpa$`(99)) + + val da: A = E() + assertEquals("D.foo(55)", da.foo(55)) + + val db: B = E() + assertEquals("D.foo(23)", db.foo(23)) + + val dd: dynamic = E() + assertEquals("D.foo(42)", dd.foo(42)) + assertEquals("D.foo(99)", dd.`foo_za3lpa$`(99)) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt12416.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt12416.kt new file mode 100644 index 00000000000..c50c81671f5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt12416.kt @@ -0,0 +1,41 @@ +interface A { + fun foo(t: T, u: Int) = "A" +} + +interface B { + fun foo(t: T, u: U) = "B" +} + +interface Z1 : A, B { + override fun foo(t: String, u: Int) = "Z1" +} + +interface Z2 : B, A { + override fun foo(t: String, u: Int) = "Z2" +} + +class Z1C : Z1 { + +} + +class Z2C : Z2 { + +} + +fun box(): String { + val z1 = Z1C() + val z2 = Z2C() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 + return when { + z1.foo("", 0) != "Z1" -> "Fail #1" + z1a.foo("", 0) != "Z1" -> "Fail #2" + z1b.foo("", 0) != "Z1" -> "Fail #3" //FAIL + z2.foo("", 0) != "Z2" -> "Fail #4" + z2a.foo("", 0) != "Z2" -> "Fail #5" + z2b.foo("", 0) != "Z2" -> "Fail #6" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt1939.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt1939.kt new file mode 100644 index 00000000000..ad300dc796e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt1939.kt @@ -0,0 +1,12 @@ +abstract class Foo { + fun hello(id: T) = "Hi $id" +} + +interface Tr { + fun hello(s : String): String +} + +class Bar: Foo(), Tr { +} + +fun box(): String = if (Bar().hello("Reg") == "Hi Reg") "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt1959.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt1959.kt new file mode 100644 index 00000000000..e7bfcbaa2c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt1959.kt @@ -0,0 +1,13 @@ +open class A { + open fun f(args : Array) {} +} + +class B(): A() { + override fun f(args : Array) {} +} + +fun main(args: Array) { + B() +} + +fun box(): String = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt2498.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt2498.kt new file mode 100644 index 00000000000..7d0feab1058 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt2498.kt @@ -0,0 +1,19 @@ +open class BaseStringList: ArrayList() { +} + +class StringList: BaseStringList() { + public override fun get(index: Int): String { + return "StringList.get()" + } +} + +fun box(): String { + val myStringList = StringList() + myStringList.add("first element") + if (myStringList.get(0) != "StringList.get()") return "Fail #1" + val b: BaseStringList = myStringList + val a: ArrayList = myStringList + if (b.get(0) != "StringList.get()") return "Fail #2" + if (a.get(0) != "StringList.get()") return "Fail #3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt2702.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt2702.kt new file mode 100644 index 00000000000..cbf5eebee68 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt2702.kt @@ -0,0 +1,14 @@ +open class A { + open fun foo(r: R): R {return r} +} + +open class B : A() { +} + +open class C : B() { + override fun foo(r: String): String { + return super.foo(r) + "K" + } +} + +fun box() = C().foo("O") diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt2833.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt2833.kt new file mode 100644 index 00000000000..50a2989d904 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt2833.kt @@ -0,0 +1,17 @@ +package test + +public interface FunDependencyEdge { + val from: FunctionNode +} + +public interface FunctionNode + +public class FunctionNodeImpl : FunctionNode + +class FunDependencyEdgeImpl(override val from: FunctionNodeImpl): FunDependencyEdge { +} + +fun box(): String { + (FunDependencyEdgeImpl(FunctionNodeImpl()) as FunDependencyEdge).from + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt2920.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt2920.kt new file mode 100644 index 00000000000..0f71953ba12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt2920.kt @@ -0,0 +1,9 @@ +interface Tr { + val v: T +} + +class C : Tr { + override val v = "OK" +} + +fun box() = C().v diff --git a/backend.native/tests/external/codegen/blackbox/bridges/kt318.kt b/backend.native/tests/external/codegen/blackbox/bridges/kt318.kt new file mode 100644 index 00000000000..72e5991297c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/kt318.kt @@ -0,0 +1,24 @@ +var result = "" + +interface Base +open class Child : Base + +interface A { + fun foo(a : E) { + result += "A" + } +} + +class B : A { + override fun foo(a : E) { + result += "B" + } +} + +fun box(): String { + val b = B() + b.foo(Child()) + val a: A = b + a.foo(Child()) + return if (result == "BB") "OK" else "Fail: $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/longChainOneBridge.kt b/backend.native/tests/external/codegen/blackbox/bridges/longChainOneBridge.kt new file mode 100644 index 00000000000..6d1d79c28e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/longChainOneBridge.kt @@ -0,0 +1,32 @@ +open class A { + open fun foo(t: T) = "A" +} + +open class B : A() + +open class C : B() { + override fun foo(t: String) = "C" +} + +open class D : C() + +class Z : D() { + override fun foo(t: String) = "Z" +} + + +fun box(): String { + val z = Z() + val d: D = z + val c: C = z + val b: B = z + val a: A = z + return when { + z.foo("") != "Z" -> "Fail #1" + d.foo("") != "Z" -> "Fail #2" + c.foo("") != "Z" -> "Fail #3" + b.foo("") != "Z" -> "Fail #4" + a.foo("") != "Z" -> "Fail #5" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/manyTypeArgumentsSubstitutedSuccessively.kt b/backend.native/tests/external/codegen/blackbox/bridges/manyTypeArgumentsSubstitutedSuccessively.kt new file mode 100644 index 00000000000..82306ddf3f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/manyTypeArgumentsSubstitutedSuccessively.kt @@ -0,0 +1,26 @@ +open class A { + open fun foo(t: T, u: U, v: V) = "A" +} + +open class B : A() + +open class C : B() + +class Z : C() { + override fun foo(t: String, u: Int, v: Double) = "Z" +} + + +fun box(): String { + val z = Z() + val c: C = z + val b: B = z + val a: A = z + return when { + z.foo("", 0, 0.0) != "Z" -> "Fail #1" + c.foo("", 0, 0.0) != "Z" -> "Fail #2" + b.foo("", 0, 0.0) != "Z" -> "Fail #3" + a.foo("", 0, 0.0) != "Z" -> "Fail #4" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/methodFromTrait.kt b/backend.native/tests/external/codegen/blackbox/bridges/methodFromTrait.kt new file mode 100644 index 00000000000..058109901d1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/methodFromTrait.kt @@ -0,0 +1,17 @@ +interface A { + fun foo(t: T, u: U) = "A" +} + +class Z : A { + override fun foo(t: T, u: Int) = "Z" +} + +fun box(): String { + val z = Z() + val a: A = z + return when { + z.foo(0, 0) != "Z" -> "Fail #1" + a.foo(0, 0) != "Z" -> "Fail #2" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/noBridgeOnMutableCollectionInheritance.kt b/backend.native/tests/external/codegen/blackbox/bridges/noBridgeOnMutableCollectionInheritance.kt new file mode 100644 index 00000000000..59e364fe37f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/noBridgeOnMutableCollectionInheritance.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +interface A { + fun foo(): Collection +} + +interface B : A { + override fun foo(): MutableCollection +} + +class C : B { + override fun foo(): MutableList = ArrayList(listOf("C")) +} + +fun box(): String { + val c = C() + var r = c.foo().iterator().next() + val b: B = c + val a: A = c + r += b.foo().iterator().next() + r += a.foo().iterator().next() + return if (r == "CCC") "OK" else "Fail: $r" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/objectClone.kt b/backend.native/tests/external/codegen/blackbox/bridges/objectClone.kt new file mode 100644 index 00000000000..773f66e04c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/objectClone.kt @@ -0,0 +1,23 @@ +// TARGET_BACKEND: JVM +import java.util.HashSet + +interface A : Set + +class B : A, HashSet() { + override fun clone(): B = throw AssertionError() +} + +fun box(): String { + return try { + B().clone() + "Fail 1" + } catch (e: AssertionError) { + try { + val hs: HashSet = B() + hs.clone() + "Fail 2" + } catch (e: AssertionError) { + "OK" + } + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/overrideAbstractProperty.kt b/backend.native/tests/external/codegen/blackbox/bridges/overrideAbstractProperty.kt new file mode 100644 index 00000000000..ec01cfced5c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/overrideAbstractProperty.kt @@ -0,0 +1,10 @@ +public abstract class AbstractClass { + public abstract val some: T +} + +public class Class: AbstractClass() { + public override val some: String + get() = "OK" +} + +fun box(): String = Class().some diff --git a/backend.native/tests/external/codegen/blackbox/bridges/overrideReturnType.kt b/backend.native/tests/external/codegen/blackbox/bridges/overrideReturnType.kt new file mode 100644 index 00000000000..e8d2619eb02 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/overrideReturnType.kt @@ -0,0 +1,13 @@ +open class C { + open fun f(): Any = "C f" +} + +class D() : C() { + override fun f(): String = "D f" +} + +fun box(): String{ + val d : C = D() + if(d.f() != "D f") return "fail f" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/propertyAccessorsWithoutBody.kt b/backend.native/tests/external/codegen/blackbox/bridges/propertyAccessorsWithoutBody.kt new file mode 100644 index 00000000000..82a9b0b930c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/propertyAccessorsWithoutBody.kt @@ -0,0 +1,15 @@ +open class A { + open var x: T = "Fail" as T + get +} + +class B : A() { + override var x: String = "Fail" + set +} + +fun box(): String { + val a: A = B() + a.x = "OK" + return a.x +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/propertyDiamond.kt b/backend.native/tests/external/codegen/blackbox/bridges/propertyDiamond.kt new file mode 100644 index 00000000000..802f6f77932 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/propertyDiamond.kt @@ -0,0 +1,18 @@ +interface A { + val o: O + val k: K +} + +interface B : A + +interface C : A + +class D : B, C { + override val o = "O" + override val k = "K" +} + +fun box(): String { + val a: A = D() + return a.o + a.k +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/propertyInConstructor.kt b/backend.native/tests/external/codegen/blackbox/bridges/propertyInConstructor.kt new file mode 100644 index 00000000000..9ca1e8bf8f5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/propertyInConstructor.kt @@ -0,0 +1,11 @@ +interface A { + var x: T +} + +class B(override var x: String) : A + +fun box(): String { + val a: A = B("Fail") + a.x = "OK" + return a.x +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/propertySetter.kt b/backend.native/tests/external/codegen/blackbox/bridges/propertySetter.kt new file mode 100644 index 00000000000..a258dc85346 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/propertySetter.kt @@ -0,0 +1,13 @@ +interface A { + var v: T +} + +class B : A { + override var v: String = "Fail" +} + +fun box(): String { + val a: A = B() + a.v = "OK" + return a.v +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simple.kt b/backend.native/tests/external/codegen/blackbox/bridges/simple.kt new file mode 100644 index 00000000000..284d7cbb44c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simple.kt @@ -0,0 +1,18 @@ +open class A { + open fun foo(t: T) = "A" +} + +class Z : A() { + override fun foo(t: String) = "Z" +} + + +fun box(): String { + val z = Z() + val a: A = z + return when { + z.foo("") != "Z" -> "Fail #1" + a.foo("") != "Z" -> "Fail #2" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simpleEnum.kt b/backend.native/tests/external/codegen/blackbox/bridges/simpleEnum.kt new file mode 100644 index 00000000000..0446aba8c33 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simpleEnum.kt @@ -0,0 +1,20 @@ +interface A { + open fun foo(t: T) = "A" +} + +enum class Z(val aname: String) : A { + Z1("Z1"), + Z2("Z2"); + override fun foo(t: String) = aname +} + + +fun box(): String { + return when { + Z.Z1.foo("") != "Z1" -> "Fail #1" + Z.Z2.foo("") != "Z2" -> "Fail #2" + (Z.Z1 as A).foo("") != "Z1" -> "Fail #3" + (Z.Z2 as A).foo("") != "Z2" -> "Fail #4" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simpleGenericMethod.kt b/backend.native/tests/external/codegen/blackbox/bridges/simpleGenericMethod.kt new file mode 100644 index 00000000000..81e6c8607c1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simpleGenericMethod.kt @@ -0,0 +1,18 @@ +open class A { + open fun foo(t: T, u: U) = "A" +} + +class Z : A() { + override fun foo(t: String, u: U) = "Z" +} + + +fun box(): String { + val z = Z() + val a: A = z + return when { + z.foo("", 0) != "Z" -> "Fail #1" + a.foo("", 0) != "Z" -> "Fail #2" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simpleObject.kt b/backend.native/tests/external/codegen/blackbox/bridges/simpleObject.kt new file mode 100644 index 00000000000..5ff3c8177e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simpleObject.kt @@ -0,0 +1,23 @@ +open class A { + open fun foo(t: T) = "A" +} + +object Z : A() { + override fun foo(t: String) = "Z" +} + + +fun box(): String { + val z = object : A() { + override fun foo(t: String) = "z" + } + val az: A = Z + val a: A = z + return when { + Z.foo("") != "Z" -> "Fail #1" + z.foo("") != "z" -> "Fail #2" + az.foo("") != "Z" -> "Fail #3" + a.foo("") != "z" -> "Fail #4" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simpleReturnType.kt b/backend.native/tests/external/codegen/blackbox/bridges/simpleReturnType.kt new file mode 100644 index 00000000000..ffd0bf84892 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simpleReturnType.kt @@ -0,0 +1,17 @@ +open class A(val t: T) { + open fun foo(): T = t +} + +class Z : A(17) { + override fun foo() = 239 +} + +fun box(): String { + val z = Z() + val a: A = z + return when { + z.foo() != 239 -> "Fail #1" + a.foo() != 239 -> "Fail #2" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simpleTraitImpl.kt b/backend.native/tests/external/codegen/blackbox/bridges/simpleTraitImpl.kt new file mode 100644 index 00000000000..1e1ccbab17e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simpleTraitImpl.kt @@ -0,0 +1,16 @@ +interface A { + fun foo(t: T) = "A" +} + +class Z : A + + +fun box(): String { + val z = Z() + val a: A = z + return when { + z.foo("") != "A" -> "Fail #1" + a.foo("") != "A" -> "Fail #2" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/simpleUpperBound.kt b/backend.native/tests/external/codegen/blackbox/bridges/simpleUpperBound.kt new file mode 100644 index 00000000000..dea1f7eb647 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/simpleUpperBound.kt @@ -0,0 +1,18 @@ +open class A { + open fun foo(t: T) = "A" +} + +class Z : A() { + override fun foo(t: Int) = "Z" +} + + +fun box(): String { + val z = Z() + val a: A = z + return when { + z.foo(0) != "Z" -> "Fail #1" + a.foo(0) != "Z" -> "Fail #2" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/strListContains.kt b/backend.native/tests/external/codegen/blackbox/bridges/strListContains.kt new file mode 100644 index 00000000000..0d260822554 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/strListContains.kt @@ -0,0 +1,52 @@ +class StrList : List { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(o: String?) = o == null || o == "abc" + + override fun iterator(): Iterator { + throw UnsupportedOperationException() + } + + override fun containsAll(c: Collection) = false + override fun get(index: Int): String { + throw UnsupportedOperationException() + } + + override fun indexOf(o: String?): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(o: String?): Int { + throw UnsupportedOperationException() + } + + override fun listIterator(): ListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): ListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): List { + throw UnsupportedOperationException() + } +} + +fun Collection.forceContains(x: Any?): Boolean = contains(x as E) + +fun box(): String { + val strList = StrList() + + if (strList.forceContains(1)) return "fail 1" + if (!strList.forceContains(null)) return "fail 2" + if (strList.forceContains("cde")) return "fail 3" + if (!strList.forceContains("abc")) return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/abstractFun.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/abstractFun.kt new file mode 100644 index 00000000000..39e1b1935f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/abstractFun.kt @@ -0,0 +1,22 @@ +abstract class A { + abstract fun foo(t: T): String +} + +abstract class B : A() + +class Z : B() { + override fun foo(t: String) = "Z" +} + + +fun box(): String { + val z = Z() + val b: B = z + val a: A = z + return when { + z.foo("") != "Z" -> "Fail #1" + b.foo("") != "Z" -> "Fail #2" + a.foo("") != "Z" -> "Fail #3" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/boundedTypeArguments.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/boundedTypeArguments.kt new file mode 100644 index 00000000000..3db4852ed2b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/boundedTypeArguments.kt @@ -0,0 +1,21 @@ +open class A { + open fun foo(t: T, u: U) = "A" +} + +open class B : A() + +class Z : B() { + override fun foo(t: Int, u: Number) = "Z" +} + +fun box(): String { + val z = Z() + val b: B = z + val a: A = z + return when { + z.foo(0, 0) != "Z" -> "Fail #1" + b.foo(0, 0) != "Z" -> "Fail #2" + a.foo(0, 0) != "Z" -> "Fail #3" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/delegation.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/delegation.kt new file mode 100644 index 00000000000..3d80f6523ea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/delegation.kt @@ -0,0 +1,18 @@ +interface A { + fun id(t: T): T +} + +open class B : A { + override fun id(t: String) = t +} + +class C : B() + +class D : A by C() + +fun box(): String { + val d = D() + if (d.id("") != "") return "Fail" + val a: A = d + return a.id("OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt new file mode 100644 index 00000000000..d3bb7ce59e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt @@ -0,0 +1,15 @@ +public open class A { + fun foo(x: T) = "O" + fun foo(x: A) = "K" +} + +// Shoudt not be reported CONFLICTING_INHERITED_JVM_DECLARATIONS +class B : A>() + +fun box(): String { + val x: A = A() + val y: A> = A() + val b = B() + + return b.foo(x) + b.foo(y) +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt new file mode 100644 index 00000000000..473cee266e1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt @@ -0,0 +1,35 @@ +public open class A { + fun foo(x: T) = "O" + fun foo(x: A) = "K" +} + +interface C { + fun foo(x: E): String + fun foo(x: A): String +} + +interface D { + fun foo(x: A>): String +} + +// Shoudt not be reported CONFLICTING_INHERITED_JVM_DECLARATIONS +class B : A>(), C>, D + +fun box(): String { + val x: A = A() + val y: A> = A() + + val b = B() + val bResult = b.foo(x) + b.foo(y) + if (bResult != "OK") return "fail 1: $bResult" + + val c: C> = B() + val cResult = c.foo(x) + c.foo(y) + if (cResult != "OK") return "fail 2: $cResult" + + val d: D = B() + + if (d.foo(y) != "K") return "fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/enum.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/enum.kt new file mode 100644 index 00000000000..243498038e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/enum.kt @@ -0,0 +1,28 @@ +interface A { + open fun foo(t: T) = "A" +} + +interface B : A + +enum class Z(val aname: String) : B { + Z1("Z1"), + Z2("Z2"); + override fun foo(t: String) = aname +} + + +fun box(): String { + val z1b: B = Z.Z1 + val z2b: B = Z.Z2 + val z1a: A = Z.Z1 + val z2a: A = Z.Z2 + return when { + Z.Z1.foo("") != "Z1" -> "Fail #1" + Z.Z2.foo("") != "Z2" -> "Fail #2" + z1b.foo("") != "Z1" -> "Fail #3" + z2b.foo("") != "Z2" -> "Fail #4" + z1a.foo("") != "Z1" -> "Fail #5" + z2a.foo("") != "Z2" -> "Fail #6" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/genericMethod.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/genericMethod.kt new file mode 100644 index 00000000000..0119eba58a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/genericMethod.kt @@ -0,0 +1,22 @@ +open class A { + open fun foo(t: T, u: U) = "A" +} + +open class B : A() + +class Z : B() { + override fun foo(t: String, u: U) = "Z" +} + + +fun box(): String { + val z = Z() + val b: B = z + val a: A = z + return when { + z.foo("", 0) != "Z" -> "Fail #1" + b.foo("", 0) != "Z" -> "Fail #2" + a.foo("", 0) != "Z" -> "Fail #3" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/object.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/object.kt new file mode 100644 index 00000000000..c7c95464c59 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/object.kt @@ -0,0 +1,30 @@ +open class A { + open fun foo(t: T) = "A" +} + +open class B : A() + +object Z : B() { + override fun foo(t: String) = "Z" +} + + +fun box(): String { + val o = object : B() { + override fun foo(t: String) = "o" + } + val zb: B = Z + val ob: B = o + val za: A = Z + val oa: A = o + + return when { + Z.foo("") != "Z" -> "Fail #1" + o.foo("") != "o" -> "Fail #2" + zb.foo("") != "Z" -> "Fail #3" + ob.foo("") != "o" -> "Fail #4" + za.foo("") != "Z" -> "Fail #5" + oa.foo("") != "o" -> "Fail #6" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/property.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/property.kt new file mode 100644 index 00000000000..21208405891 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/property.kt @@ -0,0 +1,15 @@ +open class A(val t: T) { + open val foo: T = t +} + +open class B : A("Fail") + +class Z : B() { + override val foo = "OK" +} + + +fun box(): String { + val a: A = Z() + return a.foo +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/simple.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/simple.kt new file mode 100644 index 00000000000..c6c2637ef22 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/simple.kt @@ -0,0 +1,22 @@ +open class A { + open fun foo(t: T) = "A" +} + +open class B : A() + +class Z : B() { + override fun foo(t: String) = "Z" +} + + +fun box(): String { + val z = Z() + val b: B = z + val a: A = z + return when { + z.foo("") != "Z" -> "Fail #1" + b.foo("") != "Z" -> "Fail #2" + a.foo("") != "Z" -> "Fail #3" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/upperBound.kt b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/upperBound.kt new file mode 100644 index 00000000000..f6d4dccfc40 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/upperBound.kt @@ -0,0 +1,22 @@ +open class A { + open fun foo(t: T) = "A" +} + +open class B : A() + +class Z : B() { + override fun foo(t: Int) = "Z" +} + + +fun box(): String { + val z = Z() + val b: B = z + val a: A = z + return when { + z.foo(0) != "Z" -> "Fail #1" + b.foo(0) != "Z" -> "Fail #2" + a.foo(0) != "Z" -> "Fail #3" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/traitImplInheritsTraitImpl.kt b/backend.native/tests/external/codegen/blackbox/bridges/traitImplInheritsTraitImpl.kt new file mode 100644 index 00000000000..ec0cf44081a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/traitImplInheritsTraitImpl.kt @@ -0,0 +1,17 @@ +interface A { + fun foo(): Any = "A" +} + +interface B : A { + override fun foo(): String = "B" +} + +class C : B + +fun box(): String { + val c = C() + val b: B = c + val a: A = c + var r = c.foo() + b.foo() + a.foo() + return if (r == "BBB") "OK" else "Fail: $r" +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges.kt b/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges.kt new file mode 100644 index 00000000000..38d7cb2431f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges.kt @@ -0,0 +1,33 @@ +interface A { + fun foo(t: T, u: Int) = "A" +} + +interface B { + fun foo(t: T, u: U) = "B" +} + +class Z1 : A, B { + override fun foo(t: String, u: Int) = "Z1" +} + +class Z2 : B, A { + override fun foo(t: String, u: Int) = "Z2" +} + +fun box(): String { + val z1 = Z1() + val z2 = Z2() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 + return when { + z1.foo("", 0) != "Z1" -> "Fail #1" + z1a.foo("", 0) != "Z1" -> "Fail #2" + z1b.foo("", 0) != "Z1" -> "Fail #3" + z2.foo("", 0) != "Z2" -> "Fail #4" + z2a.foo("", 0) != "Z2" -> "Fail #5" + z2b.foo("", 0) != "Z2" -> "Fail #6" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt b/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt new file mode 100644 index 00000000000..07af5afaa4e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt @@ -0,0 +1,40 @@ +interface A { + fun foo(t: T, u: Int) = "A" +} + +interface B { + fun foo(t: T, u: U) = "B" +} + +interface Z1 : A, B { + override fun foo(t: String, u: Int) = "Z1" +} + +interface Z2 : B, A { + override fun foo(t: String, u: Int) = "Z2" +} + + +class Z1Class : Z1 { +} + +class Z2Class : Z2 { +} + +fun box(): String { + val z1 = Z1Class() + val z2 = Z2Class() + val z1a: A = z1 + val z1b: B = z1 + val z2a: A = z2 + val z2b: B = z2 + return when { + z1.foo("", 0) != "Z1" -> "Fail #1" + z1a.foo("", 0) != "Z1" -> "Fail #2" + z1b.foo("", 0) != "Z1" -> "Fail #3" //FAIL + z2.foo("", 0) != "Z2" -> "Fail #4" + z2a.foo("", 0) != "Z2" -> "Fail #5" + z2b.foo("", 0) != "Z2" -> "Fail #6" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithTheSameMethodOneBridge.kt b/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithTheSameMethodOneBridge.kt new file mode 100644 index 00000000000..de57467d8b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/twoParentsWithTheSameMethodOneBridge.kt @@ -0,0 +1,24 @@ +interface A { + fun foo(t: T) = "A" +} + +interface B { + fun foo(t: T) = "B" +} + +class Z : A, B { + override fun foo(t: Int) = "Z" +} + + +fun box(): String { + val z = Z() + val a: A = z + val b: B = z + return when { + z.foo(0) != "Z" -> "Fail #1" + a.foo(0) != "Z" -> "Fail #2" + b.foo(0) != "Z" -> "Fail #3" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt new file mode 100644 index 00000000000..b141ba2bfbd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyCollection: Collection { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: T): Boolean = false + override fun iterator(): Iterator = throw UnsupportedOperationException() + override fun containsAll(c: Collection): Boolean = false + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false +} + +fun expectUoe(block: () -> Any) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val myCollection = MyCollection() + val collection = myCollection as java.util.Collection + + expectUoe { collection.add("") } + expectUoe { collection.remove("") } + expectUoe { collection.addAll(myCollection) } + expectUoe { collection.removeAll(myCollection) } + expectUoe { collection.retainAll(myCollection) } + expectUoe { collection.clear() } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt new file mode 100644 index 00000000000..043c32631f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyIterator(val v: T): Iterator { + override fun next(): T = v + override fun hasNext(): Boolean = true +} + +fun box(): String { + try { + (MyIterator("") as java.util.Iterator).remove() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + return "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt new file mode 100644 index 00000000000..e77840dbd06 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyIterator(val v: T): Iterator { + override fun next(): T = v + override fun hasNext(): Boolean = true + + public fun remove() {} +} + +fun box(): String { + (MyIterator("") as java.util.Iterator).remove() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt new file mode 100644 index 00000000000..317037880e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt @@ -0,0 +1,42 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyList: List { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: T): Boolean = false + override fun iterator(): Iterator = throw Error() + override fun containsAll(c: Collection): Boolean = false + override fun get(index: Int): T = throw IndexOutOfBoundsException() + override fun indexOf(o: T): Int = -1 + override fun lastIndexOf(o: T): Int = -1 + override fun listIterator(): ListIterator = throw Error() + override fun listIterator(index: Int): ListIterator = throw Error() + override fun subList(fromIndex: Int, toIndex: Int): List = this + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false +} + +fun expectUoe(block: () -> Any) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val list = MyList() as java.util.List + + expectUoe { list.add("") } + expectUoe { list.remove("") } + expectUoe { list.addAll(list) } + expectUoe { list.removeAll(list) } + expectUoe { list.retainAll(list) } + expectUoe { list.clear() } + expectUoe { list.set(0, "") } + expectUoe { list.add(0, "") } + expectUoe { list.remove(0) } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt new file mode 100644 index 00000000000..4296d8ee05c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyListIterator : ListIterator { + override fun next(): T = null!! + override fun hasNext(): Boolean = null!! + override fun hasPrevious(): Boolean = null!! + override fun previous(): T = null!! + override fun nextIndex(): Int = null!! + override fun previousIndex(): Int = null!! +} + +fun expectUoe(block: () -> Any) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val list = MyListIterator() as java.util.ListIterator + + expectUoe { list.set("") } + expectUoe { list.add("") } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt new file mode 100644 index 00000000000..01b5c4b66b2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt @@ -0,0 +1,45 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyList(val v: T): List { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: T): Boolean = false + override fun iterator(): Iterator = throw Error() + override fun containsAll(c: Collection): Boolean = false + override fun get(index: Int): T = v + override fun indexOf(o: T): Int = -1 + override fun lastIndexOf(o: T): Int = -1 + override fun listIterator(): ListIterator = throw Error() + override fun listIterator(index: Int): ListIterator = throw Error() + override fun subList(fromIndex: Int, toIndex: Int): List = throw Error() + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false + + public fun add(e: T): Boolean = true + public fun remove(o: T): Boolean = true + public fun addAll(c: Collection): Boolean = true + public fun addAll(index: Int, c: Collection): Boolean = true + public fun removeAll(c: Collection): Boolean = true + public fun retainAll(c: Collection): Boolean = true + public fun clear() {} + public fun set(index: Int, element: T): T = element + public fun add(index: Int, element: T) {} + public fun removeAt(index: Int): T = v +} + +fun box(): String { + val list = MyList("") as java.util.List + + list.add("") + list.remove("") + list.addAll(list) + list.removeAll(list) + list.retainAll(list) + list.clear() + list.set(0, "") + list.add(0, "") + list.remove(0) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt new file mode 100644 index 00000000000..478f2679577 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +open class Super(val v: T) { + public fun add(e: T): Boolean = true + public fun remove(o: T): Boolean = true + public fun addAll(c: Collection): Boolean = true + public fun addAll(index: Int, c: Collection): Boolean = true + public fun removeAll(c: Collection): Boolean = true + public fun retainAll(c: Collection): Boolean = true + public fun clear() {} + public fun set(index: Int, element: T): T = element + public fun add(index: Int, element: T) {} + public fun removeAt(index: Int): T = v +} + +class MyList(v: T): Super(v), List { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: T): Boolean = false + override fun iterator(): Iterator = throw Error() + override fun containsAll(c: Collection): Boolean = false + override fun get(index: Int): T = v + override fun indexOf(o: T): Int = -1 + override fun lastIndexOf(o: T): Int = -1 + override fun listIterator(): ListIterator = throw Error() + override fun listIterator(index: Int): ListIterator = throw Error() + override fun subList(fromIndex: Int, toIndex: Int): List = throw Error() + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false +} + +fun box(): String { + val list = MyList("") as java.util.List + + list.add("") + list.remove("") + list.addAll(list) + list.removeAll(list) + list.retainAll(list) + list.clear() + list.set(0, "") + list.add(0, "") + list.remove(0) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt new file mode 100644 index 00000000000..e97a5fcda49 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyMap: Map { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun containsKey(key: K): Boolean = false + override fun containsValue(value: V): Boolean = false + override fun get(key: K): V? = null + override val keys: Set get() = throw UnsupportedOperationException() + override val values: Collection get() = throw UnsupportedOperationException() + override val entries: Set> get() = throw UnsupportedOperationException() +} + +fun expectUoe(block: () -> Unit) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val myMap = MyMap() + val map = myMap as java.util.Map + + expectUoe { map.put("", 1) } + expectUoe { map.remove("") } + expectUoe { map.putAll(myMap) } + expectUoe { map.clear() } + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt new file mode 100644 index 00000000000..8b222a91b09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyMapEntry: Map.Entry { + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false + override val key: K get() = throw UnsupportedOperationException() + override val value: V get() = throw UnsupportedOperationException() +} + +fun box(): String { + try { + (MyMapEntry() as java.util.Map.Entry).setValue(1) + throw AssertionError() + } catch (e: UnsupportedOperationException) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt new file mode 100644 index 00000000000..72c60f1c053 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyMapEntry: Map.Entry { + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false + override val key: K get() = throw UnsupportedOperationException() + override val value: V get() = throw UnsupportedOperationException() + + public fun setValue(value: V): V = value +} + +fun box(): String { + (MyMapEntry() as java.util.Map.Entry).setValue(1) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt new file mode 100644 index 00000000000..9d0a4031f1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyMap: Map { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun containsKey(key: K): Boolean = false + override fun containsValue(value: V): Boolean = false + override fun get(key: K): V? = null + override val keys: Set get() = throw UnsupportedOperationException() + override val values: Collection get() = throw UnsupportedOperationException() + override val entries: Set> get() = throw UnsupportedOperationException() + + public fun put(key: K, value: V): V? = null + public fun remove(key: K): V? = null + public fun putAll(m: Map) {} + public fun clear() {} +} + +fun box(): String { + val myMap = MyMap() + val map = myMap as java.util.Map + + map.put("", 1) + map.remove("") + map.putAll(myMap) + map.clear() + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt new file mode 100644 index 00000000000..b075bb7517d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt @@ -0,0 +1,42 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyList: List { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: String): Boolean = false + override fun iterator(): Iterator = throw Error() + override fun containsAll(c: Collection): Boolean = false + override fun get(index: Int): String = throw IndexOutOfBoundsException() + override fun indexOf(o: String): Int = -1 + override fun lastIndexOf(o: String): Int = -1 + override fun listIterator(): ListIterator = throw Error() + override fun listIterator(index: Int): ListIterator = throw Error() + override fun subList(fromIndex: Int, toIndex: Int): List = this + override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = false +} + +fun expectUoe(block: () -> Any) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val list = MyList() as java.util.List + + expectUoe { list.add("") } + expectUoe { list.remove("") } + expectUoe { list.addAll(list) } + expectUoe { list.removeAll(list) } + expectUoe { list.retainAll(list) } + expectUoe { list.clear() } + expectUoe { list.set(0, "") } + expectUoe { list.add(0, "") } + expectUoe { list.remove(0) } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt new file mode 100644 index 00000000000..14b71a4a95f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +abstract class A : Iterator { + abstract fun remove(): Unit +} + +class B(var result: String) : A() { + override fun next() = "" + override fun hasNext() = false + override fun remove() { + result = "OK" + } +} + +fun box(): String { + val a = B("Fail") as java.util.Iterator + a.next() + a.hasNext() + a.remove() + + return (a as B).result +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/customReadOnlyIterator.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/customReadOnlyIterator.kt new file mode 100644 index 00000000000..2038e67cbb5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/customReadOnlyIterator.kt @@ -0,0 +1,34 @@ +class A : Collection { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun contains(element: Char): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun iterator() = MyIterator +} + +object MyIterator : Iterator { + override fun hasNext() = true + + override fun next() = 'a' +} + + +fun box(): String { + val it: MyIterator = A().iterator() + + if (!it.hasNext()) return "fail 1" + if (it.next() != 'a') return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/delegationToArrayList.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/delegationToArrayList.kt new file mode 100644 index 00000000000..b9436fab469 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/delegationToArrayList.kt @@ -0,0 +1,49 @@ +// TARGET_BACKEND: JVM + +import java.util.ArrayList + +class A : List by ArrayList() + +class B : List by A() + +fun expectUoe(block: () -> Any) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val a = A() as java.util.List + expectUoe { a.add("") } + expectUoe { a.remove("") } + expectUoe { a.addAll(a) } + expectUoe { a.addAll(0, a) } + expectUoe { a.removeAll(a) } + expectUoe { a.retainAll(a) } + expectUoe { a.clear() } + expectUoe { a.add(0, "") } + expectUoe { a.set(0, "") } + expectUoe { a.remove(0) } + a.listIterator() + a.listIterator(0) + a.subList(0, 0) + + val b = B() as java.util.List + expectUoe { b.add("") } + expectUoe { b.remove("") } + expectUoe { b.addAll(b) } + expectUoe { b.addAll(0, b) } + expectUoe { b.removeAll(b) } + expectUoe { b.retainAll(b) } + expectUoe { b.clear() } + expectUoe { b.add(0, "") } + expectUoe { b.set(0, "") } + expectUoe { b.remove(0) } + b.listIterator() + b.listIterator(0) + b.subList(0, 0) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractList.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractList.kt new file mode 100644 index 00000000000..ba7fdde2891 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractList.kt @@ -0,0 +1,22 @@ +// TARGET_BACKEND: JVM + +import java.util.AbstractList + +class A : AbstractList() { + override fun get(index: Int): String = "" + override val size: Int get() = 0 +} + +fun box(): String { + val a = A() + val b = A() + + a.addAll(b) + a.addAll(0, b) + a.removeAll(b) + a.retainAll(b) + a.clear() + a.remove("") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractMap.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractMap.kt new file mode 100644 index 00000000000..c8bb76a50ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractMap.kt @@ -0,0 +1,24 @@ +// TARGET_BACKEND: JVM + +import java.util.AbstractMap +import java.util.Collections + +class A : AbstractMap() { + override val entries: MutableSet> get() = Collections.emptySet() +} + +fun box(): String { + val a = A() + val b = A() + + a.remove(0) + + a.putAll(b) + a.clear() + + a.keys + a.values + a.entries + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractSet.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractSet.kt new file mode 100644 index 00000000000..bb2b1ec5b0a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractSet.kt @@ -0,0 +1,18 @@ +class A : HashSet() + +fun box(): String { + val a = A() + val b = A() + + a.iterator() + + a.add(0L) + a.remove(0L) + + a.addAll(b) + a.removeAll(b) + a.retainAll(b) + a.clear() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/arrayList.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/arrayList.kt new file mode 100644 index 00000000000..9a18322f4a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/arrayList.kt @@ -0,0 +1,22 @@ +// KT-6042 java.lang.UnsupportedOperationException with ArrayList + +class A : ArrayList() + +fun box(): String { + val a = A() + val b = A() + + a.addAll(b) + a.addAll(0, b) + a.removeAll(b) + a.retainAll(b) + a.clear() + + a.add("") + a.set(0, "") + a.add(0, "") + a.removeAt(0) + a.remove("") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashMap.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashMap.kt new file mode 100644 index 00000000000..2c63371c63c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashMap.kt @@ -0,0 +1,18 @@ +class A : HashMap() + +fun box(): String { + val a = A() + val b = A() + + a.put("", 0.0) + a.remove("") + + a.putAll(b) + a.clear() + + a.keys + a.values + a.entries + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashSet.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashSet.kt new file mode 100644 index 00000000000..bb2b1ec5b0a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/hashSet.kt @@ -0,0 +1,18 @@ +class A : HashSet() + +fun box(): String { + val a = A() + val b = A() + + a.iterator() + + a.add(0L) + a.remove(0L) + + a.addAll(b) + a.removeAll(b) + a.retainAll(b) + a.clear() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/mapEntry.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/mapEntry.kt new file mode 100644 index 00000000000..85ebbd34f5b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/mapEntry.kt @@ -0,0 +1,30 @@ +// TARGET_BACKEND: JVM + +// FILE: Test.java + +import java.lang.*; +import java.util.*; + +public class Test { + public static class MapEntryImpl implements Map.Entry { + public String getKey() { return null; } + public String getValue() { return null; } + public String setValue(String s) { return null; } + } +} + +// FILE: main.kt + +//class MyIterable : Test.IterableImpl() +//class MyIterator : Test.IteratorImpl() +class MyMapEntry : Test.MapEntryImpl() + +fun box(): String { + + val b = MyMapEntry() + b.key + b.value + b.setValue(null) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt new file mode 100644 index 00000000000..fef74374fe2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt @@ -0,0 +1,53 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FULL_JDK +// WITH_RUNTIME +interface ImmutableCollection : Collection { + fun add(element: @UnsafeVariance E): ImmutableCollection + fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection + fun remove(element: @UnsafeVariance E): ImmutableCollection +} + +class ImmutableCollectionmpl : ImmutableCollection { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun contains(element: E): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun iterator(): Iterator { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun add(element: E): ImmutableCollection = this + override fun addAll(elements: Collection): ImmutableCollection = this + override fun remove(element: E): ImmutableCollection = this +} + +fun box(): String { + val c = ImmutableCollectionmpl() + if (c.remove("") !== c) return "fail 1" + if (c.add("") !== c) return "fail 2" + if (c.addAll(java.util.ArrayList()) !== c) return "fail 3" + + val method = c.javaClass.methods.single { it.name == "remove" && it.returnType == Boolean::class.javaPrimitiveType } + + try { + method.invoke(c, "") + return "fail 4" + } catch (e: java.lang.reflect.InvocationTargetException) { + if (e.cause!!.message != "Operation is not supported for read-only collection") return "fail 5: ${e.cause!!.message}" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt new file mode 100644 index 00000000000..bdd27bfad0a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface Addable { + fun add(s: String): Boolean = true +} + +class C : Addable, List { + override val size: Int get() = null!! + override fun isEmpty(): Boolean = null!! + override fun contains(o: String): Boolean = null!! + override fun iterator(): Iterator = null!! + override fun containsAll(c: Collection): Boolean = null!! + override fun get(index: Int): String = null!! + override fun indexOf(o: String): Int = null!! + override fun lastIndexOf(o: String): Int = null!! + override fun listIterator(): ListIterator = null!! + override fun listIterator(index: Int): ListIterator = null!! + override fun subList(fromIndex: Int, toIndex: Int): List = null!! +} + +fun box(): String { + try { + val a = C() + if (!a.add("")) return "Fail 1" + if (!(a as Addable).add("")) return "Fail 2" + if (!(a as java.util.List).add("")) return "Fail 3" + return "OK" + } catch (e: UnsupportedOperationException) { + return "Fail: no stub method should be generated" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt new file mode 100644 index 00000000000..dd6e2cf5d27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +open class SetStringImpl { + fun add(s: String): Boolean = false + fun remove(o: String): Boolean = false + fun clear(): Unit {} +} + +class S : Set, SetStringImpl() { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: String): Boolean = false + override fun iterator(): Iterator = null!! + override fun containsAll(c: Collection) = false +} + +fun box(): String { + val s = S() as java.util.Set + s.add("") + s.remove("") + s.clear() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/manyTypeParametersWithUpperBounds.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/manyTypeParametersWithUpperBounds.kt new file mode 100644 index 00000000000..f906f817cce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/manyTypeParametersWithUpperBounds.kt @@ -0,0 +1,33 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +class A : Set { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun contains(o: W): Boolean = false + override fun iterator(): Iterator = emptySet().iterator() + override fun containsAll(c: Collection): Boolean = c.isEmpty() +} + +fun expectUoe(block: () -> Any) { + try { + block() + throw AssertionError() + } catch (e: UnsupportedOperationException) { + } +} + +fun box(): String { + val a = A() as java.util.Set + + a.iterator() + + expectUoe { a.add(42) } + expectUoe { a.remove(42) } + expectUoe { a.addAll(a) } + expectUoe { a.removeAll(a) } + expectUoe { a.retainAll(a) } + expectUoe { a.clear() } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt new file mode 100644 index 00000000000..84e3b531630 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyCollection : Collection>> { + override fun iterator() = null!! + override val size: Int get() = null!! + override fun isEmpty(): Boolean = null!! + override fun contains(o: List>): Boolean = null!! + override fun containsAll(c: Collection>>): Boolean = null!! +} + +fun box(): String { + val c = MyCollection() as java.util.Collection>> + try { + c.add(ArrayList()) + return "Fail" + } catch (e: UnsupportedOperationException) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt new file mode 100644 index 00000000000..bcc79196920 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class MyIterator : Iterator { + override fun next() = null!! + override fun hasNext() = null!! +} + +fun box(): String { + try { + (MyIterator() as java.util.Iterator).remove() + return "Fail" + } catch (e: UnsupportedOperationException) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt new file mode 100644 index 00000000000..278f819cfe0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Test.java + +public class Test { + public static void checkCallFromJava() { + try { + String x = TestKt.foo().iterator().next(); + throw new AssertionError("E should have been thrown"); + } catch (E e) { } + } +} + +// FILE: test.kt + +interface MyIterable : Iterable + +class E : RuntimeException() +fun foo(): MyIterable = throw E() + +fun box(): String { + try { + foo().iterator().next() + return "Fail: E should have been thrown" + } catch (e: E) {} + + Test.checkCallFromJava() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt new file mode 100644 index 00000000000..512a411496e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt @@ -0,0 +1,42 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Test.java + +class Test { + interface A { + boolean add(String s); + } + + static class D extends C {} + + void test() { + A a = new D(); + a.add("lol"); + } +} + +// FILE: test.kt + +abstract class C : Test.A, List { + override val size: Int get() = null!! + override fun isEmpty(): Boolean = null!! + override fun contains(o: String): Boolean = null!! + override fun iterator(): Iterator = null!! + override fun containsAll(c: Collection): Boolean = null!! + override fun get(index: Int): String = null!! + override fun indexOf(o: String): Int = null!! + override fun lastIndexOf(o: String): Int = null!! + override fun listIterator(): ListIterator = null!! + override fun listIterator(index: Int): ListIterator = null!! + override fun subList(fromIndex: Int, toIndex: Int): List = null!! +} + +fun box(): String { + try { + Test().test() + return "Fail" + } catch (e: UnsupportedOperationException) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/array.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/array.kt new file mode 100644 index 00000000000..2a78bb9cc88 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/array.kt @@ -0,0 +1,11 @@ +open class A { + var f: String = "OK" +} + +class B : A() { +} + +fun box() : String { + val b = B() + return (b::f).get() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/companionObjectReceiver.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/companionObjectReceiver.kt new file mode 100644 index 00000000000..ddf856c54da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/companionObjectReceiver.kt @@ -0,0 +1,7 @@ +class A { + companion object { + fun ok() = "OK" + } +} + +fun box() = (A.Companion::ok)() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt new file mode 100644 index 00000000000..ce40fb403cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt @@ -0,0 +1,17 @@ +// IGNORE_BACKEND: JS +enum class E { + A, B; + + fun foo() = this.name +} + +fun box(): String { + val f = E.A::foo + val ef = E::foo + + if (f() != "A") return "Fail 1: ${f()}" + if (f == E.B::foo) return "Fail 2" + if (ef != E::foo) return "Fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt new file mode 100644 index 00000000000..e0479cd1db4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt @@ -0,0 +1,37 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// See https://youtrack.jetbrains.com/issue/KT-14938 +// WITH_REFLECT + +class A + +val a = A() +val aa = A() + +fun A?.foo() {} + +var A?.bar: Int + get() = 42 + set(value) {} + +val aFoo = a::foo +val A_foo = A::foo +val nullFoo = null::foo + +val aBar = a::bar +val A_bar = A::bar +val nullBar = null::bar + +fun box(): String = + when { + nullFoo != null::foo -> "Bound extension refs with same receiver SHOULD be equal" + nullFoo == aFoo -> "Bound extension refs with different receivers SHOULD NOT be equal" + nullFoo == A_foo -> "Bound extension ref with receiver 'null' SHOULD NOT be equal to free ref" + + nullBar != null::bar -> "Bound extension property refs with same receiver SHOULD be equal" + nullBar == aBar -> "Bound extension property refs with different receivers SHOULD NOT be equal" + nullBar == A_bar -> "Bound extension property ref with receiver 'null' SHOULD NOT be equal to free property ref" + + else -> "OK" + } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt new file mode 100644 index 00000000000..070cde155b8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt @@ -0,0 +1,32 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class C { + var prop = 42 +} + +val C_propReflect = C::class.memberProperties.find { it.name == "prop" } as? KMutableProperty1 ?: throw AssertionError() +val C_prop = C::prop +val cProp = C()::prop + +fun box() = + when { + C_prop.getter != C_prop.getter -> "C_prop.getter != C_prop.getter" + C_propReflect.getter != C_propReflect.getter -> "C_propReflect.getter != C_propReflect.getter" + cProp.getter != cProp.getter -> "cProp.getter != cProp.getter" + + cProp.getter == C_prop.getter -> "cProp.getter == C_prop.getter" + C_prop.getter == cProp.getter -> "C_prop.getter == cProp.getter" + cProp.getter == C_propReflect.getter -> "cProp.getter == C_propReflect.getter" + C_propReflect.getter == cProp.getter -> "C_propReflect.getter == cProp.getter" + + // TODO https://youtrack.jetbrains.com/issue/KT-13490 + // cProp.getter != C()::prop.getter -> "cProp.getter != C()::prop.getter" + // cProp.setter != C()::prop.setter -> "cProp.setter != C()::prop.setter" + + else -> "OK" + } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt new file mode 100644 index 00000000000..fd21eac125b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt @@ -0,0 +1,27 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package test + +class A { + fun foo() {} + fun bar() {} +} + +val a = A() +val aa = A() + +val aFoo = a::foo +val aBar = a::bar +val aaFoo = aa::foo +val A_foo = A::foo + +fun box(): String = + when { + aFoo != a::foo -> "Bound refs with same receiver SHOULD be equal" + aFoo == aBar -> "Bound refs to different members SHOULD NOT be equal" + aFoo == aaFoo -> "Bound refs with different receiver SHOULD NOT be equal" + aFoo == A_foo -> "Bound ref SHOULD NOT be equal to free ref" + + else -> "OK" + } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt new file mode 100644 index 00000000000..d29849655df --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt @@ -0,0 +1,35 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class C { + fun foo() {} + val bar = 42 +} + +val C_fooReflect = C::class.functions.find { it.name == "foo" }!! +val C_foo = C::foo +val cFoo = C()::foo + +val C_barReflect = C::class.memberProperties.find { it.name == "bar" }!! +val C_bar = C::bar +val cBar= C()::bar + +val Any.className: String + get() = this::class.qualifiedName!! + +fun box(): String = + when { + C_fooReflect != C_foo -> "C_fooReflect != C_foo, ${C_fooReflect.className}" + C_foo != C_fooReflect -> "C_foo != C_fooReflect, ${C_foo.className}" + C_fooReflect == cFoo -> "C_fooReflect == cFoo, ${C_fooReflect.className}" + cFoo == C_fooReflect -> "cFoo == C_fooReflect, ${cFoo.className}" + C_barReflect != C_bar -> "C_barReflect != C_bar, ${C_barReflect.className}" + C_bar != C_barReflect -> "C_bar != C_barReflect, ${C_bar.className}" + C_barReflect == cBar -> "C_barReflect == cBar, ${C_barReflect.className}" + cBar == C_barReflect -> "cBar == C_barReflect, ${cBar.className}" + else -> "OK" + } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simple.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simple.kt new file mode 100644 index 00000000000..ab672b23ac4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simple.kt @@ -0,0 +1,5 @@ +inline fun foo(x: () -> String) = x() + +fun String.id() = this + +fun box() = foo("OK"::id) diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simpleVal.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simpleVal.kt new file mode 100644 index 00000000000..fea3e21c688 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/simpleVal.kt @@ -0,0 +1,8 @@ +inline fun go(f: () -> String) = f() + +fun String.id(): String = this + +fun box(): String { + val x = "OK" + return go(x::id) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt new file mode 100644 index 00000000000..3dcd0359a85 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt @@ -0,0 +1,10 @@ +// Enable when callable references to builtin members is supported +// IGNORE_BACKEND: JS +fun box(): String { + var state = 0 + val name = (state++)::toString.name + if (name != "toString") return "Fail 1: $name" + if (state != 1) return "Fail 2: $state" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt new file mode 100644 index 00000000000..668798431de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt @@ -0,0 +1,11 @@ +// Enable when callable references to builtin members is supported +// IGNORE_BACKEND: JS +fun get(t: T): () -> String { + return t::toString +} + +fun box(): String { + if (get(null).invoke() != "null") return "Fail null" + + return get("OK").invoke() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt new file mode 100644 index 00000000000..967150ab7cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt @@ -0,0 +1,15 @@ +//WITH_RUNTIME +// IGNORE_BACKEND: JS +fun box(): String { + val a = intArrayOf(1, 2) + val b = arrayOf("OK") + if ((a::component2)() != 2) { + return "fail" + } + + if ((a::get)(1) != 2) { + return "fail" + } + + return (b::get)(0) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/multiCase.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/multiCase.kt new file mode 100644 index 00000000000..1ffad7fac0e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/multiCase.kt @@ -0,0 +1,51 @@ +class A(var v: Int) { + fun f(x: Int) = x * v +} + +fun A.g(x: Int) = x * f(x); + +var A.w: Int + get() = 1000 * v + set(c: Int) { + v = c + 10 + } + +object F { + var u = 0 +} + +fun box(): String { + val a = A(5) + + val av = a::v + if (av() != 5) return "fail1: ${av()}" + if (av.get() != 5) return "fail2: ${av.get()}" + av.set(7) + if (a.v != 7) return "fail3: ${a.v}" + + val af = a::f + if (af(10) != 70) return "fail4: ${af(10)}" + + val ag = a::g + if (ag(10) != 700) return "fail5: ${ag(10)}" + + val aw = a::w + if (aw() != 7000) return "fail6: ${aw()}" + if (aw.get() != 7000) return "fail7: ${aw.get()}" + aw.set(5) + if (a.v != 15) return "fail8: ${a.v}" + + val fu = F::u + if (fu() != 0) return "fail9: ${fu()}" + if (fu.get() != 0) return "fail10: ${fu.get()}" + fu.set(8) + if (F.u != 8) return "fail11: ${F.u}" + + val x = 100 + + fun A.lf() = v * x; + val alf = a::lf + if (alf() != 1500) return "fail9: ${alf()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/nullReceiver.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/nullReceiver.kt new file mode 100644 index 00000000000..0111a54d58b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/nullReceiver.kt @@ -0,0 +1,4 @@ +val String?.ok: String + get() = "OK" + +fun box() = (null::ok).get() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/objectReceiver.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/objectReceiver.kt new file mode 100644 index 00000000000..a03203792d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/objectReceiver.kt @@ -0,0 +1,5 @@ +object Singleton { + fun ok() = "OK" +} + +fun box() = (Singleton::ok)() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/primitiveReceiver.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/primitiveReceiver.kt new file mode 100644 index 00000000000..2773e0cdcd1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/primitiveReceiver.kt @@ -0,0 +1,26 @@ +fun Boolean.foo() = 1 +fun Byte.foo() = 2 +fun Short.foo() = 3 +fun Int.foo() = 4 +fun Long.foo() = 5 +fun Char.foo() = 6 +fun Float.foo() = 7 +fun Double.foo() = 8 + +fun testRef(name: String, f: () -> Int, expected: Int) { + val actual = f() + if (actual != expected) throw AssertionError("$name: $actual != $expected") +} + +fun box(): String { + testRef("Boolean", true::foo, 1) + testRef("Byte", 1.toByte()::foo, 2) + testRef("Short", 1.toShort()::foo, 3) + testRef("Int", 1::foo, 4) + testRef("Long", 1L::foo, 5) + testRef("Char", '1'::foo, 6) + testRef("Float", 1.0F::foo, 7) + testRef("Double", 1.0::foo, 8) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt new file mode 100644 index 00000000000..327c73d5914 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt @@ -0,0 +1,6 @@ +// Enable when callable references to builtin members is supported +// IGNORE_BACKEND: JS +fun box(): String { + val f = "KOTLIN"::get + return "${f(1)}${f(0)}" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt new file mode 100644 index 00000000000..533c75f6bf7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt @@ -0,0 +1,8 @@ +// Enable when callable references to builtin members are supported. +// IGNORE_BACKEND: JS + +fun box(): String { + val f = "kotlin"::length + val result = f.get() + return if (result == 6) "OK" else "Fail: $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/syntheticExtensionOnLHS.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/syntheticExtensionOnLHS.kt new file mode 100644 index 00000000000..b8be5402715 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/syntheticExtensionOnLHS.kt @@ -0,0 +1,22 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FILE: A.java + +public class A { + private final String field; + + public A(String field) { + this.field = field; + } + + public CharSequence getFoo() { return field; } +} + +// FILE: test.kt + +fun box(): String { + with (A("OK")) { + val k = foo::toString + return k() + } +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/abstractClassMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/abstractClassMember.kt new file mode 100644 index 00000000000..515b25914d0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/abstractClassMember.kt @@ -0,0 +1,9 @@ +abstract class A { + abstract fun foo(): String +} + +class B : A() { + override fun foo() = "OK" +} + +fun box(): String = (A::foo)(B()) diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt new file mode 100644 index 00000000000..ece7520df91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt @@ -0,0 +1,8 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + if ((Boolean::not)(true) != false) return "Fail 1" + if ((Boolean::not)(false) != true) return "Fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromClass.kt new file mode 100644 index 00000000000..3ed816ee504 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromClass.kt @@ -0,0 +1,11 @@ +class A { + fun foo(k: Int) = k + + fun result() = (A::foo)(this, 111) +} + +fun box(): String { + val result = A().result() + if (result != 111) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromExtension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromExtension.kt new file mode 100644 index 00000000000..9619233c943 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromExtension.kt @@ -0,0 +1,12 @@ +class A { + fun o() = 111 + fun k(k: Int) = k +} + +fun A.foo() = (A::o)(this) + (A::k)(this, 222) + +fun box(): String { + val result = A().foo() + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringNoArgs.kt new file mode 100644 index 00000000000..4ea10740594 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringNoArgs.kt @@ -0,0 +1,8 @@ +class A { + fun foo() = "OK" +} + +fun box(): String { + val x = A::foo + return x(A()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt new file mode 100644 index 00000000000..acdf2f897d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt @@ -0,0 +1,8 @@ +class A { + fun foo(result: String) = result +} + +fun box(): String { + val x = A::foo + return x(A(), "OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt new file mode 100644 index 00000000000..37ebbdb72eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt @@ -0,0 +1,14 @@ +class A { + var result = "Fail" + + fun foo() { + result = "OK" + } +} + +fun box(): String { + val a = A() + val x = A::foo + x(a) + return a.result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt new file mode 100644 index 00000000000..3b280c28f34 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt @@ -0,0 +1,14 @@ +class A { + var result = "Fail" + + fun foo(newResult: String) { + result = newResult + } +} + +fun box(): String { + val a = A() + val x = A::foo + x(a, "OK") + return a.result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelNoArgs.kt new file mode 100644 index 00000000000..db7b7fd01ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelNoArgs.kt @@ -0,0 +1,5 @@ +class A { + var result = "OK" +} + +fun box() = (::A)().result diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelOneStringArg.kt new file mode 100644 index 00000000000..63a861dbcf4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/constructorFromTopLevelOneStringArg.kt @@ -0,0 +1,3 @@ +class A(val result: String) + +fun box() = (::A)("OK").result diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt new file mode 100644 index 00000000000..8a7187958d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +enum class E { + ENTRY +} + +fun box(): String { + val f = E::valueOf + val result = f("ENTRY") + return if (result == E.ENTRY) "OK" else "Fail $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt new file mode 100644 index 00000000000..0f007abd864 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt @@ -0,0 +1,6 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A + +fun box() = if ((A::equals)(A(), A())) "Fail" else "OK" diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromClass.kt new file mode 100644 index 00000000000..0248c2f9f2c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromClass.kt @@ -0,0 +1,7 @@ +class A { + fun result() = (A::foo)(this, "OK") +} + +fun A.foo(x: String) = x + +fun box() = A().result() diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromExtension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromExtension.kt new file mode 100644 index 00000000000..103ceee5cbc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromExtension.kt @@ -0,0 +1,7 @@ +class A + +fun A.foo() = (A::bar)(this, "OK") + +fun A.bar(x: String) = x + +fun box() = A().foo() diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringNoArgs.kt new file mode 100644 index 00000000000..b5fd42ad9c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringNoArgs.kt @@ -0,0 +1,8 @@ +class A + +fun A.foo() = "OK" + +fun box(): String { + val x = A::foo + return x(A()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringOneStringArg.kt new file mode 100644 index 00000000000..69db0311a69 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelStringOneStringArg.kt @@ -0,0 +1,8 @@ +class A + +fun A.foo(result: String) = result + +fun box(): String { + val x = A::foo + return x(A(), "OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitNoArgs.kt new file mode 100644 index 00000000000..b590ad2ec91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitNoArgs.kt @@ -0,0 +1,14 @@ +class A { + var result = "Fail" +} + +fun A.foo() { + result = "OK" +} + +fun box(): String { + val a = A() + val x = A::foo + x(a) + return a.result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt new file mode 100644 index 00000000000..aa9d5505bbf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt @@ -0,0 +1,14 @@ +class A { + var result = "Fail" +} + +fun A.foo(newResult: String) { + result = newResult +} + +fun box(): String { + val a = A() + val x = A::foo + x(a, "OK") + return a.result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/genericMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/genericMember.kt new file mode 100644 index 00000000000..25dabc055f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/genericMember.kt @@ -0,0 +1,5 @@ +class A(val t: T) { + fun foo(): T = t +} + +fun box() = (A::foo)(A("OK")) diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt new file mode 100644 index 00000000000..468034d992a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals +import kotlin.jvm.internal.FunctionImpl + +fun test(f: Function<*>, arity: Int) { + assertEquals(arity, (f as FunctionImpl).getArity()) +} + +fun foo(s: String, i: Int) {} +class A { + fun bar(s: String, i: Int) {} +} +fun Double.baz(s: String, i: Int) {} + +fun box(): String { + test(::foo, 2) + test(A::bar, 3) + test(Double::baz, 3) + + test(::box, 0) + + fun local(x: Int) {} + test(::local, 1) + + test(fun(s: String) = s, 1) + test(fun(){}, 0) + test({}, 0) + test({x: Int -> x}, 1) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromClass.kt new file mode 100644 index 00000000000..31bb102ee62 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromClass.kt @@ -0,0 +1,14 @@ +class A { + inner class Inner { + val o = 111 + val k = 222 + } + + fun result() = (A::Inner)(this).o + (A::Inner)(this).k +} + +fun box(): String { + val result = A().result() + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromExtension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromExtension.kt new file mode 100644 index 00000000000..bcde4b24cae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromExtension.kt @@ -0,0 +1,14 @@ +class A { + inner class Inner { + val o = 111 + val k = 222 + } +} + +fun A.foo() = (A::Inner)(this).o + (A::Inner)(this).k + +fun box(): String { + val result = A().foo() + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelNoArgs.kt new file mode 100644 index 00000000000..577eb19e7af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelNoArgs.kt @@ -0,0 +1,12 @@ +class A { + inner class Inner { + val o = 111 + val k = 222 + } +} + +fun box(): String { + val result = (A::Inner)((::A)()).o + (A::Inner)(A()).k + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt new file mode 100644 index 00000000000..0eb2b831a2b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt @@ -0,0 +1,9 @@ +class A { + inner class Inner(val result: Int) +} + +fun box(): String { + val result = (A::Inner)((::A)(), 111).result + (A::Inner)(A(), 222).result + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt new file mode 100644 index 00000000000..25f2a594300 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// KT-5123 + +import java.util.Collections +import java.util.ArrayList + +fun box(): String { + val numbers = ArrayList() + numbers.add(1) + numbers.add(2) + numbers.add(3) + (Collections::rotate)(numbers, 1) + return if ("$numbers" == "[3, 1, 2]") "OK" else "Fail $numbers" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/captureOuter.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/captureOuter.kt new file mode 100644 index 00000000000..e653f8f0574 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/captureOuter.kt @@ -0,0 +1,12 @@ +class Outer { + val result = "OK" + + inner class Inner { + fun foo() = result + } +} + +fun box(): String { + val f = Outer.Inner::foo + return f(Outer().Inner()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/classMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/classMember.kt new file mode 100644 index 00000000000..72bb8af6e81 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/classMember.kt @@ -0,0 +1,8 @@ +fun box(): String { + class Local { + fun foo() = "OK" + } + + val ref = Local::foo + return ref(Local()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/closureWithSideEffect.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/closureWithSideEffect.kt new file mode 100644 index 00000000000..e58484c9479 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/closureWithSideEffect.kt @@ -0,0 +1,9 @@ +fun box(): String { + var result = "Fail" + + fun changeToOK() { result = "OK" } + + val ok = ::changeToOK + ok() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructor.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructor.kt new file mode 100644 index 00000000000..291af016082 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructor.kt @@ -0,0 +1,7 @@ +fun box(): String { + class A { + val result = "OK" + } + + return (::A)().result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructorWithInitializer.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructorWithInitializer.kt new file mode 100644 index 00000000000..0e8c0a25839 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/constructorWithInitializer.kt @@ -0,0 +1,10 @@ +fun box(): String { + class A { + var result: String = "Fail"; + init { + result = "OK" + } + } + + return (::A)().result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/enumExtendsTrait.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/enumExtendsTrait.kt new file mode 100644 index 00000000000..5ae74283aee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/enumExtendsTrait.kt @@ -0,0 +1,11 @@ +interface Named { + val name: String +} + +enum class E : Named { + OK +} + +fun box(): String { + return E.OK.name +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extension.kt new file mode 100644 index 00000000000..3919a320e81 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extension.kt @@ -0,0 +1,6 @@ +class A + +fun box(): String { + fun A.foo() = "OK" + return (A::foo)(A()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToLocalClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToLocalClass.kt new file mode 100644 index 00000000000..43537f177e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToLocalClass.kt @@ -0,0 +1,5 @@ +fun box(): String { + class A + fun A.foo() = "OK" + return (A::foo)((::A)()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToPrimitive.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToPrimitive.kt new file mode 100644 index 00000000000..9cb84f4df07 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionToPrimitive.kt @@ -0,0 +1,4 @@ +fun box(): String { + fun Int.is42With(that: Int) = this + 2 * that == 42 + return if ((Int::is42With)(16, 13)) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionWithClosure.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionWithClosure.kt new file mode 100644 index 00000000000..cbbbcd219b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/extensionWithClosure.kt @@ -0,0 +1,11 @@ +class A + +fun box(): String { + var result = "Fail" + + fun A.ext() { result = "OK" } + + val f = A::ext + f(A()) + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/genericMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/genericMember.kt new file mode 100644 index 00000000000..12e60f50480 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/genericMember.kt @@ -0,0 +1,8 @@ +fun box(): String { + class Id { + fun invoke(t: T) = t + } + + val ref = Id::invoke + return ref(Id(), "OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localClassMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localClassMember.kt new file mode 100644 index 00000000000..98f62fb5b40 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localClassMember.kt @@ -0,0 +1,11 @@ +fun box(): String { + val result = "OK" + + class Local { + fun foo() = result + } + + val member = Local::foo + val instance = Local() + return member(instance) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt new file mode 100644 index 00000000000..f4ad0ac77f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt @@ -0,0 +1,8 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + fun OK() {} + + return ::OK.name +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localLocal.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localLocal.kt new file mode 100644 index 00000000000..a34a24395b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localLocal.kt @@ -0,0 +1,10 @@ +fun box(): String { + fun foo(): String { + fun bar() = "OK" + val ref = ::bar + return ref() + } + + val ref = ::foo + return ref() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/recursiveClosure.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/recursiveClosure.kt new file mode 100644 index 00000000000..75ca4009a47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/recursiveClosure.kt @@ -0,0 +1,7 @@ +fun foo(until: Int): String { + fun bar(x: Int): String = + if (x == until) "OK" else bar(x + 1) + return (::bar)(0) +} + +fun box() = foo(10) diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simple.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simple.kt new file mode 100644 index 00000000000..789703872db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simple.kt @@ -0,0 +1,4 @@ +fun box(): String { + fun foo() = "OK" + return (::foo)() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleClosure.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleClosure.kt new file mode 100644 index 00000000000..5aeb154fbdd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleClosure.kt @@ -0,0 +1,7 @@ +fun box(): String { + val result = "OK" + + fun foo() = result + + return (::foo)() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleWithArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleWithArg.kt new file mode 100644 index 00000000000..e45fce85e2e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/simpleWithArg.kt @@ -0,0 +1,4 @@ +fun box(): String { + fun foo(s: String) = s + return (::foo)("OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/unitWithSideEffect.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/unitWithSideEffect.kt new file mode 100644 index 00000000000..5da17e9d5e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/unitWithSideEffect.kt @@ -0,0 +1,15 @@ +var state = 23 + +fun box(): String { + fun incrementState(inc: Int) { + state += inc + } + + val inc = ::incrementState + inc(12) + inc(-5) + inc(27) + inc(-15) + + return if (state == 42) "OK" else "Fail $state" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromClass.kt new file mode 100644 index 00000000000..8e0439f4f03 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromClass.kt @@ -0,0 +1,14 @@ +class A { + class Nested { + val o = 111 + val k = 222 + } + + fun result() = (::Nested)().o + (A::Nested)().k +} + +fun box(): String { + val result = A().result() + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt new file mode 100644 index 00000000000..f99dd41ae86 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt @@ -0,0 +1,7 @@ +class A { + class Nested { + val result = "OK" + } +} + +fun box() = (A::Nested)().result diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt new file mode 100644 index 00000000000..3f0c03c67f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt @@ -0,0 +1,5 @@ +class A { + class Nested(val result: String) +} + +fun box() = (A::Nested)("OK").result diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt new file mode 100644 index 00000000000..533e8395616 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +private fun upcast(value: T): T = value + +fun box(): String { + upcast<(Int)->ByteArray>(::ByteArray)(10) + upcast<(Int)->IntArray>(::IntArray)(10) + upcast<(Int)->ShortArray>(::ShortArray)(10) + upcast<(Int)->LongArray>(::LongArray)(10) + upcast<(Int)->DoubleArray>(::DoubleArray)(10) + upcast<(Int)->FloatArray>(::FloatArray)(10) + upcast<(Int)->BooleanArray>(::BooleanArray)(10) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFun.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFun.kt new file mode 100644 index 00000000000..569ef57a1bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFun.kt @@ -0,0 +1,27 @@ +fun foo(): String = "foo1" +fun foo(i: Int): String = "foo2" + +val f1: () -> String = ::foo +val f2: (Int) -> String = ::foo + +fun foo1() {} +fun foo2(i: Int) {} + +fun bar(f: () -> Unit): String = "bar1" +fun bar(f: (Int) -> Unit): String = "bar2" + +fun box(): String { + val x1 = f1() + if (x1 != "foo1") return "Fail 1: $x1" + + val x2 = f2(0) + if (x2 != "foo2") return "Fail 2: $x2" + + val y1 = bar(::foo1) + if (y1 != "bar1") return "Fail 3: $y1" + + val y2 = bar(::foo2) + if (y2 != "bar2") return "Fail 4: $y2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt new file mode 100644 index 00000000000..5dec6776f45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import kotlin.reflect.* + +class A { + val x = 1 + fun x(): String = "OK" +} + +val f1: KProperty1 = A::x +val f2: (A) -> String = A::x + +fun box(): String { + val a = A() + + val x1 = f1.get(a) + if (x1 != 1) return "Fail 1: $x1" + + return f2(a) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/privateClassMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/privateClassMember.kt new file mode 100644 index 00000000000..f99ac7e3ad6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/privateClassMember.kt @@ -0,0 +1,7 @@ +class A { + private fun foo() = "OK" + + fun bar() = (A::foo)(this) +} + +fun box() = A().bar() diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/sortListOfStrings.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/sortListOfStrings.kt new file mode 100644 index 00000000000..5672692f9a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/sortListOfStrings.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +fun sort(list: MutableList, comparator: (String, String) -> Int) { + list.sortWith(Comparator(comparator)) +} + +fun compare(s1: String, s2: String) = s1.compareTo(s2) + +fun box(): String { + val l = mutableListOf("d", "b", "c", "e", "a") + sort(l, ::compare) + if (l != listOf("a", "b", "c", "d", "e")) return "Fail: $l" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromClass.kt new file mode 100644 index 00000000000..b8ad1d624bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromClass.kt @@ -0,0 +1,11 @@ +fun foo(o: Int, k: Int) = o + k + +class A { + fun bar() = (::foo)(111, 222) +} + +fun box(): String { + val result = A().bar() + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromExtension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromExtension.kt new file mode 100644 index 00000000000..f86acf08a0a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromExtension.kt @@ -0,0 +1,11 @@ +fun foo(o: Int, k: Int) = o + k + +class A + +fun A.bar() = (::foo)(111, 222) + +fun box(): String { + val result = A().bar() + if (result != 333) return "Fail $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringNoArgs.kt new file mode 100644 index 00000000000..b7f56d6be82 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringNoArgs.kt @@ -0,0 +1,6 @@ +fun foo() = "OK" + +fun box(): String { + val x = ::foo + return x() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt new file mode 100644 index 00000000000..78cb93f0873 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt @@ -0,0 +1,6 @@ +fun foo(x: String) = x + +fun box(): String { + val x = ::foo + return x("OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt new file mode 100644 index 00000000000..a388ed73d4e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt @@ -0,0 +1,11 @@ +var result = "Fail" + +fun foo() { + result = "OK" +} + +fun box(): String { + val x = ::foo + x() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt new file mode 100644 index 00000000000..a15697e48b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt @@ -0,0 +1,11 @@ +var result = "Fail" + +fun foo(newResult: String) { + result = newResult +} + +fun box(): String { + val x = ::foo + x("OK") + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/traitImplMethodWithClassReceiver.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/traitImplMethodWithClassReceiver.kt new file mode 100644 index 00000000000..9171f0b094b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/traitImplMethodWithClassReceiver.kt @@ -0,0 +1,11 @@ +interface T { + fun foo() = "OK" +} + +class B : T { + inner class C { + fun bar() = (T::foo)(this@B) + } +} + +fun box() = B().C().bar() diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/traitMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/traitMember.kt new file mode 100644 index 00000000000..88cf738eaa7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/traitMember.kt @@ -0,0 +1,9 @@ +interface A { + fun foo(): String +} + +class B : A { + override fun foo() = "OK" +} + +fun box() = (A::foo)(B()) diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/accessViaSubclass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/accessViaSubclass.kt new file mode 100644 index 00000000000..eb2a0728db2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/accessViaSubclass.kt @@ -0,0 +1,9 @@ +abstract class Base { + val result = "OK" +} + +class Derived : Base() + +fun box(): String { + return (Base::result).get(Derived()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/delegated.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/delegated.kt new file mode 100644 index 00000000000..00b880be84e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/delegated.kt @@ -0,0 +1,24 @@ +import kotlin.reflect.KProperty + +val four: Int by NumberDecrypter + +class A { + val two: Int by NumberDecrypter +} + +object NumberDecrypter { + operator fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) { + "four" -> 4 + "two" -> 2 + else -> throw AssertionError() + } +} + +fun box(): String { + val x = ::four.get() + if (x != 4) return "Fail x: $x" + val a = A() + val y = A::two.get(a) + if (y != 2) return "Fail y: $y" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/delegatedMutable.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/delegatedMutable.kt new file mode 100644 index 00000000000..3bc30b3c17d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/delegatedMutable.kt @@ -0,0 +1,24 @@ +import kotlin.reflect.KProperty + +var result: String by Delegate + +object Delegate { + var value = "lol" + + operator fun getValue(instance: Any?, data: KProperty<*>): String { + return value + } + + operator fun setValue(instance: Any?, data: KProperty<*>, newValue: String) { + value = newValue + } +} + +fun box(): String { + val f = ::result + if (f.get() != "lol") return "Fail 1: {$f.get()}" + Delegate.value = "rofl" + if (f.get() != "rofl") return "Fail 2: {$f.get()}" + f.set("OK") + return f.get() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/enumNameOrdinal.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/enumNameOrdinal.kt new file mode 100644 index 00000000000..10ccfbdee1e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/enumNameOrdinal.kt @@ -0,0 +1,11 @@ +enum class E { + I +} + +fun box(): String { + val i = (E::name).get(E.I) + if (i != "I") return "Fail $i" + val n = (E::ordinal).get(E.I) + if (n != 0) return "Fail $n" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/extensionToArray.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/extensionToArray.kt new file mode 100644 index 00000000000..455b69ae0cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/extensionToArray.kt @@ -0,0 +1,6 @@ +val Array.firstElement: String get() = get(0) + +fun box(): String { + val p = Array::firstElement + return p.get(arrayOf("OK", "Fail")) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/genericProperty.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/genericProperty.kt new file mode 100644 index 00000000000..a30bcbd89bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/genericProperty.kt @@ -0,0 +1,21 @@ +//For KT-6020 +import kotlin.reflect.KProperty1 +import kotlin.reflect.KMutableProperty1 +import kotlin.reflect.KProperty + +class Value(var value: T = null as T, var text: String? = null) + +val Value.additionalText by DVal(Value::text) //works + +val Value.additionalValue by DVal(Value::value) //not work + +class DVal>(val kmember: P) { + operator fun getValue(t: T, p: KProperty<*>): R { + return kmember.get(t) + } +} + +fun box(): String { + val p = Value("O", "K") + return p.additionalValue + p.additionalText +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/invokePropertyReference.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/invokePropertyReference.kt new file mode 100644 index 00000000000..617732ae7f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/invokePropertyReference.kt @@ -0,0 +1,31 @@ +var state = "" + +var topLevel: Int + get() { + state += "1" + return 42 + } + set(value) { + throw AssertionError("Nooo") + } + +class A { + val member: String + get() { + state += "2" + return "42" + } +} + +val A.ext: Any + get() { + state += "3" + return this + } + +fun box(): String { + (::topLevel)() + (A::member)(A()) + (A::ext)(A()) + return if (state == "123") "OK" else "Fail $state" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/javaBeanConvention.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/javaBeanConvention.kt new file mode 100644 index 00000000000..0030d8026c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/javaBeanConvention.kt @@ -0,0 +1,14 @@ +// Name of the getter should be 'getaBcde' according to JavaBean conventions +var aBcde: Int = 239 + +fun box(): String { + val x = (::aBcde).get() + if (x != 239) return "Fail x: $x" + + (::aBcde).set(42) + + val y = (::aBcde).get() + if (y != 42) return "Fail y: $y" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kClassInstanceIsInitializedFirst.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kClassInstanceIsInitializedFirst.kt new file mode 100644 index 00000000000..5ce636926d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kClassInstanceIsInitializedFirst.kt @@ -0,0 +1,13 @@ +import kotlin.reflect.KProperty1 + +class A { + companion object { + val ref: KProperty1 = A::foo + } + + val foo: String = "OK" +} + +fun box(): String { + return A.ref.get(A()) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt12044.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt12044.kt new file mode 100644 index 00000000000..ea43b14b545 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt12044.kt @@ -0,0 +1,12 @@ +// KT-12044 Assertion "Rewrite at slice LEXICAL_SCOPE" for 'if' with property references + +fun box(): String { + data class Pair(val first: F, val second: S) + val (x, y) = + Pair(1, + if (1 == 1) + Pair::first + else + Pair::second) + return y.get(Pair("OK", "Fail")) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt12982_protectedPropertyReference.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt12982_protectedPropertyReference.kt new file mode 100644 index 00000000000..7cabd9c6d65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt12982_protectedPropertyReference.kt @@ -0,0 +1,12 @@ +class Foo { + protected var x = 0 + + fun getX() = Foo::x +} + +fun box(): String { + val x = Foo().getX() + val foo = Foo() + x.set(foo, 42) + return if (x.get(foo) == 42) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330.kt new file mode 100644 index 00000000000..43969a5fd1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330.kt @@ -0,0 +1,8 @@ +data class Foo(var bar: Int?) + +fun box(): String { + val receiver = Foo(1) + Foo::bar.set(receiver, null) + return if (receiver.bar == null) "OK" else "fail ${receiver.bar}" + +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330_2.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330_2.kt new file mode 100644 index 00000000000..d0acfccb0bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt14330_2.kt @@ -0,0 +1,14 @@ +var recivier : Any? = "fail" +var value2 : Any? = "fail2" + +var T.bar : T + get() = this + set(value) { recivier = this; value2 = value} + + +fun box(): String { + String?::bar.set(null, null) + if (recivier != null) "fail 1: ${recivier}" + if (value2 != null) "fail 2: ${value2}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt15447.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt15447.kt new file mode 100644 index 00000000000..d1d9a817df9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt15447.kt @@ -0,0 +1,12 @@ +//WITH_RUNTIME + +fun box(): String { + var methodVar = "OK" + + fun localMethod() : String + { + return lazy { methodVar }::value.get() + } + + return localMethod() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt new file mode 100644 index 00000000000..9f5b0c55d60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class Test { + private var iv = 1 + + public fun exec() { + val t = object : Thread() { + override fun run() { + Test::iv.get(this@Test) + Test::iv.set(this@Test, 2) + } + } + t.start() + t.join(1000) + } + + fun result() = if (iv == 2) "OK" else "Fail $iv" +} + +fun box(): String { + val t = Test() + t.exec() + return t.result() +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt new file mode 100644 index 00000000000..2ef9208075f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt @@ -0,0 +1,7 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String = + if (listOf("abc", "de", "f").map(String::length) == listOf(3, 2, 1)) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/localClassVar.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/localClassVar.kt new file mode 100644 index 00000000000..fd45085df67 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/localClassVar.kt @@ -0,0 +1,9 @@ +fun box(): String { + class Local { + var result = "Fail" + } + + val l = Local() + (Local::result).set(l, "OK") + return (Local::result).get(l) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/overriddenInSubclass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/overriddenInSubclass.kt new file mode 100644 index 00000000000..d892efcba29 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/overriddenInSubclass.kt @@ -0,0 +1,9 @@ +open class Base { + open val foo = "Base" +} + +class Derived : Base() { + override val foo = "OK" +} + +fun box() = (Base::foo).get(Derived()) diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterInsideClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterInsideClass.kt new file mode 100644 index 00000000000..8674d12a3a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterInsideClass.kt @@ -0,0 +1,18 @@ +import kotlin.reflect.KMutableProperty + +class Bar(name: String) { + var foo: String = name + private set + + fun test() { + val p = Bar::foo + if (p !is KMutableProperty<*>) throw AssertionError("Fail: p is not a KMutableProperty") + p.set(this, "OK") + } +} + +fun box(): String { + val bar = Bar("Fail") + bar.test() + return bar.foo +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt new file mode 100644 index 00000000000..de11060a95d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// See KT-12337 Reference to property with invisible setter should not be a KMutableProperty + +import kotlin.reflect.KProperty1 +import kotlin.reflect.KMutableProperty + +open class Bar(name: String) { + var foo: String = name + private set +} + +class Baz : Bar("") { + fun ref() = Bar::foo +} + +fun box(): String { + val p1: KProperty1 = Bar::foo + if (p1 is KMutableProperty<*>) return "Fail: p1 is a KMutableProperty" + + val p2 = Baz().ref() + if (p2 is KMutableProperty<*>) return "Fail: p2 is a KMutableProperty" + + val p3 = Bar("")::foo + if (p3 is KMutableProperty<*>) return "Fail: p3 is a KMutableProperty" + + return p1.get(Bar("OK")) +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleExtension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleExtension.kt new file mode 100644 index 00000000000..28d7199fe8d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleExtension.kt @@ -0,0 +1,12 @@ +val String.id: String + get() = this + +fun box(): String { + val pr = String::id + + if (pr.get("123") != "123") return "Fail value: ${pr.get("123")}" + + if (pr.name != "id") return "Fail name: ${pr.name}" + + return pr.get("OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMember.kt new file mode 100644 index 00000000000..39bf36a0707 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMember.kt @@ -0,0 +1,9 @@ +class A(val x: Int) + +fun box(): String { + val p = A::x + if (p.get(A(42)) != 42) return "Fail 1" + if (p.get(A(-1)) != -1) return "Fail 2" + if (p.name != "x") return "Fail 3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableExtension.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableExtension.kt new file mode 100644 index 00000000000..e69cbbe72fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableExtension.kt @@ -0,0 +1,18 @@ +var storage = 0 + +var Int.foo: Int + get() { + return this + storage + } + set(value) { + storage = this + value + } + +fun box(): String { + val pr = Int::foo + if (pr.get(42) != 42) return "Fail 1: ${pr.get(42)}" + pr.set(200, 39) + if (pr.get(-239) != 0) return "Fail 2: ${pr.get(-239)}" + if (storage != 239) return "Fail 3: $storage" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableMember.kt new file mode 100644 index 00000000000..f7d815af3fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableMember.kt @@ -0,0 +1,16 @@ +data class Box(var value: String) + +fun box(): String { + val o = Box("lorem") + val prop = Box::value + + if (prop.get(o) != "lorem") return "Fail 1: ${prop.get(o)}" + prop.set(o, "ipsum") + if (prop.get(o) != "ipsum") return "Fail 2: ${prop.get(o)}" + if (o.value != "ipsum") return "Fail 3: ${o.value}" + o.value = "dolor" + if (prop.get(o) != "dolor") return "Fail 4: ${prop.get(o)}" + if ("$o" != "Box(value=dolor)") return "Fail 5: $o" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableTopLevel.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableTopLevel.kt new file mode 100644 index 00000000000..46abcebe5f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleMutableTopLevel.kt @@ -0,0 +1,12 @@ +data class Box(val value: String) + +var pr = Box("first") + +fun box(): String { + val property = ::pr + if (property.get() != Box("first")) return "Fail value: ${property.get()}" + if (property.name != "pr") return "Fail name: ${property.name}" + property.set(Box("second")) + if (property.get().value != "second") return "Fail value 2: ${property.get()}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleTopLevel.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleTopLevel.kt new file mode 100644 index 00000000000..818327da26f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/simpleTopLevel.kt @@ -0,0 +1,10 @@ +data class Box(val value: String) + +val foo = Box("lol") + +fun box(): String { + val property = ::foo + if (property.get() != Box("lol")) return "Fail value: ${property.get()}" + if (property.name != "foo") return "Fail name: ${property.name}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/as.kt b/backend.native/tests/external/codegen/blackbox/casts/as.kt new file mode 100644 index 00000000000..23ae5313ac2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/as.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(x: Any) = x as Runnable + +fun box(): String { + val r = object : Runnable { + override fun run() {} + } + return if (foo(r) === r) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt b/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt new file mode 100644 index 00000000000..43aa798276f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt @@ -0,0 +1,41 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + if (check(1, { it as Int }) == "OK") return "fail 1" + if (check(1, { it as Byte }) != "OK") return "fail 2" + if (check(1, { it as Short }) != "OK") return "fail 3" + if (check(1, { it as Long }) != "OK") return "fail 4" + if (check(1, { it as Char }) != "OK") return "fail 5" + if (check(1, { it as Double }) != "OK") return "fail 6" + if (check(1, { it as Float }) != "OK") return "fail 7" + + if (check(1.0, { it as Int }) != "OK") return "fail 11" + if (check(1.0, { it as Byte }) != "OK") return "fail 12" + if (check(1.0, { it as Short }) != "OK") return "fail 13" + if (check(1.0, { it as Long }) != "OK") return "fail 14" + if (check(1.0, { it as Char }) != "OK") return "fail 15" + if (check(1.0, { it as Double }) == "OK") return "fail 16" + if (check(1.0, { it as Float }) != "OK") return "fail 17" + + if (check(1f, { it as Int }) != "OK") return "fail 21" + if (check(1f, { it as Byte }) != "OK") return "fail 22" + if (check(1f, { it as Short }) != "OK") return "fail 23" + if (check(1f, { it as Long }) != "OK") return "fail 24" + if (check(1f, { it as Char }) != "OK") return "fail 25" + if (check(1f, { it as Double }) != "OK") return "fail 26" + if (check(1f, { it as Float }) == "OK") return "fail 27" + + return "OK" +} + +fun check(param: T, f: (T) -> Unit): String { + try { + f(param) + } + catch (e: ClassCastException) { + return "OK" + } + return "fail" +} + diff --git a/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt b/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt new file mode 100644 index 00000000000..94c62111e02 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(x: Any) = x as? Runnable + +fun box(): String { + val r = object : Runnable { + override fun run() {} + } + return if (foo(r) === r) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/asSafeFail.kt b/backend.native/tests/external/codegen/blackbox/casts/asSafeFail.kt new file mode 100644 index 00000000000..c3500dd5c1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/asSafeFail.kt @@ -0,0 +1,16 @@ +class A +class B + +fun box(): String { + val a = A() + a as? B + a as? B ?: "fail" + + if ((A() as? B) != null) return "fail1" + if ((a as? B) != null) return "fail2" + + val v = a as? B ?: "fail" + if (v != "fail") return "fail4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt b/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt new file mode 100644 index 00000000000..be3fbff1dc4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + if ((1 as? Int) == null) return "fail 1" + if ((1 as? Byte) != null) return "fail 2" + if ((1 as? Short) != null) return "fail 3" + if ((1 as? Long) != null) return "fail 4" + if ((1 as? Char) != null) return "fail 5" + if ((1 as? Double) != null) return "fail 6" + if ((1 as? Float) != null) return "fail 7" + + if ((1.0 as? Int) != null) return "fail 11" + if ((1.0 as? Byte) != null) return "fail 12" + if ((1.0 as? Short) != null) return "fail 13" + if ((1.0 as? Long) != null) return "fail 14" + if ((1.0 as? Char) != null) return "fail 15" + if ((1.0 as? Double) == null) return "fail 16" + if ((1.0 as? Float) != null) return "fail 17" + + if ((1f as? Int) != null) return "fail 21" + if ((1f as? Byte) != null) return "fail 22" + if ((1f as? Short) != null) return "fail 23" + if ((1f as? Long) != null) return "fail 24" + if ((1f as? Char) != null) return "fail 25" + if ((1f as? Double) != null) return "fail 26" + if ((1f as? Float) == null) return "fail 27" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/asUnit.kt b/backend.native/tests/external/codegen/blackbox/casts/asUnit.kt new file mode 100644 index 00000000000..8c11703906c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/asUnit.kt @@ -0,0 +1 @@ +fun box() = if (4 as? Unit != null) "Fail" else "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt b/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt new file mode 100644 index 00000000000..9760295a6dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun test1() = null as T +fun test2(): T { + val a : Any? = null + return a as T +} + +fun test3() = null as T + +fun box(): String { + if (test1() != null) return "fail: test1" + if (test2() != null) return "fail: test2" + var result3 = "fail" + try { + test3() + } + catch(e: TypeCastException) { + result3 = "OK" + } + if (result3 != "OK") return "fail: test3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/castGenericNull.kt b/backend.native/tests/external/codegen/blackbox/casts/castGenericNull.kt new file mode 100644 index 00000000000..42628250375 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/castGenericNull.kt @@ -0,0 +1,13 @@ +fun castToString(t: T) { + t as String +} + + +fun box(): String { + try { + castToString(null) + } catch (e: Exception) { + return "OK" + } + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt new file mode 100644 index 00000000000..43df48d37b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt @@ -0,0 +1,254 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// This is a big, ugly, semi-auto generated test. +// Use corresponding 'Small' test for debug. + +import kotlin.test.* + +fun fn0() {} +fun fn1(x0: Any) {} +fun fn2(x0: Any, x1: Any) {} +fun fn3(x0: Any, x1: Any, x2: Any) {} +fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} +fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} +fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} +fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} +fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} +fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} +fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} +fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} +fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} +fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} +fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} +fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} +fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} +fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} +fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} +fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} +fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} +fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} +fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} + +val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, + ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, + ::fn20, ::fn21, ::fn22) + +inline fun asFailsWithCCE(operation: String, crossinline block: () -> Unit) { + assertFailsWith(ClassCastException::class, "$operation should throw an exception") { + block() + } +} + +inline fun asSucceeds(operation: String, block: () -> Unit) { + block() +} + +interface TestFnBase { + fun testGood(x: Any) + fun testBad(x: Any) +} + +object TestFn0 : TestFnBase { + override fun testGood(x: Any) { x as Function0<*> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function0<*>") { + x as Function0<*> + } +} + +object TestFn1 : TestFnBase { + override fun testGood(x: Any) { x as Function1<*, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function1<*, *>") { + x as Function1<*, *> + } +} + +object TestFn2 : TestFnBase { + override fun testGood(x: Any) { x as Function2<*, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function2<*, *, *>") { + x as Function2<*, *, *> + } +} + +object TestFn3 : TestFnBase { + override fun testGood(x: Any) { x as Function3<*, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function3<*, *, *, *>") { + x as Function3<*, *, *, *> + } +} + +object TestFn4 : TestFnBase { + override fun testGood(x: Any) { x as Function4<*, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function4<*, *, *, *, *>") { + x as Function4<*, *, *, *, *> + } +} + +object TestFn5 : TestFnBase { + override fun testGood(x: Any) { x as Function5<*, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function5<*, *, *, *, *, *>") { + x as Function5<*, *, *, *, *, *> + } +} + +object TestFn6 : TestFnBase { + override fun testGood(x: Any) { x as Function6<*, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function6<*, *, *, *, *, *, *>") { + x as Function6<*, *, *, *, *, *, *> + } +} + +object TestFn7 : TestFnBase { + override fun testGood(x: Any) { x as Function7<*, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function7<*, *, *, *, *, *, *, *>") { + x as Function7<*, *, *, *, *, *, *, *> + } +} + +object TestFn8 : TestFnBase { + override fun testGood(x: Any) { x as Function8<*, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function8<*, *, *, *, *, *, *, *, *>") { + x as Function8<*, *, *, *, *, *, *, *, *> + } +} + +object TestFn9 : TestFnBase { + override fun testGood(x: Any) { x as Function9<*, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function9<*, *, *, *, *, *, *, *, *, *>") { + x as Function9<*, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn10 : TestFnBase { + override fun testGood(x: Any) { x as Function10<*, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function10<*, *, *, *, *, *, *, *, *, *, *>") { + x as Function10<*, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn11 : TestFnBase { + override fun testGood(x: Any) { x as Function11<*, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function11<*, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn12 : TestFnBase { + override fun testGood(x: Any) { x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn13 : TestFnBase { + override fun testGood(x: Any) { x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn14 : TestFnBase { + override fun testGood(x: Any) { x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn15 : TestFnBase { + override fun testGood(x: Any) { x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn16 : TestFnBase { + override fun testGood(x: Any) { x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn17 : TestFnBase { + override fun testGood(x: Any) { x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn18 : TestFnBase { + override fun testGood(x: Any) { x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn19 : TestFnBase { + override fun testGood(x: Any) { x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn20 : TestFnBase { + override fun testGood(x: Any) { x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn21 : TestFnBase { + override fun testGood(x: Any) { x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn22 : TestFnBase { + override fun testGood(x: Any) { x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> } + override fun testBad(x: Any) = + asFailsWithCCE("x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, + TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, + TestFn20, TestFn21, TestFn22) + +fun box(): String { + for (fnI in 0 .. 22) { + for (testI in 0 .. 22) { + if (fnI == testI) { + tests[testI].testGood(fns[fnI]) + } + else { + tests[testI].testBad(fns[fnI]) + } + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt new file mode 100644 index 00000000000..6ce2082e748 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun fn0() {} +fun fn1(x: Any) {} + +inline fun asFailsWithCCE(operation: String, block: () -> Unit) { + try { + block() + } + catch (e: java.lang.ClassCastException) { + return + } + catch (e: Throwable) { + throw AssertionError("$operation: should throw ClassCastException, got $e") + } + throw AssertionError("$operation: should throw ClassCastException, no exception thrown") +} + +inline fun asSucceeds(operation: String, block: () -> Unit) { + try { + block() + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +class MyFun: Function + +fun box(): String { + val f0 = ::fn0 as Any + val f1 = ::fn1 as Any + + val myFun = MyFun() as Any + + asSucceeds("f0 as Function0<*>") { f0 as Function0<*> } + asFailsWithCCE("f0 as Function1<*, *>") { f0 as Function1<*, *> } + asFailsWithCCE("f1 as Function0<*>") { f1 as Function0<*> } + asSucceeds("f1 as Function1<*, *>") { f1 as Function1<*, *> } + + asFailsWithCCE("myFun as Function0<*>") { myFun as Function0<*> } + asFailsWithCCE("myFun as Function1<*, *>") { myFun as Function1<*, *> } + + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt new file mode 100644 index 00000000000..1985402f6bc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt @@ -0,0 +1,181 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// This is a big, ugly, semi-auto generated test. +// Use corresponding 'Small' test for debug. + +fun fn0() {} +fun fn1(x0: Any) {} +fun fn2(x0: Any, x1: Any) {} +fun fn3(x0: Any, x1: Any, x2: Any) {} +fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} +fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} +fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} +fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} +fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} +fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} +fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} +fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} +fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} +fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} +fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} +fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} +fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} +fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} +fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} +fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} +fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} +fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} +fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} + +val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, + ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, + ::fn20, ::fn21, ::fn22) + +abstract class TestFnBase(val type: String) { + abstract fun testGood(x: Any) + abstract fun testBad(x: Any) + + protected fun assertIs(x: Any, condition: Boolean) { + assert(condition) { "x is $type: failed for $x" } + } + + protected fun assertIsNot(x: Any, condition: Boolean) { + assert(condition) { "x !is $type: failed for $x" } + } +} + +object TestFn0 : TestFnBase("Function0<*>") { + override fun testGood(x: Any) { assertIs(x, x is Function0<*>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function0<*>) } +} + +object TestFn1 : TestFnBase("Function1<*, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function1<*, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function1<*, *>) } +} + +object TestFn2 : TestFnBase("Function2<*, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function2<*, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function2<*, *, *>) } +} + +object TestFn3 : TestFnBase("Function3<*, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function3<*, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function3<*, *, *, *>) } +} + +object TestFn4 : TestFnBase("Function4<*, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function4<*, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function4<*, *, *, *, *>) } +} + +object TestFn5 : TestFnBase("Function5<*, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function5<*, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function5<*, *, *, *, *, *>) } +} + +object TestFn6 : TestFnBase("Function6<*, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function6<*, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function6<*, *, *, *, *, *, *>) } +} + +object TestFn7 : TestFnBase("Function7<*, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function7<*, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function7<*, *, *, *, *, *, *, *>) } +} + +object TestFn8 : TestFnBase("Function8<*, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function8<*, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function8<*, *, *, *, *, *, *, *, *>) } +} + +object TestFn9 : TestFnBase("Function9<*, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function9<*, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function9<*, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn10 : TestFnBase("Function10<*, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function10<*, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function10<*, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn11 : TestFnBase("Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function11<*, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function11<*, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn12 : TestFnBase("Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn13 : TestFnBase("Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn14 : TestFnBase("Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn15 : TestFnBase("Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn16 : TestFnBase("Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn17 : TestFnBase("Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn18 : TestFnBase("Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn19 : TestFnBase("Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn20 : TestFnBase("Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn21 : TestFnBase("Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +object TestFn22 : TestFnBase("Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertIs(x, x is Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } + override fun testBad(x: Any) { assertIsNot(x, x !is Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>) } +} + +val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, + TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, + TestFn20, TestFn21, TestFn22) + +fun box(): String { + for (fnI in 0 .. 22) { + for (testI in 0 .. 22) { + if (fnI == testI) { + tests[testI].testGood(fns[fnI]) + } + else { + tests[testI].testBad(fns[fnI]) + } + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt new file mode 100644 index 00000000000..90f81d82a3a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt @@ -0,0 +1,60 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun fn0() {} +fun fn1(x: Any) {} + +val lambda0 = {} as () -> Unit +val lambda1 = { x: Any -> } as (Any) -> Unit + +fun Any.extFun() {} + +var Any.extProp: String + get() = "extProp" + set(x: String) {} + +class A { + fun foo() {} +} + +fun box(): String { + val f0 = ::fn0 as Any + val f1 = ::fn1 as Any + + val ef = Any::extFun as Any + val epg = Any::extProp.getter + val eps = Any::extProp.setter + + val afoo = A::foo + + fun local0() {} + fun local1(x: Any) {} + + val localFun0 = ::local0 as Any + val localFun1 = ::local1 as Any + + assert(f0 is Function0<*>) { "Failed: f0 is Function0<*>" } + assert(f1 is Function1<*, *>) { "Failed: f1 is Function1<*, *>" } + assert(f0 !is Function1<*, *>) { "Failed: f0 !is Function1<*, *>" } + assert(f1 !is Function0<*>) { "Failed: f1 !is Function0<*>" } + + assert(lambda0 is Function0<*>) { "Failed: lambda0 is Function0<*>" } + assert(lambda1 is Function1<*, *>) { "Failed: lambda1 is Function1<*, *>" } + assert(lambda0 !is Function1<*, *>) { "Failed: lambda0 !is Function1<*, *>" } + assert(lambda1 !is Function0<*>) { "Failed: lambda1 !is Function0<*>" } + + assert(localFun0 is Function0<*>) { "Failed: localFun0 is Function0<*>" } + assert(localFun1 is Function1<*, *>) { "Failed: localFun1 is Function1<*, *>" } + assert(localFun0 !is Function1<*, *>) { "Failed: localFun0 !is Function1<*, *>" } + assert(localFun1 !is Function0<*>) { "Failed: localFun1 !is Function0<*>" } + + assert(ef is Function1<*, *>) { "Failed: ef is Function1<*, *>" } + assert(epg is Function1<*, *>) { "Failed: epg is Function1<*, *>"} + assert(eps is Function2<*, *, *>) { "Failed: eps is Function2<*, *, *>"} + + assert(afoo is Function1<*, *>) { "afoo is Function1<*, *>" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt new file mode 100644 index 00000000000..9d0bdedc3fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JFun.java + +class JFun implements kotlin.jvm.functions.Function0 { + public String invoke() { + return "OK"; + } +} + +// FILE: test.kt + +fun box(): String { + val jfun = JFun() + val jf = jfun as Any + if (jf is Function0<*>) return jfun() + else return "Failed: jf is Function0<*>" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt new file mode 100644 index 00000000000..d853a01bb9d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt @@ -0,0 +1,277 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// This is a big, ugly, semi-auto generated test. +// Use corresponding 'Small' test for debug. + +import kotlin.test.* + +fun fn0() {} +fun fn1(x0: Any) {} +fun fn2(x0: Any, x1: Any) {} +fun fn3(x0: Any, x1: Any, x2: Any) {} +fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} +fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} +fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} +fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} +fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} +fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} +fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} +fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} +fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} +fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} +fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} +fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} +fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} +fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} +fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} +fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} +fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} +fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} +fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} + +val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, + ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, + ::fn20, ::fn21, ::fn22) + +inline fun reifiedAsSucceeds(x: Any, operation: String) { + x as T +} + +inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { + assertFailsWith(ClassCastException::class, "$operation should throw an exception") { + x as T + } +} + +interface TestFnBase { + fun testGood(x: Any) + fun testBad(x: Any) +} + +object TestFn0 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function0<*>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function0<*>") +} + +object TestFn1 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function1<*, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function1<*, *>") +} + +object TestFn2 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function2<*, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function2<*, *, *>") +} + +object TestFn3 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function3<*, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function3<*, *, *, *>") +} + +object TestFn4 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function4<*, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function4<*, *, *, *, *>") +} + +object TestFn5 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function5<*, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function5<*, *, *, *, *, *>") +} + +object TestFn6 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function6<*, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function6<*, *, *, *, *, *, *>") +} + +object TestFn7 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function7<*, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function7<*, *, *, *, *, *, *, *>") +} + +object TestFn8 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function8<*, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function8<*, *, *, *, *, *, *, *, *>") +} + +object TestFn9 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function9<*, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function9<*, *, *, *, *, *, *, *, *, *>") +} + +object TestFn10 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function10<*, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function10<*, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn11 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function11<*, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function11<*, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn12 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn13 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn14 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn15 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn16 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn17 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn18 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn19 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn20 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn21 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn22 : TestFnBase { + override fun testGood(x: Any) = + reifiedAsSucceeds>( + x, "x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedAsFailsWithCCE>( + x, "x as Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, + TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, + TestFn20, TestFn21, TestFn22) + +fun box(): String { + for (fnI in 0 .. 22) { + for (testI in 0 .. 22) { + if (fnI == testI) { + tests[testI].testGood(fns[fnI]) + } + else { + tests[testI].testBad(fns[fnI]) + } + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt new file mode 100644 index 00000000000..100350d53da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun fn0() {} +fun fn1(x: Any) {} + +inline fun reifiedAsSucceeds(x: Any, operation: String) { + try { + x as T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { + try { + x as T + } + catch (e: java.lang.ClassCastException) { + return + } + catch (e: Throwable) { + throw AssertionError("$operation: should throw ClassCastException, got $e") + } + throw AssertionError("$operation: should fail with CCE, no exception thrown") +} + +fun box(): String { + val f0 = ::fn0 as Any + val f1 = ::fn1 as Any + + reifiedAsSucceeds>(f0, "f0 as Function0<*>") + reifiedAsFailsWithCCE>(f0, "f0 as Function1<*, *>") + reifiedAsFailsWithCCE>(f1, "f1 as Function0<*>") + reifiedAsSucceeds>(f1, "f1 as Function1<*, *>") + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt new file mode 100644 index 00000000000..40bc0a05f1f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt @@ -0,0 +1,195 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// This is a big, ugly, semi-auto generated test. +// Use corresponding 'Small' test for debug. + +fun fn0() {} +fun fn1(x0: Any) {} +fun fn2(x0: Any, x1: Any) {} +fun fn3(x0: Any, x1: Any, x2: Any) {} +fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} +fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} +fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} +fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} +fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} +fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} +fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} +fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} +fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} +fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} +fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} +fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} +fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} +fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} +fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} +fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} +fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} +fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} +fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} + +val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, + ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, + ::fn20, ::fn21, ::fn22) + +inline fun assertReifiedIs(x: Any, type: String) { + val answer: Boolean + try { + answer = x is T + } + catch (e: Throwable) { + throw AssertionError("$x is $type: should not throw exceptions, got $e") + } + assert(answer) { "$x is $type: failed" } +} + +inline fun assertReifiedIsNot(x: Any, type: String) { + val answer: Boolean + try { + answer = x !is T + } + catch (e: Throwable) { + throw AssertionError("$x !is $type: should not throw exceptions, got $e") + } + assert(answer) { "$x !is $type: failed" } +} + +abstract class TestFnBase(val type: String) { + abstract fun testGood(x: Any) + abstract fun testBad(x: Any) +} + +object TestFn0 : TestFnBase("Function0<*>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn1 : TestFnBase("Function1<*, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn2 : TestFnBase("Function2<*, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn3 : TestFnBase("Function3<*, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn4 : TestFnBase("Function4<*, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn5 : TestFnBase("Function5<*, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn6 : TestFnBase("Function6<*, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn7 : TestFnBase("Function7<*, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn8 : TestFnBase("Function8<*, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn9 : TestFnBase("Function9<*, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn10 : TestFnBase("Function10<*, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn11 : TestFnBase("Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn12 : TestFnBase("Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn13 : TestFnBase("Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn14 : TestFnBase("Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn15 : TestFnBase("Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn16 : TestFnBase("Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn17 : TestFnBase("Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn18 : TestFnBase("Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn19 : TestFnBase("Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn20 : TestFnBase("Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn21 : TestFnBase("Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +object TestFn22 : TestFnBase("Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + override fun testGood(x: Any) { assertReifiedIs>(x, type) } + override fun testBad(x: Any) { assertReifiedIsNot>(x, type) } +} + +val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, + TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, + TestFn20, TestFn21, TestFn22) + +fun box(): String { + for (fnI in 0 .. 22) { + for (testI in 0 .. 22) { + if (fnI == testI) { + tests[testI].testGood(fns[fnI]) + } + else { + tests[testI].testBad(fns[fnI]) + } + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt new file mode 100644 index 00000000000..71436394ae7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt @@ -0,0 +1,41 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun fn0() {} +fun fn1(x: Any) {} + +inline fun assertReifiedIs(x: Any, type: String) { + val answer: Boolean + try { + answer = x is T + } + catch (e: Throwable) { + throw AssertionError("$x is $type: should not throw exceptions, got $e") + } + assert(answer) { "$x is $type: failed" } +} + +inline fun assertReifiedIsNot(x: Any, type: String) { + val answer: Boolean + try { + answer = x !is T + } + catch (e: Throwable) { + throw AssertionError("$x !is $type: should not throw exceptions, got $e") + } + assert(answer) { "$x !is $type: failed" } +} + +fun box(): String { + val f0 = ::fn0 as Any + val f1 = ::fn1 as Any + + assertReifiedIs>(f0, "Function0<*>") + assertReifiedIs>(f1, "Function1<*, *>") + assertReifiedIsNot>(f1, "Function0<*>") + assertReifiedIsNot>(f0, "Function1<*, *>") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt new file mode 100644 index 00000000000..a5844221cb4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt @@ -0,0 +1,288 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// This is a big, ugly, semi-auto generated test. +// Use corresponding 'Small' test for debug. + +fun fn0() {} +fun fn1(x0: Any) {} +fun fn2(x0: Any, x1: Any) {} +fun fn3(x0: Any, x1: Any, x2: Any) {} +fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} +fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} +fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} +fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} +fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} +fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} +fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} +fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} +fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} +fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} +fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} +fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} +fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} +fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} +fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} +fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} +fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} +fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} +fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} + +val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, + ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, + ::fn20, ::fn21, ::fn22) + +inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y == null) { + throw AssertionError("$operation: should return non-null, got null") + } +} + +inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y != null) { + throw AssertionError("$operation: should return null, got $y") + } +} + +interface TestFnBase { + fun testGood(x: Any) + fun testBad(x: Any) +} + +object TestFn0 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function0<*>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function0<*>") +} + +object TestFn1 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function1<*, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function1<*, *>") +} + +object TestFn2 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function2<*, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function2<*, *, *>") +} + +object TestFn3 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function3<*, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function3<*, *, *, *>") +} + +object TestFn4 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function4<*, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function4<*, *, *, *, *>") +} + +object TestFn5 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function5<*, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function5<*, *, *, *, *, *>") +} + +object TestFn6 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function6<*, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function6<*, *, *, *, *, *, *>") +} + +object TestFn7 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function7<*, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function7<*, *, *, *, *, *, *, *>") +} + +object TestFn8 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function8<*, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function8<*, *, *, *, *, *, *, *, *>") +} + +object TestFn9 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function9<*, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function9<*, *, *, *, *, *, *, *, *, *>") +} + +object TestFn10 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn11 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn12 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn13 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn14 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn15 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn16 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn17 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn18 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn19 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn20 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn21 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +object TestFn22 : TestFnBase { + override fun testGood(x: Any) = + reifiedSafeAsReturnsNonNull>( + x, "x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") + override fun testBad(x: Any) = + reifiedSafeAsReturnsNull>( + x, "x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") +} + +val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, + TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, + TestFn20, TestFn21, TestFn22) + +fun box(): String { + for (fnI in 0 .. 22) { + for (testI in 0 .. 22) { + if (fnI == testI) { + tests[testI].testGood(fns[fnI]) + } + else { + tests[testI].testBad(fns[fnI]) + } + } + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt new file mode 100644 index 00000000000..a3d4c0fcb27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun fn0() {} +fun fn1(x: Any) {} + +inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y == null) { + throw AssertionError("$operation: should return non-null, got null") + } +} + +inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y != null) { + throw AssertionError("$operation: should return null, got $y") + } +} + +fun box(): String { + val f0 = ::fn0 as Any + val f1 = ::fn1 as Any + + reifiedSafeAsReturnsNonNull>(f0, "f0 as Function0<*>") + reifiedSafeAsReturnsNull>(f0, "f0 as Function1<*, *>") + reifiedSafeAsReturnsNull>(f1, "f1 as Function0<*>") + reifiedSafeAsReturnsNonNull>(f1, "f1 as Function1<*, *>") + + reifiedSafeAsReturnsNull>(null, "null as Function0<*>") + reifiedSafeAsReturnsNull>(null, "null as Function1<*, *>") + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt new file mode 100644 index 00000000000..4cbc23a639d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt @@ -0,0 +1,331 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// This is a big, ugly, semi-auto generated test. +// Use corresponding 'Small' test for debug. + +fun fn0() {} +fun fn1(x0: Any) {} +fun fn2(x0: Any, x1: Any) {} +fun fn3(x0: Any, x1: Any, x2: Any) {} +fun fn4(x0: Any, x1: Any, x2: Any, x3: Any) {} +fun fn5(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any) {} +fun fn6(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any) {} +fun fn7(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any) {} +fun fn8(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any) {} +fun fn9(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any) {} +fun fn10(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any) {} +fun fn11(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any) {} +fun fn12(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any) {} +fun fn13(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any) {} +fun fn14(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any) {} +fun fn15(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any) {} +fun fn16(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any) {} +fun fn17(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any) {} +fun fn18(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any) {} +fun fn19(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any) {} +fun fn20(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any) {} +fun fn21(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any) {} +fun fn22(x0: Any, x1: Any, x2: Any, x3: Any, x4: Any, x5: Any, x6: Any, x7: Any, x8: Any, x9: Any, x10: Any, x11: Any, x12: Any, x13: Any, x14: Any, x15: Any, x16: Any, x17: Any, x18: Any, x19: Any, x20: Any, x21: Any) {} + +val fns = arrayOf(::fn0, ::fn1, ::fn2, ::fn3, ::fn4, ::fn5, ::fn6, ::fn7, ::fn8, ::fn9, + ::fn10, ::fn11, ::fn12, ::fn13, ::fn14, ::fn15, ::fn16, ::fn17, ::fn18, ::fn19, + ::fn20, ::fn21, ::fn22) + +inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x == null) { "$operation: should return null, got $x" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x != null) { "$operation: should return non-null" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +interface TestFnBase { + abstract fun testGood(x: Any) + abstract fun testBad(x: Any) +} + +object TestFn0 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function0<*>") { + x as? Function0<*> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function0<*>") { + x as? Function0<*> + } +} + +object TestFn1 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function1<*, *>") { + x as? Function1<*, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function1<*, *>") { + x as? Function1<*, *> + } +} + +object TestFn2 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function2<*, *, *>") { + x as? Function2<*, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function2<*, *, *>") { + x as? Function2<*, *, *> + } +} + +object TestFn3 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function3<*, *, *, *>") { + x as? Function3<*, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function3<*, *, *, *>") { + x as? Function3<*, *, *, *> + } +} + +object TestFn4 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function4<*, *, *, *, *>") { + x as? Function4<*, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function4<*, *, *, *, *>") { + x as? Function4<*, *, *, *, *> + } +} + +object TestFn5 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function5<*, *, *, *, *, *>") { + x as? Function5<*, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function5<*, *, *, *, *, *>") { + x as? Function5<*, *, *, *, *, *> + } +} + +object TestFn6 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function6<*, *, *, *, *, *, *>") { + x as? Function6<*, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function6<*, *, *, *, *, *, *>") { + x as? Function6<*, *, *, *, *, *, *> + } +} + +object TestFn7 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function7<*, *, *, *, *, *, *, *>") { + x as? Function7<*, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function7<*, *, *, *, *, *, *, *>") { + x as? Function7<*, *, *, *, *, *, *, *> + } +} + +object TestFn8 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function8<*, *, *, *, *, *, *, *, *>") { + x as? Function8<*, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function8<*, *, *, *, *, *, *, *, *>") { + x as? Function8<*, *, *, *, *, *, *, *, *> + } +} + +object TestFn9 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function9<*, *, *, *, *, *, *, *, *, *>") { + x as? Function9<*, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function9<*, *, *, *, *, *, *, *, *, *>") { + x as? Function9<*, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn10 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") { + x as? Function10<*, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function10<*, *, *, *, *, *, *, *, *, *, *>") { + x as? Function10<*, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn11 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function11<*, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn12 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function12<*, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn13 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function13<*, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn14 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function14<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn15 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function15<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn16 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function16<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn17 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function17<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn18 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function18<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn19 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function19<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn20 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function20<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn21 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function21<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +object TestFn22 : TestFnBase { + override fun testGood(x: Any) = + safeAsReturnsNonNull("x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } + override fun testBad(x: Any) = + safeAsReturnsNull("x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *>") { + x as? Function22<*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *> + } +} + +val tests = arrayOf(TestFn0, TestFn1, TestFn2, TestFn3, TestFn4, TestFn5, TestFn6, TestFn7, TestFn8, TestFn9, + TestFn10, TestFn11, TestFn12, TestFn13, TestFn14, TestFn15, TestFn16, TestFn17, TestFn18, TestFn19, + TestFn20, TestFn21, TestFn22) + +fun box(): String { + for (fnI in 0 .. 22) { + for (testI in 0 .. 22) { + if (fnI == testI) { + tests[testI].testGood(fns[fnI]) + } + else { + tests[testI].testBad(fns[fnI]) + } + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt new file mode 100644 index 00000000000..0628070f83f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun fn0() {} +fun fn1(x: Any) {} + +inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x == null) { "$operation: should return null, got $x" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x != null) { "$operation: should return non-null" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +fun box(): String { + val f0 = ::fn0 as Any + val f1 = ::fn1 as Any + + safeAsReturnsNonNull("f0 as? Function0<*>") { f0 as? Function0<*> } + safeAsReturnsNull("f0 as? Function1<*, *>") { f0 as? Function1<*, *> } + safeAsReturnsNull("f1 as? Function0<*>") { f1 as? Function0<*> } + safeAsReturnsNonNull("f1 as? Function1<*, *>") { f1 as? Function1<*, *> } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBounds.kt b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBounds.kt new file mode 100644 index 00000000000..31183798872 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBounds.kt @@ -0,0 +1,22 @@ +interface A { + fun foo(): Any? + fun bar(): String +} + +interface B { + fun foo(): String +} + +fun bar(x: T): String where T : A, T : B { + if (x.foo().length != 2 || x.foo() != "OK") return "fail 1" + if (x.bar() != "ok") return "fail 2" + + return "OK" +} + +class C : A, B { + override fun foo() = "OK" + override fun bar() = "ok" +} + +fun box(): String = bar(C()) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt new file mode 100644 index 00000000000..de3adc56939 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt @@ -0,0 +1,16 @@ +interface FirstTrait +interface SecondTrait + +fun T.doSomething(): String where T : FirstTrait, T : SecondTrait { + return "OK" +} + +class Foo : FirstTrait, SecondTrait { + fun bar(): String { + return doSomething() + } +} + +fun box(): String { + return Foo().bar() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeSmartcast.kt b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeSmartcast.kt new file mode 100644 index 00000000000..509ef35fabd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeSmartcast.kt @@ -0,0 +1,27 @@ +interface A { + fun foo(): Any? +} + +interface B { + fun foo(): String +} + +fun bar(x: Any?): String { + if (x is A) { + val k = x.foo() + if (k != "OK") return "fail 1" + } + + if (x is B) { + val k = x.foo() + if (k.length != 2) return "fail 2" + } + + if (x is A && x is B) { + return x.foo() + } + + return "fail 4" +} + +fun box(): String = bar(object : A, B { override fun foo() = "OK" }) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt new file mode 100644 index 00000000000..8c58629b05c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt @@ -0,0 +1,13 @@ +interface Foo +interface Bar + +class Baz : Foo, Bar + +fun S.bip(): String where S : Foo, S: Bar { + return "OK" +} + +fun box(): String { + val baz = Baz() + return baz.bip() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithoutGenericsAsReceiver.kt b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithoutGenericsAsReceiver.kt new file mode 100644 index 00000000000..52c1ef7e498 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/intersectionTypeWithoutGenericsAsReceiver.kt @@ -0,0 +1,12 @@ +interface A +interface B + +class C : A, B + +fun T.foo(): String where T : A, T : B { + return "OK" +} + +fun box(): String { + return C().foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/is.kt b/backend.native/tests/external/codegen/blackbox/casts/is.kt new file mode 100644 index 00000000000..d10f77a86ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/is.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(x: Any) = x is Runnable + +fun box(): String { + val r = object : Runnable { + override fun run() {} + } + return if (foo(r) && !foo(42)) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt b/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt new file mode 100644 index 00000000000..42a86dcbb07 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt @@ -0,0 +1,9 @@ +// IGNORE_BACKEND: JS +// JS backend does not support Unit well. See KT-13932 + +val foo: () -> Unit = {} + +fun box(): String { + foo() as Unit + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt new file mode 100644 index 00000000000..8f18303c58c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt @@ -0,0 +1,7 @@ +class Box(val value: T) + +fun box() : String { + val b = Box(2 * 3) + val expected: Long? = 6L + return if (b.value == expected) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt new file mode 100644 index 00000000000..33b0eaec597 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Box.java + +public class Box { + private final T value; + + public Box(T value) { + this.value = value; + } + + public static Box create(T defaultValue) { + return new Box(defaultValue); + } + + public T getValue() { + return value; + } +} + +// FILE: test.kt +// See KT-10313: ClassCastException with Generics + +fun box(): String { + val sub = Box(-1) + return if (sub.value == -1L) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt new file mode 100644 index 00000000000..229afac35f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt @@ -0,0 +1,7 @@ +class Box(val value: T) + +fun box() : String { + val b = Box(x@ (1 + 2)) + val expected: Long? = 3L + return if (b.value == expected) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt new file mode 100644 index 00000000000..a70372d5ca4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt @@ -0,0 +1,7 @@ +class Box(val value: T) + +fun box() : String { + val b = Box((-1)) + val expected: Long? = -1L + return if (b.value == expected) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/superConstructor.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/superConstructor.kt new file mode 100644 index 00000000000..f896fd083f6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/superConstructor.kt @@ -0,0 +1,7 @@ +open class Base(val value: T) +class Box(): Base(-1) + +fun box(): String { + val expected: Long? = -1L + return if (Box().value == expected) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt new file mode 100644 index 00000000000..6f253b61557 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt @@ -0,0 +1,7 @@ +class Box(val value: T) + +fun box() : String { + val b = Box(-1) + val expected: Long? = -1L + return if (b.value == expected) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/vararg.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/vararg.kt new file mode 100644 index 00000000000..dab9ff62303 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/vararg.kt @@ -0,0 +1,11 @@ +class Box(val value: T) + +fun run(vararg z: T): Box { + return Box(z[0]) +} + +fun box(): String { + val b = run(-1, -1, -1) + val expected: Long? = -1L + return if (b.value == expected) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/asWithMutable.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/asWithMutable.kt new file mode 100644 index 00000000000..093fae25b18 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/asWithMutable.kt @@ -0,0 +1,126 @@ +// WITH_RUNTIME + +class Itr : Iterator by ArrayList().iterator() +class MItr : MutableIterator by ArrayList().iterator() +class LItr : ListIterator by ArrayList().listIterator() +class MLItr : MutableListIterator by ArrayList().listIterator() + +class It : Iterable by ArrayList() +class MIt : MutableIterable by ArrayList() +class C : Collection by ArrayList() +class MC : MutableCollection by ArrayList() +class L : List by ArrayList() +class ML : MutableList by ArrayList() +class S : Set by HashSet() +class MS : MutableSet by HashSet() + +class M : Map by HashMap() +class MM : MutableMap by HashMap() + +class ME : Map.Entry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() +} + +class MME : MutableMap.MutableEntry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() + override fun setValue(value: String): String = throw UnsupportedOperationException() +} + +inline fun asFailsWithCCE(operation: String, block: () -> Unit) { + try { + block() + } + catch (e: ClassCastException) { + return + } + catch (e: Throwable) { + throw AssertionError("$operation: should throw ClassCastException, got $e") + } + throw AssertionError("$operation: should throw ClassCastException, no exception thrown") +} + +inline fun asSucceeds(operation: String, block: () -> Unit) { + try { + block() + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +fun box(): String { + val itr = Itr() as Any + val mitr = MItr() + + asFailsWithCCE("itr as MutableIterator") { itr as MutableIterator<*> } + asSucceeds("mitr as MutableIterator") { mitr as MutableIterator<*> } + + val litr = LItr() as Any + val mlitr = MLItr() + + asFailsWithCCE("litr as MutableIterator") { litr as MutableIterator<*> } + asFailsWithCCE("litr as MutableListIterator") { litr as MutableListIterator<*> } + asSucceeds("mlitr as MutableIterator") { mlitr as MutableIterator<*> } + asSucceeds("mlitr as MutableListIterator") { mlitr as MutableListIterator<*> } + + val it = It() as Any + val mit = MIt() + val arrayList = ArrayList() + + asFailsWithCCE("it as MutableIterable") { it as MutableIterable<*> } + asSucceeds("mit as MutableIterable") { mit as MutableIterable<*> } + asSucceeds("arrayList as MutableIterable") { arrayList as MutableIterable<*> } + + val coll = C() as Any + val mcoll = MC() + + asFailsWithCCE("coll as MutableIterable") { coll as MutableIterable<*> } + asFailsWithCCE("coll as MutableCollection") { coll as MutableCollection<*> } + asSucceeds("mcoll as MutableIterable") { mcoll as MutableIterable<*> } + asSucceeds("mcoll as MutableCollection") { mcoll as MutableCollection<*> } + asSucceeds("arrayList as MutableCollection") { arrayList as MutableCollection<*> } + + val list = L() as Any + val mlist = ML() + + asFailsWithCCE("list as MutableIterable") { list as MutableIterable<*> } + asFailsWithCCE("list as MutableCollection") { list as MutableCollection<*> } + asFailsWithCCE("list as MutableList") { list as MutableList<*> } + asSucceeds("mlist as MutableIterable") { mlist as MutableIterable<*> } + asSucceeds("mlist as MutableCollection") { mlist as MutableCollection<*> } + asSucceeds("mlist as MutableList") { mlist as MutableList<*> } + + val set = S() as Any + val mset = MS() + val hashSet = HashSet() + + asFailsWithCCE("set as MutableIterable") { set as MutableIterable<*> } + asFailsWithCCE("set as MutableCollection") { set as MutableCollection<*> } + asFailsWithCCE("set as MutableSet") { set as MutableSet<*> } + asSucceeds("mset as MutableIterable") { mset as MutableIterable<*> } + asSucceeds("mset as MutableCollection") { mset as MutableCollection<*> } + asSucceeds("mset as MutableSet") { mset as MutableSet<*> } + asSucceeds("hashSet as MutableSet") { hashSet as MutableSet<*> } + + val map = M() as Any + val mmap = MM() + val hashMap = HashMap() + + asFailsWithCCE("map as MutableMap") { map as MutableMap<*, *> } + asSucceeds("mmap as MutableMap") { mmap as MutableMap<*, *> } + + val entry = ME() as Any + val mentry = MME() + + asFailsWithCCE("entry as MutableMap.MutableEntry") { entry as MutableMap.MutableEntry<*, *> } + asSucceeds("mentry as MutableMap.MutableEntry") { mentry as MutableMap.MutableEntry<*, *> } + + hashMap[""] = "" + val hashMapEntry = hashMap.entries.first() + + asSucceeds("hashMapEntry as MutableMap.MutableEntry") { hashMapEntry as MutableMap.MutableEntry<*, *> } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/isWithMutable.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/isWithMutable.kt new file mode 100644 index 00000000000..56e8fb846c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/isWithMutable.kt @@ -0,0 +1,111 @@ +// WITH_RUNTIME + +class Itr : Iterator by ArrayList().iterator() +class MItr : MutableIterator by ArrayList().iterator() +class LItr : ListIterator by ArrayList().listIterator() +class MLItr : MutableListIterator by ArrayList().listIterator() + +class It : Iterable by ArrayList() +class MIt : MutableIterable by ArrayList() +class C : Collection by ArrayList() +class MC : MutableCollection by ArrayList() +class L : List by ArrayList() +class ML : MutableList by ArrayList() +class S : Set by HashSet() +class MS : MutableSet by HashSet() + +class M : Map by HashMap() +class MM : MutableMap by HashMap() + +class ME : Map.Entry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() +} + +class MME : MutableMap.MutableEntry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() + override fun setValue(value: String): String = throw UnsupportedOperationException() +} + +fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())} + +fun box(): String { + val itr = Itr() as Any + val mitr = MItr() + + assert(itr !is MutableIterator<*>) { "Itr should satisfy '!is MutableIterator'" } + assert(mitr is MutableIterator<*>) { "MItr should satisfy 'is MutableIterator'" } + + val litr = LItr() as Any + val mlitr = MLItr() + + assert(litr !is MutableIterator<*>) { "LItr should satisfy '!is MutableIterator'" } + assert(litr !is MutableListIterator<*>) { "LItr should satisfy '!is MutableListIterator'" } + assert(mlitr is MutableListIterator<*>) { "MLItr should satisfy 'is MutableListIterator'" } + + val it = It() as Any + val mit = MIt() + val arrayList = ArrayList() + + assert(it !is MutableIterable<*>) { "It should satisfy '!is MutableIterable'" } + assert(mit is MutableIterable<*>) { "MIt should satisfy 'is MutableIterable'" } + assert(arrayList is MutableIterable<*>) { "ArrayList should satisfy 'is MutableIterable'" } + + val coll = C() as Any + val mcoll = MC() + + assert(coll !is MutableCollection<*>) { "C should satisfy '!is MutableCollection'" } + assert(coll !is MutableIterable<*>) { "C should satisfy '!is MutableIterable'" } + assert(mcoll is MutableCollection<*>) { "MC should satisfy 'is MutableCollection'" } + assert(mcoll is MutableIterable<*>) { "MC should satisfy 'is MutableIterable'" } + assert(arrayList is MutableCollection<*>) { "ArrayList should satisfy 'is MutableCollection'" } + + val list = L() as Any + val mlist = ML() + + assert(list !is MutableList<*>) { "L should satisfy '!is MutableList'" } + assert(list !is MutableCollection<*>) { "L should satisfy '!is MutableCollection'" } + assert(list !is MutableIterable<*>) { "L should satisfy '!is MutableIterable'" } + assert(mlist is MutableList<*>) { "ML should satisfy 'is MutableList'" } + assert(mlist is MutableCollection<*>) { "ML should satisfy 'is MutableCollection'" } + assert(mlist is MutableIterable<*>) { "ML should satisfy 'is MutableIterable'" } + assert(arrayList is MutableList<*>) { "ArrayList should satisfy 'is MutableList'" } + + val set = S() as Any + val mset = MS() + val hashSet = HashSet() + + assert(set !is MutableSet<*>) { "S should satisfy '!is MutableSet'" } + assert(set !is MutableCollection<*>) { "S should satisfy '!is MutableCollection'" } + assert(set !is MutableIterable<*>) { "S should satisfy '!is MutableIterable'" } + assert(mset is MutableSet<*>) { "MS should satisfy 'is MutableSet'" } + assert(mset is MutableCollection<*>) { "MS should satisfy 'is MutableCollection'" } + assert(mset is MutableIterable<*>) { "MS should satisfy 'is MutableIterable'" } + assert(hashSet is MutableSet<*>) { "HashSet should satisfy 'is MutableSet'" } + assert(hashSet is MutableCollection<*>) { "HashSet should satisfy 'is MutableCollection'" } + assert(hashSet is MutableIterable<*>) { "HashSet should satisfy 'is MutableIterable'" } + + val map = M() as Any + val mmap = MM() + val hashMap = HashMap() + + assert(map !is MutableMap<*, *>) { "M should satisfy '!is MutableMap'" } + assert(mmap is MutableMap<*, *>) { "MM should satisfy 'is MutableMap'"} + assert(hashMap is MutableMap<*, *>) { "HashMap should satisfy 'is MutableMap'" } + + val entry = ME() as Any + val mentry = MME() + + hashMap[""] = "" + val hashMapEntry = hashMap.entries.first() + + assert(entry !is MutableMap.MutableEntry<*, *>) { "ME should satisfy '!is MutableMap.MutableEntry'"} + assert(mentry is MutableMap.MutableEntry<*, *>) { "MME should satisfy 'is MutableMap.MutableEntry'"} + assert(hashMapEntry is MutableMap.MutableEntry<*, *>) { "HashMap.Entry should satisfy 'is MutableMap.MutableEntry'"} + + assert((mlist as Any) !is MutableSet<*>) { "ML !is MutableSet" } + assert((mlist as Any) !is MutableIterator<*>) { "ML !is MutableIterator" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt new file mode 100644 index 00000000000..8383b28f850 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt @@ -0,0 +1,60 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +abstract class Itr : Iterator +abstract class MItr : MutableIterator +abstract class LItr : ListIterator +abstract class MLItr : MutableListIterator +abstract class It : Iterable +abstract class MIt : MutableIterable +abstract class C : Collection +abstract class MC : MutableCollection +abstract class L : List +abstract class ML : MutableList +abstract class S : Set +abstract class MS : MutableSet +abstract class M : Map +abstract class MM : MutableMap +abstract class ME : Map.Entry +abstract class MME : MutableMap.MutableEntry + +abstract class L2 : L() +abstract class ML2 : ML() + +abstract class Weird : Iterator, MutableList + +fun expectInterfaces(jClass: Class<*>, expectedInterfaceNames: Set) { + val actualInterfaceNames = jClass.getInterfaces().mapTo(linkedSetOf()) { it.name } + + assert(actualInterfaceNames == expectedInterfaceNames) { + "${jClass.name}: interfaces: expected: $expectedInterfaceNames; actual: $actualInterfaceNames" + } +} + +fun box(): String { + expectInterfaces(Itr::class.java, setOf("java.util.Iterator", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MItr::class.java, setOf("java.util.Iterator", "kotlin.jvm.internal.markers.KMutableIterator")) + expectInterfaces(LItr::class.java, setOf("java.util.ListIterator", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MLItr::class.java, setOf("java.util.ListIterator", "kotlin.jvm.internal.markers.KMutableListIterator")) + expectInterfaces(It::class.java, setOf("java.lang.Iterable", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MIt::class.java, setOf("java.lang.Iterable", "kotlin.jvm.internal.markers.KMutableIterable")) + expectInterfaces(C::class.java, setOf("java.util.Collection", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MC::class.java, setOf("java.util.Collection", "kotlin.jvm.internal.markers.KMutableCollection")) + expectInterfaces(L::class.java, setOf("java.util.List", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(ML::class.java, setOf("java.util.List", "kotlin.jvm.internal.markers.KMutableList")) + expectInterfaces(S::class.java, setOf("java.util.Set", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MS::class.java, setOf("java.util.Set", "kotlin.jvm.internal.markers.KMutableSet")) + expectInterfaces(M::class.java, setOf("java.util.Map", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MM::class.java, setOf("java.util.Map", "kotlin.jvm.internal.markers.KMutableMap")) + expectInterfaces(ME::class.java, setOf("java.util.Map\$Entry", "kotlin.jvm.internal.markers.KMappedMarker")) + expectInterfaces(MME::class.java, setOf("java.util.Map\$Entry", "kotlin.jvm.internal.markers.KMutableMap\$Entry")) + expectInterfaces(L2::class.java, setOf()) + expectInterfaces(ML2::class.java, setOf()) + expectInterfaces(Weird::class.java, + setOf("java.util.Iterator", "kotlin.jvm.internal.markers.KMappedMarker", + "java.util.List", "kotlin.jvm.internal.markers.KMutableList")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedAsWithMutable.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedAsWithMutable.kt new file mode 100644 index 00000000000..77d2d3b8683 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedAsWithMutable.kt @@ -0,0 +1,128 @@ +// WITH_RUNTIME + +class Itr : Iterator by ArrayList().iterator() +class MItr : MutableIterator by ArrayList().iterator() +class LItr : ListIterator by ArrayList().listIterator() +class MLItr : MutableListIterator by ArrayList().listIterator() + +class It : Iterable by ArrayList() +class MIt : MutableIterable by ArrayList() +class C : Collection by ArrayList() +class MC : MutableCollection by ArrayList() +class L : List by ArrayList() +class ML : MutableList by ArrayList() +class S : Set by HashSet() +class MS : MutableSet by HashSet() + +class M : Map by HashMap() +class MM : MutableMap by HashMap() + +class ME : Map.Entry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() +} + +class MME : MutableMap.MutableEntry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() + override fun setValue(value: String): String = throw UnsupportedOperationException() +} + +inline fun reifiedAsSucceeds(x: Any, operation: String) { + try { + x as T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { + try { + x as T + } + catch (e: ClassCastException) { + return + } + catch (e: Throwable) { + throw AssertionError("$operation: should throw ClassCastException, got $e") + } + throw AssertionError("$operation: should fail with CCE, no exception thrown") +} + +fun box(): String { + val itr = Itr() as Any + val mitr = MItr() + + reifiedAsFailsWithCCE>(itr, "reifiedAs>(itr)") + reifiedAsSucceeds>(mitr, "reifiedAs>(mitr)") + + val litr = LItr() as Any + val mlitr = MLItr() + + reifiedAsFailsWithCCE>(litr, "reifiedAs>(litr)") + reifiedAsFailsWithCCE>(litr, "reifiedAs>(litr)") + reifiedAsSucceeds>(mlitr, "reifiedAs>(mlitr)") + + val it = It() as Any + val mit = MIt() + val arrayList = ArrayList() + + reifiedAsFailsWithCCE>(it, "reifiedAs>(it)") + reifiedAsSucceeds>(mit, "reifiedAs>(mit)") + reifiedAsSucceeds>(arrayList, "reifiedAs>(arrayList)") + + val coll = C() as Any + val mcoll = MC() + + reifiedAsFailsWithCCE>(coll, "reifiedAs>(coll)") + reifiedAsFailsWithCCE>(coll, "reifiedAs>(coll)") + reifiedAsSucceeds>(mcoll, "reifiedAs>(mcoll)") + reifiedAsSucceeds>(mcoll, "reifiedAs>(mcoll)") + reifiedAsSucceeds>(arrayList, "reifiedAs>(arrayList)") + + val list = L() as Any + val mlist = ML() + + reifiedAsFailsWithCCE>(list, "reifiedAs>(list)") + reifiedAsFailsWithCCE>(list, "reifiedAs>(list)") + reifiedAsFailsWithCCE>(list, "reifiedAs>(list)") + reifiedAsSucceeds>(mlist, "reifiedAs>(mlist)") + reifiedAsSucceeds>(mlist, "reifiedAs>(mlist)") + reifiedAsSucceeds>(mlist, "reifiedAs>(mlist)") + reifiedAsSucceeds>(arrayList, "reifiedAs>(arrayList)") + + val set = S() as Any + val mset = MS() + val hashSet = HashSet() + + reifiedAsFailsWithCCE>(set, "reifiedAs>(set)") + reifiedAsFailsWithCCE>(set, "reifiedAs>(set)") + reifiedAsFailsWithCCE>(set, "reifiedAs>(set)") + reifiedAsSucceeds>(mset, "reifiedAs>(mset)") + reifiedAsSucceeds>(mset, "reifiedAs>(mset)") + reifiedAsSucceeds>(mset, "reifiedAs>(mset)") + reifiedAsSucceeds>(hashSet, "reifiedAs>(hashSet)") + reifiedAsSucceeds>(hashSet, "reifiedAs>(hashSet)") + reifiedAsSucceeds>(hashSet, "reifiedAs>(hashSet)") + + val map = M() as Any + val mmap = MM() + val hashMap = HashMap() + + reifiedAsFailsWithCCE>(map, "reifiedAs>(map)") + reifiedAsSucceeds>(mmap, "reifiedAs>(mmap)") + reifiedAsSucceeds>(hashMap, "reifiedAs>(hashMap)") + + val entry = ME() as Any + val mentry = MME() + + hashMap[""] = "" + val hashMapEntry = hashMap.entries.first() + + reifiedAsFailsWithCCE>(entry, "reifiedAs>(entry)") + reifiedAsSucceeds>(mentry, "reifiedAs>(mentry)") + reifiedAsSucceeds>(hashMapEntry, "reifiedAs>(hashMapEntry)") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedIsWithMutable.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedIsWithMutable.kt new file mode 100644 index 00000000000..df6e233f20a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedIsWithMutable.kt @@ -0,0 +1,111 @@ +// WITH_RUNTIME + +class Itr : Iterator by ArrayList().iterator() +class MItr : MutableIterator by ArrayList().iterator() +class LItr : ListIterator by ArrayList().listIterator() +class MLItr : MutableListIterator by ArrayList().listIterator() + +class It : Iterable by ArrayList() +class MIt : MutableIterable by ArrayList() +class C : Collection by ArrayList() +class MC : MutableCollection by ArrayList() +class L : List by ArrayList() +class ML : MutableList by ArrayList() +class S : Set by HashSet() +class MS : MutableSet by HashSet() + +class M : Map by HashMap() +class MM : MutableMap by HashMap() + +class ME : Map.Entry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() +} + +class MME : MutableMap.MutableEntry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() + override fun setValue(value: String): String = throw UnsupportedOperationException() +} + +inline fun reifiedIs(x: Any): Boolean = x is T +inline fun reifiedIsNot(x: Any): Boolean = x !is T + +fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())} + +fun box(): String { + val itr = Itr() as Any + val mitr = MItr() + + assert(reifiedIsNot>(itr)) { "reifiedIsNot>(itr)" } + assert(reifiedIs>(mitr)) { "reifiedIs>(mitr)" } + + val litr = LItr() as Any + val mlitr = MLItr() + + assert(reifiedIsNot>(litr)) { "reifiedIsNot>(litr)" } + assert(reifiedIsNot>(litr)) { "reifiedIsNot>(litr)" } + assert(reifiedIs>(mlitr)) { "reifiedIs>(mlitr)" } + + val it = It() as Any + val mit = MIt() + val arrayList = ArrayList() + + assert(reifiedIsNot>(it)) { "reifiedIsNot>(it)" } + assert(reifiedIs>(mit)) { "reifiedIs>(mit)" } + assert(reifiedIs>(arrayList)) { "reifiedIs>(arrayList)" } + + val coll = C() as Any + val mcoll = MC() + + assert(reifiedIsNot>(coll)) { "reifiedIsNot>(coll)" } + assert(reifiedIsNot>(coll)) { "reifiedIsNot>(coll)" } + assert(reifiedIs>(mcoll)) { "reifiedIs>(mcoll)" } + assert(reifiedIs>(mcoll)) { "reifiedIs>(mcoll)" } + assert(reifiedIs>(arrayList)) { "reifiedIs>(arrayList)" } + + val list = L() as Any + val mlist = ML() + + assert(reifiedIsNot>(list)) { "reifiedIsNot>(list)" } + assert(reifiedIsNot>(list)) { "reifiedIsNot>(list)" } + assert(reifiedIsNot>(list)) { "reifiedIsNot>(list)" } + assert(reifiedIs>(mlist)) { "reifiedIs>(mlist)" } + assert(reifiedIs>(mlist)) { "reifiedIs>(mlist)" } + assert(reifiedIs>(mlist)) { "reifiedIs>(mlist)" } + assert(reifiedIs>(arrayList)) { "reifiedIs>(arrayList)" } + + val set = S() as Any + val mset = MS() + val hashSet = HashSet() + + assert(reifiedIsNot>(set)) { "reifiedIsNot>(set)" } + assert(reifiedIsNot>(set)) { "reifiedIsNot>(set)" } + assert(reifiedIsNot>(set)) { "reifiedIsNot>(set)" } + assert(reifiedIs>(mset)) { "reifiedIs>(mset)" } + assert(reifiedIs>(mset)) { "reifiedIs>(mset)" } + assert(reifiedIs>(mset)) { "reifiedIs>(mset)" } + assert(reifiedIs>(hashSet)) { "reifiedIs>(hashSet)" } + assert(reifiedIs>(hashSet)) { "reifiedIs>(hashSet)" } + assert(reifiedIs>(hashSet)) { "reifiedIs>(hashSet)" } + + val map = M() as Any + val mmap = MM() + val hashMap = HashMap() + + assert(reifiedIsNot>(map)) { "reifiedIsNot>(map)" } + assert(reifiedIs>(mmap)) { "reifiedIs>(mmap)"} + assert(reifiedIs>(hashMap)) { "reifiedIs>(hashMap)" } + + val entry = ME() as Any + val mentry = MME() + + hashMap[""] = "" + val hashMapEntry = hashMap.entries.first() + + assert(reifiedIsNot>(entry)) { "reifiedIsNot>(entry)"} + assert(reifiedIs>(mentry)) { "reifiedIs>(mentry)"} + assert(reifiedIs>(hashMapEntry)) { "reifiedIs>(hashMapEntry)"} + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedSafeAsWithMutable.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedSafeAsWithMutable.kt new file mode 100644 index 00000000000..a54ad8b239f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/reifiedSafeAsWithMutable.kt @@ -0,0 +1,139 @@ +// WITH_RUNTIME + +class Itr : Iterator by ArrayList().iterator() +class MItr : MutableIterator by ArrayList().iterator() +class LItr : ListIterator by ArrayList().listIterator() +class MLItr : MutableListIterator by ArrayList().listIterator() + +class It : Iterable by ArrayList() +class MIt : MutableIterable by ArrayList() +class C : Collection by ArrayList() +class MC : MutableCollection by ArrayList() +class L : List by ArrayList() +class ML : MutableList by ArrayList() +class S : Set by HashSet() +class MS : MutableSet by HashSet() + +class M : Map by HashMap() +class MM : MutableMap by HashMap() + +class ME : Map.Entry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() +} + +class MME : MutableMap.MutableEntry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() + override fun setValue(value: String): String = throw UnsupportedOperationException() +} + +inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y == null) { + throw AssertionError("$operation: should return non-null, got null") + } +} + +inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y != null) { + throw AssertionError("$operation: should return null, got $y") + } +} + +fun box(): String { + val itr = Itr() as Any + val mitr = MItr() + + reifiedSafeAsReturnsNull>(itr, "reifiedSafeAs>(itr)") + reifiedSafeAsReturnsNonNull>(mitr, "reifiedSafeAs>(mitr)") + + val litr = LItr() as Any + val mlitr = MLItr() + + reifiedSafeAsReturnsNull>(litr, "reifiedSafeAs>(litr)") + reifiedSafeAsReturnsNull>(litr, "reifiedSafeAs>(litr)") + reifiedSafeAsReturnsNonNull>(mlitr, "reifiedSafeAs>(mlitr)") + + val it = It() as Any + val mit = MIt() + val arrayList = ArrayList() + + reifiedSafeAsReturnsNull>(it, "reifiedSafeAs>(it)") + reifiedSafeAsReturnsNonNull>(mit, "reifiedSafeAs>(mit)") + reifiedSafeAsReturnsNonNull>(arrayList, "reifiedSafeAs>(arrayList)") + + val coll = C() as Any + val mcoll = MC() + + reifiedSafeAsReturnsNull>(coll, "reifiedSafeAs>(coll)") + reifiedSafeAsReturnsNull>(coll, "reifiedSafeAs>(coll)") + reifiedSafeAsReturnsNonNull>(mcoll, "reifiedSafeAs>(mcoll)") + reifiedSafeAsReturnsNonNull>(mcoll, "reifiedSafeAs>(mcoll)") + reifiedSafeAsReturnsNonNull>(arrayList, "reifiedSafeAs>(arrayList)") + + val list = L() as Any + val mlist = ML() + + reifiedSafeAsReturnsNull>(list, "reifiedSafeAs>(list)") + reifiedSafeAsReturnsNull>(list, "reifiedSafeAs>(list)") + reifiedSafeAsReturnsNull>(list, "reifiedSafeAs>(list)") + reifiedSafeAsReturnsNonNull>(mlist, "reifiedSafeAs>(mlist)") + reifiedSafeAsReturnsNonNull>(mlist, "reifiedSafeAs>(mlist)") + reifiedSafeAsReturnsNonNull>(mlist, "reifiedSafeAs>(mlist)") + reifiedSafeAsReturnsNonNull>(arrayList, "reifiedSafeAs>(arrayList)") + + val set = S() as Any + val mset = MS() + val hashSet = HashSet() + + reifiedSafeAsReturnsNull>(set, "reifiedSafeAs>(set)") + reifiedSafeAsReturnsNull>(set, "reifiedSafeAs>(set)") + reifiedSafeAsReturnsNull>(set, "reifiedSafeAs>(set)") + reifiedSafeAsReturnsNonNull>(mset, "reifiedSafeAs>(mset)") + reifiedSafeAsReturnsNonNull>(mset, "reifiedSafeAs>(mset)") + reifiedSafeAsReturnsNonNull>(mset, "reifiedSafeAs>(mset)") + reifiedSafeAsReturnsNonNull>(hashSet, "reifiedSafeAs>(hashSet)") + reifiedSafeAsReturnsNonNull>(hashSet, "reifiedSafeAs>(hashSet)") + reifiedSafeAsReturnsNonNull>(hashSet, "reifiedSafeAs>(hashSet)") + + val map = M() as Any + val mmap = MM() + val hashMap = HashMap() + + reifiedSafeAsReturnsNull>(map, "reifiedSafeAs>(map)") + reifiedSafeAsReturnsNonNull>(mmap, "reifiedSafeAs>(mmap)") + reifiedSafeAsReturnsNonNull>(hashMap, "reifiedSafeAs>(hashMap)") + + val entry = ME() as Any + val mentry = MME() + + hashMap[""] = "" + val hashMapEntry = hashMap.entries.first() + + reifiedSafeAsReturnsNull>(entry, "reifiedSafeAs>(entry)") + reifiedSafeAsReturnsNonNull>(mentry, "reifiedSafeAs>(mentry)") + reifiedSafeAsReturnsNonNull>(hashMapEntry, "reifiedSafeAs>(hashMapEntry)") + + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + reifiedSafeAsReturnsNull>(null, "reifiedSafeAs>(null)") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/safeAsWithMutable.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/safeAsWithMutable.kt new file mode 100644 index 00000000000..58113095c09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/safeAsWithMutable.kt @@ -0,0 +1,140 @@ +// WITH_RUNTIME + +class Itr : Iterator by ArrayList().iterator() +class MItr : MutableIterator by ArrayList().iterator() +class LItr : ListIterator by ArrayList().listIterator() +class MLItr : MutableListIterator by ArrayList().listIterator() + +class It : Iterable by ArrayList() +class MIt : MutableIterable by ArrayList() +class C : Collection by ArrayList() +class MC : MutableCollection by ArrayList() +class L : List by ArrayList() +class ML : MutableList by ArrayList() +class S : Set by HashSet() +class MS : MutableSet by HashSet() + +class M : Map by HashMap() +class MM : MutableMap by HashMap() + +class ME : Map.Entry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() +} + +class MME : MutableMap.MutableEntry { + override val key: String get() = throw UnsupportedOperationException() + override val value: String get() = throw UnsupportedOperationException() + override fun setValue(value: String): String = throw UnsupportedOperationException() +} + +fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())} + + +inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x == null) { "$operation: should return null, got $x" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x != null) { "$operation: should return non-null" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +fun box(): String { + val itr = Itr() as Any + val mitr = MItr() + + safeAsReturnsNull("itr as? MutableIterator") { itr as? MutableIterator<*> } + safeAsReturnsNonNull("mitr as? MutableIterator") { mitr as? MutableIterator<*> } + + val litr = LItr() as Any + val mlitr = MLItr() + + safeAsReturnsNull("litr as? MutableIterator") { litr as? MutableIterator<*> } + safeAsReturnsNull("litr as? MutableListIterator") { litr as? MutableListIterator<*> } + safeAsReturnsNonNull("mlitr as? MutableIterator") { mlitr as? MutableIterator<*> } + safeAsReturnsNonNull("mlitr as? MutableListIterator") { mlitr as? MutableListIterator<*> } + + val it = It() as Any + val mit = MIt() + val arrayList = ArrayList() + + safeAsReturnsNull("it as? MutableIterable") { it as? MutableIterable<*> } + safeAsReturnsNonNull("mit as? MutableIterable") { mit as? MutableIterable<*> } + safeAsReturnsNonNull("arrayList as? MutableIterable") { arrayList as? MutableIterable<*> } + + val coll = C() as Any + val mcoll = MC() + + safeAsReturnsNull("coll as? MutableIterable") { coll as? MutableIterable<*> } + safeAsReturnsNull("coll as? MutableCollection") { coll as? MutableCollection<*> } + safeAsReturnsNonNull("mcoll as? MutableIterable") { mcoll as? MutableIterable<*> } + safeAsReturnsNonNull("mcoll as? MutableCollection") { mcoll as? MutableCollection<*> } + safeAsReturnsNonNull("arrayList as? MutableCollection") { arrayList as? MutableCollection<*> } + + val list = L() as Any + val mlist = ML() + + safeAsReturnsNull("list as? MutableIterable") { list as? MutableIterable<*> } + safeAsReturnsNull("list as? MutableCollection") { list as? MutableCollection<*> } + safeAsReturnsNull("list as? MutableList") { list as? MutableList<*> } + safeAsReturnsNonNull("mlist as? MutableIterable") { mlist as? MutableIterable<*> } + safeAsReturnsNonNull("mlist as? MutableCollection") { mlist as? MutableCollection<*> } + safeAsReturnsNonNull("mlist as? MutableList") { mlist as? MutableList<*> } + + val set = S() as Any + val mset = MS() + val hashSet = HashSet() + + safeAsReturnsNull("set as? MutableIterable") { set as? MutableIterable<*> } + safeAsReturnsNull("set as? MutableCollection") { set as? MutableCollection<*> } + safeAsReturnsNull("set as? MutableSet") { set as? MutableSet<*> } + safeAsReturnsNonNull("mset as? MutableIterable") { mset as? MutableIterable<*> } + safeAsReturnsNonNull("mset as? MutableCollection") { mset as? MutableCollection<*> } + safeAsReturnsNonNull("mset as? MutableSet") { mset as? MutableSet<*> } + safeAsReturnsNonNull("hashSet as? MutableSet") { hashSet as? MutableSet<*> } + + val map = M() as Any + val mmap = MM() + val hashMap = HashMap() + + safeAsReturnsNull("map as? MutableMap") { map as? MutableMap<*, *> } + safeAsReturnsNonNull("mmap as? MutableMap") { mmap as? MutableMap<*, *> } + safeAsReturnsNonNull("hashMap as? MutableMap") { hashMap as? MutableMap<*, *> } + + val entry = ME() as Any + val mentry = MME() + + safeAsReturnsNull("entry as? MutableMap.MutableEntry") { entry as? MutableMap.MutableEntry<*, *> } + safeAsReturnsNonNull("mentry as? MutableMap.MutableEntry") { mentry as? MutableMap.MutableEntry<*, *> } + + hashMap[""] = "" + val hashMapEntry = hashMap.entries.first() + + safeAsReturnsNonNull("hashMapEntry as? MutableMap.MutableEntry") { hashMapEntry as? MutableMap.MutableEntry<*, *> } + + safeAsReturnsNull("null as? MutableIterator") { null as? MutableIterator<*> } + safeAsReturnsNull("null as? MutableListIterator") { null as? MutableListIterator<*> } + safeAsReturnsNull("null as? MutableIterable") { null as? MutableIterable<*> } + safeAsReturnsNull("null as? MutableCollection") { null as? MutableCollection<*> } + safeAsReturnsNull("null as? MutableList") { null as? MutableList<*> } + safeAsReturnsNull("null as? MutableSet") { null as? MutableSet<*> } + safeAsReturnsNull("null as? MutableMap") { null as? MutableMap<*, *> } + safeAsReturnsNull("null as? MutableMap.MutableEntry") { null as? MutableMap.MutableEntry<*, *> } + + safeAsReturnsNull("mlist as? MutableSet") { mlist as? MutableSet<*> } + safeAsReturnsNull("mlist as? MutableIterator") { mlist as? MutableIterator<*> } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt new file mode 100644 index 00000000000..19300961dac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt @@ -0,0 +1,143 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun unsupported(): Nothing = throw UnsupportedOperationException() + +class Weird : Iterator, MutableIterable, MutableMap.MutableEntry { + override fun next(): String = unsupported() + override fun hasNext(): Boolean = unsupported() + override val key: String get() = unsupported() + override val value: String get() = unsupported() + override fun setValue(value: String): String = unsupported() + override fun iterator(): MutableIterator = unsupported() +} + +inline fun asFailsWithCCE(operation: String, cast: () -> Unit) { + try { + cast() + } + catch (e: java.lang.ClassCastException) { + return + } + catch (e: Throwable) { + throw AssertionError("$operation: should throw ClassCastException, got $e") + } + throw AssertionError("$operation: should throw ClassCastException, no exception thrown") +} + +inline fun asSucceeds(operation: String, cast: () -> Unit) { + try { + cast() + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x == null) { "$operation: should return null, got $x" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun safeAsReturnsNonNull(operation: String, cast: () -> Any?) { + try { + val x = cast() + assert(x != null) { "$operation: should return non-null" } + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun reifiedIs(x: Any): Boolean = x is T + +inline fun reifiedIsNot(x: Any): Boolean = x !is T + +inline fun reifiedAsSucceeds(x: Any, operation: String) { + try { + x as T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } +} + +inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { + try { + x as T + } + catch (e: java.lang.ClassCastException) { + return + } + catch (e: Throwable) { + throw AssertionError("$operation: should throw ClassCastException, got $e") + } + throw AssertionError("$operation: should fail with CCE, no exception thrown") +} + +inline fun reifiedSafeAsReturnsNonNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y == null) { + throw AssertionError("$operation: should return non-null, got null") + } +} + +inline fun reifiedSafeAsReturnsNull(x: Any?, operation: String) { + val y = try { + x as? T + } + catch (e: Throwable) { + throw AssertionError("$operation: should not throw exceptions, got $e") + } + if (y != null) { + throw AssertionError("$operation: should return null, got $y") + } +} + +fun box(): String { + val w: Any = Weird() + + assert(w is Iterator<*>) { "w is Iterator<*>" } + assert(w !is MutableIterator<*>) { "w !is MutableIterator<*>" } + assert(w is MutableIterable<*>) { "w is MutableIterable<*>" } + assert(w is MutableMap.MutableEntry<*, *>) { "w is MutableMap.MutableEntry<*, *>" } + + asSucceeds("w as Iterator<*>") { w as Iterator<*> } + asFailsWithCCE("w as MutableIterator<*>") { w as MutableIterator<*> } + asSucceeds("w as MutableIterable<*>") { w as MutableIterable<*> } + asSucceeds("w as MutableMap.MutableEntry<*, *>") { w as MutableMap.MutableEntry<*, *> } + + safeAsReturnsNonNull("w as Iterator<*>") { w as? Iterator<*> } + safeAsReturnsNull("w as? MutableIterator<*>") { w as? MutableIterator<*> } + safeAsReturnsNonNull("w as? MutableIterable<*>") { w as? MutableIterable<*> } + safeAsReturnsNonNull("w as? MutableMap.MutableEntry<*, *>") { w as? MutableMap.MutableEntry<*, *> } + + assert(reifiedIs>(w)) { "reifiedIs>(w)" } + assert(reifiedIsNot>(w)) { "reifiedIsNot>(w)" } + assert(reifiedIs>(w)) { "reifiedIs>(w)" } + assert(reifiedIs>(w)) { "reifiedIs>(w)" } + + reifiedAsSucceeds>(w, "reified w as Iterator<*>") + reifiedAsFailsWithCCE>(w, "reified w as MutableIterator<*>") + reifiedAsSucceeds>(w, "reified w as MutableIterable<*>") + reifiedAsSucceeds>(w, "reified w as MutableMap.MutableEntry<*, *>") + + reifiedSafeAsReturnsNonNull>(w, "reified w as? Iterator<*>") + reifiedSafeAsReturnsNull>(w, "reified w as? MutableIterator<*>") + reifiedSafeAsReturnsNonNull>(w, "reified w as? MutableIterable<*>") + reifiedSafeAsReturnsNonNull>(w, "reified w as? MutableMap.MutableEntry<*, *>") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/notIs.kt b/backend.native/tests/external/codegen/blackbox/casts/notIs.kt new file mode 100644 index 00000000000..262d2db9b5a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/notIs.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(x: Any) = x !is Runnable + +fun box(): String { + val r = object : Runnable { + override fun run() {} + } + return if (!foo(r) && foo(42)) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt b/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt new file mode 100644 index 00000000000..d05da99581f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun println(s: String) { +} + +fun box(): String { + val x = println(":Hi!") as Any + if (x != Unit) return "Fail: $x" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt b/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt new file mode 100644 index 00000000000..a57a1d0a945 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun foo() {} + +fun box(): String { + try { + foo() as Int? + } + catch (e: ClassCastException) { + return "OK" + } + catch (e: Throwable) { + return "Fail: ClassCastException should have been thrown, but was instead ${e.javaClass.getName()}: ${e.message}" + } + + return "Fail: no exception was thrown" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt b/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt new file mode 100644 index 00000000000..6412c65526f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun println(s: String) { +} + +fun box(): String { + val x = println(":Hi!") as? Any + if (x != Unit) return "Fail: $x" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitNullableCast.kt b/backend.native/tests/external/codegen/blackbox/casts/unitNullableCast.kt new file mode 100644 index 00000000000..c0f644e88a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/unitNullableCast.kt @@ -0,0 +1,7 @@ +fun foo() {} + +fun bar(): Int? = foo() as? Int + +fun box(): String { + return if (bar() == null) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt new file mode 100644 index 00000000000..6731a8236b2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + var x = 42 + val k = (x++)::class.java + if (k != Int::class.java) return "Fail 1: $k" + if (x != 43) return "Fail 2: $x (side effect should have taken place)" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt new file mode 100644 index 00000000000..54c6b5b02a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(true::class, Boolean::class) + assertEquals(42.toByte()::class, Byte::class) + assertEquals('z'::class, Char::class) + assertEquals(3.14::class, Double::class) + assertEquals(2.72f::class, Float::class) + assertEquals(42::class, Int::class) + assertEquals(42L::class, Long::class) + assertEquals(42.toShort()::class, Short::class) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt new file mode 100644 index 00000000000..0f488002377 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var x = 42 + + val k1 = (x++)::class + if (k1 != Int::class) return "Fail 1: $k1" + if (x != 43) return "Fail 2: $x" + + val k2 = { x *= 2; x }()::class + // Note that k2 is the class of the wrapper type java.lang.Integer + if (k2 != Integer::class) return "Fail 3: $k2" + if (x != 86) return "Fail 4: $x" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt new file mode 100644 index 00000000000..0524e9ebf77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt @@ -0,0 +1,8 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val x: CharSequence = "" + val klass = x::class + return if (klass == String::class) "OK" else "Fail: $klass" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt new file mode 100644 index 00000000000..3ae1f3762ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt @@ -0,0 +1,63 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KClass + +fun checkPrimitive(clazz: Class<*>, expected: String) { + assert (clazz!!.canonicalName == expected) { + "clazz name: ${clazz.canonicalName}" + } +} + +fun checkPrimitive(kClass: KClass<*>, expected: String) { + checkPrimitive(kClass.java, expected) +} + +fun checkObject(clazz: Class<*>, expected: String) { + assert (clazz.canonicalName == "$expected") { + "clazz should be object, but found: ${clazz!!.canonicalName}" + } +} + +fun checkObject(kClass: KClass<*>, expected: String) { + checkObject(kClass.java, expected) +} + +fun box(): String { + checkPrimitive(Boolean::class.java, "boolean") + checkPrimitive(Boolean::class, "boolean") + + checkPrimitive(Char::class.java, "char") + checkPrimitive(Char::class, "char") + + checkPrimitive(Byte::class.java, "byte") + checkPrimitive(Byte::class, "byte") + + checkPrimitive(Short::class.java, "short") + checkPrimitive(Short::class, "short") + + checkPrimitive(Int::class.java, "int") + checkPrimitive(Int::class, "int") + + checkPrimitive(Float::class.java, "float") + checkPrimitive(Float::class, "float") + + checkPrimitive(Long::class.java, "long") + checkPrimitive(Long::class, "long") + + checkPrimitive(Double::class.java, "double") + checkPrimitive(Double::class, "double") + + checkObject(String::class.java, "java.lang.String") + checkObject(String::class, "java.lang.String") + + checkObject(Nothing::class.java, "java.lang.Void") + checkObject(Nothing::class, "java.lang.Void") + + checkObject(java.lang.Void::class.java, "java.lang.Void") + checkObject(java.lang.Void::class, "java.lang.Void") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt new file mode 100644 index 00000000000..ed794ffc106 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt @@ -0,0 +1,53 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KClass + +fun check(clazz: Class<*>?, expected: String) { + assert (clazz!!.canonicalName == expected) { + "clazz name: ${clazz.canonicalName}" + } +} + +fun check(kClass: KClass<*>, expected: String) { + check(kClass.javaObjectType, expected) +} + +fun box(): String { + check(Boolean::class.javaObjectType, "java.lang.Boolean") + check(Boolean::class, "java.lang.Boolean") + + check(Char::class.javaObjectType, "java.lang.Character") + check(Char::class, "java.lang.Character") + + check(Byte::class.javaObjectType, "java.lang.Byte") + check(Byte::class, "java.lang.Byte") + + check(Short::class.javaObjectType, "java.lang.Short") + check(Short::class, "java.lang.Short") + + check(Int::class.javaObjectType, "java.lang.Integer") + check(Int::class, "java.lang.Integer") + + check(Float::class.javaObjectType, "java.lang.Float") + check(Float::class, "java.lang.Float") + + check(Long::class.javaObjectType, "java.lang.Long") + check(Long::class, "java.lang.Long") + + check(Double::class.javaObjectType, "java.lang.Double") + check(Double::class, "java.lang.Double") + + check(String::class.javaObjectType, "java.lang.String") + check(String::class, "java.lang.String") + + check(Nothing::class.javaObjectType, "java.lang.Void") + check(Nothing::class, "java.lang.Void") + + check(Void::class.javaObjectType, "java.lang.Void") + check(Void::class, "java.lang.Void") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt new file mode 100644 index 00000000000..c03c33ba8ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun check(expected: String) { + val clazz = T::class.javaObjectType!! + assert (clazz.canonicalName == "java.lang.$expected") { + "clazz name: ${clazz.canonicalName}" + } +} + +fun box(): String { + check("Boolean") + check("Character") + check("Byte") + check("Short") + check("Integer") + check("Float") + check("Long") + check("Double") + + check("String") + check("Void") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt new file mode 100644 index 00000000000..0236f652948 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt @@ -0,0 +1,63 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KClass + +fun check(clazz: Class<*>?, expected: String) { + assert (clazz!!.canonicalName == expected) { + "clazz name: ${clazz.canonicalName}" + } +} + +fun check(kClass: KClass<*>, expected: String) { + check(kClass.javaPrimitiveType, expected) +} + +fun checkNull(clazz: Class<*>?) { + assert (clazz == null) { + "clazz should be null: ${clazz!!.canonicalName}" + } +} + +fun checkNull(kClass: KClass<*>) { + checkNull(kClass.javaPrimitiveType) +} + +fun box(): String { + check(Boolean::class.javaPrimitiveType, "boolean") + check(Boolean::class, "boolean") + + check(Char::class.javaPrimitiveType, "char") + check(Char::class, "char") + + check(Byte::class.javaPrimitiveType, "byte") + check(Byte::class, "byte") + + check(Short::class.javaPrimitiveType, "short") + check(Short::class, "short") + + check(Int::class.javaPrimitiveType, "int") + check(Int::class, "int") + + check(Float::class.javaPrimitiveType, "float") + check(Float::class, "float") + + check(Long::class.javaPrimitiveType, "long") + check(Long::class, "long") + + check(Double::class.javaPrimitiveType, "double") + check(Double::class, "double") + + checkNull(String::class.javaPrimitiveType) + checkNull(String::class) + + checkNull(Nothing::class.javaPrimitiveType) + checkNull(Nothing::class) + + checkNull(Void::class.javaPrimitiveType) + checkNull(Void::class) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt new file mode 100644 index 00000000000..ebe15afe3b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun check(expected: String) { + val clazz = T::class.javaPrimitiveType!! + assert (clazz.canonicalName == expected) { + "clazz name: ${clazz.canonicalName}" + } +} + +inline fun checkNull() { + val clazz = T::class.javaPrimitiveType + assert (clazz == null) { + "clazz should be null: ${clazz!!.canonicalName}" + } +} + +fun box(): String { + check("boolean") + check("char") + check("byte") + check("short") + check("int") + check("float") + check("long") + check("double") + + checkNull() + checkNull() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt new file mode 100644 index 00000000000..90cf2d94df7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun check(expected: String) { + val clazz = T::class.java!! + assert (clazz.canonicalName == "java.lang.$expected") { + "clazz name: ${clazz.canonicalName}" + } +} + +fun box(): String { + check("Boolean") + check("Character") + check("Byte") + check("Short") + check("Integer") + check("Float") + check("Long") + check("Double") + + check("String") + check("Void") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt new file mode 100644 index 00000000000..6271b906152 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KClass + +val > T.myjava1: Class<*> + get() = java + +val > T.myjava2: Class + get() = java + +class O +class K + +fun box(): String = + O::class.myjava1.getSimpleName() + K::class.myjava2.getSimpleName() + diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt new file mode 100644 index 00000000000..30c16850f62 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +abstract class S(val klass: Class) { + val result = klass.simpleName +} + +object OK : S(OK::class.java) + +class C { + companion object Companion : S(Companion::class.java) +} + +fun box(): String { + assertEquals("Companion", C.Companion.result) + return OK.result +} diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt new file mode 100644 index 00000000000..2fb23528510 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals +import kotlin.test.assertFalse + +fun box(): String { + val x = Int::class.javaPrimitiveType!!.kotlin + val y = Int::class.javaObjectType.kotlin + + assertEquals(x, y) + assertEquals(x.hashCode(), y.hashCode()) + assertFalse(x === y) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/boxPrimitiveTypeInClinitOfClassObject.kt b/backend.native/tests/external/codegen/blackbox/classes/boxPrimitiveTypeInClinitOfClassObject.kt new file mode 100644 index 00000000000..497167d4be6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/boxPrimitiveTypeInClinitOfClassObject.kt @@ -0,0 +1,31 @@ +class A { + companion object { + var xi = 0 + var xin : Int? = 0 + var xinn : Int? = null + + var xl = 0.toLong() + var xln : Long? = 0.toLong() + var xlnn : Long? = null + + var xb = 0.toByte() + var xbn : Byte? = 0.toByte() + var xbnn : Byte? = null + + var xf = 0.toFloat() + var xfn : Float? = 0.toFloat() + var xfnn : Float? = null + + var xd = 0.toDouble() + var xdn : Double? = 0.toDouble() + var xdnn : Double? = null + + var xs = 0.toShort() + var xsn : Short? = 0.toShort() + var xsnn : Short? = null + } +} + +fun box() : String { + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/classCompanionInitializationWithJava.kt b/backend.native/tests/external/codegen/blackbox/classes/classCompanionInitializationWithJava.kt new file mode 100644 index 00000000000..814f87dbdb5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classCompanionInitializationWithJava.kt @@ -0,0 +1,33 @@ +// TARGET_BACKEND: JVM +// FILE: CompanionInitialization.java + +public class CompanionInitialization { + + public static Object getCompanion() { + return ConcreteWithStatic.Companion; + } + +} + +// FILE: CompanionInitialization.kt + +interface IStatic + +open class Static(x: IStatic) { + fun doSth() { + } +} + +class ConcreteWithStatic : IStatic { + companion object : Static(ConcreteWithStatic()) +} + +fun box(): String { + ConcreteWithStatic.doSth() + + val companion: Any? = CompanionInitialization.getCompanion() + if (companion == null) return "fail 1" + if (companion != ConcreteWithStatic) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/classNamedAsOldPackageFacade.kt b/backend.native/tests/external/codegen/blackbox/classes/classNamedAsOldPackageFacade.kt new file mode 100644 index 00000000000..24c2efdc564 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classNamedAsOldPackageFacade.kt @@ -0,0 +1,7 @@ +package test + +class TestPackage { + val OK = "OK" +} + +fun box(): String = TestPackage().OK \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObject.kt b/backend.native/tests/external/codegen/blackbox/classes/classObject.kt new file mode 100644 index 00000000000..c8da87c8a7f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObject.kt @@ -0,0 +1,11 @@ +class C() { + companion object { + fun create() = C() + } +} + +fun box(): String { + val c = C.create() + return if (c is C) "OK" else "fail" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectAsExtensionReceiver.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectAsExtensionReceiver.kt new file mode 100644 index 00000000000..886dbdf8364 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectAsExtensionReceiver.kt @@ -0,0 +1,7 @@ +fun Any.foo() = 1 + +class A { + companion object +} + +fun box() = if (A.foo() == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectAsStaticInitializer.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectAsStaticInitializer.kt new file mode 100644 index 00000000000..d9175424f8e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectAsStaticInitializer.kt @@ -0,0 +1,19 @@ +var global = 0; + +class C { + companion object { + init { + global = 1; + } + } +} + +fun box(): String { + if (global != 0) { + return "fail1: global = $global" + } + + val c = C() + if (global == 1) return "OK" else return "fail2: global = $global" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectField.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectField.kt new file mode 100644 index 00000000000..f23073c6e89 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectField.kt @@ -0,0 +1,7 @@ +class A() { + companion object { + val value = 10 + } +} + +fun box() = if (A.value == 10) "OK" else "Fail ${A.value}" diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectInTrait.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectInTrait.kt new file mode 100644 index 00000000000..e34f5622a3e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectInTrait.kt @@ -0,0 +1,12 @@ +// EA-38323 - Illegal field modifiers in class: classObject field in C must be static and final + +interface C { + companion object { + public val FOO: String = "OK" + } +} + +fun box(): String { + return C.FOO +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectNotOfEnum.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectNotOfEnum.kt new file mode 100644 index 00000000000..e2a775320cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectNotOfEnum.kt @@ -0,0 +1,8 @@ +class A { + companion object { + fun values() = "O" + fun valueOf() = "K" + } +} + +fun box() = A.values() + A.valueOf() diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt new file mode 100644 index 00000000000..dd2744181c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt @@ -0,0 +1,9 @@ +// TODO: Enable for JS when it supports Java class library. +// IGNORE_BACKEND: JS +class SomeClass { companion object } + +fun box() = + if ((SomeClass.toString() as java.lang.String).matches("SomeClass\\\$Companion@[0-9a-fA-F]+")) + "OK" + else + "Fail: $SomeClass" diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectWithPrivateGenericMember.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectWithPrivateGenericMember.kt new file mode 100644 index 00000000000..bb7b150238f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectWithPrivateGenericMember.kt @@ -0,0 +1,15 @@ +class C() { + companion object { + private fun create() = C() + } + + class ZZZ { + val c = C.create() + } +} + +fun box(): String { + C.ZZZ().c + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectsWithParentClasses.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectsWithParentClasses.kt new file mode 100644 index 00000000000..668619e3032 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectsWithParentClasses.kt @@ -0,0 +1,12 @@ +open class Test { + companion object { + fun testStatic(ic: InnerClass): NotInnerClass = NotInnerClass(ic.value) + } + + fun test(): InnerClass = InnerClass(150) + + inner open class InnerClass(val value: Int) + open class NotInnerClass(val value: Int) +} + +fun box() = if (Test.testStatic(Test().test()).value == 150) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/defaultObjectSameNamesAsInOuter.kt b/backend.native/tests/external/codegen/blackbox/classes/defaultObjectSameNamesAsInOuter.kt new file mode 100644 index 00000000000..8332b83ef41 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/defaultObjectSameNamesAsInOuter.kt @@ -0,0 +1,18 @@ +class A { + private val p: Int + get() = 4 + + companion object B { + val p: Int + get() = 6 + } + + fun a() = p + B.p +} + + +fun box(): String { + if (A().a() != 10) return "Fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegation2.kt b/backend.native/tests/external/codegen/blackbox/classes/delegation2.kt new file mode 100644 index 00000000000..81b8b0fb47e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegation2.kt @@ -0,0 +1,24 @@ +interface Trait1 { + fun foo() : String +} + +interface Trait2 { + fun bar() : String +} + +class T1 : Trait1{ + override fun foo() = "aaa" +} + +class T2 : Trait2{ + override fun bar() = "bbb" +} + +class C(a:Trait1, b:Trait2) : Trait1 by a, Trait2 by b + +fun box() : String { + val c = C(T1(),T2()) + if(c.foo() != "aaa") return "fail" + if(c.bar() != "bbb") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegation3.kt b/backend.native/tests/external/codegen/blackbox/classes/delegation3.kt new file mode 100644 index 00000000000..fd4f07800a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegation3.kt @@ -0,0 +1,35 @@ +interface One { + public open fun foo() : Int + public open fun faz() : Int = 10 +} +interface Two { + public open fun foo() : Int + public open fun quux() : Int = 100 +} + +class OneImpl : One { + public override fun foo() = 1 +} +class TwoImpl : Two { + public override fun foo() = 2 +} + +class Test2(a : One, b : Two) : Two by b, One by a { + public override fun foo() = 0 +} + +fun box() : String { + var t2 = Test2(OneImpl(), TwoImpl()) + if (t2.foo() != 0) + return "Fail #1" + if (t2.faz() != 10) + return "Fail #2" + if (t2.quux() != 100) + return "Fail #3" + if (t2 !is One) + return "Fail #4" + if (t2 !is Two) + return "Fail #5" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegation4.kt b/backend.native/tests/external/codegen/blackbox/classes/delegation4.kt new file mode 100644 index 00000000000..7a9c9449e58 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegation4.kt @@ -0,0 +1,28 @@ +interface First { + public open fun foo() : Int +} + +interface Second : First { + public open fun bar() : Int +} + +class Impl : Second { + public override fun foo() = 1 + public override fun bar() = 2 +} + +class Test(s : Second) : Second by s {} + +fun box() : String { + var t = Test(Impl()) + if (t.foo() != 1) + return "Fail #1" + if (t.bar() != 2) + return "Fail #2" + if (t !is First) + return "Fail #3" + if (t !is Second) + return "Fail #4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegationGenericArg.kt b/backend.native/tests/external/codegen/blackbox/classes/delegationGenericArg.kt new file mode 100644 index 00000000000..f298e834f79 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegationGenericArg.kt @@ -0,0 +1,12 @@ +interface A { + fun foo(t: T): String +} + +class Derived(a: A) : A by a + +fun box(): String { + val o = object : A { + override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t" + } + return Derived(o).foo(42) +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegationGenericArgUpperBound.kt b/backend.native/tests/external/codegen/blackbox/classes/delegationGenericArgUpperBound.kt new file mode 100644 index 00000000000..72e541b7f3b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegationGenericArgUpperBound.kt @@ -0,0 +1,12 @@ +interface A { + fun foo(t: T): String +} + +class Derived(a: A) : A by a + +fun box(): String { + val o = object : A { + override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t" + } + return Derived(o).foo(42) +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegationGenericLongArg.kt b/backend.native/tests/external/codegen/blackbox/classes/delegationGenericLongArg.kt new file mode 100644 index 00000000000..8bd117f9fa1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegationGenericLongArg.kt @@ -0,0 +1,12 @@ +interface A { + fun foo(t: T, u: U): String +} + +class Derived(a: A) : A by a + +fun box(): String { + val o = object : A { + override fun foo(t: Long, u: Int) = if (t == u.toLong()) "OK" else "Fail $t $u" + } + return Derived(o).foo(42, 42) +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt b/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt new file mode 100644 index 00000000000..10f75e260bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt @@ -0,0 +1,16 @@ +// Enable for JS when it supports Java class library. +// IGNORE_BACKEND: JS + +class TestJava(r : Runnable) : Runnable by r {} +class TestRunnable() : Runnable { + public override fun run() = System.out.println("foobar") +} + +fun box() : String { + var del = TestJava(TestRunnable()) + del.run() + if (del !is Runnable) + return "Fail #1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegationMethodsWithArgs.kt b/backend.native/tests/external/codegen/blackbox/classes/delegationMethodsWithArgs.kt new file mode 100644 index 00000000000..a8c0e37230c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/delegationMethodsWithArgs.kt @@ -0,0 +1,34 @@ +package test + +interface TextField { + fun getText(): String +} + +interface InputTextField : TextField { + fun setText(text: String) +} + +interface MooableTextField : InputTextField { + fun moo(a: Int, b: Int, c: Int): Int +} + +class SimpleTextField : MooableTextField { + private var text2 = "" + override fun getText() = text2 + override fun setText(text: String) { + this.text2 = text + } + override fun moo(a: Int, b: Int, c: Int) = a + b + c +} + +class TextFieldWrapper(textField: MooableTextField) : MooableTextField by textField + +fun box() : String { + val textField = TextFieldWrapper(SimpleTextField()) + textField.setText("hello world!") + + if (!textField.getText().equals("hello world!")) return "FAIL #!1" + if (textField.moo(1,2,3) != 6) return "FAIL #2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/exceptionConstructor.kt b/backend.native/tests/external/codegen/blackbox/classes/exceptionConstructor.kt new file mode 100644 index 00000000000..30da7cb5b09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/exceptionConstructor.kt @@ -0,0 +1,7 @@ +class GameError(msg: String): Exception(msg) { +} + +fun box(): String { + val e = GameError("foo") + return if (e.message == "foo") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/extensionOnNamedClassObject.kt b/backend.native/tests/external/codegen/blackbox/classes/extensionOnNamedClassObject.kt new file mode 100644 index 00000000000..dd3efea880b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/extensionOnNamedClassObject.kt @@ -0,0 +1,12 @@ +class C() { + companion object Foo +} + +fun C.Foo.create() = 3 + +fun box(): String { + val c1 = C.Foo.create() + val c2 = C.create() + return if (c1 == 3 && c2 == 3) "OK" else "fail" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/funDelegation.kt b/backend.native/tests/external/codegen/blackbox/classes/funDelegation.kt new file mode 100644 index 00000000000..2a75f698109 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/funDelegation.kt @@ -0,0 +1,17 @@ +open class Base() { + fun n(n : Int) : Int = n + 1 +} + +interface Abstract {} + +class Derived1() : Base(), Abstract {} +class Derived2() : Abstract, Base() {} + +fun test(s : Base) : Boolean = s.n(238) == 239 + +fun box() : String { + if (!test(Base())) return "Fail #1" + if (!test(Derived1())) return "Fail #2" + if (!test(Derived2())) return "Fail #3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/implementComparableInSubclass.kt b/backend.native/tests/external/codegen/blackbox/classes/implementComparableInSubclass.kt new file mode 100644 index 00000000000..4d7504f26ac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/implementComparableInSubclass.kt @@ -0,0 +1,22 @@ +// See KT-12865 + +package foo + +abstract class Base { + val x = 23 +} + +class Derived : Base(), Comparable { + val y = 42 + override fun compareTo(other: Derived): Int { + throw UnsupportedOperationException("not implemented") + } +} + +fun box(): String { + val b = Derived() + if (b.x != 23) return "fail1: ${b.x}" + if (b.y != 42) return "fail2: ${b.y}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/inheritSetAndHashSet.kt b/backend.native/tests/external/codegen/blackbox/classes/inheritSetAndHashSet.kt new file mode 100644 index 00000000000..1bdc245676f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inheritSetAndHashSet.kt @@ -0,0 +1,9 @@ +interface A : Set + +class B : A, HashSet() + +fun box(): String { + val b = B() + b.add("OK") + return b.iterator().next() +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/inheritance.kt b/backend.native/tests/external/codegen/blackbox/classes/inheritance.kt new file mode 100644 index 00000000000..78d6d58fa3b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inheritance.kt @@ -0,0 +1,41 @@ +// Changed when traits were introduced. May not make sense any more + +open class X(val x : Int) {} +interface Y { + abstract val y : Int +} + +class YImpl(override val y : Int) : Y {} + +class Point(x : Int, yy : Int) : X(x) , Y { + override val y : Int = yy +} + +interface Abstract {} + +class P1(x : Int, yy : Y) : Abstract, X(x), Y by yy {} +class P2(x : Int, yy : Y) : X(x), Abstract, Y by yy {} +class P3(x : Int, yy : Y) : X(x), Y by yy, Abstract {} +class P4(x : Int, yy : Y) : Y by yy, Abstract, X(x) {} + +fun box() : String { + if (X(239).x != 239) return "FAIL #1" + if (YImpl(239).y != 239) return "FAIL #2" + + val p = Point(240, -1) + if (p.x + p.y != 239) return "FAIL #3" + + val y = YImpl(-1) + val p1 = P1(240, y) + if (p1.x + p1.y != 239) return "FAIL #4" + val p2 = P2(240, y) + if (p2.x + p2.y != 239) return "FAIL #5" + + val p3 = P3(240, y) + if (p3.x + p3.y != 239) return "FAIL #6" + + val p4 = P4(240, y) + if (p4.x + p4.y != 239) return "FAIL #7" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/inheritedInnerClass.kt b/backend.native/tests/external/codegen/blackbox/classes/inheritedInnerClass.kt new file mode 100644 index 00000000000..82bd91e93cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inheritedInnerClass.kt @@ -0,0 +1,14 @@ +class Outer() { + open inner class InnerBase() { + } + + inner class InnerDerived(): InnerBase() { + } + + public val foo: InnerBase? = InnerDerived() +} + +fun box() : String { + val o = Outer() + return if (o.foo === null) "fail" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/inheritedMethod.kt b/backend.native/tests/external/codegen/blackbox/classes/inheritedMethod.kt new file mode 100644 index 00000000000..fb9c3bfe080 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inheritedMethod.kt @@ -0,0 +1,13 @@ +open class Foo { + fun xyzzy(): String = "xyzzy" +} + +class Bar(): Foo() { + fun test(): String = xyzzy() +} + +fun box() : String { + val bar = Bar() + val f = bar.test() + return if (f == "xyzzy") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/initializerBlock.kt b/backend.native/tests/external/codegen/blackbox/classes/initializerBlock.kt new file mode 100644 index 00000000000..ccaac7f0473 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/initializerBlock.kt @@ -0,0 +1,13 @@ +class C() { + public var f: Int + + init { + f = 610 + } +} + +fun box(): String { + val c = C() + if (c.f != 610) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/initializerBlockDImpl.kt b/backend.native/tests/external/codegen/blackbox/classes/initializerBlockDImpl.kt new file mode 100644 index 00000000000..087f4ab0c54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/initializerBlockDImpl.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME +class World() { + public val items: ArrayList = ArrayList() + + inner class Item() { + init { + items.add(this) + } + } + + val foo = Item() +} + +fun box() : String { + val w = World() + if (w.items.size != 1) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerived.kt b/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerived.kt new file mode 100644 index 00000000000..2f928428baf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerived.kt @@ -0,0 +1,40 @@ +open class A(val value: String) { + inner class B(val s: String) { + val result = value + "_" + s + } +} + +class C : A("fromC") { + fun classReceiver() = B("OK") + fun superReceiver() = super.B("OK") + + fun newAReceiver() = A("fromA").B("OK") + fun aReceiver(): B { + val a = A("fromA") + return a.B("OK") + } + + fun A.extReceiver() = this.B("OK") + fun extReceiver() = A("fromA").extReceiver() +} + +fun box(): String { + val receiver = C() + var result = receiver.classReceiver().result + if (result != "fromC_OK") return "fail 1: $result" + + result = receiver.superReceiver().result + if (result != "fromC_OK") return "fail 2: $result" + + + result = receiver.aReceiver().result + if (result != "fromA_OK") return "fail 3: $result" + + result = receiver.newAReceiver().result + if (result != "fromA_OK") return "fail 3: $result" + + result = receiver.extReceiver().result + if (result != "fromA_OK") return "fail 3: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerivedLabeled.kt b/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerivedLabeled.kt new file mode 100644 index 00000000000..34db2545d47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInDerivedLabeled.kt @@ -0,0 +1,42 @@ +open class A(val value: String) { + inner class B(val s: String) { + val result = value + "_" + s + } +} + +class C : A("fromC") { + + inner class X: A("fromX") { + fun classReceiver() = B("OK") + fun superReceiver() = super.B("OK") + fun superXReceiver() = super@X.B("OK") + fun superXCastReceiver() = (this@X as A).B("OK") + + fun superCReceiver() = super@C.B("OK") + fun superCCastReceiver() = (this@C as A).B("OK") + } +} + +fun box(): String { + val receiver = C().X() + var result = receiver.classReceiver().result + if (result != "fromX_OK") return "fail 1: $result" + + result = receiver.superReceiver().result + if (result != "fromX_OK") return "fail 2: $result" + + result = receiver.superXReceiver().result + if (result != "fromX_OK") return "fail 3: $result" + + result = receiver.superXCastReceiver().result + if (result != "fromX_OK") return "fail 4: $result" + + + result = receiver.superCReceiver().result + if (result != "fromC_OK") return "fail 3: $result" + + result = receiver.superCCastReceiver().result + if (result != "fromC_OK") return "fail 4: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInSameClass.kt b/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInSameClass.kt new file mode 100644 index 00000000000..bc6200c60c5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/instantiateInSameClass.kt @@ -0,0 +1,34 @@ +class C(val value: String = "C") { + + inner class B(val s: String) { + val result = value + "_" + s + } + + fun classReceiver() = B("OK") + + fun newCReceiver() = C("newC").B("OK") + fun cReceiver(): B { + val c = C("newC") + return c.B("OK") + } + + fun C.extReceiver1() = this.B("OK") + fun extReceiver() = C("newC").extReceiver1() +} + +fun box(): String { + val receiver = C() + var result = receiver.classReceiver().result + if (result != "C_OK") return "fail 1: $result" + + result = receiver.cReceiver().result + if (result != "newC_OK") return "fail 3: $result" + + result = receiver.newCReceiver().result + if (result != "newC_OK") return "fail 3: $result" + + result = receiver.extReceiver().result + if (result != "newC_OK") return "fail 3: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/kt6708.kt b/backend.native/tests/external/codegen/blackbox/classes/inner/kt6708.kt new file mode 100644 index 00000000000..db242e7c0bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/kt6708.kt @@ -0,0 +1,12 @@ +open class A() { + open inner class InnerA +} + +class B : A() { + inner class InnerB : A.InnerA() +} + +fun box(): String { + B().InnerB() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/properOuter.kt b/backend.native/tests/external/codegen/blackbox/classes/inner/properOuter.kt new file mode 100644 index 00000000000..41d1e4406db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/properOuter.kt @@ -0,0 +1,16 @@ + +open class A(val s: String) { + open inner class B(val s: String) { + fun testB() = s + this@A.s + } + + open inner class C(): A("C") { + fun testC() = + B("B_").testB() + } +} + +fun box(): String { + val res = A("A").C().testC() + return if (res == "B_C") "OK" else res; +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/properSuperLinking.kt b/backend.native/tests/external/codegen/blackbox/classes/inner/properSuperLinking.kt new file mode 100644 index 00000000000..230ad1d9ee4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/properSuperLinking.kt @@ -0,0 +1,16 @@ + +open class A(val s: String) { + + val z = s + + fun test() = s + + open inner class B(s: String): A(s) { + fun testB() = z + test() + } +} + +fun box(): String { + val res = A("Fail").B("OK").testB() + return if (res == "OKOK") "OK" else res; +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/innerClass.kt b/backend.native/tests/external/codegen/blackbox/classes/innerClass.kt new file mode 100644 index 00000000000..8f43233aa95 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/innerClass.kt @@ -0,0 +1,19 @@ +class Outer(val foo: StringBuilder) { + inner class Inner() { + fun len() : Int { + return foo.length + } + } + + fun test() : Inner { + return Inner() + } +} + +fun box() : String { + val sb = StringBuilder("xyzzy") + val o = Outer(sb) + val i = o.test() + val l = i.len() + return if (l != 5) "fail" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/interfaceCompanionInitializationWithJava.kt b/backend.native/tests/external/codegen/blackbox/classes/interfaceCompanionInitializationWithJava.kt new file mode 100644 index 00000000000..0db5f2d4372 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/interfaceCompanionInitializationWithJava.kt @@ -0,0 +1,36 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FILE: CompanionInitialization.java + +public class CompanionInitialization { + + public static Object getCompanion() { + return IStatic.Companion; + } + +} + +// FILE: CompanionInitialization.kt + +open class Static(): IStatic { + val p = IStatic::class.java.getDeclaredField("const").get(null) +} + +interface IStatic { + fun doSth() { + } + + companion object : Static() { + const val const = 1; + } +} + +fun box(): String { + IStatic.doSth() + + val companion: Any? = CompanionInitialization.getCompanion() + if (companion == null) return "fail 1" + if (companion != IStatic) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1018.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1018.kt new file mode 100644 index 00000000000..6e192f5e0be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1018.kt @@ -0,0 +1,12 @@ +public class StockMarketTableModel() { + + public fun getColumnCount() : Int { + return COLUMN_TITLES?.size!! + } + + companion object { + private val COLUMN_TITLES : Array = arrayOfNulls(10) + } +} + +fun box() : String = if(StockMarketTableModel().getColumnCount()==10) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt new file mode 100644 index 00000000000..43b08faa8b8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt @@ -0,0 +1,19 @@ +// Won't ever work with JS backend. +// TODO: Consider rewriting this test without using threads, since the issue is not about threads at all. +// IGNORE_BACKEND: JS + +object RefreshQueue { + val any = Any() + val workerThread: Thread = Thread(object : Runnable { + override fun run() { + val a = any + val b = RefreshQueue.any + if (a != b) throw AssertionError() + } + }) +} + +fun box() : String { + RefreshQueue.workerThread.run() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt new file mode 100644 index 00000000000..e6028e21e95 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt @@ -0,0 +1,9 @@ +// TODO: Enable when JS backend supports Java class library +// IGNORE_BACKEND: JS +public class SomeClass() : java.lang.Object() { +} + +public fun box():String { + System.out?.println(SomeClass().getClass()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1157.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1157.kt new file mode 100644 index 00000000000..126889d5110 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1157.kt @@ -0,0 +1,21 @@ +public object SomeClass { + private val work = object : Runnable { + override fun run() { + foo() + } + } + + private fun foo(): Unit { + } + + public fun run(): Unit = work.run() +} + +interface Runnable { + fun run(): Unit +} + +fun box(): String { + SomeClass.run() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1247.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1247.kt new file mode 100644 index 00000000000..4ba62b57487 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1247.kt @@ -0,0 +1,6 @@ +fun f(a : Int?, b : Int.(Int)->Int) = a?.b(1) + +fun box(): String { + val x = f(1) { this+it+2 } + return if (x == 4) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1345.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1345.kt new file mode 100644 index 00000000000..3933f9c552e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1345.kt @@ -0,0 +1,13 @@ +interface Creator { + fun create() : T +} + +class Actor(val code: String = "OK") + +interface Factory : Creator + +class MyFactory() : Factory { + override fun create(): Actor = Actor() +} + +fun box() : String = MyFactory().create().code diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1439.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1439.kt new file mode 100644 index 00000000000..f5cd98d49c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1439.kt @@ -0,0 +1,17 @@ +class MyClass(var fnc : () -> String) { + + fun test(): String { + return fnc() + } + +} + +fun printtest() : String { + return "OK" +} + +fun box(): String { + var c = MyClass({ printtest() }) + + return c.test() +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt new file mode 100644 index 00000000000..f1efa2d6b2c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt @@ -0,0 +1,22 @@ +// TODO: Enable when JS backend supports Java class library, since FunctionX are required for interoperation +// IGNORE_BACKEND: JS +class Works() : Function0 { + public override fun invoke():Any { + return "Works" as Any + } +} +class Broken() : Function0 { + public override fun invoke():String { + return "Broken" + } +} + +fun box(): String { + val works1: ()->Any = Works(); + works1() + + val broken1: ()->String = Broken(); + broken1() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1538.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1538.kt new file mode 100644 index 00000000000..e412b9885e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1538.kt @@ -0,0 +1,21 @@ +data class Pair(val first: First, val second: Second) + +fun parseCatalogs(hashMap: Any?) { + val r = toHasMap(hashMap) + if (!r.first) { + return + } + val nodes = r.second +} + +fun toHasMap(value: Any?): Pair?> { + if(value is HashMap<*, *>) { + return Pair(true, value as HashMap) + } + return Pair(false, null as HashMap?) +} + +fun box() : String { + parseCatalogs(null) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1578.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1578.kt new file mode 100644 index 00000000000..e485684b4da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1578.kt @@ -0,0 +1,9 @@ +fun box() : String { + var i = 0 + { + i++ + }() + i++ //the problem is here +// i = i + 1 //this way it works + return if (i == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1611.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1611.kt new file mode 100644 index 00000000000..b04a15ef70e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1611.kt @@ -0,0 +1,11 @@ +fun box(): String { + return Foo().doBar("OK") +} + +class Foo() { + val bar : (str : String) -> String = { it } + + fun doBar(str : String): String { + return bar(str); + } +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1721.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1721.kt new file mode 100644 index 00000000000..c38869f87b8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1721.kt @@ -0,0 +1,6 @@ +class T(val f : () -> Any?) { + fun call() : Any? = f() +} +fun box(): String { + return T({ "OK" }).call() as String +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1726.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1726.kt new file mode 100644 index 00000000000..c718ea84028 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1726.kt @@ -0,0 +1,15 @@ +class Foo( + var state : Int, + val f : (Int) -> Int){ + + fun next() : Int { + val nextState = f(state) + state = nextState + return state + } +} + +fun box(): String { + val f = Foo(23, {x -> 2 * x}) + return if (f.next() == 46) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1759.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1759.kt new file mode 100644 index 00000000000..b34b725c39b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1759.kt @@ -0,0 +1,10 @@ +class Greeter(var name : String) { + fun greet() { + name = name.plus("") + } +} + +fun box() : String { + Greeter("OK").greet() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1891.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1891.kt new file mode 100644 index 00000000000..e9183589db3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1891.kt @@ -0,0 +1,14 @@ +class MyList() { + var value: T? = null + + operator fun get(index: Int): T = value!! + + operator fun set(index: Int, value: T) { this.value = value } +} + +fun box(): String { + val list = MyList() + list[17] = 1 + list[17] = list[18]++ + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1918.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1918.kt new file mode 100644 index 00000000000..1da1471e2d3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1918.kt @@ -0,0 +1,20 @@ +class Bar { +} + +interface Foo { + fun xyzzy(x: Any?): String +} + +fun buildFoo(bar: Bar.() -> Unit): Foo { + return object : Foo { + override fun xyzzy(x: Any?): String { + (x as? Bar)?.bar() + return "OK" + } + } +} + +fun box(): String { + val foo = buildFoo({}) + return foo.xyzzy(Bar()) +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1976.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1976.kt new file mode 100644 index 00000000000..7e02add4ef3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1976.kt @@ -0,0 +1,8 @@ +class A { + public val f : ()->String = {"OK"} +} + +fun box(): String { + val a = A() + return a.f() // does not work: (in runtime) ClassCastException: A cannot be cast to kotlin.Function0 +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1980.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1980.kt new file mode 100644 index 00000000000..74414304f25 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1980.kt @@ -0,0 +1,27 @@ +public inline fun Int.times(body : () -> Unit) { + var count = this; + while (count > 0) { + body() + count-- + } +} + +fun calc() : Int { + val a = ArrayList<()->Int>() + 2.times { + var j = 1 + a.add({ j }) + ++j + } + var sum = 0 + for (f in a) { + val g = f as () -> Int + sum += g() + } + return sum +} + +fun box() : String { + val x = calc() + return if (x == 4) "OK" else x.toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2224.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2224.kt new file mode 100644 index 00000000000..fe6d9bcbe48 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2224.kt @@ -0,0 +1,44 @@ +interface A { + fun foo(): Int +} + +class B1 : A { + override fun foo() = 10 +} + +class B2(val z: Int) : A { + override fun foo() = z +} + + + +fun f1(b: B1): Int { + val o = object : A by b { } + return o.foo() +} + +fun f2(b: B2): Int { + val o = object : A by B2(b.z) { } + return o.foo() +} + +fun f3(b: B2, mult: Int): Int { + val o = object : A by B2(mult * b.z) { } + return o.foo() +} + +fun f4(b: B1, x: Int, y: Int, z: Int): Int { + val o = object : A by b { + fun bar() = x + y + z + } + return o.foo() +} + + +fun box(): String { + if (f1(B1()) != 10) return "fail #1" + if (f2(B2(239)) != 239) return "fail #2" + if (f3(B2(239), 2) != 239*2) return "fail #3" + if (f4(B1(), 1, 2, 3) != 10) return "fail #4" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt new file mode 100644 index 00000000000..68886dd5532 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt @@ -0,0 +1,10 @@ +// TODO: Enable when JS backend supports Java class library +// IGNORE_BACKEND: JS +public open class Test(): java.util.RandomAccess, Cloneable, java.io.Serializable +{ + public override fun clone(): Test = Test() // Override 'clone()' with more precise type 'Test' + + public override fun toString() = "OK" +} + +fun box() = Test().clone().toString() diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2384.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2384.kt new file mode 100644 index 00000000000..d990d4cbc00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2384.kt @@ -0,0 +1,15 @@ +class A { + companion object { + val b = 0 + val c = b + + init { + val d = b + } + } +} + +fun box(): String { + A() + return if (A.c == A.b) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2390.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2390.kt new file mode 100644 index 00000000000..9d664ee825d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2390.kt @@ -0,0 +1,35 @@ + +class JsonObject() { +} + +class JsonArray() { +} + +public interface Formatter { + public fun format(source: IN?): OUT +} + +public interface MultiFormatter { + public fun format(source: Collection): OUT +} + +public class Project() { +} + +public interface JsonFormatter: Formatter, MultiFormatter { + public override fun format(source: Collection): JsonArray { + return JsonArray(); + } +} + +public class ProjectJsonFormatter(): JsonFormatter { + public override fun format(source: Project?): JsonObject { + return JsonObject() + } +} + + +fun box(): String { + val formatter = ProjectJsonFormatter() + return if (formatter.format(Project()) != null) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2391.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2391.kt new file mode 100644 index 00000000000..2176c01b98e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2391.kt @@ -0,0 +1,19 @@ +public interface LoggerAware { + public val logger: StringBuilder +} + +public abstract class HttpServer(): LoggerAware { + public fun start() { + logger.append("OK") + } +} + +public class MyHttpServer(): HttpServer() { + public override val logger = StringBuilder() +} + +fun box(): String { + val server = MyHttpServer() + server.start() + return server.logger.toString()!! +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2395.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2395.kt new file mode 100644 index 00000000000..ccd1b1c5356 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2395.kt @@ -0,0 +1,13 @@ +// TARGET_BACKEND: JVM + +import java.util.AbstractList + +class MyList(): AbstractList() { + public fun getModificationCount(): Int = modCount + public override fun get(index: Int): String = "" + public override val size: Int get() = 0 +} + +fun box(): String { + return if (MyList().getModificationCount() == 0) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2417.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2417.kt new file mode 100644 index 00000000000..fe584cce56a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2417.kt @@ -0,0 +1,23 @@ +fun box() : String{ + val set = HashSet() + set.add("foo") + val t1 = "foo" in set // returns true, valid + if(!t1) return "fail1" + val t2 = "foo" !in set // returns true, invalid + if(t2) return "fail2" + val t3 = "bar" in set // returns false, valid + if(t3) return "fail3" + val t4 = "bar" !in set // return false, invalid + if(!t4) return "fail4" + val t5 = when("foo") { + in set -> true + else -> false + } + if(!t5) return "fail5" + val t6 = when("foo") { + !in set -> true + else -> false + } + if(t6) return "fail6" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2477.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2477.kt new file mode 100644 index 00000000000..8f45431717c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2477.kt @@ -0,0 +1,23 @@ +package test + +interface A { + public val c: String + get() = "OK" +} + +interface B { + private val c: String + get() = "FAIL" +} + +open class C { + private val c: String = "FAIL" +} + +open class D: C(), A, B { + val b = c +} + +fun box() : String { + return D().c +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2480.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2480.kt new file mode 100644 index 00000000000..cbeec9ce597 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2480.kt @@ -0,0 +1,13 @@ +fun box() = Class().printSome() + +public abstract class AbstractClass { + public fun printSome() : T = some + + public abstract val some: T +} + +public class Class: AbstractClass() { + public override val some: String + get() = "OK" + +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2482.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2482.kt new file mode 100644 index 00000000000..6a614198741 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2482.kt @@ -0,0 +1,9 @@ +public fun box() : String { + if ( 0 == 0 ) { // Does not crash if either this... + if ( 0 == 0 ) { // ...or this is changed to if ( true ) + // Does not crash if the following is uncommented. + //println("foo") + } + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2485.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2485.kt new file mode 100644 index 00000000000..5ef24c24577 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2485.kt @@ -0,0 +1,12 @@ +fun f1(a : Any?) {} +fun f2(a : Boolean?) {} +fun f3(a : Any) {} +fun f4(a : Boolean) {} + +fun box() : String { + f1(1 == 1) + f2(1 == 1) + f3(1 == 1) + f4(1 == 1) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt249.kt b/backend.native/tests/external/codegen/blackbox/classes/kt249.kt new file mode 100644 index 00000000000..afd8fa0a0a7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt249.kt @@ -0,0 +1,13 @@ +package x + +class Outer() { + companion object { + class Inner() { + } + } +} + +fun box (): String { + val inner = Outer.Companion.Inner() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2532.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2532.kt new file mode 100644 index 00000000000..24d12e9f884 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2532.kt @@ -0,0 +1,15 @@ +package foo + +interface B { + val c: Int + get() = 2 +} + +class A(val b: B) : B by b { + override val c: Int = 3 +} + +fun box(): String { + val c = A(object: B {}).c + return if (c == 3) "OK" else "fail: $c" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2566.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2566.kt new file mode 100644 index 00000000000..6a134feb84f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2566.kt @@ -0,0 +1,15 @@ +open class A { + open fun foo() = "OK" +} + +open class B : A() { + override fun foo() = super.foo() +} + +interface I + +class C : I, B() { + override fun foo() = super.foo() +} + +fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2566_2.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2566_2.kt new file mode 100644 index 00000000000..b119af85615 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2566_2.kt @@ -0,0 +1,17 @@ +open class A { + open val foo: String = "OK" +} + +open class B : A() { + inner class E { + val foo: String = super@B.foo + } +} + +class C : B() { + inner class D { + val foo: String = super@C.foo + } +} + +fun box() = C().foo diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2607.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2607.kt new file mode 100644 index 00000000000..10688476918 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2607.kt @@ -0,0 +1,9 @@ +fun box() : String { + val o = object { + + inner class C { + fun foo() = "OK" + } + } + return o.C().foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2626.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2626.kt new file mode 100644 index 00000000000..34ba1d2ad8d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2626.kt @@ -0,0 +1,10 @@ +package example2 + +fun box() = Context.OsType.OK.toString() + +object Context +{ + public enum class OsType { + WIN2000, WINDOWS, MACOSX, LINUX, OTHER, OK; + } +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2711.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2711.kt new file mode 100644 index 00000000000..409537ae567 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2711.kt @@ -0,0 +1,15 @@ +class IntRange { + operator fun contains(a: Int) = (1..2).contains(a) +} + +class C() { + operator fun rangeTo(i: Int) = IntRange() +} + + +fun box(): String { + if (2 in C()..2) { + 2 == 2 + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2784.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2784.kt new file mode 100644 index 00000000000..fc7c5dfccbe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2784.kt @@ -0,0 +1,10 @@ +open class Factory(p: Int) + +class A { + companion object : Factory(1) +} + +fun box() : String { + A + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt285.kt b/backend.native/tests/external/codegen/blackbox/classes/kt285.kt new file mode 100644 index 00000000000..945b250f7dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt285.kt @@ -0,0 +1,15 @@ +interface Trait { + fun foo() = "O" + fun bar(): String +} + +class SimpleClass : Trait { + override fun bar() = "K" +} + +// Delegating 'toString' doesn't work, see KT-9519 +class ComplexClass : Trait by SimpleClass() { + fun qux() = foo() + bar() +} + +fun box() = ComplexClass().qux() diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt3001.kt b/backend.native/tests/external/codegen/blackbox/classes/kt3001.kt new file mode 100644 index 00000000000..0524528ca1e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt3001.kt @@ -0,0 +1,11 @@ +interface A { + val result: String +} + +class Base(override val result: String) : A + +open class Derived : A by Base("OK") + +class Z : Derived() + +fun box() = Z().result diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt3114.kt b/backend.native/tests/external/codegen/blackbox/classes/kt3114.kt new file mode 100644 index 00000000000..32d42899074 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt3114.kt @@ -0,0 +1,13 @@ +class KeySpan(val left: String) { + + public fun matches(value : String) : Boolean { + + return left > value && left > value + } + +} + +fun box() : String { + KeySpan("1").matches("3") + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt3414.kt b/backend.native/tests/external/codegen/blackbox/classes/kt3414.kt new file mode 100644 index 00000000000..6b4a083eda9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt3414.kt @@ -0,0 +1,18 @@ +interface A { + fun foo(): Int +} + +interface B { + fun foo(): Int +} + +class Z(val a: A) : A by a, B + +fun box(): String { + val s = Z(object : A { + override fun foo(): Int { + return 1; + } + }); + return if (s.foo() == 1) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt343.kt b/backend.native/tests/external/codegen/blackbox/classes/kt343.kt new file mode 100644 index 00000000000..adae992ae21 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt343.kt @@ -0,0 +1,22 @@ +fun launch(f : () -> Unit) { + f() +} + +fun box(): String { + val list = ArrayList() + val foo : () -> Unit = { + list.add(2) //first exception + } + foo() + + launch({ + list.add(3) + }) + + val bar = { + val x = 1 //second exception + } + bar() + + return if (list.size == 2 && list.get(0) == 2 && list.get(1) == 3) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt3546.kt b/backend.native/tests/external/codegen/blackbox/classes/kt3546.kt new file mode 100644 index 00000000000..b4d36c1f3e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt3546.kt @@ -0,0 +1,25 @@ +interface A { + fun test(): String +} + +interface B { + fun test(): String +} + +interface C: A, B + +class Z(val param: String): C { + + override fun test(): String { + return param + } +} + +public class MyClass(val value : C) : C by value { + +} + +fun box(): String { + val s = MyClass(Z("OK")) + return s.test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt454.kt b/backend.native/tests/external/codegen/blackbox/classes/kt454.kt new file mode 100644 index 00000000000..be3994d660c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt454.kt @@ -0,0 +1,5 @@ +fun box(): String { + var s1 = (l1@ "s") + val s2 = (l2@ if (l3@ true) s1 else null) + return if (s2 == "s") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt471.kt b/backend.native/tests/external/codegen/blackbox/classes/kt471.kt new file mode 100644 index 00000000000..4de658a6626 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt471.kt @@ -0,0 +1,109 @@ +class MyNumber(val i: Int) { + operator fun inc(): MyNumber = MyNumber(i+1) +} + +class MNR(var ref: MyNumber) {} + +fun test1() : Boolean { + var m = MyNumber(42) + + m++ + if (m.i != 43) return false + return true +} + +fun test2() : Boolean { + var m = MyNumber(44) + + var m2 = m++ + if (m2.i != 44) return false + if (m.i != 45) return false + return true +} + +fun test3() : Boolean { + var mnr = MNR(MyNumber(42)) + mnr.ref++ + if (mnr.ref.i != 43) return false + return true +} + +fun test4() : Boolean { + var mnr = MNR(MyNumber(42)) + val m3 = mnr.ref++ + if (m3.i != 42) return false + return true +} + +fun test5() : Boolean { + var mnr = Array(2,{MyNumber(42)}) + mnr[0]++ + if (mnr[0].i != 43) return false + return true +} + +fun test6() : Boolean { + var mnr = Array(2,{it -> MyNumber(42-it)}) + mnr[1] = mnr[0]++ + if (mnr[0].i != 43) return false + if (mnr[1].i != 42) return false + return true +} + +class MyArrayList() { + private var value17: T? = null + private var value39: T? = null + operator fun get(index: Int): T { + if (index == 17) return value17!! + if (index == 39) return value39!! + throw Exception() + } + operator fun set(index: Int, value: T): T? { + if (index == 17) value17 = value + else if (index == 39) value39 = value + else throw Exception() + return null + } +} + +fun test7() : Boolean { + var mnr = MyArrayList() + mnr[17] = MyNumber(42) + mnr[17]++ + if (mnr[17].i != 43) return false + return true +} + +fun test8() : Boolean { + var mnr = MyArrayList() + mnr[17] = MyNumber(42) + mnr[39] = mnr[17]++ + if (mnr[17].i != 43) return false + if (mnr[39].i != 42) return false + return true +} + + +fun box() : String { + var m = MyNumber(42) + + if (!test1()) return "fail test 1" + if (!test2()) return "fail test 2" + if (!test3()) return "fail test 3" + if (!test4()) return "fail test 4" + + if (!test5()) return "fail test 5" + if (!test6()) return "fail test 6" + if (!test7()) return "fail test 7" + if (!test8()) return "fail test 8" + + + ++m + if (m.i != 43) return "fail 0" + + var m1 = ++m + if (m1.i != 44) return "fail 3" + if (m.i != 44) return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt48.kt b/backend.native/tests/external/codegen/blackbox/classes/kt48.kt new file mode 100644 index 00000000000..007c5958af0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt48.kt @@ -0,0 +1,29 @@ +class A() { + var xi = 0 + var xin : Int? = 0 + var xinn : Int? = null + + var xl = 0.toLong() + var xln : Long? = 0.toLong() + var xlnn : Long? = null + + var xb = 0.toByte() + var xbn : Byte? = 0.toByte() + var xbnn : Byte? = null + + var xf = 0.toFloat() + var xfn : Float? = 0.toFloat() + var xfnn : Float? = null + + var xd = 0.toDouble() + var xdn : Double? = 0.toDouble() + var xdnn : Double? = null + + var xs = 0.toShort() + var xsn : Short? = 0.toShort() + var xsnn : Short? = null +} + +fun box() : String { + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt496.kt b/backend.native/tests/external/codegen/blackbox/classes/kt496.kt new file mode 100644 index 00000000000..e4c31c86a27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt496.kt @@ -0,0 +1,83 @@ +fun test1() : Boolean { + try { + return true + } finally { + if(true) // otherwise we wisely have unreachable code + return false + } +} + +var x = true +fun test2() : Boolean { + try { + } finally { + x = false; + } + return x +} + +fun test3() : Int { + var y = 0 + try { + ++y + } finally { + ++y + } + return y +} + +var z = 0 +fun test4() : Int { + z = 0 + return try { + try { + z++ + } + finally { + z++ + } + } finally { + ++z + } +} + +fun test5() : Int { + var x = 0 + while(true) { + try { + if(x < 10) + x++ + else + break + } + finally { + x++ + } + } + return x +} + +fun test6() : Int { + var x = 0 + while(x < 10) { + try { + x++ + continue + } + finally { + x++ + } + } + return x +} + +fun box() : String { + if(test1()) return "test1 failed" + if(test2()) return "test2 failed" + if(test3() != 2) return "test3 failed" + if(test4() != 0) return "test4 failed" + if(test5() != 11) return "test5 failed" + if(test6() != 10) return "test6 failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt500.kt b/backend.native/tests/external/codegen/blackbox/classes/kt500.kt new file mode 100644 index 00000000000..b9c66165f9e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt500.kt @@ -0,0 +1,29 @@ +var GUEST_USER_ID = 3 +val USER_ID = + try { + getUserIdFromEnvironment() + } + catch (e : UnsupportedOperationException) { + ++GUEST_USER_ID + } + +val USER_ID_2 = + try { + getUserIdFromEnvironment() + } + catch (e : UnsupportedOperationException) { + GUEST_USER_ID + } + finally { + GUEST_USER_ID++ + } + +fun getUserIdFromEnvironment() : Int = throw UnsupportedOperationException() + +fun box() : String { + if(USER_ID != 4) return "test0 failed" + if(USER_ID_2 != 4) return "test2 failed" + if(GUEST_USER_ID != 5) return "test3 failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt501.kt b/backend.native/tests/external/codegen/blackbox/classes/kt501.kt new file mode 100644 index 00000000000..6705704587e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt501.kt @@ -0,0 +1,22 @@ +class Reluctant() { + init { + throw Exception("I'm not coming out") + } +} + +fun test1() : String { + try { + val b = Reluctant() + return "Surprise!" + } + catch (ex : Exception) { + return "I told you so" + } +} + + +fun box() : String { + if(test1() != "I told you so") return "test1 failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt504.kt b/backend.native/tests/external/codegen/blackbox/classes/kt504.kt new file mode 100644 index 00000000000..2f55f67acdd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt504.kt @@ -0,0 +1,17 @@ +package mult_constructors_3_bug + +public open class Identifier() { + private var myNullable : Boolean = true + companion object { + open public fun init(isNullable : Boolean) : Identifier { + val id = Identifier() + id.myNullable = isNullable + return id + } + } +} + +fun box() : String { + Identifier.init(true) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt508.kt b/backend.native/tests/external/codegen/blackbox/classes/kt508.kt new file mode 100644 index 00000000000..d26dfafd6c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt508.kt @@ -0,0 +1,16 @@ +// TODO: Enable for JS when it supports Java class library. +// IGNORE_BACKEND: JS +// fails on JS with TypeError: imported$plus is not a function, it is undefined. + +operator fun MutableMap.set(key : K, value : V) = put(key, value) + +fun box() : String { + + val commands : MutableMap = HashMap() + + commands["c1"] = "239" + if(commands["c1"] != "239") return "fail" + + commands["c1"] += "932" + return if(commands["c1"] == "239932") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt5347.kt b/backend.native/tests/external/codegen/blackbox/classes/kt5347.kt new file mode 100644 index 00000000000..cca6a97b08e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt5347.kt @@ -0,0 +1,44 @@ +fun test1(str: String): String { + data class A(val x: Int) { + fun foo() = str + } + return A(0).copy().foo() +} + +class TestClass(val x: String) { + fun foo(): String { + data class A(val x: Int) { + fun foo() = this@TestClass.x + } + return A(0).copy().foo() + } +} + +fun test2(str: String): String = TestClass(str).foo() + +fun test3(str: String): String { + var xx = "" + data class A(val x: Int) { + fun foo(): String { xx = str; return xx } + } + return A(0).copy().foo() +} + +fun test4(str: String): String { + var xx = "" + fun bar(s: String): String { xx = s; return xx } + data class A(val x: Int) { + fun foo(): String = bar(str) + } + return A(0).copy().foo() +} + +fun box(): String { + return when { + test1("test1") != "test1" -> "Failed #1 (parameter capture)" + test2("test2") != "test2" -> "Failed #2 ('this' capture)" + test3("test3") != "test3" -> "Failed #3 ('var' capture)" + test4("test4") != "test4" -> "Failed #4 (local function capture)" + else -> "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt6136.kt b/backend.native/tests/external/codegen/blackbox/classes/kt6136.kt new file mode 100644 index 00000000000..14a14e1c4e0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt6136.kt @@ -0,0 +1,26 @@ +interface Id { + val id: T +} + +data class Actor ( + override val id: Int, + val firstName: String, + val lastName: String +) : Id + +fun box(): String { + val a1 = Actor(1, "Jeff", "Bridges") + + val a1c = a1.copy() + if (a1c.id != a1.id) return "Failed: a1.copy().id==${a1c.id}" + + val a2 = Actor(2, "Jeff", "Bridges") + if (a2 == a1) return "Failed: a2==a1" + + // Assume that our hashCode is good enough for this test :) + if (a2.hashCode() == a1.hashCode()) return "Failed: a2.hashCode()==a1.hashCode()" + + a1.toString() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt633.kt b/backend.native/tests/external/codegen/blackbox/classes/kt633.kt new file mode 100644 index 00000000000..04e0a26ec12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt633.kt @@ -0,0 +1,23 @@ +class mInt(val i : Int) { + override fun toString() : String = "mint: $i" + operator fun plus(i : Int) = mInt(this.i + i) + operator fun inc() = mInt(i + 1) +} + +class MyArray() { + val a = Array(10, {mInt(0)}) + operator fun get(i : mInt) : mInt = a[i.i] + operator fun set(i : mInt, v : mInt) { + a[i.i] = v + } +} + +fun box() : String { + val a = MyArray() + var i = mInt(0) + a[i++] + a[i++] = mInt(1) + for (i in 0..9) + a[mInt(i)] + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt6816.kt b/backend.native/tests/external/codegen/blackbox/classes/kt6816.kt new file mode 100644 index 00000000000..ed081c608fb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt6816.kt @@ -0,0 +1,25 @@ +public class CalculatorConstants( + val id: Long = 0, + val detour: Double = 0.0, + val taxi: Double = 0.0, + val loop: Double = 0.0, + val planeCondition: Double = 0.0, + val co2PerKerosene: Double = 0.0, + val freight: Double = 0.0, + val rfi: Double = 0.0, + val rfiAltitude: Double = 0.0, + val averageContribution: Double = 0.0, + val singleContribution: Double = 0.0, + val returnContribution: Double = 0.0, + val defraFactor: Double = 0.0, + val airCondMult: Double = 0.0, + val autoTransMult: Double = 0.0, + val hybridDefault: String? = null, + val travelClassOne: Double = 0.0, + val status: String = "OK" +) + +fun box(): String { + val c = CalculatorConstants() + return c.status +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt707.kt b/backend.native/tests/external/codegen/blackbox/classes/kt707.kt new file mode 100644 index 00000000000..8accf81be9a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt707.kt @@ -0,0 +1,11 @@ +// TODO: Enable for JS when it supports Java class library. +// IGNORE_BACKEND: JS +class List(val head: T, val tail: List? = null) + +fun List.mapHead(f: (T)-> T): List = List(f(head), null) + +fun box() : String { + val a: Int = List(1).mapHead{it * 2}.head + System.out?.println(a) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt723.kt b/backend.native/tests/external/codegen/blackbox/classes/kt723.kt new file mode 100644 index 00000000000..6d020a0bc99 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt723.kt @@ -0,0 +1,8 @@ +operator fun Int?.inc() : Int { if (this != null) return this.inc() else throw NullPointerException() } + +public fun box() : String { + var i : Int? = 10 + val j = i++ + + return if(j==10 && 11 == i) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt725.kt b/backend.native/tests/external/codegen/blackbox/classes/kt725.kt new file mode 100644 index 00000000000..3aea020f890 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt725.kt @@ -0,0 +1,8 @@ +operator fun Int?.inc() = this!!.inc() + +public fun box() : String { + var i : Int? = 10 + val j = i++ + + return if(j==10 && 11 == i) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt8011.kt b/backend.native/tests/external/codegen/blackbox/classes/kt8011.kt new file mode 100644 index 00000000000..e4ab453aa33 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt8011.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +fun testFun1(str: String): String { + val local = str + + class Local { + fun foo() = str + } + + val list = listOf(0).map { Local() } + return list[0].foo() +} + +fun box(): String { + return when { + testFun1("test1") != "test1" -> "Fail #1" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt8011a.kt b/backend.native/tests/external/codegen/blackbox/classes/kt8011a.kt new file mode 100644 index 00000000000..9a8fa24c6d9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt8011a.kt @@ -0,0 +1,52 @@ +fun testFun1(str: String): String { + val capture = str + + class A { + val x = capture + } + + return A().x +} + + +fun testFun2(str: String): String { + class A { + val x = str + } + fun bar() = A() + return bar().x +} + + +class TestClass(val str: String) { + var xx: String? = null + + init { + class A { + val x = str + } + + xx = A().x + } +} + +fun testFun3(str: String): String = TestClass(str).xx!! + + +fun String.testFun4(): String { + class A { + val x = this@testFun4 + } + return A().x +} + + +fun box(): String { + return when { + testFun1("test1") != "test1" -> "Fail #1 (local class with capture)" + testFun2("test2") != "test2" -> "Fail #2 (local class with capture ctor in another context)" + testFun3("test3") != "test3" -> "Fail #3 (local class with capture ctor in init{ ... })" + "test4".testFun4() != "test4" -> "Fail #4 (local class with extension receiver)" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt903.kt b/backend.native/tests/external/codegen/blackbox/classes/kt903.kt new file mode 100644 index 00000000000..5c3e51cbe41 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt903.kt @@ -0,0 +1,23 @@ +operator fun Int.plus(a: Int?) = this + a!! + +public open class PerfectNumberFinder() { + open public fun isPerfect(number : Int) : Boolean { + var factors : MutableList = ArrayList() + factors?.add(1) + factors?.add(number) + for (i in 2..(Math.sqrt((number).toDouble()) - 1).toInt()) + if (((number % i) == 0)) { + factors?.add(i) + if (((number / i) != i)) + factors?.add((number / i)) + + } + + var sum : Int = 0 + for (i : Int? in factors) + sum += i + return ((sum - number) == number) + } +} + +fun box () = if (PerfectNumberFinder().isPerfect(28)) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt940.kt b/backend.native/tests/external/codegen/blackbox/classes/kt940.kt new file mode 100644 index 00000000000..f9e99b3716a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt940.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +fun box() : String { + val w = object : Comparator { + + override fun compare(o1 : String?, o2 : String?) : Int { + val l1 : Int = o1?.length ?: 0 + val l2 = o2?.length ?: 0 + return l1 - l2 + } + + override fun equals(obj: Any?): Boolean = obj === this + } + + w.compare("aaa", "bbb") + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt9642.kt b/backend.native/tests/external/codegen/blackbox/classes/kt9642.kt new file mode 100644 index 00000000000..414954aab60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/kt9642.kt @@ -0,0 +1,17 @@ +class Outer { + class Nested { + fun fn(): String { + s = "OK" + return s + } + } + + companion object { + public var s = "fail" + private set + } +} + +fun box(): String { + return Outer.Nested().fn() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/namedClassObject.kt b/backend.native/tests/external/codegen/blackbox/classes/namedClassObject.kt new file mode 100644 index 00000000000..2ff7587752d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/namedClassObject.kt @@ -0,0 +1,12 @@ +class C() { + companion object Foo { + fun create() = 3 + } +} + +fun box(): String { + val c1 = C.Foo.create() + val c2 = C.create() + return if (c1 == 3 && c2 == 3) "OK" else "fail" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/outerThis.kt b/backend.native/tests/external/codegen/blackbox/classes/outerThis.kt new file mode 100644 index 00000000000..346e44ecbbf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/outerThis.kt @@ -0,0 +1,12 @@ +class Outer() { + inner class Inner() { + val outer: Outer get() = this@Outer + } + + public val x : Inner = Inner() +} + +fun box() : String { + val o = Outer() + return if (o === o.x.outer) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/overloadBinaryOperator.kt b/backend.native/tests/external/codegen/blackbox/classes/overloadBinaryOperator.kt new file mode 100644 index 00000000000..2333984acfa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/overloadBinaryOperator.kt @@ -0,0 +1,23 @@ +class ArrayWrapper() { + val contents = ArrayList() + + fun add(item: T) { + contents.add(item) + } + + operator fun plus(b: ArrayWrapper): ArrayWrapper { + val result = ArrayWrapper() + result.contents.addAll(contents) + result.contents.addAll(b.contents) + return result + } +} + +fun box(): String { + val v1 = ArrayWrapper() + val v2 = ArrayWrapper() + v1.add("foo") + v2.add("bar") + val v3 = v1 + v2 + return if (v3.contents.size == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssign.kt b/backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssign.kt new file mode 100644 index 00000000000..04fa8c842ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssign.kt @@ -0,0 +1,24 @@ +class ArrayWrapper() { + val contents = ArrayList() + + fun add(item: T) { + contents.add(item) + } + + operator fun plusAssign(rhs: ArrayWrapper) { + contents.addAll(rhs.contents) + } + + operator fun get(index: Int): T { + return contents.get(index)!! + } +} + +fun box(): String { + var v1 = ArrayWrapper() + val v2 = ArrayWrapper() + v1.add("foo") + v2.add("bar") + v1 += v2 + return if (v1.contents.size == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssignReturn.kt b/backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssignReturn.kt new file mode 100644 index 00000000000..005c69ce4f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/overloadPlusAssignReturn.kt @@ -0,0 +1,28 @@ +class ArrayWrapper() { + val contents = ArrayList() + + fun add(item: T) { + contents.add(item) + } + + operator fun plus(rhs: ArrayWrapper): ArrayWrapper { + val result = ArrayWrapper() + result.contents.addAll(contents) + result.contents.addAll(rhs.contents) + return result + } + + operator fun get(index: Int): T { + return contents.get(index)!! + } +} + +fun box(): String { + var v1 = ArrayWrapper() + val v2 = ArrayWrapper() + v1.add("foo") + val v3 = v1 + v2.add("bar") + v1 += v2 + return if (v1.contents.size == 2 && v3.contents.size == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/overloadPlusToPlusAssign.kt b/backend.native/tests/external/codegen/blackbox/classes/overloadPlusToPlusAssign.kt new file mode 100644 index 00000000000..005c69ce4f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/overloadPlusToPlusAssign.kt @@ -0,0 +1,28 @@ +class ArrayWrapper() { + val contents = ArrayList() + + fun add(item: T) { + contents.add(item) + } + + operator fun plus(rhs: ArrayWrapper): ArrayWrapper { + val result = ArrayWrapper() + result.contents.addAll(contents) + result.contents.addAll(rhs.contents) + return result + } + + operator fun get(index: Int): T { + return contents.get(index)!! + } +} + +fun box(): String { + var v1 = ArrayWrapper() + val v2 = ArrayWrapper() + v1.add("foo") + val v3 = v1 + v2.add("bar") + v1 += v2 + return if (v1.contents.size == 2 && v3.contents.size == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/overloadUnaryOperator.kt b/backend.native/tests/external/codegen/blackbox/classes/overloadUnaryOperator.kt new file mode 100644 index 00000000000..5813e80f4c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/overloadUnaryOperator.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME +class ArrayWrapper() { + val contents = ArrayList() + + fun add(item: T) { + contents.add(item) + } + + operator fun unaryMinus(): ArrayWrapper { + val result = ArrayWrapper() + result.contents.addAll(contents) + result.contents.reverse() + return result + } + + operator fun get(index: Int): T { + return contents.get(index)!! + } +} + +fun box(): String { + val v1 = ArrayWrapper() + v1.add("foo") + v1.add("bar") + val v2 = -v1 + return if (v2[0] == "bar" && v2[1] == "foo") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/privateOuterFunctions.kt b/backend.native/tests/external/codegen/blackbox/classes/privateOuterFunctions.kt new file mode 100644 index 00000000000..ceeb4ff69ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/privateOuterFunctions.kt @@ -0,0 +1,35 @@ +class C { + private fun String.ext() : String = "" + private fun f() {} + + public fun foo() : String { + { + "".ext() + f() + }.invoke() + + object : Runnable { + public override fun run() { + "".ext() + f() + } + }.run() + + Inner().innerFun() + + return "OK" + } + + private inner class Inner() { + fun innerFun() { + "".ext() + f() + } + } +} + +interface Runnable { + fun run(): Unit +} + +fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/blackbox/classes/privateOuterProperty.kt b/backend.native/tests/external/codegen/blackbox/classes/privateOuterProperty.kt new file mode 100644 index 00000000000..0f0bc3e452f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/privateOuterProperty.kt @@ -0,0 +1,31 @@ +class C{ + private var v : Int = 0 + + public fun foo() : Int { + { + v = v + 1 + }.invoke() + + object : Runnable { + public override fun run() { + v = v + 1 + } + }.run() + + Inner().innerFun() + + return v + } + + private inner class Inner() { + fun innerFun() { + v = v + 1 + } + } +} + +interface Runnable { + fun run(): Unit +} + +fun box() = if (C().foo() == 3) "OK" else "NOT OK" diff --git a/backend.native/tests/external/codegen/blackbox/classes/privateToThis.kt b/backend.native/tests/external/codegen/blackbox/classes/privateToThis.kt new file mode 100644 index 00000000000..8905986a1f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/privateToThis.kt @@ -0,0 +1,11 @@ +class A(init_o: I, private val init_k: I) { + private val o: I = init_o + private fun k(): I = init_k + + fun getOk() = o.toString() + k().toString() +} + +fun box(): String { + val a = A("O", "K") + return a.getOk() +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/propertyDelegation.kt b/backend.native/tests/external/codegen/blackbox/classes/propertyDelegation.kt new file mode 100644 index 00000000000..59720282936 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/propertyDelegation.kt @@ -0,0 +1,33 @@ +open class Base() { + val plain = 239 + public val read : Int + get() = 239 + + public var readwrite : Int = 0 + get() = field + 1 + set(n : Int) { + field = n + } +} + +interface Abstract {} + +class Derived1() : Base(), Abstract {} +class Derived2() : Abstract, Base() {} + +fun code(s : Base) : Int { + if (s.plain != 239) return 1 + if (s.read != 239) return 2 + s.readwrite = 238 + if (s.readwrite != 239) return 3 + return 0 +} + +fun test(s : Base) : Boolean = code(s) == 0 + +fun box() : String { + if (!test(Base())) return "Fail #1" + if (!test(Derived1())) return "Fail #2" + if (!test(Derived2())) return "Fail #3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/propertyInInitializer.kt b/backend.native/tests/external/codegen/blackbox/classes/propertyInInitializer.kt new file mode 100644 index 00000000000..bd8aa833063 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/propertyInInitializer.kt @@ -0,0 +1,16 @@ +class Outer() { + val s = "xyzzy" + + open inner class InnerBase(public val name: String) { + } + + inner class InnerDerived(): InnerBase(s) { + } + + val x = InnerDerived() +} + +fun box() : String { + val o = Outer() + return if (o.x.name != "xyzzy") "fail" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/rightHandOverride.kt b/backend.native/tests/external/codegen/blackbox/classes/rightHandOverride.kt new file mode 100644 index 00000000000..2c5af2c9927 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/rightHandOverride.kt @@ -0,0 +1,20 @@ +// Changed when traits were introduced. May not make sense any more + +interface Left {} +open class Right() { + open fun f() = 42 +} + +class D() : Left, Right() { + override fun f() = 239 +} + +fun box() : String { + val r : Right = Right() + val d : D = D() + + if (r.f() != 42) return "Fail #1" + if (d.f() != 239) return "Fail #2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/sealedInSameFile.kt b/backend.native/tests/external/codegen/blackbox/classes/sealedInSameFile.kt new file mode 100644 index 00000000000..673afef28ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/sealedInSameFile.kt @@ -0,0 +1,38 @@ +class B : A() + +sealed class A() { + constructor(i: Int): this() + + class C: A() +} + +object T : Y() + +class D : A(4) + +class E : A { + constructor(i: Int): super(i) + constructor(): super() +} + +object S : Z() + +sealed class Y : X() + +sealed class Z : Y() + +sealed class X : A() + +class Q : Y() + +fun box() : String { + B() + A.C() + D() + E() + E(4) + T + S + Q() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/selfcreate.kt b/backend.native/tests/external/codegen/blackbox/classes/selfcreate.kt new file mode 100644 index 00000000000..95d67471511 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/selfcreate.kt @@ -0,0 +1,14 @@ +class B () {} + +open class A(val b : B) { + fun a(): A = object: A(b) {} +} + +fun box() : String { + val b = B() + val a = A(b).a() + + if (a.b !== b) return "failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/simpleBox.kt b/backend.native/tests/external/codegen/blackbox/classes/simpleBox.kt new file mode 100644 index 00000000000..be95d012d51 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/simpleBox.kt @@ -0,0 +1,8 @@ +class Box(t: T) { + var value = t +} + +fun box(): String { + val box: Box = Box(1) + return if (box.value == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/classes/superConstructorCallWithComplexArg.kt b/backend.native/tests/external/codegen/blackbox/classes/superConstructorCallWithComplexArg.kt new file mode 100644 index 00000000000..1d2c6d4646a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/superConstructorCallWithComplexArg.kt @@ -0,0 +1,19 @@ +var log = "" + +open class Base(val s: String) + +class A(i: Int) : Base("O" + if (i == 23) { + log += "logged" + "K" +} +else { + "fail" +}) + +fun box(): String { + val result = A(23).s + if (result != "OK") return "fail: $result" + if (log != "logged") return "fail log: $log" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/classes/typedDelegation.kt b/backend.native/tests/external/codegen/blackbox/classes/typedDelegation.kt new file mode 100644 index 00000000000..e0b1241a6aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/typedDelegation.kt @@ -0,0 +1,31 @@ +interface A { + var zzzValue : T + fun zzz() : T +} + +class Base : A { + override var zzzValue : T? = null + + override fun zzz() : T? = zzzValue +} + +class X : A by Base() + +fun box() : String { + (Base() as A).zzz() + + if (X().zzz() != null) { + return "Fail" + } + + val x = X() + x.zzzValue = "aa" + if (x.zzzValue != "aa") { + return "Fail 2"; + } + if (x.zzz() != "aa") { + return "Fail 3"; + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureExtensionReceiver.kt b/backend.native/tests/external/codegen/blackbox/closures/captureExtensionReceiver.kt new file mode 100644 index 00000000000..bd78f48b9ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureExtensionReceiver.kt @@ -0,0 +1,40 @@ +interface B { + val bar: T +} + +fun String.foo() = object : B { + override val bar: String = length.toString() +} + +class C { + + fun String.extension() = this.length + + fun String.fooInClass() = object : B { + override val bar: String = extension().toString() + } + + fun String.fooInClassNoReceiver() = object : B { + override val bar: String = "123".extension().toString() + } + + fun fooInClass(s: String) = s.fooInClass().bar + + fun fooInClassNoReceiver(s: String) = s.fooInClassNoReceiver().bar +} + +fun box(): String { + var result = "Hello, world!".foo().bar + if (result != "13") return "fail 1: $result" + + result = C().fooInClass("Hello, world!") + + if (result != "13") return "fail 2: $result" + + result = C().fooInClassNoReceiver("Hello, world!") + + if (result != "3") return "fail 3: $result" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/captureFunctionInProperty.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/captureFunctionInProperty.kt new file mode 100644 index 00000000000..e2c507f3b28 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/captureFunctionInProperty.kt @@ -0,0 +1,15 @@ +interface T { + fun result(): String +} + +class A(val x: String) { + fun getx() = x + + fun foo() = object : T { + val bar = getx() + + override fun result() = bar + } +} + +fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inFunction.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inFunction.kt new file mode 100644 index 00000000000..7b4828fa7b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inFunction.kt @@ -0,0 +1,13 @@ +interface T { + fun result(): String +} + +class A(val x: String) { + fun foo() = object : T { + fun bar() = x + + override fun result() = bar() + } +} + +fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inProperty.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inProperty.kt new file mode 100644 index 00000000000..8f1846f7cfb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inProperty.kt @@ -0,0 +1,13 @@ +interface T { + fun result(): String +} + +class A(val x: String) { + fun foo() = object : T { + val bar = x + + override fun result() = bar + } +} + +fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyDeepObjectChain.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyDeepObjectChain.kt new file mode 100644 index 00000000000..0bb07f581b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyDeepObjectChain.kt @@ -0,0 +1,18 @@ +interface T { + fun result(): String +} + +class A(val x: String) { + fun foo() = object : T { + fun bar() = object : T { + fun baz() = object : T { + val y = x + override fun result() = y + } + override fun result() = baz().result() + } + override fun result() = bar().result() + } +} + +fun box() = A("OK").foo().result() diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperClass.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperClass.kt new file mode 100644 index 00000000000..2f7ff86a10c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperClass.kt @@ -0,0 +1,15 @@ +interface T { + fun result(): String +} + +open class B(val x: String) + +class A : B("OK") { + fun foo() = object : T { + val bar = x + + override fun result() = bar + } +} + +fun box() = A().foo().result() diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt new file mode 100644 index 00000000000..3d600017d08 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt @@ -0,0 +1,17 @@ +interface T { + fun result(): String +} + +abstract class A(val x: Z) + +open class B : A("OK") + +class C : B() { + fun foo() = object : T { + val bar = x + + override fun result() = bar + } +} + +fun box() = C().foo().result() diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4176.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4176.kt new file mode 100644 index 00000000000..129b3ad92c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4176.kt @@ -0,0 +1,17 @@ +open class Z(val s: Int) { + open fun a() {} +} + +class B(val x: Int) { + fun foo() { + class X : Z(x) { + + } + X() + } +} + +fun box(): String { + B(1).foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4656.kt b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4656.kt new file mode 100644 index 00000000000..c3b93ff7efd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/kt4656.kt @@ -0,0 +1,16 @@ +//KT-4656 Wrong capturing a function literal variable + +fun box(): String { + var foo = { 1 } + var bar = 1 + + val t = { "${foo()} $bar" } + fun b() = "${foo()} $bar" + + foo = { 2 } + bar = 2 + + if (t() != "2 2") return "fail1" + if (b() != "2 2") return "fail2" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/capturedLocalGenericFun.kt b/backend.native/tests/external/codegen/blackbox/closures/capturedLocalGenericFun.kt new file mode 100644 index 00000000000..ebe26220013 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/capturedLocalGenericFun.kt @@ -0,0 +1,14 @@ +fun box() : String { + + fun local(s : T) : T { + return s; + } + + fun test(s : Int) : Int { + return local(s) + } + + if (test(10) != 10) return "fail1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFun.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFun.kt new file mode 100644 index 00000000000..106b0a763b3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFun.kt @@ -0,0 +1,13 @@ +fun box(): String { + fun rec(n : Int) { + fun x(m : Int) { + if (n > 0) rec(n - 1) + } + + x(0) + } + + rec(5) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt new file mode 100644 index 00000000000..38c08c8a19d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt @@ -0,0 +1,13 @@ +fun box(): String { + fun rec(n : Int) { + fun x(m : Int, k : Int) { + if (n > 0) rec(n - 1 + k) + } + + x(0, 0) + } + + rec(5) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/propertyAndFunctionNameClash.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/propertyAndFunctionNameClash.kt new file mode 100644 index 00000000000..94562f8c7f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/propertyAndFunctionNameClash.kt @@ -0,0 +1,35 @@ +package d + +fun box(): String { + ListTag().test(listOf("a", "b")) + return "OK" +} + +fun ListTag.test(list: List) { + for (item in list) { + item() { + a { + text = item + } + } + } +} + +open class HtmlTag +open class ListTag : HtmlTag() {} +class LI : ListTag() {} + +public fun ListTag.item(body: LI.() -> Unit): Unit {} +fun HtmlTag.a(contents: A.() -> Unit) {} + +abstract class A : HtmlTag() { + public abstract var text: String +} + +fun listOf(vararg strings: String): List { + val list = ArrayList() + for (s in strings) { + list.add(s) + } + return list +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevels.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevels.kt new file mode 100644 index 00000000000..e0fc6457f26 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevels.kt @@ -0,0 +1,17 @@ +fun box(): String { + fun foo(x: Int) { + fun bar(y: Int) { + fun baz(z: Int) { + foo(x - 1) + } + + baz(y) + } + + if (x > 0) bar(x) + } + + foo(1) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt new file mode 100644 index 00000000000..a5fadc55936 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt @@ -0,0 +1,16 @@ +fun box(): String { + fun foo(x: Int, s: String): String { + fun bar(y: Int) { + fun baz(z: Int, k: Int) { + foo(x - 1 + k, "Fail") + } + + baz(y, 0) + } + + if (x > 0) bar(x) + return s + } + + return foo(1, "OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/varAsFunInsideLocalFun.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/varAsFunInsideLocalFun.kt new file mode 100644 index 00000000000..ec2ea57118e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/varAsFunInsideLocalFun.kt @@ -0,0 +1,15 @@ +//KT-3276 + +fun box(): String { + fun rec(n : Int) { + val x = { m : Int -> + if (n > 0) rec(n - 1) + } + + x(0) + } + + rec(5) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideConstrucor.kt b/backend.native/tests/external/codegen/blackbox/closures/closureInsideConstrucor.kt new file mode 100644 index 00000000000..38192dd47b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideConstrucor.kt @@ -0,0 +1,14 @@ +//adopted snippet from kdoc +open class KModel { + val sourcesInfo: String + init { + fun relativePath(psiFile: String): String { + return psiFile; + } + sourcesInfo = relativePath("OK") + } +} + +fun box():String { + return KModel().sourcesInfo; +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt new file mode 100644 index 00000000000..b0dd8df8d31 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package test + +val p = { "OK" }() + +val getter: String + get() = { "OK" }() + +fun f() = { "OK" }() + +val obj = object : Function0 { + override fun invoke() = "OK" +} + +fun box(): String { + if (p != "OK") return "FAIL" + if (getter != "OK") return "FAIL" + if (f() != "OK") return "FAIL" + if (obj() != "OK") return "FAIL" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt new file mode 100644 index 00000000000..2f161ffc47c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +val p = { "OK" }() + +val getter: String + get() = { "OK" }() + +fun f() = { "OK" }() + +val obj = object : Function0 { + override fun invoke() = "OK" +} + +fun box(): String { + if (p != "OK") return "FAIL" + if (getter != "OK") return "FAIL" + if (f() != "OK") return "FAIL" + if (obj() != "OK") return "FAIL" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureWithParameter.kt b/backend.native/tests/external/codegen/blackbox/closures/closureWithParameter.kt new file mode 100644 index 00000000000..6e5d15af401 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureWithParameter.kt @@ -0,0 +1,7 @@ +fun box() : String { + return apply( "OK", {arg: String -> arg } ) +} + +fun apply(arg : String, f : (p:String) -> String) : String { + return f(arg) +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureWithParameterAndBoxing.kt b/backend.native/tests/external/codegen/blackbox/closures/closureWithParameterAndBoxing.kt new file mode 100644 index 00000000000..a1a13fb62a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureWithParameterAndBoxing.kt @@ -0,0 +1,7 @@ +fun box() : String { + return if (apply( 5, {arg: Int -> arg + 13 } ) == 18) "OK" else "fail" +} + +fun apply(arg : Int, f : (p:Int) -> Int) : Int { + return f(arg) +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/doubleEnclosedLocalVariable.kt b/backend.native/tests/external/codegen/blackbox/closures/doubleEnclosedLocalVariable.kt new file mode 100644 index 00000000000..96ac7f2ef19 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/doubleEnclosedLocalVariable.kt @@ -0,0 +1,8 @@ +fun box() : String { + val cl = 39 + return if (sum(200, { val ff = {cl}; ff() }) == 239) "OK" else "FAIL" +} + +fun sum(arg:Int, f : () -> Int) : Int { + return arg + f() +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/enclosingLocalVariable.kt b/backend.native/tests/external/codegen/blackbox/closures/enclosingLocalVariable.kt new file mode 100644 index 00000000000..01e1a103ff2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/enclosingLocalVariable.kt @@ -0,0 +1,8 @@ +fun box() : String { + val cl = 39 + return if (sum(200, { val m = { val r = { cl }; r() }; m() }) == 239) "OK" else "FAIL" +} + +fun sum(arg:Int, f : () -> Int) : Int { + return arg + f() +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/enclosingThis.kt b/backend.native/tests/external/codegen/blackbox/closures/enclosingThis.kt new file mode 100644 index 00000000000..787a4d89e4a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/enclosingThis.kt @@ -0,0 +1,12 @@ +class Point(val x:Int, val y:Int) { + fun mul() : (scalar:Int)->Point { + return { scalar:Int -> Point(x * scalar, y * scalar) } + } +} + +val m = Point(2, 3).mul() + +fun box() : String { + val answer = m(5) + return if (answer.x == 10 && answer.y == 15) "OK" else "FAIL" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/extensionClosure.kt b/backend.native/tests/external/codegen/blackbox/closures/extensionClosure.kt new file mode 100644 index 00000000000..d4c73c7bcfe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/extensionClosure.kt @@ -0,0 +1,13 @@ +class Point(val x : Int, val y : Int) + +fun box() : String { + val answer = apply(Point(3, 5), { scalar : Int -> + Point(x * scalar, y * scalar) + }) + + return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL" +} + +fun apply(arg:Point, f : Point.(scalar : Int) -> Point) : Point { + return arg.f(2) +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt10044.kt b/backend.native/tests/external/codegen/blackbox/closures/kt10044.kt new file mode 100644 index 00000000000..277f356c76c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt10044.kt @@ -0,0 +1,41 @@ +open class JClass() { + fun test(): String { + return "OK" + } +} + +class Example : JClass { + constructor() : super() + + private var obj: JClass? = null + + var result: String? = null + + init { + { + result = obj?.test() + }() + } +} + +class Example2 : JClass { + constructor() : super() + + private var obj: JClass? = this + + var result: String? = null + + init { + { + result = obj?.test() + }() + } +} + + +fun box(): String { + val result = Example().result + if (result != null) "fail 1: $result" + + return Example2().result!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt11634.kt b/backend.native/tests/external/codegen/blackbox/closures/kt11634.kt new file mode 100644 index 00000000000..7bd1880718f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt11634.kt @@ -0,0 +1,27 @@ +interface A { + fun foo(): String +} + +class AImpl(val z: String) : A { + override fun foo(): String = z +} + +open class AFabric { + open fun createA(): A = AImpl("OK") +} + +class AWrapperFabric : AFabric() { + + override fun createA(): A { + return AImpl("fail") + } + + fun createMyA(): A { + return object : A by super.createA() { + } + } +} + +fun box(): String { + return AWrapperFabric().createMyA().foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt11634_2.kt b/backend.native/tests/external/codegen/blackbox/closures/kt11634_2.kt new file mode 100644 index 00000000000..1eb0e9ff096 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt11634_2.kt @@ -0,0 +1,27 @@ +interface A { + fun foo(): String +} + +class AImpl(val z: String) : A { + override fun foo(): String = z +} + +open class AFabric { + open fun createA(z: String): A = AImpl(z) +} + +class AWrapperFabric : AFabric() { + + override fun createA(z: String): A { + return AImpl("fail: $z") + } + + fun createMyA(): A { + val z = "OK" + return object : A by super.createA(z) {} + } +} + +fun box(): String { + return AWrapperFabric().createMyA().foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt11634_3.kt b/backend.native/tests/external/codegen/blackbox/closures/kt11634_3.kt new file mode 100644 index 00000000000..1fdaa65c236 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt11634_3.kt @@ -0,0 +1,27 @@ +interface A { + fun foo(): String +} + +class AImpl(val z: String) : A { + override fun foo(): String = z +} + +open class AFabric { + open fun createA(z: String): A = AImpl(z) +} + +class AWrapperFabric : AFabric() { + + override fun createA(z: String): A { + return AImpl("fail: $z") + } + + fun createMyA(): A { + val z = "OK" + return object : A by super@AWrapperFabric.createA(z) {} + } +} + +fun box(): String { + return AWrapperFabric().createMyA().foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt11634_4.kt b/backend.native/tests/external/codegen/blackbox/closures/kt11634_4.kt new file mode 100644 index 00000000000..08722aa81de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt11634_4.kt @@ -0,0 +1,28 @@ +interface A { + fun foo(): String +} + +open class Base (val p: String) { + open val a = object : A { + override fun foo(): String { + return p + } + } +} + +open class Derived1 (p: String): Base(p) { + override open val a = object : A { + override fun foo(): String { + return "fail" + } + } + + inner class Derived2(p: String) : Base(p) { + val x = object : A by super@Derived1.a {} + } + +} + +fun box(): String { + return Derived1("OK").Derived2("fail").x.foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt2151.kt b/backend.native/tests/external/codegen/blackbox/closures/kt2151.kt new file mode 100644 index 00000000000..5b0da23f6ea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt2151.kt @@ -0,0 +1,11 @@ +fun foo(): String { + return if (true) { + var x = "OK" + fun foo() { x += "fail" } + x + } else "fail" +} + +fun box(): String { + return foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt3152.kt b/backend.native/tests/external/codegen/blackbox/closures/kt3152.kt new file mode 100644 index 00000000000..59bf3eaaeeb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt3152.kt @@ -0,0 +1,14 @@ +public class Test { + val content = 1 + inner class A { + val v = object { + fun f() = content + } + } +} + +fun box(): String { + Test().A() + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt3523.kt b/backend.native/tests/external/codegen/blackbox/closures/kt3523.kt new file mode 100644 index 00000000000..bbc225f8fd8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt3523.kt @@ -0,0 +1,18 @@ +open class Base { + fun doSomething() { + + } +} + +class X(val action: () -> Unit) { } + +class Foo : Base() { + inner class Bar() { + val x = X({ doSomething() }) + } +} + +fun box() : String { + Foo().Bar() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt3738.kt b/backend.native/tests/external/codegen/blackbox/closures/kt3738.kt new file mode 100644 index 00000000000..a05dbde0ae1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt3738.kt @@ -0,0 +1,19 @@ +class A { + fun foo() {} + fun bar(f: A.() -> Unit = {}) {} +} + +class B { + class D { + init { + A().bar { + this.foo() + } + } + } +} + +fun box(): String { + B.D() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt3905.kt b/backend.native/tests/external/codegen/blackbox/closures/kt3905.kt new file mode 100644 index 00000000000..fafd87700d3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt3905.kt @@ -0,0 +1,5 @@ +fun box() : String { + fun foo(t:() -> T) : T = t() + + return foo {"OK"} +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt4106.kt b/backend.native/tests/external/codegen/blackbox/closures/kt4106.kt new file mode 100644 index 00000000000..f190819f8d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt4106.kt @@ -0,0 +1,15 @@ +class Foo(private val s: String) { + inner class Inner { + private val x = { + this@Foo.s + }() + } + + val f = Inner() + +} + +fun box(): String { + Foo("!") + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt4137.kt b/backend.native/tests/external/codegen/blackbox/closures/kt4137.kt new file mode 100644 index 00000000000..ea401a6fe80 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt4137.kt @@ -0,0 +1,13 @@ +open class A(val s: Int) { + +} + +infix fun Int.foo(s: Int): Int { + return this + s +} + +open class B : A({ 1 foo 2} ()) + +fun box(): String { + return if (B().s == 3) "OK" else "Fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/kt5589.kt b/backend.native/tests/external/codegen/blackbox/closures/kt5589.kt new file mode 100644 index 00000000000..3b3a27d91ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/kt5589.kt @@ -0,0 +1,5 @@ +fun box(): String { + val x = "OK" + fun bar(y: String = x): String = y + return bar() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localClassFunClosure.kt b/backend.native/tests/external/codegen/blackbox/closures/localClassFunClosure.kt new file mode 100644 index 00000000000..ba0ae9734a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localClassFunClosure.kt @@ -0,0 +1,8 @@ +fun box(): String { + val o = "O" + fun ok() = o + "K" + class OK { + val ok = ok() + } + return OK().ok +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localClassLambdaClosure.kt b/backend.native/tests/external/codegen/blackbox/closures/localClassLambdaClosure.kt new file mode 100644 index 00000000000..61fcbb61243 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localClassLambdaClosure.kt @@ -0,0 +1,8 @@ +fun box(): String { + val o = "O" + val ok_L = {o + "K"} + class OK { + val ok = ok_L() + } + return OK().ok +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localFunctionInFunction.kt b/backend.native/tests/external/codegen/blackbox/closures/localFunctionInFunction.kt new file mode 100644 index 00000000000..4639ab437dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localFunctionInFunction.kt @@ -0,0 +1,14 @@ +fun box(): String { + + fun local():Int { + return 10; + } + + class A { + fun test(): Int { + return local() + } + } + + return if (A().test() == 10) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localFunctionInInitializer.kt b/backend.native/tests/external/codegen/blackbox/closures/localFunctionInInitializer.kt new file mode 100644 index 00000000000..6035aac60ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localFunctionInInitializer.kt @@ -0,0 +1,12 @@ +fun box(): String { + + fun local():Int { + return 10; + } + + class A { + val test = local() + } + + return if (A().test == 10) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localGenericFun.kt b/backend.native/tests/external/codegen/blackbox/closures/localGenericFun.kt new file mode 100644 index 00000000000..fe55a5834b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localGenericFun.kt @@ -0,0 +1,12 @@ +fun box() : String { + + fun local(s : T) : T { + return s; + } + + if (local(10) != 10) return "fail1" + + if (local("11") != "11") return "fail2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localReturn.kt b/backend.native/tests/external/codegen/blackbox/closures/localReturn.kt new file mode 100644 index 00000000000..cf6e749f41f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localReturn.kt @@ -0,0 +1,19 @@ +fun box(): String { + val a = 1 + val explicitlyReturned = run1 f@{ + if (a > 0) + return@f "OK" + else "Fail 1" + } + if (explicitlyReturned != "OK") return explicitlyReturned + + val implicitlyReturned = run1 f@{ + if (a < 0) + return@f "Fail 2" + else "OK" + } + if (implicitlyReturned != "OK") return implicitlyReturned + return "OK" +} + +fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/localReturnWithAutolabel.kt b/backend.native/tests/external/codegen/blackbox/closures/localReturnWithAutolabel.kt new file mode 100644 index 00000000000..577f2100352 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/localReturnWithAutolabel.kt @@ -0,0 +1,19 @@ +fun box(): String { + val a = 1 + val explicitlyReturned = run1 { + if (a > 0) + return@run1 "OK" + else "Fail 1" + } + if (explicitlyReturned != "OK") return explicitlyReturned + + val implicitlyReturned = run1 { + if (a < 0) + return@run1 "Fail 2" + else "OK" + } + if (implicitlyReturned != "OK") return implicitlyReturned + return "OK" +} + +fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt b/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt new file mode 100644 index 00000000000..84b5b7ddea8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class A { + fun f(): () -> String { + val s = "OK" + return { -> s } + } +} + +fun box(): String { + val lambdaClass = A().f().javaClass + val fields = lambdaClass.getDeclaredFields().toList() + if (fields.size != 1) return "Fail: lambda should only capture 's': $fields" + + val fieldName = fields[0].getName() + if (fieldName != "\$s") return "Fail: captured variable should be named '\$s': $fields" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/recursiveClosure.kt b/backend.native/tests/external/codegen/blackbox/closures/recursiveClosure.kt new file mode 100644 index 00000000000..25c8a6a86ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/recursiveClosure.kt @@ -0,0 +1,7 @@ +fun foo(s: String): String { + fun bar(count: Int): String = + if (count == 0) s else bar(count - 1) + return bar(10) +} + +fun box(): String = foo("OK") diff --git a/backend.native/tests/external/codegen/blackbox/closures/simplestClosure.kt b/backend.native/tests/external/codegen/blackbox/closures/simplestClosure.kt new file mode 100644 index 00000000000..7a9f3b439cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/simplestClosure.kt @@ -0,0 +1,7 @@ +fun box() : String { + return invoker( {"OK"} ) +} + +fun invoker(gen : () -> String) : String { + return gen() +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/simplestClosureAndBoxing.kt b/backend.native/tests/external/codegen/blackbox/closures/simplestClosureAndBoxing.kt new file mode 100644 index 00000000000..50f22fbeb8d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/simplestClosureAndBoxing.kt @@ -0,0 +1,7 @@ +fun box() : String { + return if (int_invoker( { 7 } ) == 7) "OK" else "fail" +} + +fun int_invoker(gen : () -> Int) : Int { + return gen() +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/subclosuresWithinInitializers.kt b/backend.native/tests/external/codegen/blackbox/closures/subclosuresWithinInitializers.kt new file mode 100644 index 00000000000..3f76b76193e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/subclosuresWithinInitializers.kt @@ -0,0 +1,24 @@ +fun run(block: () -> R) = block() +inline fun inlineRun(block: () -> R) = block() + +class Outer(val outerProp: String) { + fun foo(arg: String): String { + class Local { + val work1 = run { outerProp + arg } + val work2 = inlineRun { outerProp + arg } + val obj = object : Any() { + override fun toString() = outerProp + arg + } + + override fun toString() = "${work1}#${work2}#${obj.toString()}" + } + + return Local().toString() + } +} + +fun box(): String { + val res = Outer("O").foo("K") + if (res != "OK#OK#OK") return "fail: $res" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/closures/underscoreParameters.kt b/backend.native/tests/external/codegen/blackbox/closures/underscoreParameters.kt new file mode 100644 index 00000000000..02b96fd24f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/underscoreParameters.kt @@ -0,0 +1,3 @@ +fun foo(block: (String, String, String) -> String): String = block("O", "fail", "K") + +fun box() = foo { x, _, y -> x + y } diff --git a/backend.native/tests/external/codegen/blackbox/collections/charSequence.kt b/backend.native/tests/external/codegen/blackbox/collections/charSequence.kt new file mode 100644 index 00000000000..2e7a8611009 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/charSequence.kt @@ -0,0 +1,70 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + + public static class B extends A { + public int getLength() { return 456; } + public char get(int index) { + if (index == 1) return 'a'; + return super.get(index); + } + } + + public static String foo() { + B b = new B(); + CharSequence cs = (CharSequence) b; + + if (cs.length() != 456) return "fail 01"; + if (b.length() != 456) return "fail 02"; + if (b.getLength() != 456) return "fail 03"; + + if (cs.charAt(0) != 'z') return "fail 1"; + if (b.get(0) != 'z') return "fail 2"; + + if (cs.charAt(1) != 'a') return "fail 3"; + if (b.get(1) != 'a') return "fail 4"; + + return "OK"; + } +} + +// FILE: test.kt + +open class A : CharSequence { + override val length: Int = 123 + + override fun get(index: Int) = 'z'; + + override fun subSequence(start: Int, end: Int): CharSequence { + throw UnsupportedOperationException() + } +} + +fun box(): String { + val b = J.B() + val a = A() + + if (b[0] != 'z') return "fail 6" + if (a[0] != 'z') return "fail 7" + if (b[1] != 'a') return "fail 8" + if (a[0] != 'z') return "fail 9" + + if (b.get(0) != 'z') return "fail 10" + if (a.get(0) != 'z') return "fail 11" + if (b.get(1) != 'a') return "fail 12" + if (a.get(1) != 'z') return "fail 13" + + var cs: CharSequence = a + if (a.length != 123) return "fail 14" + if (cs.length != 123) return "fail 15" + + cs = b + if (b.length != 456) return "fail 16" + if (b.length != 456) return "fail 17" + + return J.foo(); +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/implementCollectionThroughKotlin.kt b/backend.native/tests/external/codegen/blackbox/collections/implementCollectionThroughKotlin.kt new file mode 100644 index 00000000000..036eb71f713 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/implementCollectionThroughKotlin.kt @@ -0,0 +1,97 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +public class J extends MyList { + @Override + public int getSize() { + return 55; + } + + @Override + public int lastIndexOf(String s) { + return 0; + } + + @Override + public int indexOf(String s) { + return 0; + } + + @Override + public boolean contains(String s) { + return true; + } + + @Override + public boolean isEmpty() { + return false; + } + + @NotNull + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public String get(int index) { + return null; + } + + @Override + public List subList(int i, int i1) { + return super.subList(i, i1); + } + + @Override + public ListIterator listIterator(int i) { + return super.listIterator(i); + } + + @Override + public ListIterator listIterator() { + return super.listIterator(); + } +} + +// FILE: test.kt + +abstract class MyList : List + +class ListImpl : J() { + override val size: Int get() = super.size + 1 +} + +fun box(): String { + val impl = ListImpl() + if (impl.size != 56) return "fail 1" + if (!impl.contains("abc")) return "fail 2" + + val l: List = impl + + if (l.size != 56) return "fail 3" + if (!l.contains("abc")) return "fail 4" + + val anyList: List = impl as List + + if (anyList.size != 56) return "fail 5" + if (!anyList.contains("abc")) return "fail 6" + + if (anyList.contains(1)) return "fail 7" + if (anyList.contains(null)) return "fail 8" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/inSetWithSmartCast.kt b/backend.native/tests/external/codegen/blackbox/collections/inSetWithSmartCast.kt new file mode 100644 index 00000000000..ee4987608d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/inSetWithSmartCast.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +fun contains(set: Set, x: Int): Boolean = when { + set.size == 0 -> false + else -> x in set as Set +} + +fun box(): String { + val set = setOf(1) + if (contains(set, 1)) { + return "OK" + } + + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt new file mode 100644 index 00000000000..cb7912f6b6d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J { + abstract static public class AImpl { + public char charAt(int index) { + return 'A'; + } + + public final int length() { return 56; } + } + + public static class A extends AImpl implements CharSequence { + public CharSequence subSequence(int start, int end) { + return null; + } + } +} + +// FILE: test.kt + +class X : J.A() + +fun box(): String { + val x = X() + if (x.length != 56) return "fail 1" + if (x[0] != 'A') return "fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt new file mode 100644 index 00000000000..61c67c7cf22 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J { + public static class A extends AImpl implements CharSequence { + public CharSequence subSequence(int start, int end) { + return null; + } + } +} + +// FILE: test.kt + +abstract class AImpl { + fun charAt(index: Int): Char { + return 'A' + } + + fun length(): Int { + return 56 + } +} + +class X : J.A() + +fun box(): String { + val x = X() + if (x.length != 56) return "fail 1" + if (x[0] != 'A') return "fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableList.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableList.kt new file mode 100644 index 00000000000..353ad6ab61d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableList.kt @@ -0,0 +1,115 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; +public class J { + abstract static public class AImpl { + public final int size() { + return 56; + } + + public boolean isEmpty() { + return false; + } + + public final boolean contains(Object o) { + return true; + } + + public Iterator iterator() { + return null; + } + + public Object[] toArray() { + return new Object[0]; + } + + public T[] toArray(T[] a) { + return null; + } + + public boolean add(String s) { + return false; + } + + public boolean remove(Object o) { + return false; + } + + public boolean containsAll(Collection c) { + return false; + } + + public boolean addAll(Collection c) { + return false; + } + + public boolean addAll(int index, Collection c) { + return false; + } + + public boolean removeAll(Collection c) { + return false; + } + + public boolean retainAll(Collection c) { + return false; + } + + public void clear() { + + } + + public String get(int index) { + return null; + } + + public String set(int index, String element) { + return null; + } + + public void add(int index, String element) { + + } + + public String remove(int index) { + return null; + } + + public int indexOf(Object o) { + return 0; + } + + public int lastIndexOf(Object o) { + return 0; + } + + public ListIterator listIterator() { + return null; + } + + public ListIterator listIterator(int index) { + return null; + } + + public List subList(int fromIndex, int toIndex) { + return null; + } + } + + public static class A extends AImpl implements List { + } +} + +// FILE: test.kt + +class X : J.A() + +fun box(): String { + val x = X() + if (x.size != 56) return "fail 1" + if (!x.contains("")) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt new file mode 100644 index 00000000000..c697f96206a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt @@ -0,0 +1,105 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: A.java + +public class A extends AImpl implements java.util.List { + public T[] toArray(T[] a) {return null;} + public Object[] toArray() {return null;} +} + +// FILE: test.kt + +public abstract class AImpl { + fun add(element: String): Boolean { + throw UnsupportedOperationException() + } + + fun remove(element: Any?): Boolean { + throw UnsupportedOperationException() + } + + @JvmSuppressWildcards(suppress = false) + fun addAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + fun addAll(index: Int, elements: Collection<@JvmWildcard String>): Boolean { + throw UnsupportedOperationException() + } + + fun removeAll(elements: Collection<*>): Boolean { + throw UnsupportedOperationException() + } + + fun retainAll(elements: Collection<*>): Boolean { + throw UnsupportedOperationException() + } + + fun clear() { + throw UnsupportedOperationException() + } + + fun set(index: Int, element: String): String { + throw UnsupportedOperationException() + } + + fun add(index: Int, element: String) { + throw UnsupportedOperationException() + } + + fun remove(index: Int): String { + throw UnsupportedOperationException() + } + + fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + + fun size(): Int = 56 + + fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + fun contains(element: Any?) = true + + fun containsAll(elements: Collection<*>): Boolean { + throw UnsupportedOperationException() + } + + fun get(index: Int): String { + throw UnsupportedOperationException() + } + + fun indexOf(element: Any?): Int { + throw UnsupportedOperationException() + } + + fun lastIndexOf(element: Any?): Int { + throw UnsupportedOperationException() + } + + fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } +} + + +class X : A() + +fun box(): String { + val x = X() + if (x.size != 56) return "fail 1" + if (!x.contains("")) return "fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListSubstitution.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListSubstitution.kt new file mode 100644 index 00000000000..6e60e2782f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListSubstitution.kt @@ -0,0 +1,115 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; +public class J { + abstract static public class AImpl { + public int size() { + return 56; + } + + public boolean isEmpty() { + return false; + } + + public final boolean contains(Object o) { + return true; + } + + public Iterator iterator() { + return null; + } + + public Object[] toArray() { + return new Object[0]; + } + + public T[] toArray(T[] a) { + return null; + } + + public boolean add(E s) { + return false; + } + + public boolean remove(Object o) { + return false; + } + + public boolean containsAll(Collection c) { + return false; + } + + public boolean addAll(Collection c) { + return false; + } + + public boolean addAll(int index, Collection c) { + return false; + } + + public boolean removeAll(Collection c) { + return false; + } + + public boolean retainAll(Collection c) { + return false; + } + + public void clear() { + + } + + public E get(int index) { + return null; + } + + public E set(int index, E element) { + return null; + } + + public void add(int index, E element) { + + } + + public E remove(int index) { + return null; + } + + public int indexOf(Object o) { + return 0; + } + + public int lastIndexOf(Object o) { + return 0; + } + + public ListIterator listIterator() { + return null; + } + + public ListIterator listIterator(int index) { + return null; + } + + public List subList(int fromIndex, int toIndex) { + return null; + } + } + + public static class A extends AImpl implements List { + } +} + +// FILE: test.kt + +class X : J.A() + +fun box(): String { + val x = X() + if (x.size != 56) return "fail 1" + if (!x.contains(null)) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantRemoveAtOverrideInJava.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantRemoveAtOverrideInJava.kt new file mode 100644 index 00000000000..41af923e660 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantRemoveAtOverrideInJava.kt @@ -0,0 +1,112 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J implements Container { + final public String removeAt(int index) { return "abc"; } +} + +// FILE: test.kt + +interface Container { + fun removeAt(x: Int): String +} + +class A : J(), MutableList { + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override val size: Int + get() = throw UnsupportedOperationException() + + override fun contains(element: String): Boolean { + throw UnsupportedOperationException() + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun get(index: Int): String { + throw UnsupportedOperationException() + } + + override fun indexOf(element: String): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(element: String): Int { + throw UnsupportedOperationException() + } + + override fun add(element: String): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(element: String): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: String): String { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: String) { + throw UnsupportedOperationException() + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } +} + +fun box(): String { + val a = A() + if (a.removeAt(0) != "abc") return "fail 1" + + val l: MutableList = a + if (l.removeAt(0) != "abc") return "fail 2" + + val anyList: MutableList = a as MutableList + if (anyList.removeAt(0) != "abc") return "fail 3" + + val container: Container = a + if (container.removeAt(0) != "abc") return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantSizeOverrideInJava.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantSizeOverrideInJava.kt new file mode 100644 index 00000000000..b3d1023d3c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantSizeOverrideInJava.kt @@ -0,0 +1,46 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J implements Sized { + final public int getSize() { return 123; } +} + +// FILE: test.kt + +interface Sized { + val size: Int +} + +class A : J(), Collection { + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(element: T): Boolean { + throw UnsupportedOperationException() + } + + override fun iterator(): Iterator { + throw UnsupportedOperationException() + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } +} + +fun box(): String { + val a = A() + if (a.size != 123) return "fail 1" + + val c: Collection = a + if (c.size != 123) return "fail 2" + + val sized: Sized = a + if (sized.size != 123) return "fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/mutableList.kt b/backend.native/tests/external/codegen/blackbox/collections/mutableList.kt new file mode 100644 index 00000000000..8941b444032 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/mutableList.kt @@ -0,0 +1,101 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends KList {} + + public static String foo() { + Collection collection = new MyList(); + if (!collection.contains("ABCDE")) return "fail 1"; + if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + +open class KList : MutableList { + override fun add(e: E): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(o: E): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: E): E { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: E) { + throw UnsupportedOperationException() + } + + override fun removeAt(index: Int): E { + throw UnsupportedOperationException() + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } + + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(o: E) = true + override fun containsAll(c: Collection) = true + + override fun get(index: Int): E { + throw UnsupportedOperationException() + } + + override fun indexOf(o: E): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(o: E): Int { + throw UnsupportedOperationException() + } +} + +fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt b/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt new file mode 100644 index 00000000000..be1c06ad236 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt @@ -0,0 +1,69 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: B.java +public abstract class B extends A implements L { + public String callIndexAdd(int x) { + add(0, null); + return null; + } +} + +// FILE: main.kt +open class A : Collection { + override val size: Int + get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + + override fun contains(element: T): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun containsAll(elements: Collection): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun isEmpty(): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun iterator(): Iterator { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} + +interface L : List + +// 'add(Int; Object)' method must be present in C though it has supeclass that is subclass of List +class C : B() { + override fun get(index: Int): F { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun indexOf(element: F): Int { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun lastIndexOf(element: F): Int { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun listIterator(): ListIterator { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun listIterator(index: Int): ListIterator { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun subList(fromIndex: Int, toIndex: Int): List { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} + +fun box() = try { + C().callIndexAdd(1) + throw RuntimeException("fail 1") +} catch (e: UnsupportedOperationException) { + if (e.message != "Operation is not supported for read-only collection") throw RuntimeException("fail 2") + "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/platformValueContains.kt b/backend.native/tests/external/codegen/blackbox/collections/platformValueContains.kt new file mode 100644 index 00000000000..14d2cece53c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/platformValueContains.kt @@ -0,0 +1,54 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + public static String nullValue() { + return null; + } +} + +// FILE: test.kt + +class MySet : Set { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(o: String): Boolean { + throw UnsupportedOperationException() + } + + override fun iterator(): Iterator { + throw UnsupportedOperationException() + } + + override fun containsAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } +} + +fun box(): String { + val mySet = MySet() + + // no UnsupportedOperationException thrown + mySet.contains(J.nullValue()) + J.nullValue() in mySet + + val set: Set = mySet + set.contains(J.nullValue()) + J.nullValue() in set + + val anySet: Set = mySet as Set + anySet.contains(J.nullValue()) + anySet.contains(null) + J.nullValue() in anySet + null in anySet + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/collections/readOnlyList.kt b/backend.native/tests/external/codegen/blackbox/collections/readOnlyList.kt new file mode 100644 index 00000000000..041ec52be0b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/readOnlyList.kt @@ -0,0 +1,60 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends KList {} + + public static String foo() { + Collection collection = new MyList(); + if (!collection.contains("ABCDE")) return "fail 1"; + if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + +open class KList : List { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + override fun contains(o: E) = true + override fun containsAll(c: Collection) = true + + override fun iterator(): Iterator { + throw UnsupportedOperationException() + } + + override fun get(index: Int): E { + throw UnsupportedOperationException() + } + + override fun indexOf(element: E): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(element: E): Int { + throw UnsupportedOperationException() + } + + override fun listIterator(): ListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): ListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): List { + throw UnsupportedOperationException() + } +} + +fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/blackbox/collections/readOnlyMap.kt b/backend.native/tests/external/codegen/blackbox/collections/readOnlyMap.kt new file mode 100644 index 00000000000..89fd8d60c90 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/readOnlyMap.kt @@ -0,0 +1,44 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyMap extends KMap {} + + public static String foo() { + Map collection = new MyMap(); + if (!collection.containsKey("ABCDE")) return "fail 1"; + if (!collection.containsValue(1)) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + +open class KMap : Map { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun containsKey(key: K) = true + override fun containsValue(value: V) = true + + override fun get(key: K): V? { + throw UnsupportedOperationException() + } + + override val keys: Set + get() = throw UnsupportedOperationException() + override val values: Collection + get() = throw UnsupportedOperationException() + override val entries: Set> + get() = throw UnsupportedOperationException() +} + +fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/blackbox/collections/removeAtInt.kt b/backend.native/tests/external/codegen/blackbox/collections/removeAtInt.kt new file mode 100644 index 00000000000..8cb05571d02 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/removeAtInt.kt @@ -0,0 +1,106 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends A {} + + public static String foo() { + MyList myList = new MyList(); + List list = (List) myList; + + if (!list.remove((Integer) 1)) return "fail 1"; + if (list.remove((int) 1) != 123) return "fail 2"; + + if (!myList.remove((Integer) 1)) return "fail 3"; + if (myList.remove((int) 1) != 123) return "fail 4"; + + if (myList.removeAt(1) != 123) return "fail 5"; + return "OK"; + } +} + +// FILE: test.kt + +open class A : MutableList { + override val size: Int + get() = throw UnsupportedOperationException() + override fun isEmpty(): Boolean = throw UnsupportedOperationException() + + override fun contains(o: Int): Boolean { + throw UnsupportedOperationException() + } + + override fun containsAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun get(index: Int): Int { + throw UnsupportedOperationException() + } + + override fun indexOf(o: Int): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(o: Int): Int { + throw UnsupportedOperationException() + } + + override fun add(e: Int): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(o: Int) = true + + override fun removeAt(index: Int): Int = 123 + + override fun addAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: Int): Int { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: Int) { + throw UnsupportedOperationException() + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } +} + +fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/blackbox/collections/strList.kt b/backend.native/tests/external/codegen/blackbox/collections/strList.kt new file mode 100644 index 00000000000..b6d42fdbaff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/strList.kt @@ -0,0 +1,101 @@ +// TARGET_BACKEND: JVM + +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends KList {} + + public static String foo() { + Collection collection = new MyList(); + if (!collection.contains("ABCDE")) return "fail 1"; + if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + +abstract class KList : MutableList { + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(o: String) = true + override fun containsAll(c: Collection) = true + + override fun get(index: Int): String { + throw UnsupportedOperationException() + } + + override fun indexOf(o: String): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(o: String): Int { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } + + override fun add(e: String): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(o: String): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: String): String { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: String) { + throw UnsupportedOperationException() + } + + override fun removeAt(index: Int): String { + throw UnsupportedOperationException() + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + +} +fun box() = J.foo() diff --git a/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt b/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt new file mode 100644 index 00000000000..2f4e6f41896 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: B.java +public class B extends A { + @Override + public T[] toArray(T[] a) { + return a; + } +} + +// FILE: main.kt +open class A : Collection { + override val size: Int + get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + + override fun contains(element: T): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun containsAll(elements: Collection): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun isEmpty(): Boolean { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun iterator(): Iterator { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} + +fun box() = B().toArray(arrayOf("OK"))[0] diff --git a/backend.native/tests/external/codegen/blackbox/compatibility/dataClassEqualsHashCodeToString.kt b/backend.native/tests/external/codegen/blackbox/compatibility/dataClassEqualsHashCodeToString.kt new file mode 100644 index 00000000000..c0fd15fad4d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/compatibility/dataClassEqualsHashCodeToString.kt @@ -0,0 +1,13 @@ +// LANGUAGE_VERSION: 1.0 + +data class Foo(val s: String) + +fun box(): String { + val f1 = Foo("OK") + val f2 = Foo("OK") + if (f1 != f2) return "Fail equals" + if (f1.hashCode() != f2.hashCode()) return "Fail hashCode" + if (f1.toString() != f2.toString() || f1.toString() != "Foo(s=OK)") return "Fail toString: $f1 $f2" + + return f1.s +} diff --git a/backend.native/tests/external/codegen/blackbox/constants/constantsInWhen.kt b/backend.native/tests/external/codegen/blackbox/constants/constantsInWhen.kt new file mode 100644 index 00000000000..cbc39e03146 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/constants/constantsInWhen.kt @@ -0,0 +1,18 @@ +fun test( + b: Boolean, + i: Int +) { + if (b) { + when (i) { + 0 -> foo(1) + else -> null + } + } else null +} + +fun foo(i: Int) = i + +fun box(): String { + test(true, 1) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/constants/float.kt b/backend.native/tests/external/codegen/blackbox/constants/float.kt new file mode 100644 index 00000000000..5c60d382df1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/constants/float.kt @@ -0,0 +1,18 @@ +fun box(): String { + if (1F != 1.toFloat()) return "fail 1" + if (1.0F != 1.0.toFloat()) return "fail 2" + if (1e1F != 1e1.toFloat()) return "fail 3" + if (1.0e1F != 1.0e1.toFloat()) return "fail 4" + if (1e-1F != 1e-1.toFloat()) return "fail 5" + if (1.0e-1F != 1.0e-1.toFloat()) return "fail 6" + + if (1f != 1.toFloat()) return "fail 7" + if (1.0f != 1.0.toFloat()) return "fail 8" + if (1e1f != 1e1.toFloat()) return "fail 9" + if (1.0e1f != 1.0e1.toFloat()) return "fail 10" + if (1e-1f != 1e-1.toFloat()) return "fail 11" + if (1.0e-1f != 1.0e-1.toFloat()) return "fail 12" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt b/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt new file mode 100644 index 00000000000..0073c9670b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +object A { + const val a: String = "$" + const val b = "1234$a" + const val c = 10000 + + val bNonConst = "1234$a" + val bNullable: String = "1234$a" +} + +object B { + const val a: String = "$" + const val b = "1234$a" + const val c = 10000 + + val bNonConst = "1234$a" + val bNullable: String = "1234$a" +} + +fun box(): String { + if (A.a !== B.a) return "Fail 1: A.a !== B.a" + + if (A.b !== B.b) return "Fail 2: A.b !== B.b" + + if (A.c !== B.c) return "Fail 3: A.c !== B.c" + + if (A.bNonConst === B.bNonConst) return "Fail 5: A.bNonConst == B.bNonConst" + if (A.bNullable === B.bNullable) return "Fail 6: A.bNullable == B.bNullable" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/constants/long.kt b/backend.native/tests/external/codegen/blackbox/constants/long.kt new file mode 100644 index 00000000000..7fa2eaf4f50 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/constants/long.kt @@ -0,0 +1,10 @@ +fun box(): String { + if (1L != 1.toLong()) return "fail 1" + if (0x1L != 0x1.toLong()) return "fail 2" + if (0X1L != 0X1.toLong()) return "fail 3" + if (0b1L != 0b1.toLong()) return "fail 4" + if (0B1L != 0B1.toLong()) return "fail 5" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/constants/privateConst.kt b/backend.native/tests/external/codegen/blackbox/constants/privateConst.kt new file mode 100644 index 00000000000..041cc94e9fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/constants/privateConst.kt @@ -0,0 +1,7 @@ +private const val z = "OK"; + +fun box(): String { + return { + z + }() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/bottles.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/bottles.kt new file mode 100644 index 00000000000..2d376593843 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/bottles.kt @@ -0,0 +1,9 @@ +fun box(): String { + var bottles = 99 + while (bottles > 0) { + // System.out.println("bottles of beer on the wall"); + bottles -= 1 + bottles-- + } + return if (bottles == -1) "OK" else "Fail $bottles" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt new file mode 100644 index 00000000000..af81659efc5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + OUTER@while (true) { + var x = "" + try { + do { + x = x + break@OUTER + } while (true) + } finally { + return "OK" + } + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInDoWhile.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInDoWhile.kt new file mode 100644 index 00000000000..cd932454965 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInDoWhile.kt @@ -0,0 +1,10 @@ +fun box(): String { + val ok: String? = "OK" + var res = "" + + do { + res += ok ?: break + } while (false) + + return res +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInExpr.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInExpr.kt new file mode 100644 index 00000000000..203452b0a60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakInExpr.kt @@ -0,0 +1,9 @@ +fun test(str: String): String { + var s = "" + for (i in 1..3) { + s += if (i<2) str else break + } + return s +} + +fun box(): String = test("OK") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInDoWhile.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInDoWhile.kt new file mode 100644 index 00000000000..d46fe01fd97 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInDoWhile.kt @@ -0,0 +1,6 @@ +fun box(): String { + var i = 0 + do continue while (i++ < 3) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInExpr.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInExpr.kt new file mode 100644 index 00000000000..667cd474bd0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/continueInExpr.kt @@ -0,0 +1,7 @@ +fun box(): String { + var s = "OK" + for (i in 1..3) { + s = s + if (i<2) "" else continue + } + return s +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/inlineWithStack.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/inlineWithStack.kt new file mode 100644 index 00000000000..7c5b904df3e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/inlineWithStack.kt @@ -0,0 +1,17 @@ +inline fun bar(block: () -> String) : String { + return block() +} + +inline fun bar2() : String { + while (true) break + return bar { return "def" } +} + +fun foobar(x: String, y: String, z: String) = x + y + z + +fun box(): String { + val test = foobar("abc", bar2(), "ghi") + return if (test == "abcdefghi") + "OK" + else "Failed, test=$test" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt new file mode 100644 index 00000000000..96cf2e2eaec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt @@ -0,0 +1,9 @@ +fun box(): String { + var x = "OK" + do { + while (true) { + x = x + break + } + } while (false) + return x +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt14581.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt14581.kt new file mode 100644 index 00000000000..0010f1ffdbd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt14581.kt @@ -0,0 +1,11 @@ +fun foo(x: String): String { + var y: String + do { + y = x + } while (y != x.bar(x)) + return y +} + +inline fun String.bar(other: String) = this + +fun box(): String = foo("OK") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022And.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022And.kt new file mode 100644 index 00000000000..757b5c940be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022And.kt @@ -0,0 +1,9 @@ +fun box(): String { + var cycle = true; + while (true) { + if (true && break) { + return "fail" + } + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022Or.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022Or.kt new file mode 100644 index 00000000000..3b8a943d781 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022Or.kt @@ -0,0 +1,9 @@ +fun box(): String { + var cycle = true; + while (true) { + if (true || break) { + return "OK" + } + } + return "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/popSizes.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/popSizes.kt new file mode 100644 index 00000000000..8c736e5952b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/popSizes.kt @@ -0,0 +1,13 @@ +fun foo(x: Long, y: Int, z: Double, s: String) {} + +fun box(): String { + while (true) { + try { + foo(0, 0, 0.0, "" + continue) + } + finally { + foo(0, 0, 0.0, "" + break) + } + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally1.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally1.kt new file mode 100644 index 00000000000..b918861535a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally1.kt @@ -0,0 +1,12 @@ +fun box(): String { + var x = "OK" + while (true) { + try { + x = x + continue + } + finally { + x = x + break + } + } + return x +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally2.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally2.kt new file mode 100644 index 00000000000..147362a181c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally2.kt @@ -0,0 +1,13 @@ +fun box(): String { + var r = "" + for (i in 1..1) { + try { + r += "O" + break + } finally { + r += "K" + continue + } + } + return r +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/whileTrueBreak.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/whileTrueBreak.kt new file mode 100644 index 00000000000..09b73099a16 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/whileTrueBreak.kt @@ -0,0 +1,4 @@ +fun box(): String { + while (true) break + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakInFinally.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakInFinally.kt new file mode 100644 index 00000000000..d761ee60360 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakInFinally.kt @@ -0,0 +1,11 @@ +fun box(): String { + while (true) { + try { + continue; + } + finally { + break; + } + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/compareBoxedIntegerToZero.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/compareBoxedIntegerToZero.kt new file mode 100644 index 00000000000..6b2091be148 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/compareBoxedIntegerToZero.kt @@ -0,0 +1,8 @@ +fun box(): String { + val x: Int? = 0 + if (x != 0) return "Fail $x" + if (0 != x) return "Fail $x" + if (!(x == 0)) return "Fail $x" + if (!(0 == x)) return "Fail $x" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/conditionOfEmptyIf.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/conditionOfEmptyIf.kt new file mode 100644 index 00000000000..153b73525c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/conditionOfEmptyIf.kt @@ -0,0 +1,13 @@ +var result = "Fail" + +fun setOK(): Boolean { + result = "OK" + return true +} + +fun box(): String { + if (setOK()) { + } else { + } + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/continueInExpr.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInExpr.kt new file mode 100644 index 00000000000..328f8efafec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInExpr.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +fun concatNonNulls(strings: List): String { + var result = "" + for (str in strings) { + result += str?:continue + } + return result +} + +fun box(): String { + val test = concatNonNulls(listOf("abc", null, null, "", null, "def")) + if (test != "abcdef") return "Failed: test=$test" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/continueInFor.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInFor.kt new file mode 100644 index 00000000000..7d5bb6a3dc4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInFor.kt @@ -0,0 +1,123 @@ +fun for_int_range(): Int { + var c = 0 + for (i in 1..10) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_byte_range(): Int { + var c = 0 + val from: Byte = 1 + val to: Byte = 10 + for (i in from..to) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_long_range(): Int { + var c = 0 + val from: Long = 1 + val to: Long = 10 + for (i in from..to) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_int_list(): Int { + val a = ArrayList() + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_byte_list(): Int { + val a = ArrayList() + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_long_list(): Int { + val a = ArrayList() + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_double_list(): Int { + val a = ArrayList() + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_object_list(): Int { + val a = ArrayList() + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_str_array(): Int { + val a = arrayOfNulls(10) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun for_intarray(): Int { + val a = IntArray(10) + var c = 0 + for (i in a) { + if (c >= 5) continue + c++ + } + return c +} + +fun box(): String { + if (for_int_range() != 5) return "fail 1" + if (for_byte_range() != 5) return "fail 2" + if (for_long_range() != 5) return "fail 3" + if (for_intarray() != 5) return "fail 4" + if (for_str_array() != 5) return "fail 5" + if (for_int_list() != 5) return "fail 6" + if (for_byte_list() != 5) return "fail 7" + if (for_long_list() != 5) return "fail 8" + if (for_double_list() != 5) return "fail 9" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/continueInForCondition.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInForCondition.kt new file mode 100644 index 00000000000..3ebace16102 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInForCondition.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME + +fun foo(): List? = listOf("abcde") + +fun box(): String { + for (i in 1..3) { + for (value in foo() ?: continue) { + if (value != "abcde") return "Fail" + } + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/continueInWhile.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInWhile.kt new file mode 100644 index 00000000000..79b4ea623ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/continueInWhile.kt @@ -0,0 +1,16 @@ +fun foo(i: Int): Int { + var count = i; + var result = 0; + while(count > 0) { + count = count - 1; + if (count <= 2) continue; + result = result + count; + } + return result; +} + +fun box(): String { + if (foo(4) != 3) return "Fail 1" + if (foo(5) != 7) return "Fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/continueToLabelInFor.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/continueToLabelInFor.kt new file mode 100644 index 00000000000..fe644d6e64b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/continueToLabelInFor.kt @@ -0,0 +1,123 @@ +fun for_int_range(): Int { + var c = 0 + loop@ for (i in 1..10) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_byte_range(): Int { + var c = 0 + val from: Byte = 1 + val to: Byte = 10 + loop@ for (i in from..to) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_long_range(): Int { + var c = 0 + val from: Long = 1 + val to: Long = 10 + loop@ for (i in from..to) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_int_list(): Int { + val a = ArrayList() + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_byte_list(): Int { + val a = ArrayList() + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_long_list(): Int { + val a = ArrayList() + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + a.add(0); a.add(0); a.add(0); a.add(0); a.add(0) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_double_list(): Int { + val a = ArrayList() + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_object_list(): Int { + val a = ArrayList() + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_str_array(): Int { + val a = arrayOfNulls(10) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun for_intarray(): Int { + val a = IntArray(10) + var c = 0 + loop@ for (i in a) { + if (c >= 5) continue@loop + c++ + } + return c +} + +fun box(): String { + if (for_int_range() != 5) return "fail 1" + if (for_byte_range() != 5) return "fail 2" + if (for_long_range() != 5) return "fail 3" + if (for_intarray() != 5) return "fail 4" + if (for_str_array() != 5) return "fail 5" + if (for_int_list() != 5) return "fail 6" + if (for_byte_list() != 5) return "fail 7" + if (for_long_list() != 5) return "fail 8" + if (for_double_list() != 5) return "fail 9" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/doWhile.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/doWhile.kt new file mode 100644 index 00000000000..f9b776c736c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/doWhile.kt @@ -0,0 +1,15 @@ +fun box(): String { + var x = 0 + do x++ while (x < 5) + if (x != 5) return "Fail 1 $x" + + var y = 0 + do { y++ } while (y < 5) + if (y != 5) return "Fail 2 $y" + + var z = "" + do { z += z.length } while (z.length < 5) + if (z != "01234") return "Fail 3 $z" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/doWhileFib.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/doWhileFib.kt new file mode 100644 index 00000000000..088f74cb660 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/doWhileFib.kt @@ -0,0 +1,12 @@ +fun box(): String { + var fx = 1 + var fy = 1 + + do { + var tmp = fy + fy = fx + fy + fx = tmp + } while (fy < 100) + + return if (fy == 144) "OK" else "Fail $fx $fy" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/doWhileWithContinue.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/doWhileWithContinue.kt new file mode 100644 index 00000000000..bb9c73dc6a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/doWhileWithContinue.kt @@ -0,0 +1,21 @@ +fun box(): String { + var i = 0 + do { + if (i++ > 100) break; + continue; + } while(false) + if (i != 1) return "Fail 1, expected 1, but $i" + + i = 0 + do { + if (i++ > 100) break; + continue; + } while(i<10) + if (i != 10) return "Fail 2, expected 10, but $i" + + i = 0 + do continue while(i++<10) + if (i != 11) return "Fail 3, expected 11, but $i" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/emptyDoWhile.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/emptyDoWhile.kt new file mode 100644 index 00000000000..0f52a36e3b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/emptyDoWhile.kt @@ -0,0 +1,9 @@ +fun box(): String { + do while (false); + + var x = 0 + do while (x++<5); + if (x != 6) return "Fail: $x" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/emptyFor.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/emptyFor.kt new file mode 100644 index 00000000000..6a09c1b3b43 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/emptyFor.kt @@ -0,0 +1,19 @@ +var index = 0 + +interface IterableIterator : Iterator { + operator fun iterator(): Iterator = this +} + +val iterator = object : IterableIterator { + override fun hasNext() = index < 5 + override fun next() = index++ +} + +fun box(): String { + for (x in 1..5); + + for (x in iterator); + if (index != 5) return "Fail: $index" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/emptyWhile.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/emptyWhile.kt new file mode 100644 index 00000000000..c52c5124f52 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/emptyWhile.kt @@ -0,0 +1,9 @@ +fun box(): String { + while (false); + + var x = 0 + while (x++<5); + if (x != 6) return "Fail: $x" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/factorialTest.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/factorialTest.kt new file mode 100644 index 00000000000..fdb108f8bdc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/factorialTest.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun facWhile(i: Int): Int { + var count = 1; + var result = 1; + while(count < i) { + count = count + 1; + result = result * count; + } + return result; +} + +fun facBreak(i: Int): Int { + var count = 1; + var result = 1; + while(true) { + count = count + 1; + result = result * count; + if (count == i) break; + } + return result; +} + +fun facDoWhile(i: Int): Int { + var count = 1; + var result = 1; + do { + count = count + 1; + result = result * count; + } while(count != i); + return result; +} + +fun box(): String { + assertEquals(6, facWhile(3)) + assertEquals(6, facBreak(3)) + assertEquals(6, facDoWhile(3)) + assertEquals(120, facWhile(5)) + assertEquals(120, facBreak(5)) + assertEquals(120, facDoWhile(5)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/finallyOnEmptyReturn.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/finallyOnEmptyReturn.kt new file mode 100644 index 00000000000..db1262a9d7a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/finallyOnEmptyReturn.kt @@ -0,0 +1,14 @@ +var result = "Fail" + +fun foo() { + try { + return + } finally { + result = "OK" + } +} + +fun box(): String { + foo() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forArrayList.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forArrayList.kt new file mode 100644 index 00000000000..cce12773de3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forArrayList.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME +val alist = arrayListOf(1, 2, 3) // : j.u.ArrayList + +fun box(): String { + var result = 0 + for (i: Int in alist) { + result += i + } + + return if (result == 6) "OK" else "fail: $result" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forArrayListMultiDecl.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forArrayListMultiDecl.kt new file mode 100644 index 00000000000..04bd627762e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forArrayListMultiDecl.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +val alist = arrayListOf(1 to 2, 2 to 3, 3 to 4) + +fun box(): String { + var result = 0 + for ((i: Int, z: Int) in alist) { + + result += i + z + } + + return if (result == 15) "OK" else "fail: $result" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forInSmartCastToArray.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forInSmartCastToArray.kt new file mode 100644 index 00000000000..83a919d7e9f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forInSmartCastToArray.kt @@ -0,0 +1,14 @@ +fun f(x: Any?): Any? { + if (x is Array<*>) { + for (i in x) { + return i + } + } + return "FAIL" +} + +fun box(): String { + val a = arrayOfNulls(1) as Array + a[0] = "OK" + return f(a) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forIntArray.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forIntArray.kt new file mode 100644 index 00000000000..9fc295b3eda --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forIntArray.kt @@ -0,0 +1,14 @@ +fun box() : String { + val a = arrayOfNulls(5) + var i = 0 + var sum = 0 + for(el in 0..4) { + a[i] = i++ + } + for (el in (a as Array)) { + sum = sum + el + } + if(sum != 10) return "a failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt new file mode 100644 index 00000000000..bd701f507a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt @@ -0,0 +1,26 @@ +class It { +} + +class C { +} + +class X { + var hasNext = true + operator fun It.hasNext() = if (hasNext) {hasNext = false; true} else false + operator fun It.next() = 5 + operator fun C.iterator(): It = It() + + fun test() { + for (i in C()) { + foo(i) + } + } + +} + +fun foo(x: Int) {} + +fun box(): String { + X().test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionHasNext.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionHasNext.kt new file mode 100644 index 00000000000..fd0e52ec3f8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionHasNext.kt @@ -0,0 +1,26 @@ +class It { + operator fun next() = 5 +} + +class C { + operator fun iterator(): It = It() +} + +class X { + var hasNext = true + operator fun It.hasNext() = if (hasNext) {hasNext = false; true} else false + + fun test() { + for (i in C()) { + foo(i) + } + } + +} + +fun foo(x: Int) {} + +fun box(): String { + X().test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt new file mode 100644 index 00000000000..bfc79302ec1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class It { + var hasNext = true + operator fun hasNext() = if (hasNext) {hasNext = false; true} else false +} + +class C { + operator fun iterator(): It = It() +} + +class X { + operator fun It.next() = 5 + + fun test() { + for (i in C()) { + foo(i) + } + } + +} + +fun foo(x: Int) {} + +fun box(): String { + X().test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forNullableIntArray.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forNullableIntArray.kt new file mode 100644 index 00000000000..10e29bcba89 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forNullableIntArray.kt @@ -0,0 +1,15 @@ +fun box() : String { + val b : Array = arrayOfNulls (5) + var i = 0 + var sum = 0 + while(i < 5) { + b[i] = i++ + } + sum = 0 + for (el in b) { + sum = sum + (el ?: 0) + } + if(sum != 10) return "b failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forPrimitiveIntArray.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forPrimitiveIntArray.kt new file mode 100644 index 00000000000..566894de73a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forPrimitiveIntArray.kt @@ -0,0 +1,14 @@ +fun box() : String { + val a = IntArray (5) + var i = 0 + var sum = 0 + for(el in 0..4) { + a[i] = i++ + } + for (el in a) { + sum = sum + el + } + if(sum != 10) return "a failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt new file mode 100644 index 00000000000..cd714a0de1f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt @@ -0,0 +1,117 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box() : String { + var sum : Int = 0 + var i = 0 + + val c6 = MyCollection4() + sum = 0 + for (el in c6) { + sum = sum + el + } + if(sum != 15) return "c6 failed" + + val c5 = MyCollection3() + sum = 0 + for (el in c5) { + sum = sum + (el ?: 0) + } + if(sum != 15) return "c5 failed" + + val c1: Iterable = MyCollection1() + sum = 0 + for (el in c1) { + sum = sum + el!! + } + if(sum != 15) return "c1 failed" + + val c2 = MyCollection1() + sum = 0 + for (el in c2) { + sum = sum + el!! + } + if(sum != 15) return "c2 failed" + + val c3: Iterable = MyCollection2() + sum = 0 + for (el in c3) { + sum = sum + el!! + } + if(sum != 15) return "c3 failed" + + val c4 = MyCollection2() + sum = 0 + for (el in c4) { + sum = sum + el!! + } + if(sum != 15) return "c4 failed" + + val a : Array = arrayOfNulls(5) as Array + for(el in 0..4) { + a[i] = i++ + } + sum = 0 + for (el in a) { + sum = sum + el!! + } + if(sum != 10) return "a failed" + + val b : Array = arrayOfNulls (5) + i = 0 + while(i < 5) { + b[i] = i++ + } + sum = 0 + for (el in b) { + sum = sum + (el ?: 0) + } + System.out?.println(sum) + if(sum != 10) return "b failed" + + return "OK" +} + +class MyCollection1(): Iterable { + override fun iterator(): Iterator = MyIterator() + + class MyIterator(): Iterator { + var k : Int = 5 + + override fun next() : Int = k-- + override fun hasNext() = k > 0 + } +} + +class MyCollection2(): Iterable { + override fun iterator(): Iterator = MyIterator() + + class MyIterator(): Iterator { + var k : Int = 5 + + override fun next() : Int = k-- + override fun hasNext() : Boolean = k > 0 + } +} + +class MyCollection3() { + operator fun iterator() = MyIterator() + + class MyIterator() { + var k : Int = 5 + + operator fun next() : Int? = k-- + operator fun hasNext() : Boolean = k > 0 + } +} + +class MyCollection4() { + operator fun iterator() = MyIterator() + + class MyIterator() { + var k : Int = 5 + + operator fun next() : Int = k-- + operator fun hasNext() = k > 0 + } +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/inRangeConditionsInWhen.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/inRangeConditionsInWhen.kt new file mode 100644 index 00000000000..09f2faa5557 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/inRangeConditionsInWhen.kt @@ -0,0 +1,8 @@ +operator fun Int.contains(i : Int) = true + +fun box(): String { + when (1) { + in 2 -> return "OK" + else -> return "fail" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt12908.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt12908.kt new file mode 100644 index 00000000000..e35d92b93dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt12908.kt @@ -0,0 +1,20 @@ +var field: Int = 0 + +fun next(): Int { + return ++field +} + + +fun box(): String { + val task: String + + do { + if (next() % 2 == 0) { + task = "OK" + break + } + } + while (true) + + return task +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt12908_2.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt12908_2.kt new file mode 100644 index 00000000000..f4fd0e0555e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt12908_2.kt @@ -0,0 +1,20 @@ +var field: Int = 0 + +fun next(): Int { + return ++field +} + + +fun box(): String { + val task: String + + do { + if (next() % 2 == 0) { + task = "OK" + break + } + } + while (!false) + + return task +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt1441.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1441.kt new file mode 100644 index 00000000000..7e5099064b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1441.kt @@ -0,0 +1,16 @@ +class Foo { + var rnd = 10 + + public override fun equals(that : Any?) : Boolean = that is Foo && (that.rnd == rnd) +} + +fun box() : String { + val a = Foo() + val b = Foo() + if (a !== a) return "fail 1" + if (b !== b) return "fail 2" + if (b === a) return "fail 3" + if (a === b) return "fail 4" + if( a !=b ) return "fail5" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt14839.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt14839.kt new file mode 100644 index 00000000000..c76925da31f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt14839.kt @@ -0,0 +1,10 @@ +fun box(): String { + try { + } catch (e: Exception) { + inlineFunctionWithDefaultArguments(e) + } + return "OK" +} + +inline fun inlineFunctionWithDefaultArguments(t: Throwable? = null, bug: Boolean = true) = + Unit \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt1688.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1688.kt new file mode 100644 index 00000000000..0bbc232c5f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1688.kt @@ -0,0 +1,10 @@ +fun box(): String { + var s = "" + try { + throw RuntimeException() + } catch (e : RuntimeException) { + } finally { + s += "OK" + } + return s +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt1742.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1742.kt new file mode 100644 index 00000000000..6e950e30e41 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1742.kt @@ -0,0 +1,7 @@ +fun box(): String { + val x = 2 + return when(x) { + in (1..3) -> "OK" + else -> "fail" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt1899.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1899.kt new file mode 100644 index 00000000000..92a38e1bd89 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt1899.kt @@ -0,0 +1,5 @@ +fun box(): String { + if (1 != 0) { + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2147.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2147.kt new file mode 100644 index 00000000000..df664fb16ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2147.kt @@ -0,0 +1,9 @@ +class Foo { + fun isOk() = true +} + +fun box(): String { + val foo: Foo? = Foo() + if (foo?.isOk()!!) return "OK" + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2259.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2259.kt new file mode 100644 index 00000000000..7b695efee06 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2259.kt @@ -0,0 +1,10 @@ +fun main(args: Array) { + try { + } finally { + try { + } catch (e: Throwable) { + } + } +} + +fun box() = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2291.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2291.kt new file mode 100644 index 00000000000..a1afcfe91b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2291.kt @@ -0,0 +1,6 @@ +fun box(): String { + 1 in 1.rangeTo(10) + 1..10 + 'h' in 'A'.rangeTo('Z') + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt new file mode 100644 index 00000000000..d236a3f9ff9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun main(args: Array?) { + val y: Unit = Unit //do not compile + A() //do not compile + C(Unit) //do not compile + //do not compile + System.out?.println(fff(Unit)) //do not compile + System.out?.println(id(y)) //do not compile + System.out?.println(fff(id(y)) == id(foreach(arrayOfNulls(0) as Array,{ e : Int -> }))) //do not compile +} +class A() + +class C(val value: T) { + fun foo(): T = value +} + +fun fff(x: T) : T { return x } + +fun id(value: T): T = value + +fun foreach(array: Array, action: (Int)-> Unit) { + for (el in array) { + action(el) //exception through compilation (see below) + } +} + +fun almostFilter(array: Array, action: (Int)-> Int) { + for (el in array) { + action(el) + } +} + +fun box() : String { + val a = arrayOfNulls(3) as Array + a[0] = 0 + a[1] = 1 + a[2] = 2 + foreach(a, { el : Int -> System.out?.println(el) }) + almostFilter(a, { el : Int -> el }) + main(null) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2416.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2416.kt new file mode 100644 index 00000000000..f1442680ff5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2416.kt @@ -0,0 +1,16 @@ +fun box(): String { + 9 in 0..9 + val intRange = 0..9 + 9 in intRange + val charRange = '0'..'9' + '9' in charRange + val byteRange = 0.toByte()..9.toByte() + // seems no stdlib available here, thus no contains as extension + 9 in byteRange + val longRange = 0.toLong()..9.toLong() + 9.toLong() in longRange + val shortRange = 0.toShort()..9.toShort() + 9 in shortRange + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2423.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2423.kt new file mode 100644 index 00000000000..c6390b86d3c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2423.kt @@ -0,0 +1,53 @@ +// TARGET_BACKEND: JVM + +// WITH_RUNTIME +// FULL_JDK + +import java.util.LinkedList + +fun ok1(): Boolean { + val queue = LinkedList(listOf(1, 2, 3)) + while (!queue.isEmpty()) { + queue.poll() + for (y in 1..3) { + if (queue.contains(y)) { + return true + } + } + } + return false +} + +fun ok2(): Boolean { + val queue = LinkedList(listOf(1, 2, 3)) + val array = arrayOf(1, 2, 3) + while (!queue.isEmpty()) { + queue.poll() + for (y in array) { + if (queue.contains(y)) { + return true + } + } + } + return false +} + +fun ok3(): Boolean { + val queue = LinkedList(listOf(1, 2, 3)) + while (!queue.isEmpty()) { + queue.poll() + var x = 0 + do { + x++ + if (x == 2) return true + } while (x < 2) + } + return false +} + +fun box(): String { + if (!ok1()) return "Fail #1" + if (!ok2()) return "Fail #2" + if (!ok3()) return "Fail #3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2577.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2577.kt new file mode 100644 index 00000000000..c11ba235411 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2577.kt @@ -0,0 +1,12 @@ +fun foo(): Int { + try { + } finally { + try { + return 1 + } catch (e: Throwable) { + return 2 + } + } +} + +fun box() = if (foo() == 1) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt2597.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2597.kt new file mode 100644 index 00000000000..af5af144a86 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt2597.kt @@ -0,0 +1,10 @@ +fun box(): String { + var i = 0 + { + if (1 == 1) { + i++ + } else { + } + }() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt299.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt299.kt new file mode 100644 index 00000000000..9cb4628e7da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt299.kt @@ -0,0 +1,21 @@ +class MyRange1() : ClosedRange { + override val start: Int + get() = 0 + override val endInclusive: Int + get() = 0 + override fun contains(item: Int) = true +} + +class MyRange2() { + operator fun contains(item: Int) = true +} + +fun box(): String { + if (1 in MyRange1()) { + if (1 in MyRange2()) { + return "OK" + } + return "fail 2" + } + return "fail 1" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3087.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3087.kt new file mode 100644 index 00000000000..5858faa4364 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3087.kt @@ -0,0 +1,26 @@ +fun putNumberCompareAsUnit() { + if (1 == 1) { + } + else if (1 == 1) { + } +} + +fun putNumberCompareAsVoid() { + if (1 == 1) { + 1 == 1 + } else { + } +} + +fun putInvertAsUnit(b: Boolean) { + if (1 == 1) { + } else if (!b) { + } +} + +fun box(): String { + putNumberCompareAsUnit() + putNumberCompareAsVoid() + putInvertAsUnit(true) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_1.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_1.kt new file mode 100644 index 00000000000..a1b72471df1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_1.kt @@ -0,0 +1,19 @@ +fun testIf() { + val condition = true + val result = if (condition) { + val hello: String? = "hello" + if (hello == null) { + false + } + else { + true + } + } + else true + if (!result) throw AssertionError("result is false") +} + +fun box(): String { + testIf() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_2.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_2.kt new file mode 100644 index 00000000000..bde4cc3fe77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3203_2.kt @@ -0,0 +1,20 @@ +fun check1() { + val result = if (true) { + if (true) 1 else 2 + } + else 3 + if (result != 1) throw AssertionError("result: $result") +} + +fun check2() { + val result = if (true) + if (true) 1 else 2 + else 3 + if (result != 1) throw AssertionError("result: $result") +} + +fun box(): String { + check1() + check2() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3273.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3273.kt new file mode 100644 index 00000000000..187dc50ecf8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3273.kt @@ -0,0 +1,21 @@ +fun printlnMock(a: Any) {} + +public fun testCoalesce() { + val value: String = when { + true -> { + if (true) { + "foo" + } else { + "bar" + } + } + else -> "Hello world" + } + + printlnMock(value.length) +} + +fun box(): String { + testCoalesce() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3280.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3280.kt new file mode 100644 index 00000000000..2a2b87a8f1c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3280.kt @@ -0,0 +1,24 @@ +fun foo() { + var x = 0 + do { + x++ + var y = x + 5 + } while (y < 10) + if (x != 5) throw AssertionError("$x") +} + +fun bar() { + var b = false + do { + var x = "X" + var y = "Y" + b = true + } while (x + y != "XY") + if (!b) throw AssertionError() +} + +fun box(): String { + foo() + bar() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt new file mode 100644 index 00000000000..9efb57c0b2b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun nil() = null + +fun list() = java.util.Arrays.asList("1") + +fun box(): String { + for (x in nil()?:list()) { + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt416.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt416.kt new file mode 100644 index 00000000000..85876312256 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt416.kt @@ -0,0 +1,4 @@ +fun box() : String { + var a = 10 + return if(a?.plus(10) == 20) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt513.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt513.kt new file mode 100644 index 00000000000..74092c47aed --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt513.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +class A() { + infix fun ArrayList.add3(el: T) = add(el) + + fun test(list: ArrayList) { + for (i in 1..10) { + list add3 i + } + } +} + +infix fun ArrayList.add2(el: T) = add(el) + +fun box() : String{ + var list = ArrayList() + for (i in 1..10) { + list.add(i) + list add2 i + } + A().test(list) + println(list) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt628.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt628.kt new file mode 100644 index 00000000000..234e336e5a7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt628.kt @@ -0,0 +1,48 @@ +class A() { + fun action() = "OK" + + infix fun infix(a: String) = "O" + a + + val property = "OK" + + val a : A + get() = A() +} + +fun test1() = A()!!.property +fun test2() = (A() as A?)!!.property +fun test3() = A()!!.action() +fun test4() = (A() as A?)!!.action() +fun test5() = (null as A?)!!.action() +fun test6() = A().a.a!!.action() +fun test7() = 10!!.plus(11) +fun test8() = (10 as Int?)!!.plus(11) +fun test9() = A()!! infix "K" +fun test10() = (A() as A?) !! infix "K" +fun test11() = (A() as A?) !! infix("K") +fun test12() = A()!! infix ("K") + +fun box() : String { + if(test1() != "OK") return "fail" + if(test2() != "OK") return "fail" + if(test3() != "OK") return "fail" + if(test4() != "OK") return "fail" + + try { + test5() + return "fail" + } + catch(e: NullPointerException) { // + } + + if(test6() != "OK") return "fail" + if(test7() != 21) return "fail" + if(test8() != 21) return "fail" + + if(test9() != "OK") return "fail" + if(test10() != "OK") return "fail" + if(test11() != "OK") return "fail" + if(test12() != "OK") return "fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt new file mode 100644 index 00000000000..c565d684ab1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package w_range + +fun box() : String { + var i = 0 + when (i) { + 1 -> i-- + else -> { i = 2 } + } + System.out?.println(i) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt772.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt772.kt new file mode 100644 index 00000000000..6facb9ef23d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt772.kt @@ -0,0 +1,25 @@ +package demo2 + +fun print(o : Any?) {} + +fun test(i : Int) { + var monthString : String? = "" + when (i) { + 1 -> { + print(1) + print(2) + print(3) + print(4) + print(5) + } + else -> { + monthString = "Invalid month" + } + } + print(monthString) +} + +fun box() : String { + for (i in 1..12) test(i) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt773.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt773.kt new file mode 100644 index 00000000000..6facb9ef23d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt773.kt @@ -0,0 +1,25 @@ +package demo2 + +fun print(o : Any?) {} + +fun test(i : Int) { + var monthString : String? = "" + when (i) { + 1 -> { + print(1) + print(2) + print(3) + print(4) + print(5) + } + else -> { + monthString = "Invalid month" + } + } + print(monthString) +} + +fun box() : String { + for (i in 1..12) test(i) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt new file mode 100644 index 00000000000..9b2c97df507 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A(var value: String) + +fun box(): String { + val a = A("start") + + try { + test(a) + } catch(e: java.lang.RuntimeException) { + + } + + if (a.value != "start, try, finally1, finally2") return "fail: ${a.value}" + + return "OK" +} + +fun test(a: A) : String { + try { + try { + a.value += ", try" + return a.value + } finally { + a.value += ", finally1" + } + } finally { + a.value += ", finally2" + throw RuntimeException("fail") + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt new file mode 100644 index 00000000000..6815b647c67 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A(var value: String) + +fun box(): String { + val a = A("start") + + try { + test(a) + } catch(e: java.lang.RuntimeException) { + + } + + if (a.value != "start, try, finally1, finally2") return "fail: ${a.value}" + + return "OK" +} + +fun test(a: A) : String { + while (true) { + try { + try { + a.value += ", try" + break + } + finally { + a.value += ", finally1" + } + } + finally { + a.value += ", finally2" + throw RuntimeException("fail") + } + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt new file mode 100644 index 00000000000..780bab67ce5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A(var value: String) + +fun box(): String { + val a = A("start") + + try { + test(a) + } catch(e: java.lang.RuntimeException) { + + } + + if (a.value != "start, try, finally1, finally2") return "fail: ${a.value}" + + return "OK" +} + +fun test(a: A) : String { + while (a.value == "start") { + try { + try { + a.value += ", try" + continue + } + finally { + a.value += ", finally1" + } + } + finally { + a.value += ", finally2" + throw RuntimeException("fail") + } + } + return "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt870.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt870.kt new file mode 100644 index 00000000000..9dde0366a40 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt870.kt @@ -0,0 +1,5 @@ +fun box() = when { + 1 > 2 -> "false" + 1 >= 1 -> "OK" + else -> "else" + } diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt new file mode 100644 index 00000000000..99f0849c513 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun testOr(b: Boolean): Boolean { + return b || return !b; +} + +fun testOr(): Boolean { + return true || return false; +} + + +fun testAnd(b: Boolean): Boolean { + return b && return !b; +} + +fun testAnd(): Boolean { + return true && return false; +} + +fun box(): String { + if (testOr(false) != true) return "fail 1" + if (testOr(true) != true) return "fail 2" + if (testAnd(false) != false) return "fail 3" + if (testAnd(true) != false) return "fail 4" + if (testOr() != true) return "fail 5" + if (testAnd() != false) return "fail 6" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt new file mode 100644 index 00000000000..f7ee695a931 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + var cycle = true; + while (true) { + if (true || throw java.lang.RuntimeException()) { + return "OK" + } + } + return "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt910.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt910.kt new file mode 100644 index 00000000000..a9226bbdba2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt910.kt @@ -0,0 +1,21 @@ +fun foo() : Int = + try { + 2 + } + finally { + "s" + } + +fun bar(set : MutableSet) : Set = + try { + set + } + finally { + set.add(42) + } + +fun box() : String { + if (foo() != 2) return "fail 1" + val s = bar(HashSet()) + return if (s.contains(42)) "OK" else "fail 2" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt958.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt958.kt new file mode 100644 index 00000000000..f32079bfb69 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt958.kt @@ -0,0 +1,3 @@ +fun test() = 239 + +fun box() = if(test() in 239..240) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/longRange.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/longRange.kt new file mode 100644 index 00000000000..b1ab17ee093 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/longRange.kt @@ -0,0 +1,8 @@ +fun box(): String { + val r = 1.toLong()..2 + var s = "" + for (l in r) { + s += l + } + return if (s == "12") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/quicksort.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/quicksort.kt new file mode 100644 index 00000000000..381a8cf44bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/quicksort.kt @@ -0,0 +1,41 @@ +fun IntArray.swap(i:Int, j:Int) { + val temp = this[i] + this[i] = this[j] + this[j] = temp +} + +fun IntArray.quicksort() = quicksort(0, size-1) + +fun IntArray.quicksort(L: Int, R:Int) { + val m = this[(L + R) / 2] + var i = L + var j = R + while (i <= j) { + while (this[i] < m) + i++ + while (this[j] > m) + j-- + if (i <= j) { + swap(i++, j--) + } + else { + } + } + if (L < j) + quicksort(L, j) + if (R > i) + quicksort(i, R) +} + +fun box() : String { + val a = IntArray(10) + for(i in 0..4) { + a[2*i] = 2*i + a[2*i+1] = -2*i-1 + } + a.quicksort() + for(i in 0..a.size-2) { + if (a[i] > a[i+1]) return "Fail $i: ${a[i]} > ${a[i+1]}" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/ifElse.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/ifElse.kt new file mode 100644 index 00000000000..98d5401d12e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/ifElse.kt @@ -0,0 +1,14 @@ +var flag = true + +fun exit(): Nothing = null!! + +fun box(): String { + val a: String + if (flag) { + a = "OK" + } + else { + exit() + } + return a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/inlineMethod.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/inlineMethod.kt new file mode 100644 index 00000000000..5ec5f8feff2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/inlineMethod.kt @@ -0,0 +1,12 @@ +inline fun exit(): Nothing = null!! + +fun box(): String { + val a: String + try { + a = "OK" + } + catch (e: Exception) { + exit() + } + return a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/propertyGetter.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/propertyGetter.kt new file mode 100644 index 00000000000..1b69f5b1b66 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/propertyGetter.kt @@ -0,0 +1,16 @@ +var flag = true + +object Test { + val magic: Nothing get() = null!! +} + +fun box(): String { + val a: String + if (flag) { + a = "OK" + } + else { + Test.magic + } + return a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/tryCatch.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/tryCatch.kt new file mode 100644 index 00000000000..bc23f5cb748 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/tryCatch.kt @@ -0,0 +1,12 @@ +fun exit(): Nothing = null!! + +fun box(): String { + val a: String + try { + a = "OK" + } + catch (e: Exception) { + exit() + } + return a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/when.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/when.kt new file mode 100644 index 00000000000..e4953bb6e3c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/when.kt @@ -0,0 +1,14 @@ +fun exit(): Nothing = null!! + +var x = 0 + +fun box(): String { + val a: String + when (x) { + 0 -> a = "OK" + 1 -> a = "???" + 2 -> exit() + else -> exit() + } + return a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchFinallyChain.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchFinallyChain.kt new file mode 100644 index 00000000000..b0ee1f314dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchFinallyChain.kt @@ -0,0 +1,19 @@ +fun box() : String { + try { + } finally { + try { + try { + } finally { + try { + } finally { + } + } + } catch (e: Exception) { + try { + } catch (f: Exception) { + } finally { + } + } + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/catch.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/catch.kt new file mode 100644 index 00000000000..cb00faf1fe3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/catch.kt @@ -0,0 +1,2 @@ +fun box(): String = + "O" + try { throw Exception("oops!") } catch (e: Exception) { "K" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/complexChain.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/complexChain.kt new file mode 100644 index 00000000000..36f2e84f29f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/complexChain.kt @@ -0,0 +1,52 @@ +fun cleanup() {} + +inline fun concat(x: String, y: String): String = x + y + +inline fun throws() { + try { + throw Exception() + } + finally { + cleanup() + } +} + +inline fun first(x: String, y: String): String = x + +fun box(): String = + "" + concat( + try { "" } finally { "0" }, + "" + concat( + first( + try { + try { + "O" + } + finally { + "1" + } + } + catch (e: Exception) { + throw e + } + finally { + cleanup() + }, + "2" + ), + first( + try { + throws() + throw Exception() + "3" + } + catch (e: Exception) { + "K" + } + finally { + cleanup() + }, + "4" + ) + ) + ) diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/deadTryCatch.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/deadTryCatch.kt new file mode 100644 index 00000000000..41a91a17e08 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/deadTryCatch.kt @@ -0,0 +1,26 @@ +inline fun catchAll(x: String, block: () -> Unit): String { + try { + block() + } catch (e: Throwable) { + } + return x +} + +inline fun tryTwice(block: () -> Unit) { + try { + block() + try { + block() + } catch (e: Exception) { + } + } catch (e: Exception) { + } +} + +fun box(): String { + return catchAll("OK") { + tryTwice { + throw Exception() + } + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt new file mode 100644 index 00000000000..645de5f06e1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(b: Byte, s: String, i: Int, d: Double, li: Long): String = "$b $s $i $d $li" + +fun box(): String { + val test = foo(1, "abc", 1, 1.0, try { 1L } catch (e: Exception) { 10L }) + if (test != "1 abc 1 1.0 1") return "Failed, test==$test" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/expectException.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/expectException.kt new file mode 100644 index 00000000000..63bd4900c12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/expectException.kt @@ -0,0 +1,35 @@ +public inline fun fails(block: () -> Unit): Throwable? { + var thrown: Throwable? = null + try { + block() + } catch (e: Throwable) { + thrown = e + } + if (thrown == null) + throw Exception("Expected an exception to be thrown") + return thrown +} + +public inline fun throwIt(msg: String) { + throw Exception(msg) +} + +fun box(): String { + fails { + throwIt("oops!") + } + + var x = 0 + try { + fails { + x = 1 + } + } + catch (e: Exception) { + x = 2 + } + + if (x != 2) return "Failed: x==$x" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/finally.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/finally.kt new file mode 100644 index 00000000000..2d4b9f825a7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/finally.kt @@ -0,0 +1,2 @@ +fun box(): String = + "O" + try { "K" } finally { "hmmm" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryCatch.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryCatch.kt new file mode 100644 index 00000000000..dd3a181348a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryCatch.kt @@ -0,0 +1,17 @@ +inline fun tryOrElse(f1: () -> T, f2: () -> T): T { + try { + return f1() + } + catch (e: Exception) { + return f2() + } +} + +fun testIt() = "abc" + tryOrElse({ "def" }, { "oops" }) + "ghi" + +fun box(): String { + val test = testIt() + if (test != "abcdefghi") return "Failed, test==$test" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryExpr.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryExpr.kt new file mode 100644 index 00000000000..8205200452a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryExpr.kt @@ -0,0 +1,14 @@ +inline fun tryOrElse(f1: () -> T, f2: () -> T): T = + try { f1() } catch (e: Exception) { f2() } + +fun testIt() = + "abc" + + tryOrElse({ try { "def" } catch(e: Exception) { "oops!" } }, { "hmmm..." }) + + "ghi" + +fun box(): String { + val test = testIt() + if (test != "abcdefghi") return "Failed, test==$test" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryFinally.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryFinally.kt new file mode 100644 index 00000000000..eb488beb689 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryFinally.kt @@ -0,0 +1,22 @@ +inline fun tryAndThen(f1: () -> Unit, f2: () -> Unit, f3: () -> T): T { + try { + f1() + } + catch (e: Exception) { + f2() + } + finally { + return f3() + } +} + +fun testIt() = "abc" + + tryAndThen({}, {}, { "def" }) + + "ghi" + +fun box(): String { + val test = testIt() + if (test != "abcdefghi") return "Failed, test==$test" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt8608.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt8608.kt new file mode 100644 index 00000000000..1d0b92b2c09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt8608.kt @@ -0,0 +1,30 @@ +interface Callable { + fun call(b: Boolean) +} + +inline fun run(f: () -> Unit) { f() } + +class A { + fun foo(): String { + run { + val x = object : Callable { + override fun call(b: Boolean) { + if (b) { + x() + } else { + try { + x() + } catch(t: Throwable) { + } + } + } + } + } + return "OK" + } + + private fun x() {} +} + +fun box(): String = + A().foo() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt9644try.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt9644try.kt new file mode 100644 index 00000000000..63921992a06 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/kt9644try.kt @@ -0,0 +1,21 @@ +inline fun doCall(f: () -> Any) = f() + +fun test1() { + val localResult = doCall { + try { "1" } catch (e: Exception) { "2" } + return + } +} + +fun test2(): String { + val localResult = doCall { + try { "1" } catch (e: Exception) { "2" } + return@test2 "OK" + } + return "Hmmm..." +} + +fun box(): String { + test1() + return test2() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt new file mode 100644 index 00000000000..4d1bf16a733 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt @@ -0,0 +1,20 @@ +class Exception1(msg: String): Exception(msg) +class Exception2(msg: String): Exception(msg) +class Exception3(msg: String): Exception(msg) + +fun box(): String = + "O" + try { + throw Exception3("K") + } + catch (e1: Exception1) { + "e1" + } + catch (e2: Exception2) { + "e2" + } + catch (e3: Exception3) { + e3.message + } + catch (e: Exception) { + "e" + } diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTry.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTry.kt new file mode 100644 index 00000000000..c60bde586a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTry.kt @@ -0,0 +1,25 @@ +inline fun test(s: () -> Int): Int = + try { + val i = s() + i + 10 + } + finally { + 0 + } + +fun box() : String { + test { + try { + val p = 1 + return "OK" + } + catch(e: Exception) { + -2 + } + finally { + -3 + } + } + + return "Failed" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner1.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner1.kt new file mode 100644 index 00000000000..bbf5ad07064 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner1.kt @@ -0,0 +1,11 @@ +fun shouldReturnFalse() : Boolean { + try { + return true + } finally { + if (true) + return false + } +} + +fun box(): String = + if (shouldReturnFalse()) "Failed" else "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner2.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner2.kt new file mode 100644 index 00000000000..7c0c3e81c55 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner2.kt @@ -0,0 +1,22 @@ +fun shouldReturn11() : Int { + var x = 0 + while (true) { + try { + if(x < 10) + x++ + else + break + } + finally { + x++ + } + } + return x +} + +fun box(): String { + val test = shouldReturn11() + if (test != 11) return "Failed, test=$test" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/try.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/try.kt new file mode 100644 index 00000000000..695e324988e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/try.kt @@ -0,0 +1,2 @@ +fun box(): String = + "O" + try { "K" } catch (e: Exception) { "oops!" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAfterTry.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAfterTry.kt new file mode 100644 index 00000000000..7d6dcc3d2a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAfterTry.kt @@ -0,0 +1,4 @@ +fun box(): String = + "" + + try { "O" } catch (e: Exception) { "1" } + + try { throw Exception("oops!") } catch (e: Exception) { "K" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndBreak.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndBreak.kt new file mode 100644 index 00000000000..a1f867b1c3d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndBreak.kt @@ -0,0 +1,19 @@ +fun idiv(a: Int, b: Int): Int = + if (b == 0) throw Exception("Division by zero") else a / b + +fun foo(): Int { + var sum = 0 + var i = 2 + while (i > -10) { + sum += try { idiv(100, i) } catch (e: Exception) { break } + i-- + } + return sum +} + +fun box(): String { + val test = foo() + if (test != 150) return "Failed, test=$test" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndContinue.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndContinue.kt new file mode 100644 index 00000000000..120d463b00c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndContinue.kt @@ -0,0 +1,17 @@ +fun idiv(a: Int, b: Int): Int = + if (b == 0) throw Exception("Division by zero") else a / b + +fun foo(): Int { + var sum = 0 + for (i in -10 .. 10) { + sum += try { idiv(100, i) } catch (e: Exception) { continue } + } + return sum +} + +fun box(): String { + val test = foo() + if (test != 0) return "Failed, test=$test" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideCatch.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideCatch.kt new file mode 100644 index 00000000000..09f9857b57c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideCatch.kt @@ -0,0 +1,8 @@ +fun box(): String = + "O" + + try { + throw Exception("oops!") + } + catch (e: Exception) { + try { "K" } catch (e: Exception) { "2" } + } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideTry.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideTry.kt new file mode 100644 index 00000000000..3d1ccd9e7ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideTry.kt @@ -0,0 +1,10 @@ +class MyException(message: String): Exception(message) + +fun box(): String = + "O" + + try { + try { throw Exception("oops!") } catch (mye: MyException) { "1" } + } + catch (e: Exception) { + "K" + } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt new file mode 100644 index 00000000000..015b4137f65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt @@ -0,0 +1,17 @@ +inline fun catchAll(x: String, block: () -> Unit): String { + try { + block() + } catch (e: Throwable) { + } + return x +} + +inline fun throwIt(msg: String) { + throw Exception(msg) +} + +inline fun bar(x: String): String = + x + catchAll("") { throwIt("oops!") } + +fun box(): String = + bar("OK") diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/asyncIterator.kt b/backend.native/tests/external/codegen/blackbox/coroutines/asyncIterator.kt new file mode 100644 index 00000000000..027eeb08845 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/asyncIterator.kt @@ -0,0 +1,121 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +interface AsyncGenerator { + suspend fun yield(value: T) +} + +interface AsyncSequence { + operator fun iterator(): AsyncIterator +} + +interface AsyncIterator { + operator suspend fun hasNext(): Boolean + operator suspend fun next(): T +} + +fun asyncGenerate(block: suspend AsyncGenerator.() -> Unit): AsyncSequence = object : AsyncSequence { + override fun iterator(): AsyncIterator { + val iterator = AsyncGeneratorIterator() + iterator.nextStep = block.createCoroutine(receiver = iterator, completion = iterator) + return iterator + } +} + +class AsyncGeneratorIterator: AsyncIterator, AsyncGenerator, Continuation { + var computedNext = false + var nextValue: T? = null + var nextStep: Continuation? = null + + // if (computesNext) computeContinuation is Continuation + // if (!computesNext) computeContinuation is Continuation + var computesNext = false + var computeContinuation: Continuation<*>? = null + + suspend fun computeHasNext(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + computesNext = false + computeContinuation = c + nextStep!!.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } + + suspend fun computeNext(): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + computesNext = true + computeContinuation = c + nextStep!!.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } + + @Suppress("UNCHECKED_CAST") + fun resumeIterator(exception: Throwable?) { + if (exception != null) { + done() + computeContinuation!!.resumeWithException(exception) + return + } + if (computesNext) { + computedNext = false + (computeContinuation as Continuation).resume(nextValue as T) + } else { + (computeContinuation as Continuation).resume(nextStep != null) + } + } + + override suspend fun hasNext(): Boolean { + if (!computedNext) return computeHasNext() + return nextStep != null + } + + override suspend fun next(): T { + if (!computedNext) return computeNext() + computedNext = false + return nextValue as T + } + + private fun done() { + computedNext = true + nextStep = null + } + + // Completion continuation implementation + override fun resume(value: Unit) { + done() + resumeIterator(null) + } + + override fun resumeWithException(exception: Throwable) { + done() + resumeIterator(exception) + } + + // Generator implementation + override suspend fun yield(value: T): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + computedNext = true + nextValue = value + nextStep = c + resumeIterator(null) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + val seq = asyncGenerate { + yield("O") + yield("K") + } + + var res = "" + + builder { + for (i in seq) { + res += i + } + } + + return res +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/await.kt b/backend.native/tests/external/codegen/blackbox/coroutines/await.kt new file mode 100644 index 00000000000..093436eb720 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/await.kt @@ -0,0 +1,115 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// FILE: promise.kt +import kotlin.coroutines.* + +class Promise(private val executor: ((T) -> Unit) -> Unit) { + private var value: Any? = null + private var thenList: MutableList<(T) -> Unit>? = mutableListOf() + + init { + executor { + value = it + for (resolve in thenList!!) { + resolve(it) + } + thenList = null + } + } + + fun then(onFulfilled: (T) -> S): Promise { + return Promise { resolve -> + if (thenList != null) { + thenList!!.add { resolve(onFulfilled(it)) } + } + else { + resolve(onFulfilled(value as T)) + } + } + } +} + +// FILE: queue.kt + +private val queue = mutableListOf<() -> Unit>() + +fun postpone(computation: () -> T): Promise { + return Promise { resolve -> + queue += { + resolve(computation()) + } + } +} + +fun processQueue() { + while (queue.isNotEmpty()) { + queue.removeAt(0)() + } +} + +// FILE: await.kt +import kotlin.coroutines.* + +private var log = "" + +private var inAwait = false + +suspend fun await(value: Promise): S = suspendCoroutine { continuation -> + if (inAwait) { + throw IllegalStateException("Can't call await recursively") + } + inAwait = true + postpone { + value.then { result -> + continuation.resume(result) + } + } + inAwait = false + CoroutineIntrinsics.SUSPENDED +} + +suspend fun awaitAndLog(value: Promise): S { + log += "before await;" + return await(value.then { result -> + log += "after await: $result;" + result + }) +} + +fun async(c: suspend () -> T): Promise { + return Promise { resolve -> + c.startCoroutine(handleResultContinuation(resolve)) + } +} + +fun asyncOperation(resultSupplier: () -> T) = Promise { resolve -> + log += "before async;" + postpone { + val result = resultSupplier() + log += "after async $result;" + resolve(result) + } +} + +fun getLog() = log + +// FILE: main.kt +import kotlin.coroutines.* + +private fun test() = async { + val o = await(asyncOperation { "O" }) + val k = awaitAndLog(asyncOperation { "K" }) + return@async o + k +} + +fun box(): String { + val resultPromise = test() + var result: String? = null + resultPromise.then { result = it } + processQueue() + + if (result != "OK") return "fail1: $result" + if (getLog() != "before async;after async O;before async;before await;after async K;after await: K;") return "fail2: ${getLog()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/beginWithException.kt b/backend.native/tests/external/codegen/blackbox/coroutines/beginWithException.kt new file mode 100644 index 00000000000..bcc6ec8b478 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/beginWithException.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): Any = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> } + +fun builder(c: suspend () -> Unit) { + var exception: Throwable? = null + + c.createCoroutine(object : Continuation { + override fun resume(data: Unit) { + } + + override fun resumeWithException(e: Throwable) { + exception = e + } + }).resumeWithException(RuntimeException("OK")) + + if (exception?.message != "OK") { + throw RuntimeException("Unexpected result: ${exception?.message}") + } +} + +fun box(): String { + var result = "OK" + builder { + suspendHere() + result = "fail 1" + } + + builder { + result = "fail 2" + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/beginWithExceptionNoHandleException.kt b/backend.native/tests/external/codegen/blackbox/coroutines/beginWithExceptionNoHandleException.kt new file mode 100644 index 00000000000..fc1142ec9a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/beginWithExceptionNoHandleException.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* +suspend fun suspendHere(): Any = CoroutineIntrinsics.suspendCoroutineOrReturn { x ->} + +fun builder(c: suspend () -> Unit) { + try { + c.createCoroutine(EmptyContinuation).resumeWithException(RuntimeException("OK")) + } + catch(e: Exception) { + if (e?.message != "OK") { + throw RuntimeException("Unexpected result: ${e?.message}") + } + return + } + + throw RuntimeException("Exception must be thrown above") +} + +fun box(): String { + var result = "OK" + builder { + suspendHere() + result = "fail 1" + } + + builder { + result = "fail 2" + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/coercionToUnit.kt b/backend.native/tests/external/codegen/blackbox/coroutines/coercionToUnit.kt new file mode 100644 index 00000000000..ac01525766c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/coercionToUnit.kt @@ -0,0 +1,47 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +suspend fun await(t: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(t) + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit): String { + var result = "fail" + c.startCoroutine(handleResultContinuation { + result = "OK" + }) + return result +} + +var TRUE = true +var FALSE = false +fun box(): String { + val r1 = builder { await(Unit) } + if (r1 != "OK") return "fail 1" + + val r2 = builder { + if (await(1) != 1) throw RuntimeException("fail1") + + if (TRUE) return@builder + } + if (r2 != "OK") return "fail 2" + + val r3 = builder { + if (await(1) != 1) throw RuntimeException("fail2") + + if (FALSE) return@builder + } + if (r3 != "OK") return "fail 3" + + val r4 = builder { + if (await(1) != 1) throw RuntimeException("fail3") + + return@builder + } + if (r4 != "OK") return "fail 4" + + return builder { await(1) } +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakFinally.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakFinally.kt new file mode 100644 index 00000000000..d49e8c0179c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakFinally.kt @@ -0,0 +1,55 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + val value = builder { + try { + outer@for (x in listOf("A", "B")) { + try { + result += suspendWithResult(x) + for (y in listOf("C", "D")) { + try { + result += suspendWithResult(y) + if (y == "D") { + break@outer + } + } + finally { + result += "!" + } + result += "E" + } + } + finally { + result += "@" + } + result += "ignore" + } + result += "*" + } + finally { + result += "finally" + } + result += "." + } + if (value != "AC!ED!@*finally.") return "fail: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakStatement.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakStatement.kt new file mode 100644 index 00000000000..8aff6f5a2ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/breakStatement.kt @@ -0,0 +1,51 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + var value = builder { + outer@for (x in listOf("O", "K")) { + result += suspendWithResult(x) + for (y in listOf("Q", "W")) { + result += suspendWithResult(y) + if (y == "W") { + break@outer + } + } + } + result += "." + } + if (value != "OQW.") return "fail: break outer loop: $value" + + value = builder { + for (x in listOf("O", "K")) { + result += suspendWithResult(x) + for (y in listOf("Q", "W")) { + if (y == "W") { + break + } + result += suspendWithResult(y) + } + } + result += "." + } + if (value != "OQKQ.") return "fail: break inner loop: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/doWhileStatement.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/doWhileStatement.kt new file mode 100644 index 00000000000..932fc621dd7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/doWhileStatement.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + var value = builder { + var x = 1 + do { + result += x + } while (suspendWithResult(x++) < 3) + result += "." + } + if (value != "123.") return "fail: suspend as do..while condition: $value" + + value = builder { + var x = 1 + do { + result += suspendWithResult(x) + result += ";" + } while (x++ < 3) + result += "." + } + if (value != "1;2;3;.") return "fail: suspend in do..while body: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forContinue.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forContinue.kt new file mode 100644 index 00000000000..e1ff99af922 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forContinue.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + val value = builder { + for (x in listOf("O", "$", "K")) { + if (x == "$") continue + result += suspendWithResult(x) + } + result += "." + } + if (value != "OK.") return "fail: suspend in for body: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forStatement.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forStatement.kt new file mode 100644 index 00000000000..5de02f0b5f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/forStatement.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + val value = builder { + for (x in listOf("O", "K")) { + result += suspendWithResult(x) + } + result += "." + } + if (value != "OK.") return "fail: suspend in for body: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/ifStatement.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/ifStatement.kt new file mode 100644 index 00000000000..e7816fb694f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/ifStatement.kt @@ -0,0 +1,76 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + var value = builder { + if (suspendWithResult(true)) { + result = "OK" + } + } + if (value != "OK") return "fail: suspend as if condition: $value" + + value = builder { + for (x in listOf(true, false)) { + if (x) { + result += suspendWithResult("O") + } + else { + result += "K" + } + } + } + if (value != "OK") return "fail: suspend in then branch: $value" + + value = builder { + for (x in listOf(true, false)) { + if (x) { + result += "O" + } + else { + result += suspendWithResult("K") + } + } + } + if (value != "OK") return "fail: suspend in else branch: $value" + + value = builder { + for (x in listOf(true, false)) { + if (x) { + result += suspendWithResult("O") + } + else { + result += suspendWithResult("K") + } + } + } + if (value != "OK") return "fail: suspend in both branches: $value" + + value = builder { + for (x in listOf(true, false)) { + if (x) { + result += suspendWithResult("O") + } + result += ";" + } + } + if (value != "O;;") return "fail: suspend in then branch without else: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/returnFromFinally.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/returnFromFinally.kt new file mode 100644 index 00000000000..2453c6947b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/returnFromFinally.kt @@ -0,0 +1,46 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +// Does not work in JVM backend, probably due to bug. It's not clear which behaviour is right. +// TODO: fix the bug and enable for JVM backend +// TARGET_BACKEND: JS + +class Controller { + var result = "" + + suspend fun suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + result += "suspend($value);" + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> String): String { + val controller = Controller() + c.startCoroutine(controller, handleResultContinuation { + controller.result += "return($it);" + }) + return controller.result +} + +fun id(value: T) = value + +fun box(): String { + val value = builder { + try { + if (id(23) == 23) { + return@builder suspendAndLog("OK") + } + } + finally { + result += "finally;" + } + result += "afterFinally;" + "shouldNotReach" + } + if (value != "suspend(OK);finally;return(OK);") return "fail: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/switchLikeWhen.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/switchLikeWhen.kt new file mode 100644 index 00000000000..cf386e60c97 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/switchLikeWhen.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + result += "[" + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + var value = builder { + for (v in listOf("A", "B", "C")) { + when (v) { + "A" -> result += "A;" + "B" -> result += suspendWithResult(v) + "]" + else -> result += suspendWithResult(v) + "]!" + } + } + } + if (value != "A;B]C]!") return "fail: suspend as if condition: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwFromCatch.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwFromCatch.kt new file mode 100644 index 00000000000..ce70aa13d49 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwFromCatch.kt @@ -0,0 +1,59 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + result += "suspend($value);" + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } + + // Tail calls are not allowed to be Nothing typed. See KT-15051 + suspend fun suspendLogAndThrow(exception: Throwable): Any? = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + result += "throw(${exception.message});" + c.resumeWithException(exception) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, object : Continuation { + override fun resume(data: Unit) { + + } + + override fun resumeWithException(exception: Throwable) { + controller.result += "caught(${exception.message});" + } + }) + + return controller.result +} + +fun box(): String { + val value = builder { + try { + try { + suspendAndLog("1") + suspendLogAndThrow(RuntimeException("exception")) + } + catch (e: RuntimeException) { + suspendAndLog("caught") + suspendLogAndThrow(RuntimeException("fromCatch")) + } + } finally { + suspendAndLog("finally") + } + suspendAndLog("ignore") + } + if (value != "suspend(1);throw(exception);suspend(caught);throw(fromCatch);suspend(finally);caught(fromCatch);") { + return "fail: $value" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwInTryWithHandleResult.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwInTryWithHandleResult.kt new file mode 100644 index 00000000000..6fd8bd06afd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/throwInTryWithHandleResult.kt @@ -0,0 +1,43 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + result += "suspend($value);" + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, object : Continuation { + override fun resume(data: Unit) {} + + override fun resumeWithException(exception: Throwable) { + controller.result += "ignoreCaught(${exception.message});" + } + }) + return controller.result +} + +fun box(): String { + val value = builder { + try { + suspendAndLog("before") + throw RuntimeException("foo") + } catch (e: RuntimeException) { + result += "caught(${e.message});" + } + suspendAndLog("after") + } + if (value != "suspend(before);caught(foo);suspend(after);") { + return "fail: $value" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/whileStatement.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/whileStatement.kt new file mode 100644 index 00000000000..bfd9670c2c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/whileStatement.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var result = "" + + suspend fun suspendWithResult(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + c.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + return controller.result +} + +fun box(): String { + var value = builder { + var x = 1 + while (suspendWithResult(x) <= 3) { + result += x++ + } + result += "." + } + if (value != "123.") return "fail: suspend as while condition: $value" + + value = builder { + var x = 1 + while (x <= 3) { + result += suspendWithResult(x++) + result += ";" + } + result += "." + } + if (value != "1;2;3;.") return "fail: suspend in while body: $value" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controllerAccessFromInnerLambda.kt b/backend.native/tests/external/codegen/blackbox/coroutines/controllerAccessFromInnerLambda.kt new file mode 100644 index 00000000000..d2ce1e4b381 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controllerAccessFromInnerLambda.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var result = false + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } + + fun foo() { + result = true + } +} + +fun builder(c: suspend Controller.() -> Unit) { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation) + if (!controller.result) throw RuntimeException("fail") +} + +fun noinlineRun(block: () -> Unit) { + block() +} + +fun box(): String { + builder { + if (suspendHere() != "OK") { + throw RuntimeException("fail 1") + } + noinlineRun { + foo() + } + + if (suspendHere() != "OK") { + throw RuntimeException("fail 2") + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/defaultParametersInSuspend.kt b/backend.native/tests/external/codegen/blackbox/coroutines/defaultParametersInSuspend.kt new file mode 100644 index 00000000000..c6feea4f052 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/defaultParametersInSuspend.kt @@ -0,0 +1,46 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(a: String = "abc", i: Int = 2): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(a + "#" + (i + 1)) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "OK" + + builder { + var a = suspendHere() + if (a != "abc#3") { + result = "fail 1: $a" + throw RuntimeException(result) + } + + a = suspendHere("cde") + if (a != "cde#3") { + result = "fail 2: $a" + throw RuntimeException(result) + } + + a = suspendHere(i = 6) + if (a != "abc#7") { + result = "fail 3: $a" + throw RuntimeException(result) + } + + a = suspendHere("xyz", 9) + if (a != "xyz#10") { + result = "fail 4: $a" + throw RuntimeException(result) + } + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/dispatchResume.kt b/backend.native/tests/external/codegen/blackbox/coroutines/dispatchResume.kt new file mode 100644 index 00000000000..c09f21dec45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/dispatchResume.kt @@ -0,0 +1,69 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var log = "" + var resumeIndex = 0 + + suspend fun suspendWithValue(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation -> + log += "suspend($value);" + continuation.resume(value) + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(value: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { continuation -> + log += "error($value);" + continuation.resumeWithException(RuntimeException(value)) + CoroutineIntrinsics.SUSPENDED + } +} + +fun test(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, EmptyContinuation, object: ContinuationDispatcher { + private fun dispatchResume(block: () -> Unit) { + val id = controller.resumeIndex++ + controller.log += "before $id;" + block() + controller.log += "after $id;" + } + + override fun

dispatchResume(data: P, continuation: Continuation

): Boolean { + dispatchResume { + continuation.resume(data) + } + return true + } + + override fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean { + dispatchResume { + continuation.resumeWithException(exception) + } + return true + } + }) + return controller.log +} + +fun box(): String { + var result = test { + val o = suspendWithValue("O") + val k = suspendWithValue("K") + log += "$o$k;" + } + if (result != "before 0;suspend(O);before 1;suspend(K);before 2;OK;after 2;after 1;after 0;") return "fail1: $result" + + result = test { + try { + suspendWithException("OK") + log += "ignore;" + } + catch (e: RuntimeException) { + log += "${e.message};" + } + } + if (result != "before 0;error(OK);before 1;OK;after 1;after 0;") return "fail2: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/emptyClosure.kt b/backend.native/tests/external/codegen/blackbox/coroutines/emptyClosure.kt new file mode 100644 index 00000000000..9a648c512c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/emptyClosure.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var result = 0 + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + result++ + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } +} + + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + + for (i in 1..3) { + builder { + if (suspendHere() != "OK") throw RuntimeException("fail 1") + } + } + + if (result != 3) return "fail 2: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/falseUnitCoercion.kt b/backend.native/tests/external/codegen/blackbox/coroutines/falseUnitCoercion.kt new file mode 100644 index 00000000000..a2a1d712017 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/falseUnitCoercion.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(v: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +var result: Any = "" + +fun foo(v: T) { + builder { + val r = suspendHere(v) + suspendHere("") + result = r + } +} + +fun box(): String { + foo("OK") + return result as String +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/generate.kt b/backend.native/tests/external/codegen/blackbox/coroutines/generate.kt new file mode 100644 index 00000000000..47c94806875 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/generate.kt @@ -0,0 +1,59 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// FULL_JDK +import kotlin.coroutines.* + +fun box(): String { + val x = gen().joinToString() + if (x != "1, 2") return "fail1: $x" + + val y = gen().joinToString() + if (y != "-1") return "fail2: $y" + return "OK" +} + +var was = false + +fun gen() = generate { + if (was) { + yield(-1) + return@generate + } + for (i in 1..2) { + yield(i) + } + was = true +} + +// LIBRARY CODE +interface Generator { + suspend fun yield(value: T) +} + +fun generate(block: suspend Generator.() -> Unit): Sequence = GeneratedSequence(block) + +class GeneratedSequence(private val block: suspend Generator.() -> Unit) : Sequence { + override fun iterator(): Iterator = GeneratedIterator(block) +} + +class GeneratedIterator(block: suspend Generator.() -> Unit) : AbstractIterator(), Generator { + private var nextStep: Continuation = block.createCoroutine(this, object : Continuation { + override fun resume(data: Unit) { + done() + } + + override fun resumeWithException(exception: Throwable) { + throw exception + } + }) + + override fun computeNext() { + nextStep.resume(Unit) + } + suspend override fun yield(value: T) = CoroutineIntrinsics.suspendCoroutineOrReturn { c -> + setNext(value) + nextStep = c + + CoroutineIntrinsics.SUSPENDED + } +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/handleException.kt b/backend.native/tests/external/codegen/blackbox/coroutines/handleException.kt new file mode 100644 index 00000000000..56935d5bbeb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/handleException.kt @@ -0,0 +1,80 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var exception: Throwable? = null + val postponedActions = ArrayList<() -> Unit>() + + suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resume(v) + } + + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resumeWithException(e) + } + + CoroutineIntrinsics.SUSPENDED + } + + fun run(c: suspend Controller.() -> Unit) { + c.startCoroutine(this, handleExceptionContinuation { + exception = it + }) + while (postponedActions.isNotEmpty()) { + postponedActions[0]() + postponedActions.removeAt(0) + } + } +} + +fun builder(c: suspend Controller.() -> Unit) { + val controller = Controller() + controller.run(c) + + if (controller.exception?.message != "OK") { + throw RuntimeException("Unexpected result: ${controller.exception?.message}") + } +} + +fun commonThrow(t: Throwable) { + throw t +} + +fun box(): String { + builder { + throw RuntimeException("OK") + } + + builder { + commonThrow(RuntimeException("OK")) + } + + builder { + suspendWithException(RuntimeException("OK")) + } + + builder { + try { + suspendWithException(RuntimeException("fail 1")) + } catch (e: RuntimeException) { + suspendWithException(RuntimeException("OK")) + } + } + + builder { + try { + suspendWithException(Exception("OK")) + } catch (e: RuntimeException) { + suspendWithException(RuntimeException("fail 3")) + throw RuntimeException("fail 4") + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/handleResultCallEmptyBody.kt b/backend.native/tests/external/codegen/blackbox/coroutines/handleResultCallEmptyBody.kt new file mode 100644 index 00000000000..2efaebac409 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/handleResultCallEmptyBody.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +fun builder(c: suspend () -> Unit): String { + var ok = false + c.startCoroutine(handleResultContinuation { + ok = true + }) + if (!ok) throw RuntimeException("Was not called") + return "OK" +} + +fun unitFun() {} + +fun box(): String { + return builder {} +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/handleResultNonUnitExpression.kt b/backend.native/tests/external/codegen/blackbox/coroutines/handleResultNonUnitExpression.kt new file mode 100644 index 00000000000..0943e13080a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/handleResultNonUnitExpression.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + var isCompleted = false + c.startCoroutine(handleResultContinuation { + isCompleted = true + }) + if (!isCompleted) throw RuntimeException("fail") +} + +fun box(): String { + builder { + "OK" + } + + builder { + suspendHere() + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/handleResultSuspended.kt b/backend.native/tests/external/codegen/blackbox/coroutines/handleResultSuspended.kt new file mode 100644 index 00000000000..c97385948e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/handleResultSuspended.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var log = "" + + suspend fun suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + log += "suspend($value);" + x.resume(value) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> String): String { + val controller = Controller() + c.startCoroutine(controller, handleResultContinuation { + controller.log += "return($it);" + }) + return controller.log +} + +fun box(): String { + val result = builder { suspendAndLog("OK") } + + if (result != "suspend(OK);return(OK);") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/illegalState.kt b/backend.native/tests/external/codegen/blackbox/coroutines/illegalState.kt new file mode 100644 index 00000000000..88cb58acb02 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/illegalState.kt @@ -0,0 +1,63 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// TARGET_BACKEND: JVM +import kotlin.coroutines.* + +suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED +} + +fun builder1(c: suspend () -> Unit) { + (c as Continuation).resume(Unit) +} + +fun builder2(c: suspend () -> Unit) { + val continuation = c.createCoroutine(EmptyContinuation) + val declaredField = continuation.javaClass.superclass.superclass.getDeclaredField("label") + declaredField.setAccessible(true) + declaredField.set(continuation, -3) + continuation.resume(Unit) +} + +fun box(): String { + + try { + builder1 { + suspendHere() + } + return "fail 1" + } catch (e: kotlin.KotlinNullPointerException) { + } + + try { + builder2 { + suspendHere() + } + return "fail 3" + } catch (e: java.lang.IllegalStateException) { + if (e.message != "call to 'resume' before 'invoke' with coroutine") return "fail 4: ${e.message!!}" + } + + var result = "OK" + + try { + builder1 { + result = "fail 5" + } + return "fail 6" + } catch (e: kotlin.KotlinNullPointerException) { + } + + try { + builder2 { + result = "fail 8" + } + return "fail 9" + } catch (e: java.lang.IllegalStateException) { + if (e.message != "call to 'resume' before 'invoke' with coroutine") return "fail 10: ${e.message!!}" + return result + } + + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/inlineSuspendFunction.kt b/backend.native/tests/external/codegen/blackbox/coroutines/inlineSuspendFunction.kt new file mode 100644 index 00000000000..ec2de0105a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/inlineSuspendFunction.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// WITH_REFLECT +// CHECK_NOT_CALLED: suspendInline_61zpoe$ +// CHECK_NOT_CALLED: suspendInline_6r51u9$ +// CHECK_NOT_CALLED: suspendInline +import kotlin.coroutines.* + +class Controller { + fun withValue(v: String, x: Continuation) { + x.resume(v) + } + + suspend inline fun suspendInline(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + withValue(v, x) + CoroutineIntrinsics.SUSPENDED + } + + suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b()) + + suspend inline fun suspendInline(): String = suspendInline({ T::class.simpleName!! }) +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +class OK + +fun box(): String { + var result = "" + + builder { + result = suspendInline("56") + if (result != "56") throw RuntimeException("fail 1") + + result = suspendInline { "57" } + if (result != "57") throw RuntimeException("fail 2") + + result = suspendInline() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/inlinedTryCatchFinally.kt b/backend.native/tests/external/codegen/blackbox/coroutines/inlinedTryCatchFinally.kt new file mode 100644 index 00000000000..43029d735ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/inlinedTryCatchFinally.kt @@ -0,0 +1,160 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var globalResult = "" +var wasCalled = false +class Controller { + val postponedActions = mutableListOf<() -> Unit>() + + suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resume(v) + } + + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resumeWithException(e) + } + + CoroutineIntrinsics.SUSPENDED + } + + fun run(c: suspend Controller.() -> String) { + c.startCoroutine(this, handleResultContinuation { + globalResult = it + }) + while (postponedActions.isNotEmpty()) { + postponedActions[0]() + postponedActions.removeAt(0) + } + } +} + +fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { + val controller = Controller() + + globalResult = "#" + wasCalled = false + if (!expectException) { + controller.run(c) + } + else { + try { + controller.run(c) + globalResult = "fail: exception was not thrown" + } catch (e: Exception) { + globalResult = e.message!! + } + } + + if (!wasCalled) { + throw RuntimeException("fail wasCalled") + } + + if (globalResult != "OK") { + throw RuntimeException("fail $globalResult") + } +} + +fun commonThrow(t: Throwable) { + throw t +} + +inline fun tryCatch(t: () -> String, onException: (Exception) -> String) = + try { + t() + } catch (e: RuntimeException) { + onException(e) + } + +inline fun tryCatchFinally(t: () -> String, onException: (Exception) -> String, f: () -> Unit) = + try { + t() + } catch (e: RuntimeException) { + onException(e) + } finally { + f() + } + +fun box(): String { + builder { + tryCatch( + { + suspendWithValue("") + wasCalled = true + suspendWithValue("OK") + }, + { e -> + suspendWithValue("fail 1") + } + ) + } + + builder { + tryCatch( + { + suspendWithException(RuntimeException("M")) + }, + { e -> + if (e.message != "M") throw RuntimeException("fail 2") + wasCalled = true + suspendWithValue("OK") + } + ) + } + + builder { + tryCatchFinally( + { + suspendWithValue("") + wasCalled = true + suspendWithValue("OK") + }, + { + suspendWithValue("fail 1") + }, + { + suspendWithValue("ignored 1") + wasCalled = true + } + ) + } + + builder { + tryCatchFinally( + { + suspendWithException(RuntimeException("M")) + }, + { e -> + if (e.message != "M") throw RuntimeException("fail 2") + suspendWithValue("OK") + }, + { + suspendWithValue("ignored 2") + wasCalled = true + } + ) + } + + builder { + tryCatchFinally( + { + if (suspendWithValue("56") == "56") return@tryCatchFinally "OK" + suspendWithValue("fail 4") + }, + { + suspendWithValue("fail 5") + }, + { + suspendWithValue("ignored 3") + wasCalled = true + } + ) + } + + return globalResult +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/innerSuspensionCalls.kt b/backend.native/tests/external/codegen/blackbox/coroutines/innerSuspensionCalls.kt new file mode 100644 index 00000000000..19de56f9200 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/innerSuspensionCalls.kt @@ -0,0 +1,40 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var i = 0 + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume((i++).toString()) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result += "-" + result += suspendHere() + + if (result == "-0") { + builder { + result += "+" + result += suspendHere() + result += suspendHere() + result += "#" + } + + result += suspendHere() + result += "&" + } + } + + if (result != "-0+01#1&") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/instanceOfContinuation.kt b/backend.native/tests/external/codegen/blackbox/coroutines/instanceOfContinuation.kt new file mode 100644 index 00000000000..dab09664ad8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/instanceOfContinuation.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// WITH_REFLECT +import kotlin.coroutines.* + +class Controller { + suspend fun runInstanceOf(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + val y: Any = x + x.resume(x is Continuation<*>) + CoroutineIntrinsics.SUSPENDED + } + + suspend fun runCast(): Boolean = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + val y: Any = x + x.resume(Continuation::class.isInstance(y as Continuation<*>)) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = runInstanceOf().toString() + "," + runCast().toString() + } + + if (result != "true,true") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/complicatedMerge.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/complicatedMerge.kt new file mode 100644 index 00000000000..86a5c981bac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/complicatedMerge.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun foo() = true + +private var booleanResult = false +fun setBooleanRes(x: Boolean) { + booleanResult = x +} + +fun box(): String { + builder { + val x = true + val y = false + suspendHere() + setBooleanRes(if (foo()) x else y) + } + + if (!booleanResult) return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/i2bResult.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/i2bResult.kt new file mode 100644 index 00000000000..32eaf28ec3f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/i2bResult.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +private var byteResult: Byte = 0 +fun setByteRes(x: Byte) { + byteResult = x +} + +fun foo(): Int = 1 + +fun box(): String { + builder { + val x: Byte = foo().toByte() + suspendHere() + setByteRes(x) + } + + if (byteResult != 1.toByte()) return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt new file mode 100644 index 00000000000..48bc273b3ea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +private var booleanResult = false +fun setBooleanRes(x: Boolean) { + booleanResult = x +} + +fun box(): String { + builder { + val a = booleanArrayOf(true) + val x = a[0] + suspendHere() + setBooleanRes(x) + } + + if (!booleanResult) return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromByteArray.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromByteArray.kt new file mode 100644 index 00000000000..d9e615db484 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/loadFromByteArray.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +private var byteResult: Byte = 0 +fun setByteRes(x: Byte) { + byteResult = x +} + +fun box(): String { + builder { + val a = byteArrayOf(1) + val x = a[0] + suspendHere() + setByteRes(x) + } + + if (byteResult != 1.toByte()) return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/noVariableInTable.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/noVariableInTable.kt new file mode 100644 index 00000000000..5ba69a2ee1c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/noVariableInTable.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +private var booleanResult = false +fun setBooleanRes(x: Boolean, ignored: Unit) { + booleanResult = x +} + +fun box(): String { + builder { + // 'true' value is spilled into variable and saved to field before suspension point + // It's important that there is no type info about this variable in local var table, + // so we should infer that ICONST_1 is a boolean value from it's usage + setBooleanRes(true, suspendHere()) + } + + if (!booleanResult) return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt new file mode 100644 index 00000000000..87a8b21cbf7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +private var result: String = "" +fun setRes(x: Byte, y: Int) { + result = "$x#$y" +} + +fun foo(): Int = 1 + +fun box(): String { + builder { + val x: Byte = 1 + // No actual cast happens here + val y: Int = x.toInt() + suspendHere() + setRes(x, y) + } + + if (result != "1#1") return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInArrayStore.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInArrayStore.kt new file mode 100644 index 00000000000..96eda9cfad5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInArrayStore.kt @@ -0,0 +1,79 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// TARGET_BACKEND: JVM +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +@JvmField +var booleanResult = booleanArrayOf() +@JvmField +var charResult = charArrayOf() +@JvmField +var byteResult = byteArrayOf() +@JvmField +var shortResult = shortArrayOf() +@JvmField +var intResult = intArrayOf() + +fun box(): String { + builder { + val x = true + suspendHere() + val a = BooleanArray(1) + a[0] = x + booleanResult = a + } + + if (!booleanResult[0]) return "fail 1" + + builder { + val x = '1' + suspendHere() + val a = CharArray(1) + a[0] = x + charResult = a + } + + if (charResult[0] != '1') return "fail 2" + + builder { + val x: Byte = 1 + suspendHere() + val a = ByteArray(1) + a[0] = x + byteResult = a + } + + if (byteResult[0] != 1.toByte()) return "fail 3" + + builder { + val x: Short = 1 + suspendHere() + val a = ShortArray(1) + a[0] = x + shortResult = a + } + + if (shortResult[0] != 1.toShort()) return "fail 4" + + builder { + val x: Int = 1 + suspendHere() + val a = IntArray(1) + a[0] = x + intResult = a + } + + if (intResult[0] != 1) return "fail 5" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInMethodCall.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInMethodCall.kt new file mode 100644 index 00000000000..2de332b53a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInMethodCall.kt @@ -0,0 +1,82 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +private var booleanResult = false +fun setBooleanRes(x: Boolean) { + booleanResult = x +} + +private var charResult: Char = '0' +fun setCharRes(x: Char) { + charResult = x +} + +private var byteResult: Byte = 0 +fun setByteRes(x: Byte) { + byteResult = x +} + +private var shortResult: Short = 0 +fun setShortRes(x: Short) { + shortResult = x +} + +private var intResult: Int = 0 +fun setIntRes(x: Int) { + intResult = x +} + +fun box(): String { + builder { + val x = true + suspendHere() + setBooleanRes(x) + } + + if (!booleanResult) return "fail 1" + + builder { + val x = '1' + suspendHere() + setCharRes(x) + } + + if (charResult != '1') return "fail 2" + + builder { + val x: Byte = 1 + suspendHere() + setByteRes(x) + } + + if (byteResult != 1.toByte()) return "fail 3" + + builder { + val x: Short = 1 + suspendHere() + setShortRes(x) + } + + if (shortResult != 1.toShort()) return "fail 4" + + builder { + val x: Int = 1 + suspendHere() + setIntRes(x) + } + + if (intResult != 1) return "fail 5" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInPutfield.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInPutfield.kt new file mode 100644 index 00000000000..47aeadcf71d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInPutfield.kt @@ -0,0 +1,69 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// TARGET_BACKEND: JVM +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +@JvmField +var booleanResult = false +@JvmField +var charResult: Char = '0' +@JvmField +var byteResult: Byte = 0 +@JvmField +var shortResult: Short = 0 +@JvmField +var intResult: Int = 0 + +fun box(): String { + builder { + val x = true + suspendHere() + booleanResult = x + } + + if (!booleanResult) return "fail 1" + + builder { + val x = '1' + suspendHere() + charResult = x + } + + if (charResult != '1') return "fail 2" + + builder { + val x: Byte = 1 + suspendHere() + byteResult = x + } + + if (byteResult != 1.toByte()) return "fail 3" + + builder { + val x: Short = 1 + suspendHere() + shortResult = x + } + + if (shortResult != 1.toShort()) return "fail 4" + + builder { + val x: Int = 1 + suspendHere() + intResult = x + } + + if (intResult != 1) return "fail 5" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInVarStore.kt b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInVarStore.kt new file mode 100644 index 00000000000..4568620869f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/usedInVarStore.kt @@ -0,0 +1,58 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + builder { + val x = true + suspendHere() + val y: Boolean = x + if (!y) throw IllegalStateException("fail 1") + } + + builder { + val x = '1' + suspendHere() + + val y: Char = x + if (y != '1') throw IllegalStateException("fail 2") + } + + builder { + val x: Byte = 1 + suspendHere() + + val y: Byte = x + if (y != 1.toByte()) throw IllegalStateException("fail 3") + } + + builder { + val x: Short = 1 + + suspendHere() + + val y: Short = x + if (y != 1.toShort()) throw IllegalStateException("fail 4") + } + + builder { + val x: Int = 1 + suspendHere() + + val y: Int = x + if (y != 1) throw IllegalStateException("fail 5") + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/iterateOverArray.kt b/backend.native/tests/external/codegen/blackbox/coroutines/iterateOverArray.kt new file mode 100644 index 00000000000..a9bb1b5c742 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/iterateOverArray.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + val a = arrayOfNulls(2) as Array + a[0] = "O" + a[1] = "K" + var result = "" + + builder { + for (s in a) { + // 's' variable must be spilled before suspension point + // And it's important that it should be treated as a String instance because of 'result += s' after + // But BasicInterpreter just ignores type of argument array for AALOAD opcode (treating it's return type as plain Object), + // so we should refine the relevant part in our intepreter + if (suspendHere() != "OK") throw RuntimeException("fail 1") + result += s + } + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/kt12958.kt b/backend.native/tests/external/codegen/blackbox/coroutines/kt12958.kt new file mode 100644 index 00000000000..0ec9c8f8330 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/kt12958.kt @@ -0,0 +1,37 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// WITH_CONTINUATION +import kotlin.coroutines.* + +suspend fun suspendHere(v: V): V = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> String): String { + var result = "fail" + c.startCoroutine(handleResultContinuation { + result = it + }) + + return result +} + +fun foo(): String = builder { + // A piece of code for next statement: + // INVOKEVIRTUAL suspendHere + // CHECKCAST [B + // + // Analyzer uses `newValue` method for estimation of type generated by CHECKCAST insn, + // but for arrays `newValue` returned just Basic.REFERENCE_VALUE, thus we didn't add necessary checkcasts + // for variables spilled into fields + val data2 = suspendHere(ByteArray(2)) + + suspendHere("") + data2.size.toString() +} + +fun box(): String { + if (foo() != "2") return "fail 1" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/lastExpressionIsLoop.kt b/backend.native/tests/external/codegen/blackbox/coroutines/lastExpressionIsLoop.kt new file mode 100644 index 00000000000..965ec182d8a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/lastExpressionIsLoop.kt @@ -0,0 +1,54 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var result = "" + var ok = false + suspend fun suspendHere(v: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + result += v + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, handleResultContinuation { + controller.ok = true + }) + if (!controller.ok) throw RuntimeException("Fail ok") + return controller.result +} + +fun box(): String { + val r1 = builder { + for (i in 5..6) { + suspendHere(i.toString()) + } + } + + if (r1 != "56") return "fail 1: $r1" + + val r2 = builder { + var i = 7 + while (i <= 8) { + suspendHere(i.toString()) + i++ + } + } + + if (r2 != "78") return "fail 2: $r2" + + val r3 = builder { + var i = 9 + do { + suspendHere(i.toString()) + i++ + } while (i <= 10); + } + + if (r3 != "910") return "fail 3: $r3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/lastStatementInc.kt b/backend.native/tests/external/codegen/blackbox/coroutines/lastStatementInc.kt new file mode 100644 index 00000000000..b24c04d1cb3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/lastStatementInc.kt @@ -0,0 +1,43 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + var wasHandleResultCalled = false + c.startCoroutine(handleResultContinuation { + wasHandleResultCalled = true + }) + + if (!wasHandleResultCalled) throw RuntimeException("fail 1") +} + +fun box(): String { + var result = 0 + + builder { + result++ + + if (suspendHere() != "OK") throw RuntimeException("fail 2") + + result-- + } + + if (result != 0) return "fail 3" + + builder { + --result + + if (suspendHere() != "OK") throw RuntimeException("fail 4") + + ++result + } + + if (result != 0) return "fail 5" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/lastStementAssignment.kt b/backend.native/tests/external/codegen/blackbox/coroutines/lastStementAssignment.kt new file mode 100644 index 00000000000..f04c11cede8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/lastStementAssignment.kt @@ -0,0 +1,45 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + var wasHandleResultCalled = false + c.startCoroutine(handleResultContinuation { + wasHandleResultCalled = true + }) + + if (!wasHandleResultCalled) throw RuntimeException("fail 1") +} + +var varWithCustomSetter: String = "" + set(value) { + if (field != "") throw RuntimeException("fail 2") + field = value + } + +fun box(): String { + var result = "" + + builder { + result += "O" + + if (suspendHere() != "OK") throw RuntimeException("fail 3") + + result += "K" + } + + if (result != "OK") return "fail 4" + + builder { + if (suspendHere() != "OK") throw RuntimeException("fail 5") + + varWithCustomSetter = "OK" + } + + return varWithCustomSetter +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/lastUnitExpression.kt b/backend.native/tests/external/codegen/blackbox/coroutines/lastUnitExpression.kt new file mode 100644 index 00000000000..79e7352fe06 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/lastUnitExpression.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var ok = false + var v = "fail" + suspend fun suspendHere(v: String): Unit = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + this.v = v + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit): String { + val controller = Controller() + c.startCoroutine(controller, handleResultContinuation { + controller.ok = true + }) + if (!controller.ok) throw RuntimeException("Fail 1") + return controller.v +} + +fun box(): String { + + return builder { + suspendHere("OK") + } +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/inlineFunctionWithOptionalParam.kt b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/inlineFunctionWithOptionalParam.kt new file mode 100644 index 00000000000..fe81fa42641 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/inlineFunctionWithOptionalParam.kt @@ -0,0 +1,30 @@ +// MODULE: lib +// FILE: lib.kt +inline fun foo(x: String = "OK"): String { + return x + x +} + +// MODULE: main(lib) +// FILE: main.kt +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var result = "" + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(object : Continuation { + override fun resume(value: Unit) { + } + override fun resumeWithException(exception: Throwable) { + } + }) +} + +fun box(): String { + builder { + result = foo() + } + if (result != "OKOK") return "fail: $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/simple.kt b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/simple.kt new file mode 100644 index 00000000000..3f7c8a605bc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/simple.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// MODULE: controller +// FILE: controller.kt +package lib + +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } +} + +// MODULE: main(controller, support) +// FILE: main.kt +import lib.* +import kotlin.coroutines.* + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCalls.kt b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCalls.kt new file mode 100644 index 00000000000..892ea72c0bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCalls.kt @@ -0,0 +1,101 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var lastSuspension: Continuation? = null + var result = "fail" + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + lastSuspension = x + CoroutineIntrinsics.SUSPENDED + } + + fun hasNext() = lastSuspension != null + fun next() { + val x = lastSuspension!! + lastSuspension = null + x.resume("56") + } +} + +fun builder(c: suspend Controller.() -> Unit) { + val controller1 = Controller() + val controller2 = Controller() + + c.startCoroutine(controller1, EmptyContinuation) + c.startCoroutine(controller2, EmptyContinuation) + + runControllers(controller1, controller2) +} + +// TODO: additional parameters are not supported yet +//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { +// val controller1 = Controller() +// val controller2 = Controller() +// +// c(controller1, 1234567890123456789L, "Q").resume(Unit) +// c(controller2, 1234567890123456789L, "Q").resume(Unit) +// +// runControllers(controller1, controller2) +//} + +private fun runControllers(controller1: Controller, controller2: Controller) { + while (controller1.hasNext()) { + if (!controller2.hasNext()) throw RuntimeException("fail 1") + + if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") + + controller1.next() + controller2.next() + } + + if (controller2.hasNext()) throw RuntimeException("fail 2") + + if (controller1.result != "OK") throw RuntimeException("fail 3") + if (controller2.result != "OK") throw RuntimeException("fail 4") +} + +fun box(): String { + // no suspension + builder { + result = "OK" + } + + // 1 suspension + builder { + if (suspendHere() != "56") return@builder + result = "OK" + } + + // 2 suspensions + builder { + if (suspendHere() != "56") return@builder + suspendHere() + result = "OK" + } + + // with capture + + var x = "O" + var y = "K" + + // no suspension + builder { + result = x + y + } + + // 1 suspension + builder { + if (suspendHere() != "56") return@builder + result = x + y + } + + // 2 suspensions + builder { + if (suspendHere() != "56") return@builder + suspendHere() + result = x + y + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda1.kt b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda1.kt new file mode 100644 index 00000000000..3926e11eb52 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda1.kt @@ -0,0 +1,90 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var lastSuspension: Continuation? = null + var result = "fail" + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + lastSuspension = x + CoroutineIntrinsics.SUSPENDED + } + + fun hasNext() = lastSuspension != null + fun next() { + val x = lastSuspension!! + lastSuspension = null + x.resume("56") + } +} + +fun builder(c: suspend Controller.() -> Unit) { + val controller1 = Controller() + val controller2 = Controller() + + c.startCoroutine(controller1, EmptyContinuation) + c.startCoroutine(controller2, EmptyContinuation) + + runControllers(controller1, controller2) +} + +// TODO: additional parameters are not supported yet +//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { +// val controller1 = Controller() +// val controller2 = Controller() +// +// c(controller1, 1234567890123456789L, "Q").resume(Unit) +// c(controller2, 1234567890123456789L, "Q").resume(Unit) +// +// runControllers(controller1, controller2) +//} + +private fun runControllers(controller1: Controller, controller2: Controller) { + while (controller1.hasNext()) { + if (!controller2.hasNext()) throw RuntimeException("fail 1") + + if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") + + controller1.next() + controller2.next() + } + + if (controller2.hasNext()) throw RuntimeException("fail 2") + + if (controller1.result != "OK") throw RuntimeException("fail 3") + if (controller2.result != "OK") throw RuntimeException("fail 4") +} + +inline fun run(b: () -> Unit) { + b() +} + +fun box(): String { + // with capture and params + + var x = "O" + var y = "K" + + // inlined + run { + // no suspension + builder { + result = x + y + } + + // 1 suspension + builder { + if (suspendHere() != "56") return@builder + result = x + y + } + + // 2 suspensions + builder { + if (suspendHere() != "56") return@builder + suspendHere() + result = x + y + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda2.kt b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda2.kt new file mode 100644 index 00000000000..fdf83f31294 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda2.kt @@ -0,0 +1,92 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var lastSuspension: Continuation? = null + var result = "fail" + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + lastSuspension = x + CoroutineIntrinsics.SUSPENDED + } + + fun hasNext() = lastSuspension != null + fun next() { + val x = lastSuspension!! + lastSuspension = null + x.resume("56") + } +} + +fun builder(c: suspend Controller.() -> Unit) { + val controller1 = Controller() + val controller2 = Controller() + + c.startCoroutine(controller1, EmptyContinuation) + c.startCoroutine(controller2, EmptyContinuation) + + runControllers(controller1, controller2) +} + +// TODO: additional parameters are not supported yet +//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { +// val controller1 = Controller() +// val controller2 = Controller() +// +// c(controller1, 1234567890123456789L, "Q").resume(Unit) +// c(controller2, 1234567890123456789L, "Q").resume(Unit) +// +// runControllers(controller1, controller2) +//} + +private fun runControllers(controller1: Controller, controller2: Controller) { + while (controller1.hasNext()) { + if (!controller2.hasNext()) throw RuntimeException("fail 1") + + if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") + + controller1.next() + controller2.next() + } + + if (controller2.hasNext()) throw RuntimeException("fail 2") + + if (controller1.result != "OK") throw RuntimeException("fail 3") + if (controller2.result != "OK") throw RuntimeException("fail 4") +} + +inline fun run(b: () -> Unit) { + b() +} + +fun box(): String { + // with capture and params + var x = "O" + + // inlined + run { + var y = "K" + + { + // no suspension + builder { + result = "OK" + } + + // 1 suspension + builder { + if (suspendHere() != "56") return@builder + result = "OK" + } + + // 2 suspensions + builder { + if (suspendHere() != "56") return@builder + suspendHere() + result = "OK" + } + }() + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda3.kt b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda3.kt new file mode 100644 index 00000000000..5dac65520ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda3.kt @@ -0,0 +1,90 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var lastSuspension: Continuation? = null + var result = "fail" + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + lastSuspension = x + CoroutineIntrinsics.SUSPENDED + } + + fun hasNext() = lastSuspension != null + fun next() { + val x = lastSuspension!! + lastSuspension = null + x.resume("56") + } +} + +fun builder(c: suspend Controller.() -> Unit) { + val controller1 = Controller() + val controller2 = Controller() + + c.startCoroutine(controller1, EmptyContinuation) + c.startCoroutine(controller2, EmptyContinuation) + + runControllers(controller1, controller2) +} + +// TODO: additional parameters are not supported yet +//fun builder2(coroutine c: Controller.(Long, String) -> Continuation) { +// val controller1 = Controller() +// val controller2 = Controller() +// +// c(controller1, 1234567890123456789L, "Q").resume(Unit) +// c(controller2, 1234567890123456789L, "Q").resume(Unit) +// +// runControllers(controller1, controller2) +//} + +private fun runControllers(controller1: Controller, controller2: Controller) { + while (controller1.hasNext()) { + if (!controller2.hasNext()) throw RuntimeException("fail 1") + + if (controller1.lastSuspension === controller2.lastSuspension) throw RuntimeException("equal references") + + controller1.next() + controller2.next() + } + + if (controller2.hasNext()) throw RuntimeException("fail 2") + + if (controller1.result != "OK") throw RuntimeException("fail 3") + if (controller2.result != "OK") throw RuntimeException("fail 4") +} + +inline fun run(b: () -> Unit) { + b() +} + +fun box(): String { + var x = "O" + + { + var y = "K" + // inlined + run { + // no suspension + builder { + result = "OK" + } + + // 1 suspension + builder { + if (suspendHere() != "56") return@builder + result = "OK" + } + + // 2 suspensions + builder { + if (suspendHere() != "56") return@builder + suspendHere() + result = "OK" + } + } + } () + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/nestedTryCatch.kt b/backend.native/tests/external/codegen/blackbox/coroutines/nestedTryCatch.kt new file mode 100644 index 00000000000..2e7b27f929e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/nestedTryCatch.kt @@ -0,0 +1,114 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var globalResult = "" +var wasCalled = false +class Controller { + val postponedActions = ArrayList<() -> Unit>() + + suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resume(v) + } + + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resumeWithException(e) + } + + CoroutineIntrinsics.SUSPENDED + } + + fun run(c: suspend Controller.() -> String) { + c.startCoroutine(this, handleResultContinuation { + globalResult = it + }) + while (postponedActions.isNotEmpty()) { + postponedActions[0]() + postponedActions.removeAt(0) + } + } +} + +fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { + val controller = Controller() + + globalResult = "#" + wasCalled = false + if (!expectException) { + controller.run(c) + } + else { + try { + controller.run(c) + globalResult = "fail: exception was not thrown" + } catch (e: Exception) { + globalResult = e.message!! + } + } + + if (!wasCalled) { + throw RuntimeException("fail wasCalled") + } + + if (globalResult != "OK") { + throw RuntimeException("fail $globalResult") + } +} + +fun commonThrow(t: Throwable) { + throw t +} + +fun box(): String { + builder { + try { + try { + suspendWithValue("") + suspendWithValue("OK") + } + catch (e: RuntimeException) { + suspendWithValue("fail 1") + } + } finally { + wasCalled = true + } + } + + builder { + try { + try { + suspendWithException(RuntimeException("M1")) + } + catch (e: RuntimeException) { + if (e.message != "M1") throw RuntimeException("fail 2") + wasCalled = true + suspendWithValue("OK") + } + } catch (e: Exception) { + suspendWithValue("fail 3") + } + } + + builder { + try { + try { + suspendWithException(Exception("M2")) + } + catch (e: RuntimeException) { + suspendWithValue("fail 4") + } finally { + wasCalled = true + } + } catch (e: Exception) { + if (e.message != "M2") throw RuntimeException("fail 5") + suspendWithValue("OK") + } + } + + return globalResult +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/noSuspensionPoints.kt b/backend.native/tests/external/codegen/blackbox/coroutines/noSuspensionPoints.kt new file mode 100644 index 00000000000..5a8a13d4fe6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/noSuspensionPoints.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +fun builder(c: suspend () -> Int): Int { + var res = 0 + c.startCoroutine(handleResultContinuation { + res = it + }) + + return res +} + +fun box(): String { + var result = "" + + val handledResult = builder { + result = "OK" + 56 + } + + if (handledResult != 56) return "fail 1: $handledResult" + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambda.kt b/backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambda.kt new file mode 100644 index 00000000000..ac8d1592ed7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambda.kt @@ -0,0 +1,46 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var cResult = 0 + suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v * 2) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Int): Controller { + val controller = Controller() + c.startCoroutine(controller, handleResultContinuation { + controller.cResult = it + }) + + return controller +} + +inline fun foo(x: (Int) -> Unit) { + for (i in 1..2) { + x(i) + } +} + +fun box(): String { + var result = "" + + val controllerResult = builder { + result += "-" + foo { + result += suspendHere(it).toString() + if (it == 2) return@builder 56 + } + // Should be unreachable + result += "+" + 1 + }.cResult + + if (result != "-24") return "fail 1: $result" + if (controllerResult != 56) return "fail 2: $controllerResult" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambdaDeep.kt b/backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambdaDeep.kt new file mode 100644 index 00000000000..9c0de6fadad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/nonLocalReturnFromInlineLambdaDeep.kt @@ -0,0 +1,51 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + + +class Controller { + var cResult = 0 + suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v * 2) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Int): Controller { + val controller = Controller() + c.startCoroutine(controller, handleResultContinuation { + controller.cResult = it + }) + + return controller +} + +inline fun foo(x: (Int) -> Unit) { + for (i in 1..2) { + run { + x(i) + } + } +} + +fun box(): String { + var result = "" + + val controllerResult = builder { + result += "-" + foo { + run { + result += suspendHere(it).toString() + if (it == 2) return@builder 56 + } + } + // Should be unreachable + result += "+" + 1 + }.cResult + + if (result != "-24") return "fail 1: $result" + if (controllerResult != 56) return "fail 2: $controllerResult" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/returnByLabel.kt b/backend.native/tests/external/codegen/blackbox/coroutines/returnByLabel.kt new file mode 100644 index 00000000000..583aa33bbc8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/returnByLabel.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Int): Int { + var res = 0 + c.startCoroutine(handleResultContinuation { + res = it + }) + + return res +} + +fun box(): String { + var result = "" + + val handledResult = builder { + result = suspendHere() + return@builder 56 + } + + if (handledResult != 56) return "fail 1: $handledResult" + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/simple.kt b/backend.native/tests/external/codegen/blackbox/coroutines/simple.kt new file mode 100644 index 00000000000..d640d67f0ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/simple.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/simpleException.kt b/backend.native/tests/external/codegen/blackbox/coroutines/simpleException.kt new file mode 100644 index 00000000000..06999f19879 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/simpleException.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resumeWithException(RuntimeException("OK")) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + try { + suspendHere() + result = "fail" + } catch (e: RuntimeException) { + result = "OK" + } + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/simpleWithHandleResult.kt b/backend.native/tests/external/codegen/blackbox/coroutines/simpleWithHandleResult.kt new file mode 100644 index 00000000000..d6f61c1fee3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/simpleWithHandleResult.kt @@ -0,0 +1,39 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Int): Int { + var res = 0 + + c.createCoroutine(object : Continuation { + override fun resume(data: Int) { + res = data + } + + override fun resumeWithException(exception: Throwable) { + throw exception + } + }).resume(Unit) + + return res +} + + + +fun box(): String { + var result = "" + + val handledResult = builder { + result = suspendHere() + 56 + } + + if (handledResult != 56) return "fail 1: $handledResult" + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/exception.kt b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/exception.kt new file mode 100644 index 00000000000..04294aa9e4b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/exception.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = throw RuntimeException("OK") +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = try { suspendHere() } catch (e: RuntimeException) { e.message!! } + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/inlineSuspendFunction.kt b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/inlineSuspendFunction.kt new file mode 100644 index 00000000000..6708e8a2714 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/inlineSuspendFunction.kt @@ -0,0 +1,37 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// WITH_REFLECT +// CHECK_NOT_CALLED: suspendInline_61zpoe$ +// CHECK_NOT_CALLED: suspendInline_6r51u9$ +// CHECK_NOT_CALLED: suspendInline +import kotlin.coroutines.* + +class Controller { + suspend inline fun suspendInline(v: String): String = v + + suspend inline fun suspendInline(crossinline b: () -> String): String = suspendInline(b()) + + suspend inline fun suspendInline(): String = suspendInline({ T::class.simpleName!! }) +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +class OK + +fun box(): String { + var result = "" + + builder { + result = suspendInline("56") + if (result != "56") throw RuntimeException("fail 1") + + result = suspendInline { "57" } + if (result != "57") throw RuntimeException("fail 2") + + result = suspendInline() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/simple.kt b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/simple.kt new file mode 100644 index 00000000000..31e1bc7f640 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/simple.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere() = "OK" +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/suspendInCycle.kt b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/suspendInCycle.kt new file mode 100644 index 00000000000..7810fea43ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/suspendInCycle.kt @@ -0,0 +1,48 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + 1 + } + suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + "?" + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result += "-" + for (i in 0..10000) { + if (i % 2 == 0) { + result += suspendHere().toString() + } + else if (i == 3) { + result += suspendThere() + } + } + result += "+" + } + + var mustBe = "-" + for (i in 0..10000) { + if (i % 2 == 0) { + mustBe += "1" + } + else if (i == 3) { + mustBe += "?" + } + } + mustBe += "+" + + if (result != mustBe) return "fail: $result/$mustBe" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/statementLikeLastExpression.kt b/backend.native/tests/external/codegen/blackbox/coroutines/statementLikeLastExpression.kt new file mode 100644 index 00000000000..197969c80f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/statementLikeLastExpression.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var globalResult = "" +suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> String) { + c.startCoroutine(handleResultContinuation { + globalResult = it + }) +} + +fun box(): String { + + var condition = true + + builder { + if (condition) { + suspendWithValue("OK") + } else { + suspendWithValue("fail 1") + } + } + + return globalResult +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendDelegation.kt b/backend.native/tests/external/codegen/blackbox/coroutines/suspendDelegation.kt new file mode 100644 index 00000000000..7e0b04a51fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendDelegation.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = suspendThere() + + suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendFromInlineLambda.kt b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFromInlineLambda.kt new file mode 100644 index 00000000000..f77e3ac11b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFromInlineLambda.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(v: Int): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v * 2) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +inline fun foo(x: (Int) -> Unit) { + for (i in 1..2) { + x(i) + } +} + +fun box(): String { + var result = "" + + builder { + result += "-" + foo { + result += suspendHere(it).toString() + } + result += "+" + } + + if (result != "-24+") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/manyParameters.kt b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/manyParameters.kt new file mode 100644 index 00000000000..de436c53998 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/manyParameters.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +suspend fun foo(c: suspend Double.(Long, Int, String) -> String) = (1.0).c(56L, 55, "abc") + +fun box(): String { + var result = "" + var final = "" + + builder { + final = foo { l, i, s -> + result = suspendHere("$this#$l#$i#$s") + "OK" + } + } + + if (result != "1.0#56#55#abc" && result != "1#56#55#abc") return "fail: $result" + + return final +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/simple.kt b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/simple.kt new file mode 100644 index 00000000000..10c2b655e73 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/simple.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +suspend fun foo1(c: suspend () -> Unit) = c() +suspend fun foo2(c: suspend String.() -> Int) = "2".c() +suspend fun foo3(c: suspend (String) -> Int) = c("3") + +fun box(): String { + var result = "" + + builder { + foo1 { + result = suspendHere("begin#") + } + + val q2 = foo2 { result += suspendHere(this) + "#"; 1 } + val q3 = foo3 { result += suspendHere(it); 2 } + + if (q2 != 1) throw RuntimeException("fail q2") + if (q3 != 2) throw RuntimeException("fail q3") + } + + if (result != "begin#2#3") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendInCycle.kt b/backend.native/tests/external/codegen/blackbox/coroutines/suspendInCycle.kt new file mode 100644 index 00000000000..d59e9c44fcf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendInCycle.kt @@ -0,0 +1,40 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + var i = 0 + suspend fun suspendHere(): Int = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(i++) + CoroutineIntrinsics.SUSPENDED + } + suspend fun suspendThere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("?") + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result += "-" + for (i in 0..5) { + if (i % 2 == 0) { + result += suspendHere().toString() + } + else if (i == 3) { + result += suspendThere() + } + } + result += "+" + } + + if (result != "-01?2+") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendInTheMiddleOfObjectConstruction.kt b/backend.native/tests/external/codegen/blackbox/coroutines/suspendInTheMiddleOfObjectConstruction.kt new file mode 100644 index 00000000000..95114878c23 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendInTheMiddleOfObjectConstruction.kt @@ -0,0 +1,98 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("K") + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithArgument(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithDouble(v: Double): Double = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +class A(val first: String, val second: String) { + override fun toString() = "$first$second" +} +class B(val first: String, val second: String, val third: String) { + override fun toString() = "$first$second$third" +} + +class C(val first: Long, val second: Double, val third: String) { + override fun toString() = "$first#$second#$third" +} + + +fun box(): String { + var result = "OK" + + builder { + var local: Any = A("O", suspendHere()) + + if (local.toString() != "OK") { + result = "fail 1: $local" + return@builder + } + + local = A(suspendWithArgument("O"), suspendHere()) + + if (local.toString() != "OK") { + result = "fail 2: $local" + return@builder + } + + local = B("#", suspendWithArgument("O"), suspendHere()) + + if (local.toString() != "#OK") { + result = "fail 3: $local" + return@builder + } + + local = B(suspendWithArgument("#"), "O", suspendHere()) + + if (local.toString() != "#OK") { + result = "fail 4: $local" + return@builder + } + + local = B("#", B("", "O", suspendWithArgument("")).toString(), suspendHere()) + + if (local.toString() != "#OK") { + result = "fail 5: $local" + return@builder + } + + val condition = local.toString() == "#OK" + + local = B( + if (!condition) "1" else suspendWithArgument("#"), + if (condition) suspendWithArgument("O") else "2", + if (condition) suspendHere() else suspendWithArgument("3")) + + if (local.toString() != "#OK") { + result = "fail 5: $local" + return@builder + } + + local = C(1234567890123L, suspendWithDouble(3.14), suspendWithArgument("OK")) + + if (local.toString() != "1234567890123#3.14#OK") { + result = "fail 5: $local" + return@builder + } + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/tryCatchFinallyWithHandleResult.kt b/backend.native/tests/external/codegen/blackbox/coroutines/tryCatchFinallyWithHandleResult.kt new file mode 100644 index 00000000000..c94ec80e3ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/tryCatchFinallyWithHandleResult.kt @@ -0,0 +1,177 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var globalResult = "" +var wasCalled = false +class Controller { + val postponedActions = ArrayList<() -> Unit>() + + suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resume(v) + } + + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resumeWithException(e) + } + + CoroutineIntrinsics.SUSPENDED + } + + fun run(c: suspend Controller.() -> String) { + c.startCoroutine(this, handleResultContinuation { + globalResult = it + }) + while (postponedActions.isNotEmpty()) { + postponedActions[0]() + postponedActions.removeAt(0) + } + } +} + +fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { + val controller = Controller() + + globalResult = "#" + wasCalled = false + if (!expectException) { + controller.run(c) + } + else { + try { + controller.run(c) + globalResult = "fail: exception was not thrown" + } catch (e: Exception) { + globalResult = e.message!! + } + } + + if (!wasCalled) { + throw RuntimeException("fail wasCalled") + } + + if (globalResult != "OK") { + throw RuntimeException("fail $globalResult") + } +} + +fun commonThrow(t: Throwable) { + throw t +} + +fun box(): String { + builder { + try { + suspendWithValue("") + suspendWithValue("OK") + } catch (e: RuntimeException) { + suspendWithValue("fail 1") + } finally { + suspendWithValue("ignored 1") + wasCalled = true + } + } + + builder { + try { + suspendWithException(RuntimeException("M")) + } catch (e: RuntimeException) { + if (e.message != "M") throw RuntimeException("fail 2") + suspendWithValue("OK") + } finally { + suspendWithValue("ignored 2") + wasCalled = true + } + } + + builder(expectException = true) { + try { + suspendWithException(Exception("OK")) + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 3") + } finally { + suspendWithValue("ignored 3") + wasCalled = true + } + } + + builder(expectException = true) { + try { + suspendWithException(Exception("OK")) + } catch (e: RuntimeException) { + suspendWithValue("fail") + return@builder "xyz" + } finally { + suspendWithValue("ignored 4") + wasCalled = true + } + } + + builder { + try { + suspendWithException(Exception("M2")) + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 4") + } catch (e: Exception) { + if (e.message != "M2") throw Exception("fail 5: ${e.message}") + suspendWithValue("OK") + } finally { + suspendWithValue("ignored 4") + wasCalled = true + } + } + + builder { + try { + suspendWithValue("123") + commonThrow(RuntimeException("M3")) + suspendWithValue("456") + } catch (e: RuntimeException) { + if (e.message != "M3") throw Exception("fail 6: ${e.message}") + suspendWithValue("OK") + } finally { + suspendWithValue("ignored 5") + wasCalled = true + } + } + + builder(expectException = true) { + try { + suspendWithValue("123") + commonThrow(Exception("OK")) + suspendWithValue("456") + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 7") + } finally { + suspendWithValue("ignored 6") + wasCalled = true + } + } + + builder { + try { + suspendWithValue("123") + commonThrow(Exception("M3")) + suspendWithValue("456") + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 8") + } catch (e: Exception) { + if (e.message != "M3") throw Exception("fail 9: ${e.message}") + suspendWithValue("OK") + } finally { + suspendWithValue("ignored 7") + wasCalled = true + } + } + + return globalResult +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/tryCatchWithHandleResult.kt b/backend.native/tests/external/codegen/blackbox/coroutines/tryCatchWithHandleResult.kt new file mode 100644 index 00000000000..8be35219df5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/tryCatchWithHandleResult.kt @@ -0,0 +1,151 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var globalResult = "" +var wasCalled = false +class Controller { + val postponedActions = ArrayList<() -> Unit>() + + suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resume(v) + } + + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resumeWithException(e) + } + + CoroutineIntrinsics.SUSPENDED + } + + fun run(c: suspend Controller.() -> String) { + c.startCoroutine(this, handleResultContinuation { + globalResult = it + }) + while (postponedActions.isNotEmpty()) { + postponedActions[0]() + postponedActions.removeAt(0) + } + } +} + +fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { + val controller = Controller() + + globalResult = "#" + wasCalled = false + if (!expectException) { + controller.run(c) + } + else { + try { + controller.run(c) + globalResult = "fail: exception was not thrown" + } catch (e: Exception) { + globalResult = e.message!! + } + } + + if (!wasCalled) { + throw RuntimeException("fail wasCalled") + } + + if (globalResult != "OK") { + throw RuntimeException("fail $globalResult") + } +} + +fun commonThrow(t: Throwable) { + throw t +} + +fun box(): String { + builder { + try { + suspendWithValue("") + wasCalled = true + suspendWithValue("OK") + } catch (e: RuntimeException) { + suspendWithValue("fail 1") + } + } + + builder { + try { + suspendWithException(RuntimeException("M")) + } catch (e: RuntimeException) { + if (e.message != "M") throw RuntimeException("fail 2") + wasCalled = true + suspendWithValue("OK") + } + } + + builder(expectException = true) { + try { + wasCalled = true + suspendWithException(Exception("OK")) + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 3") + } + } + + builder { + try { + suspendWithException(Exception("M2")) + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 4") + } catch (e: Exception) { + if (e.message != "M2") throw Exception("fail 5: ${e.message}") + wasCalled = true + suspendWithValue("OK") + } + } + + builder { + try { + suspendWithValue("123") + commonThrow(RuntimeException("M3")) + suspendWithValue("456") + } catch (e: RuntimeException) { + if (e.message != "M3") throw Exception("fail 6: ${e.message}") + wasCalled = true + suspendWithValue("OK") + } + } + + builder(expectException = true) { + try { + suspendWithValue("123") + wasCalled = true + commonThrow(Exception("OK")) + suspendWithValue("456") + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 7") + } + } + + builder { + try { + suspendWithValue("123") + commonThrow(Exception("M3")) + suspendWithValue("456") + } catch (e: RuntimeException) { + suspendWithValue("fail") + throw RuntimeException("fail 8") + } catch (e: Exception) { + if (e.message != "M3") throw Exception("fail 9: ${e.message}") + wasCalled = true + suspendWithValue("OK") + } + } + + return globalResult +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyInsideInlineLambda.kt b/backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyInsideInlineLambda.kt new file mode 100644 index 00000000000..202481ee123 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyInsideInlineLambda.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(v) + + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +inline fun run(block: () -> Unit) { + block() +} + +fun box(): String { + var result = "" + run { + builder { + try { + result += suspendHere("O") + } finally { + result += suspendHere("K") + } + } + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyWithHandleResult.kt b/backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyWithHandleResult.kt new file mode 100644 index 00000000000..c539516da92 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/tryFinallyWithHandleResult.kt @@ -0,0 +1,98 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var globalResult = "" +var wasCalled = false +class Controller { + val postponedActions = mutableListOf<() -> Unit>() + + suspend fun suspendWithValue(v: String): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resume(v) + } + + CoroutineIntrinsics.SUSPENDED + } + + suspend fun suspendWithException(e: Exception): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + postponedActions.add { + x.resumeWithException(e) + } + + CoroutineIntrinsics.SUSPENDED + } + + fun run(c: suspend Controller.() -> String) { + c.startCoroutine(this, handleResultContinuation { + globalResult = it + }) + while (postponedActions.isNotEmpty()) { + postponedActions[0]() + postponedActions.removeAt(0) + } + } +} + +fun builder(expectException: Boolean = false, c: suspend Controller.() -> String) { + val controller = Controller() + + globalResult = "#" + wasCalled = false + if (!expectException) { + controller.run(c) + } + else { + try { + controller.run(c) + globalResult = "fail: exception was not thrown" + } catch (e: Exception) { + globalResult = e.message!! + } + } + + if (!wasCalled) { + throw RuntimeException("fail wasCalled") + } + + if (globalResult != "OK") { + throw RuntimeException("fail $globalResult") + } +} + +fun commonThrow() { + throw RuntimeException("OK") +} + +fun box(): String { + builder { + try { + suspendWithValue("OK") + } finally { + if (suspendWithValue("G") != "G") throw RuntimeException("fail 1") + wasCalled = true + } + } + + builder(expectException = true) { + try { + suspendWithException(RuntimeException("OK")) + } finally { + if (suspendWithValue("G") != "G") throw RuntimeException("fail 2") + wasCalled = true + } + } + + builder(expectException = true) { + try { + suspendWithValue("OK") + commonThrow() + suspendWithValue("OK") + } finally { + if (suspendWithValue("G") != "G") throw RuntimeException("fail 3") + wasCalled = true + } + } + + return globalResult +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt new file mode 100644 index 00000000000..0f462b8a2fe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt @@ -0,0 +1,46 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + var wasResumeCalled = false + c.startCoroutine(object : Continuation { + override fun resume(value: Unit) { + wasResumeCalled = true + } + + override fun resumeWithException(exception: Throwable) { + + } + }) + + if (!wasResumeCalled) throw RuntimeException("fail 1") +} + +fun box(): String { + var result = "" + + builder { + run { + if (result == "") return@builder + } + suspendHere() + throw RuntimeException("fail 2") + } + + result = "fail1" + + builder { + run { + if (result == "") return@builder + } + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineReturn.kt b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineReturn.kt new file mode 100644 index 00000000000..b237e7cf158 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/coroutineReturn.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + var wasResumeCalled = false + c.startCoroutine(object : Continuation { + override fun resume(value: Unit) { + wasResumeCalled = true + } + + override fun resumeWithException(exception: Throwable) { + + } + }) + + if (!wasResumeCalled) throw RuntimeException("fail 1") +} + +fun box(): String { + var result = "" + + builder { + if (result == "") return@builder + suspendHere() + throw RuntimeException("fail 2") + } + + result = "fail" + + builder { + if (result == "") return@builder + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt new file mode 100644 index 00000000000..f0d6919046e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME +// WITH_COROUTINES +// IGNORE_BACKEND: JS +import kotlin.coroutines.* + +var result = "0" + + +suspend fun suspendHere(x: Int): Unit { + run { + if (x == 0) return + if (x == 1) return@suspendHere + } + + result = "OK" + return CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + builder { + if (suspendHere(0) != Unit) throw RuntimeException("fail 1") + if (suspendHere(1) != Unit) throw RuntimeException("fail 2") + if (suspendHere(2) != Unit) throw RuntimeException("fail 3") + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendReturn.kt b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendReturn.kt new file mode 100644 index 00000000000..589be86c2eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendReturn.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +var result = "0" + +suspend fun suspendHere(x: Int): Unit { + if (x == 0) return + result = "OK" + return CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume(Unit) + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + builder { + suspendHere(0) + suspendHere(1) + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTable.kt b/backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTable.kt new file mode 100644 index 00000000000..a0c7415d6aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTable.kt @@ -0,0 +1,41 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "fail 1" + builder { + // Initialize var with Int value + for (i in 1..1) { + if (i != 1) continue + } + + // This variable should take the same slot as 'i' had + var s: String + + // We should not spill 's' to continuation field because it's not initialized + // More precisely it contains a value of wrong type (it conflicts with contents of local var table), + // so an attempt of spilling may lead to problems on Android + if (suspendHere() == "OK") { + s = "OK" + } + else { + s = "fail 2" + } + + result = s + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTableSameSort.kt b/backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTableSameSort.kt new file mode 100644 index 00000000000..d0eb7032a76 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/varValueConflictsWithTableSameSort.kt @@ -0,0 +1,41 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import kotlin.coroutines.* + +class Controller { + suspend fun suspendHere(): String = CoroutineIntrinsics.suspendCoroutineOrReturn { x -> + x.resume("OK") + CoroutineIntrinsics.SUSPENDED + } +} + +fun builder(c: suspend Controller.() -> Unit) { + c.startCoroutine(Controller(), EmptyContinuation) +} + +fun box(): String { + var result = "fail 1" + builder { + // Initialize var with Int value + try { + var i: String = "abc" + i = "123" + } finally { } + + // This variable should take the same slot as 'i' had + var s: String + + // We shout not spill 's' to continuation field because it's not effectively initialized + // But we do this because it's not illegal (at least in Android/OpenJDK VM's) + if (suspendHere() == "OK") { + s = "OK" + } + else { + s = "fail 2" + } + + result = s + } + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/arrayParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/arrayParams.kt new file mode 100644 index 00000000000..3c55fb1a0dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/arrayParams.kt @@ -0,0 +1,10 @@ +data class A(val x: Array, val y: IntArray) + +fun foo(x: Array, y: IntArray) = A(x, y) + +fun box(): String { + val a = Array(0, {0}) + val b = IntArray(0) + val (x, y) = foo(a, b) + return if (a == x && b == y) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/changingVarParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/changingVarParam.kt new file mode 100644 index 00000000000..56f9c63561f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/changingVarParam.kt @@ -0,0 +1,8 @@ +data class A(var string: String) + +fun box(): String { + val a = A("Fail") + a.string = "OK" + val (result) = a + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/constructorWithDefaultParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/constructorWithDefaultParam.kt new file mode 100644 index 00000000000..5211d6889ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/constructorWithDefaultParam.kt @@ -0,0 +1,29 @@ +data class A(val a: Int = 1, val b: String = "$a") {} + +fun box() : String { + var result = "" + val a = A() + val b = a.copy() + if (b.a == 1 && b.b == "1") { + result += "1" + } + + val c = a.copy(a = 2) + if (c.a == 2 && c.b == "1") { + result += "2" + } + + val d = a.copy(b = "2") + if (d.a == 1 && d.b == "2") { + result += "3" + } + + val e = a.copy(a = 2, b = "2") + if (e.a == 2 && e.b == "2") { + result += "4" + } + if (result == "1234") { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/copyInObjectNestedDataClass.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/copyInObjectNestedDataClass.kt new file mode 100644 index 00000000000..935389c50cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/copyInObjectNestedDataClass.kt @@ -0,0 +1,17 @@ +class Bar(val name: String) + +abstract class Foo { + public abstract fun foo(): String +} + +fun box(): String { + return object: Foo() { + inner class NestedFoo(val bar: Bar) { + fun copy(bar: Bar) = NestedFoo(bar) + } + + override fun foo(): String { + return NestedFoo(Bar("Fail")).copy(bar = Bar("OK")).bar.name + } + }.foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt12708.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt12708.kt new file mode 100644 index 00000000000..f2ac4b4e0af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt12708.kt @@ -0,0 +1,13 @@ +fun box(): String { + val a: A = B(1) + a.copy(1) + a.component1() + return "OK" +} + +interface A { + fun copy(x: Int): A + fun component1(): Any +} + +data class B(val x: Int) : A diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt3033.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt3033.kt new file mode 100644 index 00000000000..7fc12756d88 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/kt3033.kt @@ -0,0 +1,10 @@ +data class A(val a: Double, val b: Double) + +fun box() : String { + val a = A(1.0, 1.0) + val b = a.copy() + if (b.a == 1.0 && b.b == 1.0) { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/valInConstructorParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/valInConstructorParams.kt new file mode 100644 index 00000000000..a340685014e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/valInConstructorParams.kt @@ -0,0 +1,29 @@ +data class A(val a: Int, val b: String) {} + +fun box() : String { + var result = "" + val a = A(1, "a") + val b = a.copy() + if (b.a == 1 && b.b == "a") { + result += "1" + } + + val c = a.copy(a = 2) + if (c.a == 2 && c.b == "a") { + result += "2" + } + + val d = a.copy(b = "b") + if (d.a == 1 && d.b == "b") { + result += "3" + } + + val e = a.copy(a = 2, b = "b") + if (e.a == 2 && e.b == "b") { + result += "4" + } + if (result == "1234") { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/varInConstructorParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/varInConstructorParams.kt new file mode 100644 index 00000000000..6cd1a25ae2c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/varInConstructorParams.kt @@ -0,0 +1,29 @@ +data class A(var a: Int, var b: String) {} + +fun box() : String { + var result = "" + val a = A(1, "a") + val b = a.copy() + if (b.a == 1 && b.b == "a") { + result += "1" + } + + val c = a.copy(a = 2) + if (c.a == 2 && c.b == "a") { + result += "2" + } + + val d = a.copy(b = "b") + if (d.a == 1 && d.b == "b") { + result += "3" + } + + val e = a.copy(a = 2, b = "b") + if (e.a == 2 && e.b == "b") { + result += "4" + } + if (result == "1234") { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/withGenericParameter.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/withGenericParameter.kt new file mode 100644 index 00000000000..83a4d82db02 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/withGenericParameter.kt @@ -0,0 +1,14 @@ +data class A(val a: Foo) {} + +class Foo(val a: T) { } + +fun box() : String { + val f1 = Foo("a") + val f2 = Foo("b") + val a = A(f1) + val b = a.copy(f2) + if (b.a.a == "b") { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt new file mode 100644 index 00000000000..7c4f6be1a75 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +val NAN = Double.NaN + +data class A(val x: Double) + +fun box(): String { + if (A(+0.0) == A(-0.0)) return "Fail: +0.0 == -0.0" + if (A(+0.0).hashCode() == A(-0.0).hashCode()) return "Fail: hash(+0.0) == hash(-0.0)" + + if (A(NAN) != A(NAN)) return "Fail: NaN != NaN" + if (A(NAN).hashCode() != A(NAN).hashCode()) return "Fail: hash(NaN) != hash(NaN)" + + val s = HashSet() + for (times in 1..5) { + s.add(A(3.14)) + s.add(A(+0.0)) + s.add(A(-0.0)) + s.add(A(-2.72)) + s.add(A(NAN)) + } + + if (A(3.14) !in s) return "Fail: 3.14 not found" + if (A(+0.0) !in s) return "Fail: +0.0 not found" + if (A(-0.0) !in s) return "Fail: -0.0 not found" + if (A(-2.72) !in s) return "Fail: -2.72 not found" + if (A(NAN) !in s) return "Fail: NaN not found" + + return if (s.size == 5) "OK" else "Fail $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclared.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclared.kt new file mode 100644 index 00000000000..65e9e5b9bcf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclared.kt @@ -0,0 +1,8 @@ +data class A(val x: Int) { + override fun equals(other: Any?): Boolean = false +} + +fun box(): String { + val a = A(0) + return if (a.equals(a)) "fail" else "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt new file mode 100644 index 00000000000..9727d31a9ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +data class B(val x: Int) { + fun equals(other: B): Boolean = false +} + +data class C(val x: Int) { + fun equals(): Boolean = false +} + +data class D(val x: Int) { + fun equals(other: Any?, another: String): Boolean = false +} + +data class E(val x: Int) { + fun equals(x: E): Boolean = false + override fun equals(x: Any?): Boolean = false +} + +fun box(): String { + B::class.java.getDeclaredMethod("equals", Any::class.java) + B::class.java.getDeclaredMethod("equals", B::class.java) + + C::class.java.getDeclaredMethod("equals", Any::class.java) + C::class.java.getDeclaredMethod("equals") + + D::class.java.getDeclaredMethod("equals", Any::class.java) + D::class.java.getDeclaredMethod("equals", Any::class.java, String::class.java) + + E::class.java.getDeclaredMethod("equals", Any::class.java) + E::class.java.getDeclaredMethod("equals", E::class.java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/genericarray.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/genericarray.kt new file mode 100644 index 00000000000..eaf4b04032e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/genericarray.kt @@ -0,0 +1,8 @@ +data class A(val v: Array) + +fun box() : String { + val myArray = arrayOf(0, 1, 2) + if(A(myArray) == A(arrayOf(0, 1, 2))) return "fail" + if(A(myArray) != A(myArray)) return "fail 2" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/intarray.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/intarray.kt new file mode 100644 index 00000000000..85eb1bec509 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/intarray.kt @@ -0,0 +1,8 @@ +data class A(val v: IntArray) + +fun box() : String { + val myArray = intArrayOf(0, 1, 2) + if(A(myArray) == A(intArrayOf(0, 1, 2))) return "fail" + if(A(myArray) != A(myArray)) return "fail 2" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/nullother.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/nullother.kt new file mode 100644 index 00000000000..bb0f764e061 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/nullother.kt @@ -0,0 +1,11 @@ +class Dummy { + override fun equals(other: Any?) = true +} + +data class A(val v: Any?) + +fun box() : String { + val a = A(Dummy()) + val b: A? = null + return if(a != b && b != a) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/sameinstance.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/sameinstance.kt new file mode 100644 index 00000000000..04a1cfdc4f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/sameinstance.kt @@ -0,0 +1,7 @@ +data class A(val arg: Any? = null) + +fun box() : String { + val a = A() + val b = a + return if(b == a) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt new file mode 100644 index 00000000000..aaa8f2b5e2f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +val NAN = Float.NaN + +data class A(val x: Float) + +fun box(): String { + if (A(+0f) == A(-0f)) return "Fail: +0 == -0" + if (A(+0f).hashCode() == A(-0f).hashCode()) return "Fail: hash(+0) == hash(-0)" + + if (A(NAN) != A(NAN)) return "Fail: NaN != NaN" + if (A(NAN).hashCode() != A(NAN).hashCode()) return "Fail: hash(NaN) != hash(NaN)" + + val s = HashSet() + for (times in 1..5) { + s.add(A(3.14f)) + s.add(A(+0f)) + s.add(A(-0f)) + s.add(A(-2.72f)) + s.add(A(NAN)) + } + + if (A(3.14f) !in s) return "Fail: 3.14 not found" + if (A(+0f) !in s) return "Fail: +0 not found" + if (A(-0f) !in s) return "Fail: -0 not found" + if (A(-2.72f) !in s) return "Fail: -2.72 not found" + if (A(NAN) !in s) return "Fail: NaN not found" + + return if (s.size == 5) "OK" else "Fail $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/genericParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/genericParam.kt new file mode 100644 index 00000000000..5bf58f528f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/genericParam.kt @@ -0,0 +1,12 @@ +data class A(val x: T) + +fun box(): String { + val a = A(42) + if (a.component1() != 42) return "Fail a: ${a.component1()}" + + val b = A(239.toLong()) + if (b.component1() != 239.toLong()) return "Fail b: ${b.component1()}" + + val c = A("OK") + return c.component1() +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclared.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclared.kt new file mode 100644 index 00000000000..ee7b621c974 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclared.kt @@ -0,0 +1,7 @@ +data class A(val x: Int) { + override fun hashCode(): Int = -3 +} + +fun box(): String { + return if (A(0).hashCode() == -3) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt new file mode 100644 index 00000000000..612e0df4fbb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +data class A(val x: Int) { + fun hashCode(other: Any): Int = 0 +} + +data class B(val x: Int) { + fun hashCode(other: B, another: Any): Int = 0 +} + +fun box(): String { + A::class.java.getDeclaredMethod("hashCode") + A::class.java.getDeclaredMethod("hashCode", Any::class.java) + + B::class.java.getDeclaredMethod("hashCode") + B::class.java.getDeclaredMethod("hashCode", B::class.java, Any::class.java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt new file mode 100644 index 00000000000..e001c48a2a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt @@ -0,0 +1,9 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +data class A(val a: IntArray, var b: Array) + +fun box() : String { + if( A(intArrayOf(1,2,3),arrayOf("239")).hashCode() != 31*java.util.Arrays.hashCode(intArrayOf(0,1,2)) + "239".hashCode()) "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/boolean.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/boolean.kt new file mode 100644 index 00000000000..afc41bbe2e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/boolean.kt @@ -0,0 +1,5 @@ +data class A(val a: Boolean) + +fun box() : String { + return if( A(true).hashCode()==1 && A(false).hashCode()==0 ) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/byte.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/byte.kt new file mode 100644 index 00000000000..ce33977b555 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/byte.kt @@ -0,0 +1,7 @@ +data class A(val a: Byte) + +fun box() : String { + val v1 = A(10.toByte()).hashCode() + val v2 = (10.toByte() as Byte?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/char.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/char.kt new file mode 100644 index 00000000000..e2ac5e67291 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/char.kt @@ -0,0 +1,7 @@ +data class A(val a: Char) + +fun box() : String { + val v1 = A('a').hashCode() + val v2 = ('a' as Char?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/double.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/double.kt new file mode 100644 index 00000000000..f0899ad1b59 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/double.kt @@ -0,0 +1,7 @@ +data class A(val a: Double) + +fun box() : String { + val v1 = A(-10.toDouble()).hashCode() + val v2 = (-10.toDouble() as Double?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/float.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/float.kt new file mode 100644 index 00000000000..41dc25c43c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/float.kt @@ -0,0 +1,7 @@ +data class A(val a: Float) + +fun box() : String { + val v1 = A(-10.toFloat()).hashCode() + val v2 = (-10.toFloat() as Float?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/genericNull.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/genericNull.kt new file mode 100644 index 00000000000..6987eab9670 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/genericNull.kt @@ -0,0 +1,7 @@ +data class A(val t: T) + +fun box(): String { + val h = A(null).hashCode() + if (h != 0) return "Fail $h" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/int.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/int.kt new file mode 100644 index 00000000000..0596e4c72af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/int.kt @@ -0,0 +1,7 @@ +data class A(val a: Int) + +fun box() : String { + val v1 = A(-10.toInt()).hashCode() + val v2 = (-10.toInt() as Int?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/long.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/long.kt new file mode 100644 index 00000000000..067593cb672 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/long.kt @@ -0,0 +1,7 @@ +data class A(val a: Long) + +fun box() : String { + val v1 = A(-10.toLong()).hashCode() + val v2 = (-10.toLong() as Long?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/null.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/null.kt new file mode 100644 index 00000000000..75777abec50 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/null.kt @@ -0,0 +1,16 @@ +data class A(val a: Any?, var x: Int) +data class B(val a: Any?) +data class C(val a: Int, var x: Int?) +data class D(val a: Int?) + +fun box() : String { + if( A(null,19).hashCode() != 19) "fail" + if( A(239,19).hashCode() != (239*31+19)) "fail" + if( B(null).hashCode() != 0) "fail" + if( B(239).hashCode() != 239) "fail" + if( C(239,19).hashCode() != (239*31+19)) "fail" + if( C(239,null).hashCode() != 239*31) "fail" + if( D(239).hashCode() != (239)) "fail" + if( D(null).hashCode() != 0) "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/short.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/short.kt new file mode 100644 index 00000000000..5e220e27cfc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/short.kt @@ -0,0 +1,7 @@ +data class A(val a: Short) + +fun box() : String { + val v1 = A(10.toShort()).hashCode() + val v2 = (10.toShort() as Short?)!!.hashCode() + return if( v1 == v2 ) "OK" else "$v1 $v2" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt new file mode 100644 index 00000000000..763ddc8909c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.io.Serializable + +public data class Pair ( + public val first: A, + public val second: B +) : Serializable + +fun box(): String { + val p = Pair(42, "OK") + val q = Pair(42, "OK") + if (p != q) return "Fail equals" + if (p.hashCode() != q.hashCode()) return "Fail hashCode" + if (p.toString() != q.toString()) return "Fail toString" + return p.second +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/mixedParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/mixedParams.kt new file mode 100644 index 00000000000..90637df9768 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/mixedParams.kt @@ -0,0 +1,8 @@ +data class A(var x: Int, val z: Int) + +fun box(): String { + val a = A(1, 3) + if (a.component1() != 1) return "Fail: ${a.component1()}" + if (a.component2() != 3) return "Fail: ${a.component2()}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclaration.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclaration.kt new file mode 100644 index 00000000000..c74ea42a4a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclaration.kt @@ -0,0 +1,7 @@ +data class A(val x: Int, val y: Any?, val z: String) + +fun box(): String { + val a = A(42, null, "OK") + val (x, y, z) = a + return if (x == 42 && y == null) z else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclarationFor.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclarationFor.kt new file mode 100644 index 00000000000..b7756b0c036 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/multiDeclarationFor.kt @@ -0,0 +1,17 @@ +data class A(val x: Int, val y: String) + +fun box(): String { + val arr = Array(5) { + i -> A(i, i.toString()) + } + + var sum = 0 + var str = "" + + for ((x, y) in arr) { + sum += x + str += y + } + + return if (sum == 0+1+2+3+4 && str == "01234") "OK" else "Fail ${sum} ${str}" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialFinalMemberInSuperClass.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialFinalMemberInSuperClass.kt new file mode 100644 index 00000000000..4e655f2d38e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialFinalMemberInSuperClass.kt @@ -0,0 +1,17 @@ +abstract class Base { + final override fun toString() = "OK" + final override fun hashCode() = 42 + final override fun equals(other: Any?) = false +} + +data class DataClass(val field: String) : Base() + +fun box(): String { + val d = DataClass("x") + + if (d.toString() != "OK") return "Fail toString" + if (d.hashCode() != 42) return "Fail hashCode" + if (d.equals(d) != false) return "Fail equals" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialMemberInSuperClass.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialMemberInSuperClass.kt new file mode 100644 index 00000000000..32287fbd597 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/nonTrivialMemberInSuperClass.kt @@ -0,0 +1,19 @@ +// See KT-6206 Always generate hashCode() and equals() for data classes even if base classes have non-trivial analogs + +abstract class Base { + override fun toString() = "Fail" + override fun hashCode() = -42 + override fun equals(other: Any?) = false +} + +data class DataClass(val field: String) : Base() + +fun box(): String { + val d = DataClass("x") + + if (d.toString() != "DataClass(field=x)") return "Fail toString" + if (d.hashCode() != "x".hashCode()) return "Fail hashCode" + if (d.equals(d) == false) return "Fail equals" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/privateValParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/privateValParams.kt new file mode 100644 index 00000000000..d667588ab98 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/privateValParams.kt @@ -0,0 +1,13 @@ +data class D(private val x: Long, private val y: Char) { + fun foo() = "${component1()}${component2()}" +} + +fun box(): String { + val d1 = D(42L, 'a') + val d2 = D(42L, 'a') + if (d1 != d2) return "Fail equals" + if (d1.hashCode() != d2.hashCode()) return "Fail hashCode" + if (d1.toString() != d2.toString()) return "Fail toString" + if (d1.foo() != d2.foo()) return "Fail foo" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclared.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclared.kt new file mode 100644 index 00000000000..f95ea92633c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclared.kt @@ -0,0 +1,7 @@ +data class A(val x: Int) { + override fun toString(): String = "!" +} + +fun box(): String { + return if (A(0).toString() == "!") "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt new file mode 100644 index 00000000000..d8521815442 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +data class A(val x: Int) { + fun toString(other: Any): String = "" +} + +data class B(val x: Int) { + fun toString(other: B, another: Any): String = "" +} + +fun box(): String { + A::class.java.getDeclaredMethod("toString") + A::class.java.getDeclaredMethod("toString", Any::class.java) + + B::class.java.getDeclaredMethod("toString") + B::class.java.getDeclaredMethod("toString", B::class.java, Any::class.java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt new file mode 100644 index 00000000000..c195530bf54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +data class A(val x: Array?, val y: IntArray?) + +fun box(): String { + var ts = A(Array(2, {it}), IntArray(3)).toString() + if(ts != "A(x=[0, 1], y=[0, 0, 0])") return ts + + ts = A(null, IntArray(3)).toString() + if(ts != "A(x=null, y=[0, 0, 0])") return ts + + ts = A(null, null).toString() + if(ts != "A(x=null, y=null)") return ts + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/changingVarParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/changingVarParam.kt new file mode 100644 index 00000000000..0268af29435 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/changingVarParam.kt @@ -0,0 +1,11 @@ +data class A(var string: String) + +fun box(): String { + val a = A("Fail") + if(a.toString() != "A(string=Fail)") return "fail" + + a.string = "OK" + if("$a" != "A(string=OK)") return a.toString() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/genericParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/genericParam.kt new file mode 100644 index 00000000000..794bad5dbe1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/genericParam.kt @@ -0,0 +1,11 @@ +data class A(val x: T) + +fun box(): String { + val a = A(42) + if ("$a" != "A(x=42)") return "$a" + + val b = A(239.toLong()) + if ("$b" != "A(x=239)") return "$b" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/mixedParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/mixedParams.kt new file mode 100644 index 00000000000..a8e9b7dbd20 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/mixedParams.kt @@ -0,0 +1,7 @@ +data class A(var x: Int, val z: Int?) + +fun box(): String { + val a = A(1, null) + if("$a" != "A(x=1, z=null)") return "$a" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/unitComponent.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/unitComponent.kt new file mode 100644 index 00000000000..72e5965b320 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/unitComponent.kt @@ -0,0 +1,6 @@ +data class A(val x: Unit) + +fun box(): String { + val a = A(Unit) + return if ("$a" == "A(x=kotlin.Unit)") "OK" else "$a" +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/twoValParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/twoValParams.kt new file mode 100644 index 00000000000..91b918b1a8c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/twoValParams.kt @@ -0,0 +1,6 @@ +data class A(val x: Int, val y: String) + +fun box(): String { + val a = A(42, "OK") + return if (a.component1() == 42) a.component2() else a.component1().toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/twoVarParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/twoVarParams.kt new file mode 100644 index 00000000000..053cfe55892 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/twoVarParams.kt @@ -0,0 +1,9 @@ +data class A(var x: Int, var y: String) + +fun box(): String { + val a = A(21, "K") + if (a.component1() != 21 || a.component2() != "K") return "Fail" + a.x *= 2 + a.y = "O" + a.component2() + return if (a.component1() == 42) a.component2() else a.component1().toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/unitComponent.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/unitComponent.kt new file mode 100644 index 00000000000..b70b461ab91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/unitComponent.kt @@ -0,0 +1,6 @@ +data class A(val x: Unit) + +fun box(): String { + val a = A(Unit) + return if (a.component1() is Unit) "OK" else "Fail ${a.component1()}" +} diff --git a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/emptyVariableRange.kt b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/emptyVariableRange.kt new file mode 100644 index 00000000000..c162fbeec34 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/emptyVariableRange.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(): Int { + return 1 + // val xyz has empty live range because everything after return will be removed as dead + val xyz = 1 +} + +fun box(): String { + assertEquals(1, foo()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRange.kt b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRange.kt new file mode 100644 index 00000000000..4d685fb2a0c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRange.kt @@ -0,0 +1,13 @@ +fun box(): String { + try { + return "OK" + if (1 == 1) { + val z = 2 + } + if (3 == 3) { + val z = 4 + } + } finally { + + } +} diff --git a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRangeInFinally.kt b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRangeInFinally.kt new file mode 100644 index 00000000000..071bd50aa47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/intersectingVariableRangeInFinally.kt @@ -0,0 +1,12 @@ +fun box(): String { + try { + return "OK" + } finally { + if (1 == 1) { + val z = 2 + } + if (3 == 3) { + val z = 4 + } + } +} diff --git a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/kt14357.kt b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/kt14357.kt new file mode 100644 index 00000000000..377a6facdac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/kt14357.kt @@ -0,0 +1,10 @@ +fun box(): String { + if (false) { + try { + null!! + } catch (e: Exception) { + throw e + } + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/annotation.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/annotation.kt new file mode 100644 index 00000000000..f7e1453599d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/annotation.kt @@ -0,0 +1,11 @@ +annotation class A(val a: Int = 0) + +@A fun test1() = 1 +@A(2) fun test2() = 1 + +fun box(): String { + if ((test1() + test2()) == 2) { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt new file mode 100644 index 00000000000..51b4d127934 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class A(value: Int = 1) + +fun box(): String { + val constructors = A::class.java.getConstructors().filter { !it.isSynthetic() } + return if (constructors.size == 2) "OK" else constructors.size.toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1.kt new file mode 100644 index 00000000000..db8161f1911 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1.kt @@ -0,0 +1,8 @@ +class A(val a: Int = 0) + +fun box(): String { + if (A().a == 0 && A(1).a == 1) { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1InnerClass.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1InnerClass.kt new file mode 100644 index 00000000000..588b0cf1c60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs1InnerClass.kt @@ -0,0 +1,14 @@ +class A { + inner class B(val a: String = "a", val b: Int = 55, val c: String = "c") +} + +fun box(): String { + val bDefault = A().B() + val b = A().B("aa", 66, "cc") + if (bDefault.a == "a" && bDefault.b == 55 && bDefault.c == "c") { + if (b.a == "aa" && b.b == 66 && b.c == "cc") { + return "OK" + } + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs2.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs2.kt new file mode 100644 index 00000000000..9a22d318336 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/defArgs2.kt @@ -0,0 +1,13 @@ +class A(val a: Int = 0, val b: String = "a") + +fun box(): String { + val a1 = A() + val a2 = A(1) + val a3 = A(b = "b") + val a4 = A(2, "c") + if (a1.a != 0 && a1.b != "a") return "fail" + if (a2.a != 1 && a2.b != "a") return "fail" + if (a3.a != 0 && a3.b != "b") return "fail" + if (a4.a != 2 && a4.b != "c") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/doubleDefArgs1InnerClass.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/doubleDefArgs1InnerClass.kt new file mode 100644 index 00000000000..cc9737c3e47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/doubleDefArgs1InnerClass.kt @@ -0,0 +1,14 @@ +class A { + inner class B(val a: Double = 1.0, val b: Int = 55, val c: String = "c") +} + +fun box(): String { + val bDefault = A().B() + val b = A().B(2.0, 66, "cc") + if (bDefault.a == 1.0 && bDefault.b == 55 && bDefault.c == "c") { + if (b.a == 2.0 && b.b == 66 && b.c == "cc") { + return "OK" + } + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enum.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enum.kt new file mode 100644 index 00000000000..edc9e061d4c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enum.kt @@ -0,0 +1,11 @@ +enum class A(val a: Int = 1) { + FIRST(), + SECOND(2) +} + +fun box(): String { + if (A.FIRST.a == 1 && A.SECOND.a == 2) { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithOneDefArg.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithOneDefArg.kt new file mode 100644 index 00000000000..339ab868c0d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithOneDefArg.kt @@ -0,0 +1,10 @@ +enum class Foo(val a: Int = 1, val b: String) { + B(2, "b"), + C(b = "b") +} + +fun box(): String { + if (Foo.B.a != 2 || Foo.B.b != "b") return "fail" + if (Foo.C.a != 1 || Foo.C.b != "b") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDefArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDefArgs.kt new file mode 100644 index 00000000000..7a7d6db0814 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDefArgs.kt @@ -0,0 +1,14 @@ +enum class Foo(val a: Int = 1, val b: String = "a") { + A(), + B(2, "b"), + C(b = "b"), + D(a = 2) +} + +fun box(): String { + if (Foo.A.a != 1 || Foo.A.b != "a") return "fail" + if (Foo.B.a != 2 || Foo.B.b != "b") return "fail" + if (Foo.C.a != 1 || Foo.C.b != "b") return "fail" + if (Foo.D.a != 2 || Foo.D.b != "a") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt new file mode 100644 index 00000000000..e461fd6a32e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt @@ -0,0 +1,14 @@ +enum class Foo(val a: Double = 1.0, val b: Double = 1.0) { + A(), + B(2.0, 2.0), + C(b = 2.0), + D(a = 2.0) +} + +fun box(): String { + if (Foo.A.a != 1.0 || Foo.A.b != 1.0) return "fail" + if (Foo.B.a != 2.0 || Foo.B.b != 2.0) return "fail" + if (Foo.C.a != 1.0 || Foo.C.b != 2.0) return "fail" + if (Foo.D.a != 2.0 || Foo.D.b != 1.0) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt2852.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt2852.kt new file mode 100644 index 00000000000..9a5434a99cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt2852.kt @@ -0,0 +1,7 @@ +fun box(): String { + val o = object { + inner class A(val value: String = "OK") + } + + return o.A().value +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt3060.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt3060.kt new file mode 100644 index 00000000000..ca4275a7403 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/kt3060.kt @@ -0,0 +1,10 @@ +class Foo private constructor(val param: String = "OK") { + companion object { + val s = Foo() + } +} + +fun box(): String { + Foo.s.param + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt new file mode 100644 index 00000000000..f291406389e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt @@ -0,0 +1,216 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class A(val a: Int = 1, + val b: Int = 2, + val c: Int = 3, + val d: Int = 4, + val e: Int = 5, + val f: Int = 6, + val g: Int = 7, + val h: Int = 8, + val i: Int = 9, + val j: Int = 10, + val k: Int = 11, + val l: Int = 12, + val m: Int = 13, + val n: Int = 14, + val o: Int = 15, + val p: Int = 16, + val q: Int = 17, + val r: Int = 18, + val s: Int = 19, + val t: Int = 20, + val u: Int = 21, + val v: Int = 22, + val w: Int = 23, + val x: Int = 24, + val y: Int = 25, + val z: Int = 26, + val aa: Int = 27, + val bb: Int = 28, + val cc: Int = 29, + val dd: Int = 30, + val ee: Int = 31, + val ff: Int = 32) { + override fun toString(): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" + } +} + +class B(val a: Int = 1, + val b: Int = 2, + val c: Int = 3, + val d: Int = 4, + val e: Int = 5, + val f: Int = 6, + val g: Int = 7, + val h: Int = 8, + val i: Int = 9, + val j: Int = 10, + val k: Int = 11, + val l: Int = 12, + val m: Int = 13, + val n: Int = 14, + val o: Int = 15, + val p: Int = 16, + val q: Int = 17, + val r: Int = 18, + val s: Int = 19, + val t: Int = 20, + val u: Int = 21, + val v: Int = 22, + val w: Int = 23, + val x: Int = 24, + val y: Int = 25, + val z: Int = 26, + val aa: Int = 27, + val bb: Int = 28, + val cc: Int = 29, + val dd: Int = 30, + val ee: Int = 31, + val ff: Int = 32, + val gg: Int = 33, + val hh: Int = 34, + val ii: Int = 35, + val jj: Int = 36, + val kk: Int = 37, + val ll: Int = 38, + val mm: Int = 39, + val nn: Int = 40) { + override fun toString(): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + + "$gg $hh $ii $jj $kk $ll $mm $nn" + } +} + +class C(val a: Int = 1, + val b: Int = 2, + val c: Int = 3, + val d: Int = 4, + val e: Int = 5, + val f: Int = 6, + val g: Int = 7, + val h: Int = 8, + val i: Int = 9, + val j: Int = 10, + val k: Int = 11, + val l: Int = 12, + val m: Int = 13, + val n: Int = 14, + val o: Int = 15, + val p: Int = 16, + val q: Int = 17, + val r: Int = 18, + val s: Int = 19, + val t: Int = 20, + val u: Int = 21, + val v: Int = 22, + val w: Int = 23, + val x: Int = 24, + val y: Int = 25, + val z: Int = 26, + val aa: Int = 27, + val bb: Int = 28, + val cc: Int = 29, + val dd: Int = 30, + val ee: Int = 31, + val ff: Int = 32, + val gg: Int = 33, + val hh: Int = 34, + val ii: Int = 35, + val jj: Int = 36, + val kk: Int = 37, + val ll: Int = 38, + val mm: Int = 39, + val nn: Int = 40, + val oo: Int = 41, + val pp: Int = 42, + val qq: Int = 43, + val rr: Int = 44, + val ss: Int = 45, + val tt: Int = 46, + val uu: Int = 47, + val vv: Int = 48, + val ww: Int = 49, + val xx: Int = 50, + val yy: Int = 51, + val zz: Int = 52, + val aaa: Int = 53, + val bbb: Int = 54, + val ccc: Int = 55, + val ddd: Int = 56, + val eee: Int = 57, + val fff: Int = 58, + val ggg: Int = 59, + val hhh: Int = 60, + val iii: Int = 61, + val jjj: Int = 62, + val kkk: Int = 63, + val lll: Int = 64, + val mmm: Int = 65, + val nnn: Int = 66, + val ooo: Int = 67, + val ppp: Int = 68, + val qqq: Int = 69, + val rrr: Int = 70) { + override fun toString(): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + + "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + + "$mmm $nnn $ooo $ppp $qqq $rrr" + } +} + +fun box(): String { + val test1 = A(4, e = 8, f = 15, w = 16, aa = 23, ff = 42).toString() + val test2 = A::class.java.newInstance().toString() + val test3 = A(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, + u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1).toString() + if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { + return "test1 = $test1" + } + if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { + return "test2 = $test2" + } + if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test3 = $test3" + } + + val test4 = B(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55).toString() + val test5 = B::class.java.newInstance().toString() + val test6 = B(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, + w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, + jj = 5, kk = 4, ll = 3, mm = 2, nn = 1).toString() + if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { + return "test4 = $test4" + } + if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { + return "test5 = $test5" + } + if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test6 = $test6" + } + + val test7 = C(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7).toString() + val test8 = C::class.java.newInstance().toString() + val test9 = C(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, + 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, + uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, + ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1).toString() + if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + + "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { + return "test7 = $test7" + } + if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + + "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { + return "test8 = $test8" + } + if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + + "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test9 = $test9" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/incWithDefaultInGetter.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/incWithDefaultInGetter.kt new file mode 100644 index 00000000000..a576bf5b852 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/incWithDefaultInGetter.kt @@ -0,0 +1,26 @@ +var inc: String = "" + +class X { + var result: String = "fail" + + operator fun get(name: String, type: String = "none") = name + inc + type + + operator fun set(name: String, s: String) { + result = name + s; + } +} + +operator fun String.inc(): String { + inc = this + "1" + return this + "1" +} + +fun box(): String { + var x = X() + val res = ++x["a"] + if (x.result != "aanone1") return "fail 1: ${x.result}" + + if (res != "aanone1none") return "fail 2: ${res}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/kt9140.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/kt9140.kt new file mode 100644 index 00000000000..ea677b74a84 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/kt9140.kt @@ -0,0 +1,11 @@ +class X { + operator fun get(name: String, type: String = "none") = name + type +} + +fun box(): String { + if (X().get("a") != "anone") return "fail 1: ${X().get("a")}" + + if (X()["a"] != "anone") return "fail 2: ${X()["a"]}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/plusAssignWithDefaultInGetter.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/plusAssignWithDefaultInGetter.kt new file mode 100644 index 00000000000..0b6f63450de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/plusAssignWithDefaultInGetter.kt @@ -0,0 +1,31 @@ +class X { + var result: String = "fail" + + operator fun get(name: String, type: String = "none") = name + type + + operator fun set(name: String, s: String) { + result = name + s; + } +} + +class Y { + var result: String = "fail" + + operator fun get(name: String, type: String = "no", type2: String = "ne") = name + type + type2 + + operator fun set(name: String, s: String) { + result = name + s; + } +} + +fun box(): String { + var x = X() + x["a"] += "OK" + if (x.result != "aanoneOK") return "fail: ${x.result}" + + var y = Y() + y["a"] += "OK" + if (y.result != "aanoneOK") return "fail: ${y.result}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/abstractClass.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/abstractClass.kt new file mode 100644 index 00000000000..c1cc5d0bd9e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/abstractClass.kt @@ -0,0 +1,16 @@ +abstract class Base { + abstract fun foo(a: String = "abc"): String +} + +class Derived: Base() { + override fun foo(a: String): String { + return a + } +} + +fun box(): String { + val result = Derived().foo() + if (result != "abc") return "Fail: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverride.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverride.kt new file mode 100644 index 00000000000..b2ad3e749c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverride.kt @@ -0,0 +1,10 @@ +open class Foo { + open fun foo(x: CharSequence = "O"): CharSequence = x +} +class Bar(): Foo() { + override fun foo(x: CharSequence): String { // Note the covariant return type + return x.toString() + "K" + } +} + +fun box() = Bar().foo() diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverrideGeneric.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverrideGeneric.kt new file mode 100644 index 00000000000..9f24919d51d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/covariantOverrideGeneric.kt @@ -0,0 +1,10 @@ +open class Foo { + open fun foo(x: CharSequence = "O"): CharSequence = x +} +class Bar: Foo() { + override fun foo(x: CharSequence): T { // Note the covariant return type + return (x.toString() + "K") as T + } +} + +fun box() = Bar().foo() diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extensionFunctionManyArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extensionFunctionManyArgs.kt new file mode 100644 index 00000000000..82984a99369 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extensionFunctionManyArgs.kt @@ -0,0 +1,205 @@ +fun Int.foo(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" +} + +fun String.bar(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + + "$gg $hh $ii $jj $kk $ll $mm $nn" +} + +fun Char.baz(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40, + oo: Int = 41, + pp: Int = 42, + qq: Int = 43, + rr: Int = 44, + ss: Int = 45, + tt: Int = 46, + uu: Int = 47, + vv: Int = 48, + ww: Int = 49, + xx: Int = 50, + yy: Int = 51, + zz: Int = 52, + aaa: Int = 53, + bbb: Int = 54, + ccc: Int = 55, + ddd: Int = 56, + eee: Int = 57, + fff: Int = 58, + ggg: Int = 59, + hhh: Int = 60, + iii: Int = 61, + jjj: Int = 62, + kkk: Int = 63, + lll: Int = 64, + mmm: Int = 65, + nnn: Int = 66, + ooo: Int = 67, + ppp: Int = 68, + qqq: Int = 69, + rrr: Int = 70): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + + "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + + "$mmm $nnn $ooo $ppp $qqq $rrr" +} + +fun box(): String { + val test1 = 1.foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) + val test2 = 1.foo() + val test3 = 1.foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, + u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) + if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { + return "test1 = $test1" + } + if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { + return "test2 = $test2" + } + if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test3 = $test3" + } + + val test4 = "".bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) + val test5 = "".bar() + val test6 = "".bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, + w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, + jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) + if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { + return "test4 = $test4" + } + if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { + return "test5 = $test5" + } + if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test6 = $test6" + } + + val test7 = 'a'.baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) + val test8 = 'a'.baz() + val test9 = 'a'.baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, + 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, + uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, + ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) + if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + + "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { + return "test7 = $test7" + } + if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + + "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { + return "test8 = $test8" + } + if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + + "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test9 = $test9" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunction.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunction.kt new file mode 100644 index 00000000000..b985d4b6467 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunction.kt @@ -0,0 +1,9 @@ +fun Int.foo(a: Int = 1): Int { + return a +} + +fun box(): String { + if (1.foo() != 1) return "fail" + if (1.foo(2) != 2) return "fail" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDouble.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDouble.kt new file mode 100644 index 00000000000..8b4b1fbd712 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDouble.kt @@ -0,0 +1,9 @@ +fun Double.foo(a: Double = 1.0): Double { + return a +} + +fun box(): String { + if (1.0.foo() != 1.0) return "fail" + if (1.0.foo(2.0) != 2.0) return "fail" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt new file mode 100644 index 00000000000..9c36a1335a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt @@ -0,0 +1,11 @@ +fun Double.foo(a: Double = 1.0, b: Double = 1.0): Double { + return a + b +} + +fun box(): String { + if (1.0.foo() != 2.0) return "fail" + if (1.0.foo(2.0, 2.0) != 4.0) return "fail" + if (1.0.foo(a = 2.0) != 3.0) return "fail" + if (1.0.foo(b = 2.0) != 3.0) return "fail" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInClassObject.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInClassObject.kt new file mode 100644 index 00000000000..876be1766c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInClassObject.kt @@ -0,0 +1,17 @@ +class A { + companion object { + fun Int.foo(a: Int = 1): Int { + return a + } + + fun test(): String { + if (1.foo() != 1) return "fail" + if (1.foo(2) != 2) return "fail" + return "OK" + } + } +} + +fun box(): String { + return A.test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInObject.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInObject.kt new file mode 100644 index 00000000000..d16105ac6b3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionInObject.kt @@ -0,0 +1,15 @@ +object A { + fun Int.foo(a: Int = 1): Int { + return a + } + + fun test(): String { + if (1.foo() != 1) return "fail" + if (1.foo(2) != 2) return "fail" + return "OK" + } +} + +fun box(): String { + return A.test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionWithOneDefArg.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionWithOneDefArg.kt new file mode 100644 index 00000000000..c905daed1b2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/extentionFunctionWithOneDefArg.kt @@ -0,0 +1,9 @@ +fun Int.foo(a: Int = 1, b: String): Int { + return a +} + +fun box(): String { + if (1.foo(b = "b") != 1) return "fail" + if (1.foo(2, "b") != 2) return "fail" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/funInTrait.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/funInTrait.kt new file mode 100644 index 00000000000..06b181e10b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/funInTrait.kt @@ -0,0 +1,14 @@ +interface Foo { + fun foo(a: Double = 1.0): Double +} + +class FooImpl : Foo { + override fun foo(a: Double): Double { + return a + } +} +fun box(): String { + if (FooImpl().foo() != 1.0) return "fail" + if (FooImpl().foo(2.0) != 2.0) return "fail" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunction.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunction.kt new file mode 100644 index 00000000000..35a3e575fe4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunction.kt @@ -0,0 +1,15 @@ +class A { + fun Int.foo(a: Int = 1): Int { + return a + } + + fun test(): String { + if (1.foo() != 1) return "fail" + if (1.foo(2) != 2) return "fail" + return "OK" + } +} + +fun box(): String { + return A().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDouble.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDouble.kt new file mode 100644 index 00000000000..a18b571e32b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDouble.kt @@ -0,0 +1,15 @@ +class A { + fun Double.foo(a: Double = 1.0): Double { + return a + } + + fun test(): String { + if (1.0.foo() != 1.0) return "fail" + if (1.0.foo(2.0) != 2.0) return "fail" + return "OK" + } +} + +fun box(): String { + return A().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt new file mode 100644 index 00000000000..844f5e88ef4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt @@ -0,0 +1,17 @@ +class A { + fun Double.foo(a: Double = 1.0, b: Double = 1.0): Double { + return a + b + } + + fun test(): String { + if (1.0.foo() != 2.0) return "fail" + if (1.0.foo(2.0, 2.0) != 4.0) return "fail" + if (1.0.foo(a = 2.0) != 3.0) return "fail" + if (1.0.foo(b = 2.0) != 3.0) return "fail" + return "OK" + } +} + +fun box(): String { + return A().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionManyArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionManyArgs.kt new file mode 100644 index 00000000000..3ed1be3d6c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/innerExtentionFunctionManyArgs.kt @@ -0,0 +1,211 @@ +class A { + fun Int.foo(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" + } + + fun String.bar(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + + "$gg $hh $ii $jj $kk $ll $mm $nn" + } + + fun Char.baz(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40, + oo: Int = 41, + pp: Int = 42, + qq: Int = 43, + rr: Int = 44, + ss: Int = 45, + tt: Int = 46, + uu: Int = 47, + vv: Int = 48, + ww: Int = 49, + xx: Int = 50, + yy: Int = 51, + zz: Int = 52, + aaa: Int = 53, + bbb: Int = 54, + ccc: Int = 55, + ddd: Int = 56, + eee: Int = 57, + fff: Int = 58, + ggg: Int = 59, + hhh: Int = 60, + iii: Int = 61, + jjj: Int = 62, + kkk: Int = 63, + lll: Int = 64, + mmm: Int = 65, + nnn: Int = 66, + ooo: Int = 67, + ppp: Int = 68, + qqq: Int = 69, + rrr: Int = 70): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + + "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + + "$mmm $nnn $ooo $ppp $qqq $rrr" + } + + fun test(): String { + val test1 = 1.foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) + val test2 = 1.foo() + val test3 = 1.foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, + u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) + if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { + return "test1 = $test1" + } + if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { + return "test2 = $test2" + } + if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test3 = $test3" + } + + val test4 = "".bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) + val test5 = "".bar() + val test6 = "".bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, + w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, + jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) + if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { + return "test4 = $test4" + } + if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { + return "test5 = $test5" + } + if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test6 = $test6" + } + + val test7 = 'a'.baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) + val test8 = 'a'.baz() + val test9 = 'a'.baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, + 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, + uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, + ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) + if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + + "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { + return "test7 = $test7" + } + if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + + "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { + return "test8 = $test8" + } + if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + + "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test9 = $test9" + } + + return "OK" + } +} + +fun box(): String { + return A().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/kt5232.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/kt5232.kt new file mode 100644 index 00000000000..8b91d2bd2d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/kt5232.kt @@ -0,0 +1,14 @@ +interface A { + fun visit(a:String, b:String="") : String = b + a +} + +class B : A { + override fun visit(a:String, b:String) : String = b + a +} + +fun box(): String { + val result = B().visit("K", "O") + if (result != "OK") return "fail $result" + + return B().visit("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/memberFunctionManyArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/memberFunctionManyArgs.kt new file mode 100644 index 00000000000..def2549e106 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/memberFunctionManyArgs.kt @@ -0,0 +1,208 @@ +class A() { + fun foo(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" + } + + fun bar(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + + "$gg $hh $ii $jj $kk $ll $mm $nn" + } + + fun baz(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40, + oo: Int = 41, + pp: Int = 42, + qq: Int = 43, + rr: Int = 44, + ss: Int = 45, + tt: Int = 46, + uu: Int = 47, + vv: Int = 48, + ww: Int = 49, + xx: Int = 50, + yy: Int = 51, + zz: Int = 52, + aaa: Int = 53, + bbb: Int = 54, + ccc: Int = 55, + ddd: Int = 56, + eee: Int = 57, + fff: Int = 58, + ggg: Int = 59, + hhh: Int = 60, + iii: Int = 61, + jjj: Int = 62, + kkk: Int = 63, + lll: Int = 64, + mmm: Int = 65, + nnn: Int = 66, + ooo: Int = 67, + ppp: Int = 68, + qqq: Int = 69, + rrr: Int = 70): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + + "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + + "$mmm $nnn $ooo $ppp $qqq $rrr" + } +} + +fun box(): String { + val a = A() + val test1 = a.foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) + val test2 = a.foo() + val test3 = a.foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, + u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) + if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { + return "test1 = $test1" + } + if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { + return "test2 = $test2" + } + if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test3 = $test3" + } + + val test4 = a.bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) + val test5 = a.bar() + val test6 = a.bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, + w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, + jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) + if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { + return "test4 = $test4" + } + if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { + return "test5 = $test5" + } + if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test6 = $test6" + } + + val test7 = a.baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) + val test8 = a.baz() + val test9 = a.baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, + 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, + uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, + ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) + if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + + "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { + return "test7 = $test7" + } + if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + + "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { + return "test8 = $test8" + } + if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + + "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test9 = $test9" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/mixingNamedAndPositioned.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/mixingNamedAndPositioned.kt new file mode 100644 index 00000000000..7b3aebeec18 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/mixingNamedAndPositioned.kt @@ -0,0 +1,16 @@ +fun foo(a: String = "Companion", b: Int = 1, c: Long = 2): String { + return "$a $b $c" +} + +fun box(): String { + val test1 = foo("test1", 2, c = 3) + if (test1 != "test1 2 3") return test1 + + val test2 = foo("test2", c = 3) + if (test2 != "test2 1 3") return test2 + + val test3 = foo("test3", b = 3) + if (test3 != "test3 3 2") return test3 + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/topLevelManyArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/topLevelManyArgs.kt new file mode 100644 index 00000000000..1086f23b45f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/topLevelManyArgs.kt @@ -0,0 +1,205 @@ +fun foo(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff" +} + +fun bar(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff " + + "$gg $hh $ii $jj $kk $ll $mm $nn" +} + +fun baz(a: Int = 1, + b: Int = 2, + c: Int = 3, + d: Int = 4, + e: Int = 5, + f: Int = 6, + g: Int = 7, + h: Int = 8, + i: Int = 9, + j: Int = 10, + k: Int = 11, + l: Int = 12, + m: Int = 13, + n: Int = 14, + o: Int = 15, + p: Int = 16, + q: Int = 17, + r: Int = 18, + s: Int = 19, + t: Int = 20, + u: Int = 21, + v: Int = 22, + w: Int = 23, + x: Int = 24, + y: Int = 25, + z: Int = 26, + aa: Int = 27, + bb: Int = 28, + cc: Int = 29, + dd: Int = 30, + ee: Int = 31, + ff: Int = 32, + gg: Int = 33, + hh: Int = 34, + ii: Int = 35, + jj: Int = 36, + kk: Int = 37, + ll: Int = 38, + mm: Int = 39, + nn: Int = 40, + oo: Int = 41, + pp: Int = 42, + qq: Int = 43, + rr: Int = 44, + ss: Int = 45, + tt: Int = 46, + uu: Int = 47, + vv: Int = 48, + ww: Int = 49, + xx: Int = 50, + yy: Int = 51, + zz: Int = 52, + aaa: Int = 53, + bbb: Int = 54, + ccc: Int = 55, + ddd: Int = 56, + eee: Int = 57, + fff: Int = 58, + ggg: Int = 59, + hhh: Int = 60, + iii: Int = 61, + jjj: Int = 62, + kkk: Int = 63, + lll: Int = 64, + mmm: Int = 65, + nnn: Int = 66, + ooo: Int = 67, + ppp: Int = 68, + qqq: Int = 69, + rrr: Int = 70): String { + return "$a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z $aa $bb $cc $dd $ee $ff $gg $hh $ii $jj $kk " + + "$ll $mm $nn $oo $pp $qq $rr $ss $tt $uu $vv $ww $xx $yy $zz $aaa $bbb $ccc $ddd $eee $fff $ggg $hhh $iii $jjj $kkk $lll " + + "$mmm $nnn $ooo $ppp $qqq $rrr" +} + +fun box(): String { + val test1 = foo(4, e = 8, f = 15, w = 16, aa = 23, ff = 42) + val test2 = foo() + val test3 = foo(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, q = 16, r = 15, s = 14, t = 13, + u = 12, v = 11, w = 10, x = 9, y = 8, z = 7, aa = 6, bb = 5, cc = 4, dd = 3, ee = 2, ff = 1) + if (test1 != "4 2 3 4 8 15 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 24 25 26 23 28 29 30 31 42") { + return "test1 = $test1" + } + if (test2 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") { + return "test2 = $test2" + } + if (test3 != "32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test3 = $test3" + } + + val test4 = bar(54, 217, h = 236, l = 18, q = 3216, u = 8, aa = 22, ff = 33, jj = 44, mm = 55) + val test5 = bar() + val test6 = bar(40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, u = 20, v = 19, + w = 18, x = 17, y = 16, z = 15, aa = 14, bb = 13, cc = 12, dd = 11, ee = 10, ff = 9, gg = 8, hh = 7, ii = 6, + jj = 5, kk = 4, ll = 3, mm = 2, nn = 1) + if (test4 != "54 217 3 4 5 6 7 236 9 10 11 18 13 14 15 16 3216 18 19 20 8 22 23 24 25 26 22 28 29 30 31 33 33 34 35 44 37 38 55 40") { + return "test4 = $test4" + } + if (test5 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40") { + return "test5 = $test5" + } + if (test6 != "40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test6 = $test6" + } + + val test7 = baz(5, f = 3, w = 1, aa = 71, nn = 2, qq = 15, ww = 97, aaa = 261258, iii = 3, nnn = 8, rrr = 7) + val test8 = baz() + val test9 = baz(70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, + 40, 39, 38, 37, 36, jj = 35, kk = 34, ll = 33, mm = 32, nn = 31, oo = 30, pp = 29, qq = 28, rr = 27, ss = 26, tt = 25, + uu = 24, vv = 23, ww = 22, xx = 21, yy = 20, zz = 19, aaa = 18, bbb = 17, ccc = 16, ddd = 15, eee = 14, fff = 13, + ggg = 12, hhh = 11, iii = 10, jjj = 9, kkk = 8, lll = 7, mmm = 6, nnn = 5, ooo = 4, ppp = 3, qqq = 2, rrr = 1) + if (test7 != "5 2 3 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 24 25 26 71 28 29 30 31 32 33 34 35 36 37 38 39 2 41 42 15 " + + "44 45 46 47 48 97 50 51 52 261258 54 55 56 57 58 59 60 3 62 63 64 65 8 67 68 69 7") { + return "test7 = $test7" + } + if (test8 != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 " + + "43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70") { + return "test8 = $test8" + } + if (test9 != "70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 " + + "31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1") { + return "test9 = $test9" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/trait.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/trait.kt new file mode 100644 index 00000000000..91bafe072f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/trait.kt @@ -0,0 +1,14 @@ +interface Base { + fun bar(a: String = "abc"): String = a + " from interface" +} + +class Derived: Base { + override fun bar(a: String): String = a + " from class" +} + +fun box(): String { + val result = Derived().bar() + if (result != "abc from class") return "Fail: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/kt6382.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/kt6382.kt new file mode 100644 index 00000000000..07910e2cf12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/kt6382.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +fun box(): String { + return if (A().run() == "Aabc") "OK" else "fail" +} + +public class A { + fun run() = + with ("abc") { + show() + } + + private fun String.show(p: Boolean = false): String = getName() + this + + private fun getName() = "A" +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberExtensionFunction.kt new file mode 100644 index 00000000000..01167805ef4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberExtensionFunction.kt @@ -0,0 +1,9 @@ +class A { + private fun Int.foo(other: Int = 5): Int = this + other + + inner class B { + fun bar() = 37.foo() + } +} + +fun box() = if (A().B().bar() == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberFunction.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberFunction.kt new file mode 100644 index 00000000000..64fe7c2de65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/memberFunction.kt @@ -0,0 +1,11 @@ +// KT-5786 NoSuchMethodError: no accessor for private fun with default arguments + +class A { + private fun foo(result: String = "OK"): String = result + + companion object { + fun bar() = A().foo() + } +} + +fun box() = A.bar() diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/primaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/primaryConstructor.kt new file mode 100644 index 00000000000..7b4ba263678 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/primaryConstructor.kt @@ -0,0 +1,16 @@ +var state: String = "Fail" + +class A private constructor(x: String = "OK") { + init { + state = x + } + + companion object { + fun foo() = A() + } +} + +fun box(): String { + A.foo() + return state +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/secondaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/secondaryConstructor.kt new file mode 100644 index 00000000000..ea7569669e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/secondaryConstructor.kt @@ -0,0 +1,16 @@ +var state: String = "Fail" + +class A { + private constructor(x: String = "OK") { + state = x + } + + companion object { + fun foo() = A() + } +} + +fun box(): String { + A.foo() + return state +} diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/protected.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/protected.kt new file mode 100644 index 00000000000..be1243f96c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/protected.kt @@ -0,0 +1,23 @@ +// FILE: Foo.kt + +package foo + +open class Foo() { + protected fun foo(value: Boolean = false) = if (!value) "OK" else "fail5" +} + +// FILE: Bar.kt + +package bar + +import foo.Foo + +class Bar() : Foo() { + fun execute(): String { + return { foo() } () + } +} + +fun box(): String { + return Bar().execute() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt2789.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt2789.kt new file mode 100644 index 00000000000..043b0d071a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt2789.kt @@ -0,0 +1,23 @@ +interface FooTrait { + fun make(size: Int = 16) : T + + fun makeFromTraitImpl() : T = make() +} + +class FooClass : FooTrait { + override fun make(size: Int): String { + return "$size" + } +} + +fun box(): String { + val explicitParam = FooClass().make(16) + val defaultRes = FooClass().make() + val defaultTraitRes = FooClass().makeFromTraitImpl() + if (explicitParam != defaultRes) return "fail 1: ${explicitParam} != ${defaultRes}" + if (explicitParam != "16") return "fail 2: ${explicitParam}" + + if (explicitParam != defaultTraitRes) return "fail 3: ${explicitParam} != ${defaultTraitRes}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9428.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9428.kt new file mode 100644 index 00000000000..b9d89105d37 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9428.kt @@ -0,0 +1,23 @@ +open class Player(val name: String) +open class SlashPlayer(name: String) : Player(name) + +public abstract class Game { + abstract fun getPlayer(name: String, create: Boolean = true): T? +} + +class SimpleGame : Game() { + override fun getPlayer(name: String, create: Boolean): SlashPlayer? { + return if (create) { + SlashPlayer(name) + } + else null + } +} + +fun box(): String { + val player1 = SimpleGame().getPlayer("fail", false) + if (player1 != null) return "fail 1" + + val player2 = SimpleGame().getPlayer("OK") + return player2!!.name +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9924.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9924.kt new file mode 100644 index 00000000000..8366f26008e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/kt9924.kt @@ -0,0 +1,13 @@ +abstract class A { + abstract fun test(a: T, b:Boolean = false) : String +} + +class B : A() { + override fun test(a: String, b: Boolean): String { + return a + } +} + +fun box(): String { + return B().test("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/simpleFromOtherFile.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/simpleFromOtherFile.kt new file mode 100644 index 00000000000..e039250e9ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/simpleFromOtherFile.kt @@ -0,0 +1,7 @@ +// FILE: 1.kt + +fun box() = ok() + +// FILE: 2.kt + +fun ok(res: String = "OK") = res diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt new file mode 100644 index 00000000000..0d939974c2a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +open class MyClass { + fun def(i: Int = 0): Int { + return i + } +} + +fun box():String { + val method = MyClass::class.java.getMethod("def\$default", MyClass::class.java, Int::class.java, Int::class.java, Any::class.java) + val result = method.invoke(null, MyClass(), -1, 1, null) + + if (result != 0) return "fail 1: $result" + + var failed = false + try { + method.invoke(null, MyClass(), -1, 1, "fail") + } + catch(e: Exception) { + val cause = e.cause + if (cause is UnsupportedOperationException && cause.message!!.startsWith("Super calls")) { + failed = true + } + } + + return if (!failed) "fail" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt new file mode 100644 index 00000000000..b409bd753ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt @@ -0,0 +1,15 @@ +import kotlin.reflect.KProperty + +// KT-5612 + +class Delegate { + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String { + return "OK" + } +} + +val prop by Delegate() + +val a = prop + +fun box() = a diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/capturePropertyInClosure.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/capturePropertyInClosure.kt new file mode 100644 index 00000000000..3c03bc94ca8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/capturePropertyInClosure.kt @@ -0,0 +1,23 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +class B { + private var value: Int by Delegate() + + public fun test() { + fun foo() { + value = 1 + } + foo() + } +} + +fun box(): String { + B().test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/castGetReturnType.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/castGetReturnType.kt new file mode 100644 index 00000000000..cc106890792 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/castGetReturnType.kt @@ -0,0 +1,13 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +class AImpl { + val prop: Number by Delegate() +} + +fun box(): String { + return if(AImpl().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/castSetParameter.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/castSetParameter.kt new file mode 100644 index 00000000000..3d3e7a7806a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/castSetParameter.kt @@ -0,0 +1,26 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = Derived() + operator fun getValue(t: Any?, p: KProperty<*>): Derived { + inner = Derived(inner.a + "-get") + return inner + } + operator fun setValue(t: Any?, p: KProperty<*>, i: Base) { inner = Derived(inner.a + "-" + i.a + "-set") } +} + +class A { + var prop: Derived by Delegate() +} + +fun box(): String { + val c = A() + if(c.prop.a != "derived-get") return "fail get ${c.prop.a}" + c.prop = Derived() + if (c.prop.a != "derived-get-derived-set-get") return "fail set ${c.prop.a}" + return "OK" +} + +open class Base(open val a: String = "base") + +class Derived(override val a: String = "derived"): Base() diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateAsInnerClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateAsInnerClass.kt new file mode 100644 index 00000000000..9b503ccce83 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateAsInnerClass.kt @@ -0,0 +1,19 @@ +import kotlin.reflect.KProperty + +class A { + var prop: Int by Delegate() + + class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } + } +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByOtherProperty.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByOtherProperty.kt new file mode 100644 index 00000000000..7ec7f0c9151 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByOtherProperty.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +class A { + val p = Delegate() + var prop: Int by p +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelFun.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelFun.kt new file mode 100644 index 00000000000..5900d71c985 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelFun.kt @@ -0,0 +1,21 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +fun foo() = Delegate() + +class A { + var prop: Int by foo() +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelProperty.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelProperty.kt new file mode 100644 index 00000000000..22f7b1b2ed3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateByTopLevelProperty.kt @@ -0,0 +1,21 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +val p = Delegate() + +class A { + var prop: Int by p +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtProperty.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtProperty.kt new file mode 100644 index 00000000000..4eac9e2dc73 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtProperty.kt @@ -0,0 +1,14 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: A, p: KProperty<*>): Int = 1 +} + +val A.prop: Int by Delegate() + +class A { +} + +fun box(): String { + return if(A().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtPropertyInClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtPropertyInClass.kt new file mode 100644 index 00000000000..7cdaca652eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateForExtPropertyInClass.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: F.A, p: KProperty<*>): Int = 1 +} + +class F { + val A.prop: Int by Delegate() + + class A { + } + + fun foo(): Int { + return A().prop + } +} + +fun box(): String { + return if(F().foo() == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateWithPrivateSet.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateWithPrivateSet.kt new file mode 100644 index 00000000000..d44684bb4c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/delegateWithPrivateSet.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME +// See KT-10107: 'Variable must be initialized' for delegate with private set + +class My { + var delegate: String by kotlin.properties.Delegates.notNull() + private set + + init { + delegate = "OK" + } +} + +fun box() = My().delegate diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionDelegatesWithSameNames.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionDelegatesWithSameNames.kt new file mode 100644 index 00000000000..ec5f37c0536 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionDelegatesWithSameNames.kt @@ -0,0 +1,14 @@ +open class C + +object O : C() + +object K : C() + +class D(val value: String) { + operator fun getValue(thisRef: C, property: Any): String = value +} + +val O.prop by D("O") +val K.prop by D("K") + +fun box() = O.prop + K.prop diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionPropertyAndExtensionGetValue.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionPropertyAndExtensionGetValue.kt new file mode 100644 index 00000000000..1e796085d97 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/extensionPropertyAndExtensionGetValue.kt @@ -0,0 +1,13 @@ +class A(val o: String) + +interface I { + val k: String +} + +inline operator fun A.getValue(thisRef: I, property: Any): String = o + thisRef.k + +class B(override val k: String) : I + +val B.prop by A("O") + +fun box() = B("K").prop \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/genericDelegate.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/genericDelegate.kt new file mode 100644 index 00000000000..f1072a6c339 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/genericDelegate.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Delegate(var inner: T) { + operator fun getValue(t: Any?, p: KProperty<*>): T = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } +} + +class A { + inner class B { + var prop: Int by Delegate(1) + } +} + +fun box(): String { + val c = A().B() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFun.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFun.kt new file mode 100644 index 00000000000..c08af8aeca2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFun.kt @@ -0,0 +1,14 @@ +import kotlin.reflect.KProperty + +class Delegate { +} + +operator fun Delegate.getValue(t: Any?, p: KProperty<*>): Int = 1 + +class A { + val prop: Int by Delegate() +} + +fun box(): String { + return if(A().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFunInClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFunInClass.kt new file mode 100644 index 00000000000..653c844066e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/getAsExtensionFunInClass.kt @@ -0,0 +1,13 @@ +import kotlin.reflect.KProperty + +class Delegate { +} + +class A { + operator fun Delegate.getValue(t: Any?, p: KProperty<*>): Int = 1 + val prop: Int by Delegate() +} + +fun box(): String { + return if(A().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVal.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVal.kt new file mode 100644 index 00000000000..0878fe18868 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVal.kt @@ -0,0 +1,13 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +class A { + val prop: Int by Delegate() +} + +fun box(): String { + return if(A().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVar.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVar.kt new file mode 100644 index 00000000000..4541763a721 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inClassVar.kt @@ -0,0 +1,19 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +class A { + var prop: Int by Delegate() +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/inTrait.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inTrait.kt new file mode 100644 index 00000000000..10a1746e561 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inTrait.kt @@ -0,0 +1,17 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +interface A { + val prop: Int +} + +class AImpl: A { + override val prop: Int by Delegate() +} + +fun box(): String { + return if(AImpl().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/inferredPropertyType.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inferredPropertyType.kt new file mode 100644 index 00000000000..50d8ad91411 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/inferredPropertyType.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Delegate(var inner: T) { + operator fun getValue(t: Any?, p: KProperty<*>): T = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } +} + +class A { + inner class B { + var prop by Delegate(1) + } +} + +fun box(): String { + val c = A().B() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt4138.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt4138.kt new file mode 100644 index 00000000000..f4535dd82e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt4138.kt @@ -0,0 +1,37 @@ +import kotlin.reflect.KProperty + +class Delegate(var inner: T) { + operator fun getValue(t: Any?, p: KProperty<*>): T = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: T) { inner = i } +} + + +class Foo (val f: Int) { + companion object { + val A: Foo by Delegate(Foo(11)) + var B: Foo by Delegate(Foo(11)) + } +} + +interface FooTrait { + companion object { + val A: Foo by Delegate(Foo(11)) + var B: Foo by Delegate(Foo(11)) + } +} + +fun box() : String { + if (Foo.A.f != 11) return "fail 1" + if (Foo.B.f != 11) return "fail 2" + + Foo.B = Foo(12) + if (Foo.B.f != 12) return "fail 3" + + if (FooTrait.A.f != 11) return "fail 4" + if (FooTrait.B.f != 11) return "fail 5" + + FooTrait.B = Foo(12) + if (FooTrait.B.f != 12) return "fail 6" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt6722.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt6722.kt new file mode 100644 index 00000000000..f680293e6dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt6722.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +interface T { +} + +fun box(): String { + val a = "OK" + val t = object : T { + val foo by lazy { + a + } + } + return t.foo +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt9712.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt9712.kt new file mode 100644 index 00000000000..dd4f6cf1945 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/kt9712.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +import kotlin.properties.Delegates + +object X { + public var O: String + by Delegates.observable("O") { prop, old, new -> } + private set +} + +open class A { + public var K: String + by Delegates.observable("") { prop, old, new -> } + protected set +} + +class B : A() { + init { + K = "K" + } +} + +fun box(): String = + X.O + B().K diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVal.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVal.kt new file mode 100644 index 00000000000..52a0de0cd68 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVal.kt @@ -0,0 +1,14 @@ +package foo + +import kotlin.reflect.KProperty + +inline fun run(f: () -> T) = f() + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +fun box(): String { + val prop: Int by Delegate() + return run { if (prop == 1) "OK" else "fail" } +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalValNoInline.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalValNoInline.kt new file mode 100644 index 00000000000..bb21f1e3b52 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalValNoInline.kt @@ -0,0 +1,14 @@ +package foo + +import kotlin.reflect.KProperty + +fun run(f: () -> T) = f() + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +fun box(): String { + val prop: Int by Delegate() + return run { if (prop == 1) "OK" else "fail" } +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVar.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVar.kt new file mode 100644 index 00000000000..d655e965ab1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVar.kt @@ -0,0 +1,20 @@ +package foo + +import kotlin.reflect.KProperty + +inline fun run(f: () -> T) = f() + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { + inner = i + } +} + +fun box(): String { + var prop: Int by Delegate() + run { prop = 2 } + if (prop != 2) return "fail get" + return run { if (prop != 2) "fail set" else "OK" } +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVarNoInline.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVarNoInline.kt new file mode 100644 index 00000000000..8ac07a3f364 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/capturedLocalVarNoInline.kt @@ -0,0 +1,20 @@ +package foo + +import kotlin.reflect.KProperty + +fun run(f: () -> T) = f() + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { + inner = i + } +} + +fun box(): String { + var prop: Int by Delegate() + run { prop = 2 } + if (prop != 2) return "fail get" + return run { if (prop != 2) "fail set" else "OK" } +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineGetValue.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineGetValue.kt new file mode 100644 index 00000000000..80a60fd6e61 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineGetValue.kt @@ -0,0 +1,12 @@ +package foo + +import kotlin.reflect.KProperty + +class Delegate { + inline operator fun getValue(t: Any?, p: KProperty<*>): String = p.name +} + +fun box(): String { + val OK: String by Delegate() + return OK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineOperators.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineOperators.kt new file mode 100644 index 00000000000..98198d4acd4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/inlineOperators.kt @@ -0,0 +1,19 @@ +package foo + +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + inline operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + inline operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { + inner = i + } +} + +fun box(): String { + var prop: Int by Delegate() + if (prop != 1) return "fail get" + prop = 2 + if (prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt12891.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt12891.kt new file mode 100644 index 00000000000..683c4fca841 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt12891.kt @@ -0,0 +1,5 @@ +//WITH_RUNTIME +fun box(): String { + val x by lazy { "OK" } + return x +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt13557.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt13557.kt new file mode 100644 index 00000000000..dd49cb336dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/kt13557.kt @@ -0,0 +1,14 @@ +//WITH_REFLECT + +import kotlin.properties.Delegates + +fun box(): String { + var foo: String by Delegates.notNull(); + + object { + fun baz() { + foo = "OK" + } + }.baz() + return foo +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVal.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVal.kt new file mode 100644 index 00000000000..cd3f7178453 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVal.kt @@ -0,0 +1,12 @@ +package foo + +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +fun box(): String { + val prop: Int by Delegate() + return if (prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localValNoExplicitType.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localValNoExplicitType.kt new file mode 100644 index 00000000000..20e86275732 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localValNoExplicitType.kt @@ -0,0 +1,12 @@ +package foo + +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +fun box(): String { + val prop by Delegate() + return if (prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVar.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVar.kt new file mode 100644 index 00000000000..606bc60c871 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVar.kt @@ -0,0 +1,19 @@ +package foo + +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { + inner = i + } +} + +fun box(): String { + var prop: Int by Delegate() + if (prop != 1) return "fail get" + prop = 2 + if (prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVarNoExplicitType.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVarNoExplicitType.kt new file mode 100644 index 00000000000..b9e51893775 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/localVarNoExplicitType.kt @@ -0,0 +1,19 @@ +package foo + +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { + inner = i + } +} + +fun box(): String { + var prop by Delegate() + if (prop != 1) return "fail get" + prop = 2 + if (prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt new file mode 100644 index 00000000000..68784f3f8fb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +object Delegate { + operator fun getValue(thiz: My, property: KProperty<*>): String { + if (property !is KMutableProperty<*>) return "Fail: property is not a KMutableProperty" + property as KMutableProperty1 + + try { + property.set(thiz, "") + return "Fail: property.set should cause IllegalCallableAccessException" + } + catch (e: IllegalCallableAccessException) { + // OK + } + + property.isAccessible = true + property.set(thiz, "") + + return "OK" + } + + operator fun setValue(thiz: My, property: KProperty<*>, value: String) { + } +} + +class My { + var delegate: String by Delegate + private set +} + +fun box() = My().delegate diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateVar.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateVar.kt new file mode 100644 index 00000000000..33faef3e3b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateVar.kt @@ -0,0 +1,22 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +class A { + private var prop: Int by Delegate() + + fun test(): String { + if(prop != 1) return "fail get" + prop = 2 + if (prop != 2) return "fail set" + return "OK" + } +} + +fun box(): String { + return A().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt new file mode 100644 index 00000000000..b1c8e42f488 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.util.IdentityHashMap +import kotlin.reflect.KProperty + +class A { + var foo: Int by IntHandler + + companion object { + var bar: Any? by AnyHandler + } +} + +val baz: String by StringHandler + + + +val metadatas = IdentityHashMap, Unit>() + +fun record(p: KProperty<*>) = metadatas.put(p, Unit) + +object IntHandler { + operator fun getValue(t: Any?, p: KProperty<*>): Int { record(p); return 42 } + operator fun setValue(t: Any?, p: KProperty<*>, value: Int) { record(p) } +} + +object AnyHandler { + operator fun getValue(t: Any?, p: KProperty<*>): Any? { record(p); return 3.14 } + operator fun setValue(t: Any?, p: KProperty<*>, value: Any?) { record(p) } +} + +object StringHandler { + operator fun getValue(t: Any?, p: KProperty<*>): String { record(p); return p.name } + operator fun setValue(t: Any?, p: KProperty<*>, value: String) { record(p) } +} + +fun box(): String { + val a = A() + a.foo = 42 + a.foo = a.foo + baz.length + a.foo = 239 + A.bar = baz + a.foo + baz + A.bar + + if (metadatas.keys.size != 3) + return "Fail: only three instances of KProperty should have been created\n${metadatas.keys}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/protectedVarWithPrivateSet.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/protectedVarWithPrivateSet.kt new file mode 100644 index 00000000000..76bb953d48f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/protectedVarWithPrivateSet.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.properties.Delegates + +open class A { + protected var value: T by Delegates.notNull() + private set +} + +class B : A() + +fun box(): String { + B() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/differentReceivers.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/differentReceivers.kt new file mode 100644 index 00000000000..990b7d63455 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/differentReceivers.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +class MyClass(val value: String) + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun MyClass.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf(${this.value});") { this.value } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +val testO by runLogged("O;") { MyClass("O") } +val testK by runLogged("K;") { "K" } +val testOK = runLogged("OK;") { testO + testK } + +fun box(): String { + assertEquals("O;tdf(O);K;OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrder.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrder.kt new file mode 100644 index 00000000000..c837b248604 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrder.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf($this);") { this } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +val testO by runLogged("O;") { "O" } +val testK by runLogged("K;") { "K" } +val testOK = runLogged("OK;") { testO + testK } + +fun box(): String { + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrderVar.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrderVar.kt new file mode 100644 index 00000000000..e31915c332d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrderVar.kt @@ -0,0 +1,38 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +val dispatcher = hashMapOf() + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: Any): String { + dispatcher[this] = this + return runLogged("tdf($this);") { this } +} + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get(${dispatcher[this]});") { dispatcher[this]!! } + +operator fun String.setValue(receiver: Any?, p: Any, newValue: String) { + dispatcher[this] = newValue + runLogged("set(${dispatcher[this]});") { dispatcher[this]!! } +} + +var testO by runLogged("K;") { "K" } +var testK by runLogged("O;") { "O" } +val testOK = runLogged("OK;") { + testO = "O" + testK = "K" + testO + testK +} + +fun box(): String { + assertEquals("K;tdf(K);O;tdf(O);OK;set(O);set(K);get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/extensionDelegated.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/extensionDelegated.kt new file mode 100644 index 00000000000..f44e553e7f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/extensionDelegated.kt @@ -0,0 +1,16 @@ +import kotlin.reflect.KProperty + +var log = "" + +class UserDataProperty(val key: String) { + operator fun getValue(thisRef: R, desc: KProperty<*>) = thisRef.toString() + key + + operator fun setValue(thisRef: R, desc: KProperty<*>, value: String?) { log += "set"} +} + + +var String.calc: String by UserDataProperty("K") + +fun box(): String { + return "O".calc +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/generic.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/generic.kt new file mode 100644 index 00000000000..8e6af346f90 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/generic.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +open class MyClass(val value: String) { + override fun toString(): String { + return value + } +} + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun T.provideDelegate(host: Any?, p: Any): T = + runLogged("tdf(${this.value});") { this } + +operator fun T.getValue(receiver: Any?, p: Any): T = + runLogged("get($this);") { this } + +val testO by runLogged("O;") { MyClass("O") } +val testK by runLogged("K;") { "K" } +val testOK = runLogged("OK;") { testO.value + testK } + +fun box(): String { + assertEquals("O;tdf(O);K;OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/hostCheck.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/hostCheck.kt new file mode 100644 index 00000000000..788f19e57d0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/hostCheck.kt @@ -0,0 +1,14 @@ +import kotlin.reflect.KProperty + +class Delegate(val value: String) { + operator fun provideDelegate(instance: A, property: KProperty<*>): Delegate = Delegate(instance.value) + operator fun getValue(instance: Any?, property: KProperty<*>) = value +} + +class A(val value: String) { + val result: String by Delegate("Fail") +} + +fun box(): String { + return A("OK").result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inClass.kt new file mode 100644 index 00000000000..e1456a8bd0f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inClass.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf($this);") { this } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +class Test { + val testO by runLogged("O;") { "O" } + val testK by runLogged("K;") { "K" } + val testOK = runLogged("OK;") { testO + testK } +} + +fun box(): String { + assertEquals("", log) + val test = Test() + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return test.testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inlineProvideDelegate.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inlineProvideDelegate.kt new file mode 100644 index 00000000000..3ce685006b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/inlineProvideDelegate.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +inline operator fun String.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf($this);") { this } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +val testO by runLogged("O;") { "O" } +val testK by runLogged("K;") { "K" } +val testOK = runLogged("OK;") { testO + testK } + +fun box(): String { + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt new file mode 100644 index 00000000000..c16dcdc2615 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME +// IGNORE_BACKEND: JS + +import kotlin.test.* + +var log: String = "" + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf($this);") { this } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +object Test { + fun foo() {} + @JvmStatic val testO by runLogged("O;") { "O" } + @JvmStatic val testK by runLogged("K;") { "K" } + @JvmStatic val testOK = runLogged("OK;") { testO + testK } +} + +fun box(): String { + assertEquals("", log) + Test.foo() + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return Test.testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/kt15437.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/kt15437.kt new file mode 100644 index 00000000000..85d54e3cc18 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/kt15437.kt @@ -0,0 +1,12 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun provideDelegate(instance: Any?, property: KProperty<*>): Delegate = this + operator fun getValue(instance: Any?, property: KProperty<*>) = "OK" +} + +val result: String by Delegate() + +fun box(): String { + return result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/local.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/local.kt new file mode 100644 index 00000000000..e010f9f1242 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/local.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf($this);") { this } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +fun box(): String { + val testO by runLogged("O;") { "O" } + val testK by runLogged("K;") { "K" } + val testOK = runLogged("OK;") { testO + testK } + + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localCaptured.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localCaptured.kt new file mode 100644 index 00000000000..1018b841950 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localCaptured.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf($this);") { this } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + +fun box(): String { + val testO by runLogged("O;") { "O" } + val testK by runLogged("K;") { "K" } + val testOK = runLogged("OK;") { testO + testK } + + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localDifferentReceivers.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localDifferentReceivers.kt new file mode 100644 index 00000000000..387236a5640 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/localDifferentReceivers.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +import kotlin.test.* + +var log: String = "" + +class MyClass(val value: String) + +fun runLogged(entry: String, action: () -> String): String { + log += entry + return action() +} + +fun runLogged2(entry: String, action: () -> MyClass): MyClass { + log += entry + return action() +} + +operator fun MyClass.provideDelegate(host: Any?, p: Any): String = + runLogged("tdf(${this.value});") { this.value } + +operator fun String.getValue(receiver: Any?, p: Any): String = + runLogged("get($this);") { this } + + +fun box(): String { + val testO by runLogged2("O;") { MyClass("O") } + val testK by runLogged("K;") { "K" } + val testOK = runLogged("OK;") { testO + testK } + + assertEquals("O;tdf(O);K;OK;get(O);get(K);", log) + return testOK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/memberExtension.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/memberExtension.kt new file mode 100644 index 00000000000..7cfa5f86b0c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/memberExtension.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +object Host { + class StringDelegate(val s: String) { + operator fun getValue(receiver: String, p: Any) = receiver + s + } + + operator fun String.provideDelegate(host: Any?, p: Any) = StringDelegate(this) + + val String.plusK by "K" + + val ok = "O".plusK +} + +fun box(): String = Host.ok \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/propertyMetadata.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/propertyMetadata.kt new file mode 100644 index 00000000000..549b1b249e4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/propertyMetadata.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME + +import kotlin.test.* +import kotlin.reflect.KProperty + +var log: String = "" + +inline fun runLogged(entry: String, action: () -> T): T { + log += entry + return action() +} + +operator fun String.provideDelegate(host: Any?, p: KProperty<*>): String = + if (p.name == this) runLogged("tdf($this);") { this } else "fail 1" + +operator fun String.getValue(receiver: Any?, p: KProperty<*>): String = + if (p.name == this) runLogged("get($this);") { this } else "fail 2" + +val O by runLogged("O;") { "O" } +val K by runLogged("K;") { "K" } +val OK = runLogged("OK;") { O + K } + +fun box(): String { + assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log) + return OK +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFun.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFun.kt new file mode 100644 index 00000000000..69924d135ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFun.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner +} + +operator fun Delegate.setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } + +class A { + var prop: Int by Delegate() +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFunInClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFunInClass.kt new file mode 100644 index 00000000000..ef2ddccf0f6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/setAsExtensionFunInClass.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner +} + +class A { + operator fun Delegate.setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } + + var prop: Int by Delegate() +} + +fun box(): String { + val c = A() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt new file mode 100644 index 00000000000..9f06958fede --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt @@ -0,0 +1,57 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.InvocationTargetException +import kotlin.reflect.* + +object Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): String { + (p as? KProperty0)?.get() + (p as? KProperty1)?.get(O) + (p as? KProperty2)?.get(O, O) + return "Fail" + } + + operator fun setValue(t: Any?, p: KProperty<*>, v: String) { + (p as? KMutableProperty0)?.set(v) + (p as? KMutableProperty1)?.set(O, v) + (p as? KMutableProperty2)?.set(O, O, v) + } +} + +var topLevel: String by Delegate +object O { + var member: String by Delegate + var O.memExt: String by Delegate +} + +fun check(lambda: () -> Unit) { + try { + lambda() + } catch (e: Throwable) { + if (e !is InvocationTargetException && e !is StackOverflowError) { + throw RuntimeException("The current implementation uses reflection to get the value of the property," + + "so either InvocationTargetException or StackOverflowError should have happened", + e) + } + return + } + throw AssertionError("Getting the property value with .get() from getValue() or setting it with .set() in setValue() " + + "is effectively an endless recursion and should fail") +} + +fun box(): String { + check { topLevel } + check { topLevel = "" } + check { O.member } + check { O.member = "" } + with (O) { + check { O.memExt } + check { O.memExt = "" } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVal.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVal.kt new file mode 100644 index 00000000000..e28913fabbe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVal.kt @@ -0,0 +1,11 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +val prop: Int by Delegate() + +fun box(): String { + return if(prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVar.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVar.kt new file mode 100644 index 00000000000..688405e32de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/topLevelVar.kt @@ -0,0 +1,16 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +var prop: Int by Delegate() + +fun box(): String { + if(prop != 1) return "fail get" + prop = 2 + if (prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/twoPropByOneDelegete.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/twoPropByOneDelegete.kt new file mode 100644 index 00000000000..d73aadaf604 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/twoPropByOneDelegete.kt @@ -0,0 +1,22 @@ +import kotlin.reflect.KProperty + +class Delegate(val f: (T) -> Int) { + operator fun getValue(t: T, p: KProperty<*>): Int = f(t) +} + +val p = Delegate { t -> t.foo() } + +class A(val i: Int) { + val prop: Int by p + + fun foo(): Int { + return i + } +} + +fun box(): String { + if(A(1).prop != 1) return "fail get1" + if(A(10).prop != 10) return "fail get2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/useKPropertyLater.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/useKPropertyLater.kt new file mode 100644 index 00000000000..f457e44dafc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/useKPropertyLater.kt @@ -0,0 +1,45 @@ +// WITH_REFLECT +// TODO: replace with WITH_RUNTIME once KT-11316 is fixed + +import kotlin.reflect.* + +val properties = HashSet>() + +object Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): String { + properties.add(p) + return "" + } + + operator fun setValue(t: Any?, p: KProperty<*>, v: String) { + properties.add(p) + } +} + +var topLevel: String by Delegate +object O { + var member: String by Delegate + var O.memExt: String by Delegate +} + +fun box(): String { + topLevel = "" + O.member = "" + with (O) { + O.memExt = "" + } + + for (p in HashSet(properties)) { + // None of these should fail + + (p as? KProperty0)?.get() + (p as? KProperty1)?.get(O) + (p as? KProperty2)?.get(O, O) + + (p as? KMutableProperty0)?.set("") + (p as? KMutableProperty1)?.set(O, "") + (p as? KMutableProperty2)?.set(O, O, "") + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt new file mode 100644 index 00000000000..6e614eec0dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): String { + p.parameters + p.returnType + p.annotations + return p.toString() + } +} + +val prop: String by Delegate() + +fun box() = if (prop == "val prop: kotlin.String") "OK" else "Fail: $prop" diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/valInInnerClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/valInInnerClass.kt new file mode 100644 index 00000000000..43cda384acc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/valInInnerClass.kt @@ -0,0 +1,15 @@ +import kotlin.reflect.KProperty + +class Delegate { + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 +} + +class A { + inner class B { + val prop: Int by Delegate() + } +} + +fun box(): String { + return if(A().B().prop == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/varInInnerClass.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/varInInnerClass.kt new file mode 100644 index 00000000000..4b99bb19003 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/varInInnerClass.kt @@ -0,0 +1,21 @@ +import kotlin.reflect.KProperty + +class Delegate { + var inner = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = inner + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) { inner = i } +} + +class A { + inner class B { + var prop: Int by Delegate() + } +} + +fun box(): String { + val c = A().B() + if(c.prop != 1) return "fail get" + c.prop = 2 + if (c.prop != 2) return "fail set" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt b/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt new file mode 100644 index 00000000000..f8ae3d3a78a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt @@ -0,0 +1,49 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +interface IActing { + fun act(): String +} + +class CActing(val value: String = "OK") : IActing { + override fun act(): String = value +} + +// final so no need in delegate field +class Test(val acting: CActing = CActing()) : IActing by acting { +} + +// even if open so we don't need delegate field +open class Test2(open val acting: CActing = CActing()) : IActing by acting { +} + +// even if open the backing field is final, so we don't need delegate field +class Test3() : Test2() { + override val acting = CActing("OKOK") +} + +fun box(): String { + try { + Test::class.java.getDeclaredField("\$\$delegate_0") + return "\$\$delegate_0 field generated for class Test but should not" + } + catch (e: NoSuchFieldException) { + // ok + } + + try { + Test2::class.java.getDeclaredField("\$\$delegate_0") + return "\$\$delegate_0 field generated for class Test but should not" + } + catch (e: NoSuchFieldException) { + // ok + } + + if (Test3().acting.act() != "OKOK") return "Fail Test3" + + val test = Test() + return test.act() +} diff --git a/backend.native/tests/external/codegen/blackbox/delegation/kt8154.kt b/backend.native/tests/external/codegen/blackbox/delegation/kt8154.kt new file mode 100644 index 00000000000..86550e49f60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegation/kt8154.kt @@ -0,0 +1,19 @@ +interface A { + fun foo(): T +} + +interface B : A + +class BImpl(a: A) : B, A by a + +fun box(): String { + val b: B = BImpl(object : A { + override fun foo() = "OK" + }) + + if (b.foo() != "OK") return "fail 1" + + val a: A = b + + return a.foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/extensionComponents.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/extensionComponents.kt new file mode 100644 index 00000000000..201e2cb3a60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/extensionComponents.kt @@ -0,0 +1,21 @@ +class A(val x: String, val y: String, val z: T) + +fun foo(a: A, block: (A) -> String): String = block(a) + +operator fun A<*>.component1() = x + +object B { + operator fun A<*>.component2() = y +} + +fun B.bar(): String { + + operator fun A.component3() = z + + val x = foo(A("O", "K", 123)) { (x, y, z) -> x + y + z.toString() } + if (x != "OK123") return "fail 1: $x" + + return "OK" +} + +fun box() = B.bar() diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/generic.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/generic.kt new file mode 100644 index 00000000000..4dadddb91cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/generic.kt @@ -0,0 +1,11 @@ +data class A(val x: T, val y: F) + +fun foo(a: A, block: (A) -> String) = block(a) + +fun box(): String { + val x = foo(A("OK", 1)) { (x, y) -> x + (y.toString()) } + + if (x != "OK1") return "fail1: $x" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/inline.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/inline.kt new file mode 100644 index 00000000000..6835b91f21c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/inline.kt @@ -0,0 +1,5 @@ +data class A(val x: String, val y: String) + +inline fun foo(a: A, block: (A) -> String): String = block(a) + +fun box() = foo(A("O", "K")) { (x, y) -> x + y } diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/otherParameters.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/otherParameters.kt new file mode 100644 index 00000000000..f973aca1710 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/otherParameters.kt @@ -0,0 +1,11 @@ +data class A(val x: String, val y: String) + +fun foo(a: A, block: (Int, A, String) -> String): String = block(1, a, "#") + +fun box(): String { + val x = foo(A("O", "K")) { i, (x, y), v -> i.toString() + x + y + v } + + if (x != "1OK#") return "fail 1: $x" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/simple.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/simple.kt new file mode 100644 index 00000000000..50523e3fec4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/simple.kt @@ -0,0 +1,5 @@ +data class A(val x: String, val y: String) + +fun foo(a: A, block: (A) -> String): String = block(a) + +fun box() = foo(A("O", "K")) { (x, y) -> x + y } diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/stdlibUsages.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/stdlibUsages.kt new file mode 100644 index 00000000000..fe527e1237d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/stdlibUsages.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +fun box(): String { + val r1 = listOf("O", "K", "fail").let { + (x, y) -> x + y + } + + + if (r1 != "OK") return "fail 1: $r1" + + val r2 = listOf(Pair("O", "K")).map { (x, y) -> x + y }[0] + + if (r2 != "OK") return "fail 2: $r2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/underscoreNames.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/underscoreNames.kt new file mode 100644 index 00000000000..8db07f7778e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/underscoreNames.kt @@ -0,0 +1,9 @@ +class A { + operator fun component1() = "O" + operator fun component2(): String = throw RuntimeException("fail 0") + operator fun component3() = "K" +} + +fun foo(a: A, block: (A) -> String): String = block(a) + +fun box() = foo(A()) { (x, _, y) -> x + y } diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/withIndexed.kt b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/withIndexed.kt new file mode 100644 index 00000000000..13280feb86e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/withIndexed.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME +data class Station( + val id: String?, + val name: String, + val distance: Int) + +fun box(): String { + var result = "" + // See KT-14399 + listOf(Station("O", "K", 56)).forEachIndexed { i, (id, name, distance) -> result += "$id$name$distance" } + if (result != "OK56") return "fail: $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.kt new file mode 100644 index 00000000000..15a7a2e94e2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.kt @@ -0,0 +1,25 @@ +// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST + +fun foo(f: () -> R): R = f() + +fun some(v: T?, b: T): T { + return foo { + if (v != null) { + v + } + else { + b + } + } +} + +fun some1(v: T?, b: T): T { + return foo { if (v != null) v else b } +} + +fun box() = when { + some(1, 2) != 1 -> "fail 1" + some(null, 2) != 2 -> "fail 2" + some1(1, 2) != 1 -> "fail 3" + else -> "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.txt new file mode 100644 index 00000000000..ebfdf25004c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/kt6176.txt @@ -0,0 +1,6 @@ +package + +public fun box(): kotlin.String +public fun foo(/*0*/ f: () -> R): R +public fun some(/*0*/ v: T?, /*1*/ b: T): T +public fun some1(/*0*/ v: T?, /*1*/ b: T): T diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt new file mode 100644 index 00000000000..5f7fbce55f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt @@ -0,0 +1,8 @@ +class A { + companion object { + operator fun invoke(i: Int) = i + } +} + +fun box() = if (A(42) == 42) "OK" else "fail" + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.txt new file mode 100644 index 00000000000..29670b42fcb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.txt @@ -0,0 +1,18 @@ +package + +public fun box(): kotlin.String + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ i: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt new file mode 100644 index 00000000000..b808ed09f6a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt @@ -0,0 +1,11 @@ +interface B + +operator fun B.invoke(i: Int) = i + +class A { + companion object: B { + } +} + +fun box() = if (A(42) == 42) "OK" else "fail" + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.txt new file mode 100644 index 00000000000..6ab8e9be9be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.txt @@ -0,0 +1,24 @@ +package + +public fun box(): kotlin.String +public operator fun B.invoke(/*0*/ i: kotlin.Int): kotlin.Int + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion : B { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public interface B { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt new file mode 100644 index 00000000000..dcc924a9ba8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt @@ -0,0 +1,9 @@ +class A { + class Nested { + companion object { + operator fun invoke(i: Int) = i + } + } +} + +fun box() = if (A.Nested(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.txt new file mode 100644 index 00000000000..4722c798bb3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.txt @@ -0,0 +1,25 @@ +package + +public fun box(): kotlin.String + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class Nested { + public constructor Nested() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ i: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt new file mode 100644 index 00000000000..85b73084d1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt @@ -0,0 +1,11 @@ +import A.Nested + +class A { + class Nested { + companion object { + operator fun invoke(i: Int) = i + } + } +} + +fun box() = if (Nested(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.txt new file mode 100644 index 00000000000..4722c798bb3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.txt @@ -0,0 +1,25 @@ +package + +public fun box(): kotlin.String + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class Nested { + public constructor Nested() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ i: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt new file mode 100644 index 00000000000..6491d8e0cc9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt @@ -0,0 +1,8 @@ +enum class A { + ONE, + TWO; + + operator fun invoke(i: Int) = i +} + +fun box() = if (A.ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.txt new file mode 100644 index 00000000000..98f250eefb7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.txt @@ -0,0 +1,25 @@ +package + +public fun box(): kotlin.String + +public final enum class A : kotlin.Enum { + enum entry ONE + + enum entry TWO + + private constructor A() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: A): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ i: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): A + public final /*synthesized*/ fun values(): kotlin.Array +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt new file mode 100644 index 00000000000..95eb4b9c827 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt @@ -0,0 +1,8 @@ +enum class A { + ONE, + TWO +} + +operator fun A.invoke(i: Int) = i + +fun box() = if (A.ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.txt new file mode 100644 index 00000000000..0547a5bfbde --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.txt @@ -0,0 +1,25 @@ +package + +public fun box(): kotlin.String +public operator fun A.invoke(/*0*/ i: kotlin.Int): kotlin.Int + +public final enum class A : kotlin.Enum { + enum entry ONE + + enum entry TWO + + private constructor A() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: A): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): A + public final /*synthesized*/ fun values(): kotlin.Array +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt new file mode 100644 index 00000000000..d627dad85a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt @@ -0,0 +1,10 @@ +import A.ONE + +enum class A { + ONE, + TWO; + + operator fun invoke(i: Int) = i +} + +fun box() = if (ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.txt new file mode 100644 index 00000000000..98f250eefb7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.txt @@ -0,0 +1,25 @@ +package + +public fun box(): kotlin.String + +public final enum class A : kotlin.Enum { + enum entry ONE + + enum entry TWO + + private constructor A() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: A): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ i: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): A + public final /*synthesized*/ fun values(): kotlin.Array +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt new file mode 100644 index 00000000000..53ecfc65908 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt @@ -0,0 +1,10 @@ +import A.ONE + +enum class A { + ONE, + TWO +} + +operator fun A.invoke(i: Int) = i + +fun box() = if (ONE(42) == 42) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.txt new file mode 100644 index 00000000000..0547a5bfbde --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.txt @@ -0,0 +1,25 @@ +package + +public fun box(): kotlin.String +public operator fun A.invoke(/*0*/ i: kotlin.Int): kotlin.Int + +public final enum class A : kotlin.Enum { + enum entry ONE + + enum entry TWO + + private constructor A() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: A): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): A + public final /*synthesized*/ fun values(): kotlin.Array +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt new file mode 100644 index 00000000000..e14c1acefc4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt @@ -0,0 +1,5 @@ +object A + +operator fun A.invoke(i: Int) = i + +fun box() = if (A(42) == 42) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.txt new file mode 100644 index 00000000000..cb0f049e350 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.txt @@ -0,0 +1,11 @@ +package + +public fun box(): kotlin.String +public operator fun A.invoke(/*0*/ i: kotlin.Int): kotlin.Int + +public object A { + private constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt new file mode 100644 index 00000000000..fc16215881c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt @@ -0,0 +1,5 @@ +object A { + operator fun invoke(i: Int) = i +} + +fun box() = if (A(42) == 42) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.txt new file mode 100644 index 00000000000..a0046e7528d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.txt @@ -0,0 +1,11 @@ +package + +public fun box(): kotlin.String + +public object A { + private constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(/*0*/ i: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.kt new file mode 100644 index 00000000000..77551daaaf2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.kt @@ -0,0 +1,15 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int = 0, e : Any = "a") { + if (!e.equals("a")) { + throw IllegalArgumentException() + } + if (x > 0) { + test(x - 1) + } +} + +fun box() : String { + test(100000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.txt new file mode 100644 index 00000000000..1e8d7ae0b64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int = ..., /*1*/ e: kotlin.Any = ...): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt new file mode 100644 index 00000000000..2f924b56908 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +open class A { + open fun foo(s: String = "OK") = s +} + +class B : A() { + override tailrec fun foo(s: String): String { + return if (s == "OK") s else foo() + } +} + +fun box() = B().foo("FAIL") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.txt new file mode 100644 index 00000000000..f5a8d3fb277 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.txt @@ -0,0 +1,19 @@ +package + +public fun box(): kotlin.String + +public open class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun foo(/*0*/ s: kotlin.String = ...): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B : A { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open tailrec override /*1*/ fun foo(/*0*/ s: kotlin.String = ...): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.kt new file mode 100644 index 00000000000..e9873fc4a14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.kt @@ -0,0 +1,13 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun Int.foo(x: Int) { + if (x == 0) return + return 1.foo(x - 1) +} + +fun box(): String { + 1.foo(1000000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.txt new file mode 100644 index 00000000000..48175789377 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun kotlin.Int.foo(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.kt new file mode 100644 index 00000000000..15eb0203244 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun noTails() { + // nothing here +} + +fun box(): String { + noTails() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.txt new file mode 100644 index 00000000000..7ecae67b1cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun noTails(): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt new file mode 100644 index 00000000000..c6b15a3234d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun badTails(x : Int) : Int { + if (x < 50 && x != 10 && x > 0) { + return 1 + badTails(x - 1) + } + else if (x == 10) { + @Suppress("NON_TAIL_RECURSIVE_CALL") + return 1 + badTails(x - 1) + } else if (x >= 50) { + return badTails(x - 1) + } + return 0 +} + +fun box(): String { + badTails(1000000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.txt new file mode 100644 index 00000000000..34acf2c57af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.txt @@ -0,0 +1,4 @@ +package + +public tailrec fun badTails(/*0*/ x: kotlin.Int): kotlin.Int +public fun box(): kotlin.String diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt new file mode 100644 index 00000000000..06b569df4d4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt @@ -0,0 +1,14 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +fun withoutAnnotation(x : Int) : Int { + if (x > 0) { + return 1 + withoutAnnotation(x - 1) + } + return 0 +} + +fun box(): String { + val r = withoutAnnotation(10) + if (r == 10) return "OK" + return "Fail $r" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.txt new file mode 100644 index 00000000000..c0078f88d0c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public fun withoutAnnotation(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.kt new file mode 100644 index 00000000000..4642b88c175 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.kt @@ -0,0 +1,10 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec infix fun Int.test(x : Int) : Int { + if (this > 1) { + return (this - 1) test x + } + return this +} + +fun box() : String = if (1000000.test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.txt new file mode 100644 index 00000000000..013cb7ee7b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public infix tailrec fun kotlin.Int.test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.kt new file mode 100644 index 00000000000..09212b1ad4b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.kt @@ -0,0 +1,14 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec infix fun Int.foo(x: Int) { + if (x == 0) return + val xx = x - 1 + return 1 foo xx +} + +fun box(): String { + 1 foo 1000000 + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.txt new file mode 100644 index 00000000000..641a4681712 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public infix tailrec fun kotlin.Int.foo(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.kt new file mode 100644 index 00000000000..d758897bde5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(counter : Int) : Int? { + if (counter < 0) return null + if (counter == 0) return 777 + + return test(-1) ?: test(-2) ?: test(counter - 1) +} + +fun box() : String = + if (test(100000) == 777) "OK" + else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.txt new file mode 100644 index 00000000000..4322f6cd06e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ counter: kotlin.Int): kotlin.Int? diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.kt new file mode 100644 index 00000000000..307a0163bca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.kt @@ -0,0 +1,30 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +class B { + inner class C { + tailrec fun h(counter : Int) { + if (counter > 0) { + this@C.h(counter - 1) + } + } + + tailrec fun h2(x : Any) { + this@B.h2("no recursion") // keep vigilance + } + + } + + fun makeC() : C = C() + + fun h2(x : Any) { + } +} + +fun box() : String { + B().makeC().h(1000000) + B().makeC().h2(0) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.txt new file mode 100644 index 00000000000..26d9a88dbad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.txt @@ -0,0 +1,21 @@ +package + +public fun box(): kotlin.String + +public final class B { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun h2(/*0*/ x: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun makeC(): B.C + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final inner class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final tailrec fun h(/*0*/ counter: kotlin.Int): kotlin.Unit + public final tailrec fun h2(/*0*/ x: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.kt new file mode 100644 index 00000000000..0eac7241a86 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Int { + var z = if (x > 3) 3 else x + while (z > 0) { + if (z > 10) { + return test(x - 1) + } + test(0) + z = z - 1 + } + + return 1 +} + +fun box() : String = if (test(100000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.txt new file mode 100644 index 00000000000..865b86f16eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/loops.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.kt new file mode 100644 index 00000000000..597ca8dd231 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Int { + if (x == 1) { + if (x != 1) { + test(0) + return test(0) + } else { + return test(x + test(0)) + } + } else if (x > 0) { + return test(x - 1) + } + return -1 +} + +fun box() : String = if (test(1000000) == -1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.txt new file mode 100644 index 00000000000..865b86f16eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.kt new file mode 100644 index 00000000000..a4523b4320d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun Iterator.foldl(acc : A, foldFunction : (e : T, acc : A) -> A) : A = + if (!hasNext()) acc + else foldl(foldFunction(next(), acc), foldFunction) + +fun box() : String { + val sum = (1..1000000).iterator().foldl(0) { e : Int, acc : Long -> + acc + e + } + + return if (sum == 500000500000) "OK" else "FAIL: $sum" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.txt new file mode 100644 index 00000000000..5fac038d69c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun kotlin.collections.Iterator.foldl(/*0*/ acc: A, /*1*/ foldFunction: (e: T, acc: A) -> A): A diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.kt new file mode 100644 index 00000000000..f78c458a8e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.kt @@ -0,0 +1,17 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +fun escapeChar(c : Char) : String? = when (c) { + '\\' -> "\\\\" + '\n' -> "\\n" + '"' -> "\\\"" + else -> "" + c +} + +tailrec fun String.escape(i : Int = 0, result : StringBuilder = StringBuilder()) : String = + if (i == length) result.toString() + else escape(i + 1, result.append(escapeChar(get(i)))) + +fun box() : String { + "test me not \\".escape() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.txt new file mode 100644 index 00000000000..328683f8d54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.txt @@ -0,0 +1,5 @@ +package + +public fun box(): kotlin.String +public fun escapeChar(/*0*/ c: kotlin.Char): kotlin.String? +public tailrec fun kotlin.String.escape(/*0*/ i: kotlin.Int = ..., /*1*/ result: kotlin.text.StringBuilder /* = java.lang.StringBuilder */ = ...): kotlin.String diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.kt new file mode 100644 index 00000000000..2772ef3c3a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.kt @@ -0,0 +1,10 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun String.repeat(num : Int, acc : StringBuilder = StringBuilder()) : String = + if (num == 0) acc.toString() + else repeat(num - 1, acc.append(this)) + +fun box() : String { + val s = "a".repeat(10000) + return if (s.length == 10000) "OK" else "FAIL: ${s.length}" +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.txt new file mode 100644 index 00000000000..a0d6f90a0f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun kotlin.String.repeat(/*0*/ num: kotlin.Int, /*1*/ acc: kotlin.text.StringBuilder /* = java.lang.StringBuilder */ = ...): kotlin.String diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt new file mode 100644 index 00000000000..e53fc49a214 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt @@ -0,0 +1,17 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun foo() { + bar { + foo() + } +} + +fun bar(a: Any) {} + +fun box(): String { + foo() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.txt new file mode 100644 index 00000000000..8c24a2ff136 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.txt @@ -0,0 +1,5 @@ +package + +public fun bar(/*0*/ a: kotlin.Any): kotlin.Unit +public fun box(): kotlin.String +public tailrec fun foo(): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt new file mode 100644 index 00000000000..c6e5fe2a79f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun foo() { + fun bar() { + foo() + } +} + +fun box(): String { + foo() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.txt new file mode 100644 index 00000000000..091eb5de165 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun foo(): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt new file mode 100644 index 00000000000..cf6ac28a2b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt @@ -0,0 +1,13 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +fun test() { + tailrec fun g3(counter : Int) { + if (counter > 0) { g3(counter - 1) } + } + g3(1000000) +} + +fun box() : String { + test() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.txt new file mode 100644 index 00000000000..4b035952c5d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public fun test(): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.kt new file mode 100644 index 00000000000..f974aac542d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Int { + return if (x == 1) { + test(x - 1) + 1 + test(x - 1) + } else if (x > 0) { + test(x - 1) + } else { + 0 + } +} + +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.txt new file mode 100644 index 00000000000..865b86f16eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.kt new file mode 100644 index 00000000000..94541e9b0ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(counter : Int) : Int { + if (counter == 0) return 0 + + try { + throw Exception() + } catch (e : Exception) { + return test(counter - 1) + } +} + +fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.txt new file mode 100644 index 00000000000..fe405335127 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ counter: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.kt new file mode 100644 index 00000000000..37c8bde1bd5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(counter : Int) : Int { + if (counter == 0) return 0 + + try { + // do nothing + } finally { + return test(counter - 1) + } +} + +fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.txt new file mode 100644 index 00000000000..fe405335127 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ counter: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.kt new file mode 100644 index 00000000000..a91a01c4007 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(counter : Int) : Int { + if (counter == 0) return 0 + + try { + // do nothing + } finally { + if (counter > 0) { + return test(counter - 1) + } + } + + return -1 +} + +fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.txt new file mode 100644 index 00000000000..fe405335127 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ counter: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.kt new file mode 100644 index 00000000000..6a05a80c18d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.kt @@ -0,0 +1,11 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun foo(x: Int) { + if (x == 0) return + (return foo(x - 1)) +} + +fun box(): String { + foo(1000000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.txt new file mode 100644 index 00000000000..4fd18812fe0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun foo(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.kt new file mode 100644 index 00000000000..f3c225f251e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(counter : Int) : Int { + if (counter == 0) return 0 + + try { + return test(counter - 1) + } catch (any : Throwable) { + return -1 + } +} + +fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.txt new file mode 100644 index 00000000000..fe405335127 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ counter: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.kt new file mode 100644 index 00000000000..7d2cf67bd63 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Int = + if (x == 1) { + test(x - 1) + 1 + test(x - 1) + } else if (x > 0) { + test(x - 1) + } else { + 0 + } + +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.txt new file mode 100644 index 00000000000..865b86f16eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.kt new file mode 100644 index 00000000000..497f0456cf8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Int { + if (x == 10) { + return 1 + test(x - 1) + } + if (x > 0) { + return test(x - 1) + } + return 0 +} + +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.txt new file mode 100644 index 00000000000..865b86f16eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt new file mode 100644 index 00000000000..5e41e54a3cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Int { + if (x == 0) { + return 0 + } else if (x == 10) { + test(0) + return 1 + test(x - 1) + } else { + return test(x - 1) + } +} + +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.txt new file mode 100644 index 00000000000..865b86f16eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.kt new file mode 100644 index 00000000000..461f09c5ec1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun sum(x: Long, sum: Long): Long { + if (x == 0.toLong()) return sum + return sum(x - 1, sum + x) +} + +fun box() : String { + val sum = sum(1000000, 0) + if (sum != 500000500000.toLong()) return "Fail $sum" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.txt new file mode 100644 index 00000000000..cc7cff75ba0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/sum.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun sum(/*0*/ x: kotlin.Long, /*1*/ sum: kotlin.Long): kotlin.Long diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt new file mode 100644 index 00000000000..92fd0bf3ffb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt @@ -0,0 +1,13 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun foo(x: Int) { + return if (x > 0) { + (foo(x - 1)) + } + else Unit +} + +fun box(): String { + foo(1000000) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.txt new file mode 100644 index 00000000000..4fd18812fe0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun foo(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.kt new file mode 100644 index 00000000000..d0c54318be0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.kt @@ -0,0 +1,11 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun foo(x: Int) { + if (x == 0) return + return (foo(x - 1)) +} + +fun box(): String { + foo(1000000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.txt new file mode 100644 index 00000000000..4fd18812fe0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun foo(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt new file mode 100644 index 00000000000..a69c34bd44c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(go: Boolean) : Unit { + if (!go) return + try { + test(false) + } catch (any : Exception) { + test(false) + } finally { + test(false) + } +} + +fun box(): String { + test(true) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.txt new file mode 100644 index 00000000000..883abc7200c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ go: kotlin.Boolean): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.kt new file mode 100644 index 00000000000..b067a3c5717 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +class A { + tailrec fun f1(c : Int) { + if (c > 0) { + this.f1(c - 1) + } + } + + tailrec fun f2(c : Int) { + if (c > 0) { + f2(c - 1) + } + } + + tailrec fun f3(a : A) { + a.f3(a) // non-tail recursion, could be potentially resolved by condition if (a == this) f3() else a.f3() + } +} + +fun box() : String { + A().f1(1000000) + A().f2(1000000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.txt new file mode 100644 index 00000000000..c919fcdf798 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.txt @@ -0,0 +1,13 @@ +package + +public fun box(): kotlin.String + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final tailrec fun f1(/*0*/ c: kotlin.Int): kotlin.Unit + public final tailrec fun f2(/*0*/ c: kotlin.Int): kotlin.Unit + public final tailrec fun f3(/*0*/ a: A): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.kt new file mode 100644 index 00000000000..9324f76ad43 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun test(x : Int) : Unit { + if (x == 1) { + test(x - 1) + } else if (x == 2) { + test(x - 1) + return + } else if (x == 3) { + test(x - 1) + if (x == 3) { + test(x - 1) + } + return + } else if (x > 0) { + test(x - 1) + } +} + +fun box() : String { + test(1000000) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.txt new file mode 100644 index 00000000000..6dd7b2f167f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun test(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.kt new file mode 100644 index 00000000000..c87fb69a91e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun withWhen(counter : Int) : Int = + when (counter) { + 0 -> counter + 50 -> 1 + withWhen(counter - 1) + else -> withWhen(counter - 1) + } + +fun box() : String = if (withWhen(100000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.txt new file mode 100644 index 00000000000..1aa338bd9c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun withWhen(/*0*/ counter: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.kt new file mode 100644 index 00000000000..9ceaf639f08 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.kt @@ -0,0 +1,16 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun withWhen(counter : Int, d : Any) : Int = + when (counter) { + 0 -> counter + 1, 2 -> withWhen(counter - 1, "1,2") + in 3..49 -> withWhen(counter - 1, "3..49") + 50 -> 1 + withWhen(counter - 1, "50") + !in 0..50 -> withWhen(counter - 1, "!0..50") + else -> withWhen(counter - 1, "else") + } + +fun box() : String = if (withWhen(100000, "test") == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.txt new file mode 100644 index 00000000000..aa55835bd00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun withWhen(/*0*/ counter: kotlin.Int, /*1*/ d: kotlin.Any): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.kt new file mode 100644 index 00000000000..d86ee798725 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.kt @@ -0,0 +1,17 @@ +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun withWhen(counter : Int, d : Any) : Int = + if (counter == 0) { + 0 + } + else if (counter == 5) { + withWhen(counter - 1, 999) + } + else + when (d) { + is String -> withWhen(counter - 1, "is String") + is Number -> withWhen(counter, "is Number") + else -> throw IllegalStateException() + } + +fun box() : String = if (withWhen(100000, "test") == 0) "OK" else "FAIL" diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.txt new file mode 100644 index 00000000000..aa55835bd00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun withWhen(/*0*/ counter: kotlin.Int, /*1*/ d: kotlin.Any): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.kt new file mode 100644 index 00000000000..154371bacee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND_WITHOUT_CHECK: JS + +tailrec fun withWhen2(counter : Int) : Int = + when { + counter == 0 -> counter + counter == 50 -> 1 + withWhen2(counter - 1) + withWhen2(0) == 0 -> withWhen2(counter - 1) + else -> 1 + } + +fun box() : String = if (withWhen2(100000) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.txt new file mode 100644 index 00000000000..5426fa21dfd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.txt @@ -0,0 +1,4 @@ +package + +public fun box(): kotlin.String +public tailrec fun withWhen2(/*0*/ counter: kotlin.Int): kotlin.Int diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.kt b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.kt new file mode 100644 index 00000000000..80e1489d641 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.kt @@ -0,0 +1,15 @@ +fun box(): String { + main(array()) + return "OK" +} + +fun main(args: Array) { + D.foo(array()) +} + +object D { + fun foo(array: Array) = array +} + +@Suppress("UNCHECKED_CAST") +inline fun array(vararg t : T) : Array = t as Array \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.txt b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.txt new file mode 100644 index 00000000000..2b01eebc3f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/kt4172.txt @@ -0,0 +1,13 @@ +package + +@kotlin.Suppress(names = {"UNCHECKED_CAST"}) public inline fun array(/*0*/ vararg t: T /*kotlin.Array*/): kotlin.Array +public fun box(): kotlin.String +public fun main(/*0*/ args: kotlin.Array): kotlin.Unit + +public object D { + private constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(/*0*/ array: kotlin.Array): kotlin.Array + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/backend.native/tests/external/codegen/blackbox/elvis/genericNull.kt b/backend.native/tests/external/codegen/blackbox/elvis/genericNull.kt new file mode 100644 index 00000000000..beb1cb723f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/elvis/genericNull.kt @@ -0,0 +1,8 @@ +fun foo(t: T) { + (t ?: 42).toInt() +} + +fun box(): String { + foo(null) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/elvis/kt6694ExactAnnotationForElvis.kt b/backend.native/tests/external/codegen/blackbox/elvis/kt6694ExactAnnotationForElvis.kt new file mode 100644 index 00000000000..af26c6e87f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/elvis/kt6694ExactAnnotationForElvis.kt @@ -0,0 +1,19 @@ +interface PsiElement { + fun findChildByType(i: Int): T? = + if (i == 42) JetOperationReferenceExpression() as T else throw Exception() +} +interface JetSimpleNameExpression : PsiElement { + fun getReferencedNameElement(): PsiElement +} +class JetOperationReferenceExpression : JetSimpleNameExpression { + override fun getReferencedNameElement() = this +} +class JetLabelReferenceExpression : JetSimpleNameExpression { + public override fun getReferencedNameElement(): PsiElement = + findChildByType(42) ?: this +} + +fun box(): String { + val element = JetLabelReferenceExpression().getReferencedNameElement() + return if (element is JetOperationReferenceExpression) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/elvis/nullNullOk.kt b/backend.native/tests/external/codegen/blackbox/elvis/nullNullOk.kt new file mode 100644 index 00000000000..e25fe160183 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/elvis/nullNullOk.kt @@ -0,0 +1 @@ +fun box() = null ?: null ?: "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/elvis/primitive.kt b/backend.native/tests/external/codegen/blackbox/elvis/primitive.kt new file mode 100644 index 00000000000..bd3edd1a725 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/elvis/primitive.kt @@ -0,0 +1,6 @@ +fun box(): String { + if ((42 ?: 239) != 42) return "Fail Int" + if ((42.toLong() ?: 239.toLong()) != 42.toLong()) return "Fail Long" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/abstractMethodInEnum.kt b/backend.native/tests/external/codegen/blackbox/enum/abstractMethodInEnum.kt new file mode 100644 index 00000000000..0d3ed6de674 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/abstractMethodInEnum.kt @@ -0,0 +1,9 @@ +enum class A() { + ENTRY(){ override fun t() = "OK"}; + + abstract fun t(): String +} + +fun f(a: A) = a.t() + +fun box()= f(A.ENTRY) diff --git a/backend.native/tests/external/codegen/blackbox/enum/abstractNestedClass.kt b/backend.native/tests/external/codegen/blackbox/enum/abstractNestedClass.kt new file mode 100644 index 00000000000..3994bd54e17 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/abstractNestedClass.kt @@ -0,0 +1,10 @@ +enum class E { + ENTRY; + + abstract class Nested +} + +fun box(): String { + E.ENTRY + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/asReturnExpression.kt b/backend.native/tests/external/codegen/blackbox/enum/asReturnExpression.kt new file mode 100644 index 00000000000..c001e02763a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/asReturnExpression.kt @@ -0,0 +1,14 @@ +// http://youtrack.jetbrains.com/issue/KT-2167 + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo() = Season.SPRING + +fun box() = + if (foo() == Season.SPRING) "OK" + else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt b/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt new file mode 100644 index 00000000000..f3a6de3c5dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +enum class IssueState { + DEFAULT, + FIXED { + override fun ToString() = "K" + }; + + open fun ToString(): String = "O" +} + +fun box(): String { + val field = IssueState::class.java.getField("FIXED") + + val typeName = field.type.name + if (typeName != "IssueState") return "Fail type name: $typeName" + + val className = field.get(null).javaClass.name + if (className != "IssueState\$FIXED") return "Fail class name: $className" + + val classLoader = IssueState::class.java.classLoader + classLoader.loadClass("IssueState\$FIXED") + try { + classLoader.loadClass("IssueState\$DEFAULT") + return "Fail: no class should have been generated for DEFAULT" + } + catch (e: Exception) { + // ok + } + + return IssueState.DEFAULT.ToString() + IssueState.FIXED.ToString() +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/companionObjectInEnum.kt b/backend.native/tests/external/codegen/blackbox/enum/companionObjectInEnum.kt new file mode 100644 index 00000000000..3e6d423f64e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/companionObjectInEnum.kt @@ -0,0 +1,22 @@ +enum class Game { + ROCK, + PAPER, + SCISSORS; + + companion object { + fun foo() = ROCK + val bar = PAPER + val values2 = values() + val scissors = valueOf("SCISSORS") + } +} + +fun box(): String { + if (Game.foo() != Game.ROCK) return "Fail 1" + if (Game.bar != Game.PAPER) return "Fail 2: ${Game.bar}" + if (Game.values().size != 3) return "Fail 3" + if (Game.valueOf("SCISSORS") != Game.SCISSORS) return "Fail 4" + if (Game.values2.size != 3) return "Fail 5" + if (Game.scissors != Game.SCISSORS) return "Fail 6" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt b/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt new file mode 100644 index 00000000000..412cf9a2801 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package test + +enum class My(val s: String) { + ENTRY; + constructor(): this("OK") +} + +fun box() = My.ENTRY.s diff --git a/backend.native/tests/external/codegen/blackbox/enum/emptyEnumValuesValueOf.kt b/backend.native/tests/external/codegen/blackbox/enum/emptyEnumValuesValueOf.kt new file mode 100644 index 00000000000..6cad0c98a04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/emptyEnumValuesValueOf.kt @@ -0,0 +1,13 @@ +enum class Empty + +fun box(): String { + if (Empty.values().size != 0) return "Fail: ${Empty.values()}" + + try { + val found = Empty.valueOf("nonExistentEntry") + return "Fail: $found" + } + catch (e: Exception) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/enumInheritedFromTrait.kt b/backend.native/tests/external/codegen/blackbox/enum/enumInheritedFromTrait.kt new file mode 100644 index 00000000000..8171865caed --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/enumInheritedFromTrait.kt @@ -0,0 +1,16 @@ +package test + +fun box() = MyEnum.E1.f() + MyEnum.E2.f() + +enum class MyEnum : T { + E1 { + override fun f() = "O" + }, + E2 { + override fun f() = "K" + } +} + +interface T { + fun f(): String +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/enum/enumShort.kt b/backend.native/tests/external/codegen/blackbox/enum/enumShort.kt new file mode 100644 index 00000000000..78935006d2b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/enumShort.kt @@ -0,0 +1,11 @@ +enum class Color(val rgb: Int) { + RED(0xff0000), + GREEN(0x00ff00), + BLUE(0x0000ff); +} + +fun foo(): Int { + return Color.RED.rgb + Color.GREEN.rgb + Color.BLUE.rgb +} + +fun box() = if (foo() == 0xffffff) "OK" else "Fail: ${foo()}" diff --git a/backend.native/tests/external/codegen/blackbox/enum/enumWithLambdaParameter.kt b/backend.native/tests/external/codegen/blackbox/enum/enumWithLambdaParameter.kt new file mode 100644 index 00000000000..d41886a5370 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/enumWithLambdaParameter.kt @@ -0,0 +1,19 @@ +// KT-4423 Enum with function not compiled + +enum class Sign(val str: String, val func: (x: Int, y: Int) -> Int){ + plus("+", { x, y -> x + y }), + + mult("*", { x, y -> x * y }) { + override fun toString() = "${func(4,5)}" + } +} + +fun box(): String { + val sum = Sign.plus.func(2, 3) + if (sum != 5) return "Fail 1: $sum" + + val product = Sign.mult.toString() + if (product != "20") return "Fail 2: $product" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/inPackage.kt b/backend.native/tests/external/codegen/blackbox/enum/inPackage.kt new file mode 100644 index 00000000000..388eb0a0dd3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/inPackage.kt @@ -0,0 +1,14 @@ +package test + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo(): Season = Season.SPRING + +fun box() = + if (foo() == Season.SPRING) "OK" + else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/enum/inclassobj.kt b/backend.native/tests/external/codegen/blackbox/enum/inclassobj.kt new file mode 100644 index 00000000000..5006013d4b7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/inclassobj.kt @@ -0,0 +1,15 @@ +fun box() = if(Context.operatingSystemType == Context.Companion.OsType.OTHER) "OK" else "fail" + +public class Context +{ + companion object + { + public enum class OsType { + LINUX, + OTHER; + } + + public val operatingSystemType: OsType + get() = OsType.OTHER + } +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/inner.kt b/backend.native/tests/external/codegen/blackbox/enum/inner.kt new file mode 100644 index 00000000000..01ef380fbc3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/inner.kt @@ -0,0 +1,7 @@ +class A { + enum class E { + OK + } +} + +fun box() = A.E.OK.toString() diff --git a/backend.native/tests/external/codegen/blackbox/enum/innerWithExistingClassObject.kt b/backend.native/tests/external/codegen/blackbox/enum/innerWithExistingClassObject.kt new file mode 100644 index 00000000000..139345cc14a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/innerWithExistingClassObject.kt @@ -0,0 +1,8 @@ +class A { + companion object {} + enum class E { + OK + } +} + +fun box() = A.E.OK.toString() diff --git a/backend.native/tests/external/codegen/blackbox/enum/kt1119.kt b/backend.native/tests/external/codegen/blackbox/enum/kt1119.kt new file mode 100644 index 00000000000..6445197faee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/kt1119.kt @@ -0,0 +1,12 @@ +enum class Direction() { + NORTH { + val someSpecialValue = "OK" + + override fun f() = someSpecialValue + }; + + + abstract fun f():String +} + +fun box() = Direction.NORTH.f() diff --git a/backend.native/tests/external/codegen/blackbox/enum/kt2350.kt b/backend.native/tests/external/codegen/blackbox/enum/kt2350.kt new file mode 100644 index 00000000000..d4a363062b3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/kt2350.kt @@ -0,0 +1,7 @@ +enum class A(val b: String) { + E1("OK"){ override fun t() = b }; + + abstract fun t(): String +} + +fun box()= A.E1.t() diff --git a/backend.native/tests/external/codegen/blackbox/enum/kt9711.kt b/backend.native/tests/external/codegen/blackbox/enum/kt9711.kt new file mode 100644 index 00000000000..096316ed24b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/kt9711.kt @@ -0,0 +1,13 @@ +enum class X { + + B { + val value2 = "OK" + override val value = { value2 } + }; + + abstract val value: () -> String +} + +fun box(): String { + return X.B.value() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt b/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt new file mode 100644 index 00000000000..8642ed92784 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +enum class IssueState { + + FIXED { + override fun ToString() = D().k + + fun s() = "OK" + + class D { + val k = s() + } + }; + + open fun ToString() : String = "fail" +} + +fun box(): String { + return IssueState.FIXED.ToString() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt b/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt new file mode 100644 index 00000000000..f9b1f65dad3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import java.lang.reflect.Modifier + +enum class En { + Y +} + +fun box(): String { + val klass = En::class.java + val superclass = klass.superclass.name + if (superclass != "java.lang.Enum") "Fail superclass: $superclass" + + val enumModifiers = klass.modifiers + if ((enumModifiers and 0x4000) == 0) return "Fail ACC_ENUM on class" + if ((enumModifiers and Modifier.FINAL) == 0) return "Fail FINAL on class" + + val entry = klass.getField("Y") + val entryModifiers = entry.modifiers + if ((entryModifiers and 0x4000) == 0) return "Fail ACC_ENUM on entry" + if ((entryModifiers and Modifier.FINAL) == 0) return "Fail FINAL on entry" + if ((entryModifiers and Modifier.STATIC) == 0) return "Fail FINAL on entry" + if ((entryModifiers and Modifier.PUBLIC) == 0) return "Fail FINAL on entry" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt b/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt new file mode 100644 index 00000000000..2821b7cf1a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +enum class State { + O, + K +} + +fun box(): String { + val field = State::class.java.getField("O") + val className = field.get(null).javaClass.name + if (className != "State") return "Fail: $className" + + return "${State.O.name}${State.K.name}" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/objectInEnum.kt b/backend.native/tests/external/codegen/blackbox/enum/objectInEnum.kt new file mode 100644 index 00000000000..9f19d3c1704 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/objectInEnum.kt @@ -0,0 +1,20 @@ +enum class E { + ENTRY, + SUBCLASS { + object O { + fun foo() = 2 + } + override fun bar() = O.foo() + }; + + object O { + fun foo() = 1 + } + open fun bar() = O.foo() +} + +fun box(): String { + if (E.ENTRY.bar() != 1) return "Fail 1" + if (E.SUBCLASS.bar() != 2) return "Fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/ordinal.kt b/backend.native/tests/external/codegen/blackbox/enum/ordinal.kt new file mode 100644 index 00000000000..d66c3e0ae4e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/ordinal.kt @@ -0,0 +1,8 @@ +enum class State { + _0, + _1, + _2, + _3 +} + +fun box() = if(State._0.ordinal == 0 && State._1.ordinal == 1 && State._2.ordinal == 2 && State._3.ordinal == 3) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/enum/simple.kt b/backend.native/tests/external/codegen/blackbox/enum/simple.kt new file mode 100644 index 00000000000..ed48d29a5d9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/simple.kt @@ -0,0 +1,12 @@ +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo(): Season = Season.SPRING + +fun box() = + if (foo() == Season.SPRING) "OK" + else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/enum/sortEnumEntries.kt b/backend.native/tests/external/codegen/blackbox/enum/sortEnumEntries.kt new file mode 100644 index 00000000000..8b894a1ffe2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/sortEnumEntries.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import Game.* + +enum class Game { + ROCK, + PAPER, + SCISSORS, + LIZARD, + SPOCK +} + +fun box(): String { + val a = arrayOf(LIZARD, SCISSORS, SPOCK, ROCK, PAPER) + a.sort() + val str = a.joinToString(" ") + return if (str == "ROCK PAPER SCISSORS LIZARD SPOCK") "OK" else "Fail: $str" +} diff --git a/backend.native/tests/external/codegen/blackbox/enum/superCallInEnumLiteral.kt b/backend.native/tests/external/codegen/blackbox/enum/superCallInEnumLiteral.kt new file mode 100644 index 00000000000..11507d9d147 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/superCallInEnumLiteral.kt @@ -0,0 +1,18 @@ +package test + +fun box() = E.E1.f() + E.E2.f() + +enum class E { + E1 { + override fun f(): String { + return super.f() + "O" + } + }, + E2 { + override fun f(): String { + return super.f() + "K" + } + }; + + open fun f() = "" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/enum/toString.kt b/backend.native/tests/external/codegen/blackbox/enum/toString.kt new file mode 100644 index 00000000000..b4890365b12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/toString.kt @@ -0,0 +1,6 @@ +enum class State { + O, + K +} + +fun box() = "${State.O}${State.K}" diff --git a/backend.native/tests/external/codegen/blackbox/enum/valueof.kt b/backend.native/tests/external/codegen/blackbox/enum/valueof.kt new file mode 100644 index 00000000000..89aeaa9cce6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/valueof.kt @@ -0,0 +1,22 @@ +enum class Color { + RED, + BLUE +} + +fun throwsOnGreen(): Boolean { + try { + Color.valueOf("GREEN") + return false + } + catch (e: Exception) { + return true + } +} + +fun box() = if( + Color.valueOf("RED") == Color.RED + && Color.valueOf("BLUE") == Color.BLUE + && Color.values()[0] == Color.RED + && Color.values()[1] == Color.BLUE + && throwsOnGreen() + ) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/char.kt b/backend.native/tests/external/codegen/blackbox/evaluate/char.kt new file mode 100644 index 00000000000..de1f18f18e2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/char.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package test + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val c1: Int) + +@Ann('a' - 'a') class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.c1 != 0) return "fail : expected = ${1}, actual = ${annotation.c1}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt b/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt new file mode 100644 index 00000000000..3a8bdf88bbc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val b: Byte, + val s: Short, + val i: Int, + val l: Long +) + +@Ann(1 / 1, 1 / 1, 1 / 1, 1 / 1) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.b != 1.toByte()) return "fail 1" + if (annotation.s != 1.toShort()) return "fail 2" + if (annotation.i != 1) return "fail 2" + if (annotation.l != 1.toLong()) return "fail 2" + return "OK" +} + +// EXPECTED: Ann[b = IntegerValueType(1): IntegerValueType(1), i = IntegerValueType(1): IntegerValueType(1), l = IntegerValueType(1): IntegerValueType(1), s = IntegerValueType(1): IntegerValueType(1)] diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt b/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt new file mode 100644 index 00000000000..e754ece6e3e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Int, + val p2: Short, + val p3: Byte, + val p4: Int, + val p5: Int, + val p6: Int +) + +val prop1: Int = 1 or 1 +val prop2: Short = 1 and 1 +val prop3: Byte = 1 xor 1 +val prop4: Int = 1 shl 1 +val prop5: Int = 1 shr 1 +val prop6: Int = 1 ushr 1 + +@Ann(1 or 1, 1 and 1, 1 xor 1, 1 shl 1, 1 shr 1, 1 ushr 1) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/kt9443.kt b/backend.native/tests/external/codegen/blackbox/evaluate/kt9443.kt new file mode 100644 index 00000000000..9a8946a9e79 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/kt9443.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +abstract class BaseClass { + protected open val menuId: Int = 0 + + public fun run(): Pair = + "$menuId" to (menuId == 0) +} + +class ImplClass: BaseClass() { + override val menuId: Int = 3 +} + +public fun box(): String { + val result = ImplClass().run() + + if (result != ("3" to false)) return "Fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt b/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt new file mode 100644 index 00000000000..af59932d9a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Int, + val p2: Int, + val p3: Int, + val p4: Int, + val p5: Long, + val p6: Long +) + +@Ann( + p1 = java.lang.Byte.MAX_VALUE + 1, + p2 = java.lang.Short.MAX_VALUE + 1, + p3 = java.lang.Integer.MAX_VALUE + 1, + p4 = java.lang.Integer.MAX_VALUE + 1, + p5 = java.lang.Integer.MAX_VALUE + 1.toLong(), + p6 = java.lang.Long.MAX_VALUE + 1 +) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != 128) return "fail 1, expected = ${128}, actual = ${annotation.p1}" + if (annotation.p2 != 32768) return "fail 2, expected = ${32768}, actual = ${annotation.p2}" + if (annotation.p3 != -2147483648) return "fail 3, expected = ${-2147483648}, actual = ${annotation.p3}" + if (annotation.p4 != -2147483648) return "fail 4, expected = ${-2147483648}, actual = ${annotation.p4}" + if (annotation.p5 != 2147483648.toLong()) return "fail 5, expected = ${2147483648}, actual = ${annotation.p5}" + if (annotation.p6 != java.lang.Long.MAX_VALUE + 1) return "fail 5, expected = ${java.lang.Long.MAX_VALUE + 1}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt new file mode 100644 index 00000000000..18c097da59c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Int, + val p2: Byte, + val p4: Int, + val p5: Int +) + +@Ann( + p1 = java.lang.Byte.MAX_VALUE + 1, + p2 = 1 + 1, + p4 = 1 + 1, + p5 = 1.toByte() + 1 +) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != 128) return "fail 1, expected = ${128}, actual = ${annotation.p1}" + if (annotation.p2 != 2.toByte()) return "fail 2, expected = ${2}, actual = ${annotation.p2}" + if (annotation.p4 != 2) return "fail 4, expected = ${2}, actual = ${annotation.p4}" + if (annotation.p5 != 2) return "fail 5, expected = ${2}, actual = ${annotation.p5}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt new file mode 100644 index 00000000000..333f5cb2156 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Int, + val p2: Int, + val p4: Long, + val p5: Int +) + +@Ann( + p1 = java.lang.Integer.MAX_VALUE + 1, + p2 = 1 + 1, + p4 = 1 + 1, + p5 = 1.toInt() + 1.toInt() +) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != -2147483648) return "fail 1, expected = ${-2147483648}, actual = ${annotation.p1}" + if (annotation.p2 != 2) return "fail 2, expected = ${2}, actual = ${annotation.p2}" + if (annotation.p4 != 2.toLong()) return "fail 4, expected = ${2}, actual = ${annotation.p4}" + if (annotation.p5 != 2) return "fail 5, expected = ${2}, actual = ${annotation.p5}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt new file mode 100644 index 00000000000..1adaea6b353 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +val prop1: Byte = 1 - 1 +val prop2: Short = 1 - 1 +val prop3: Int = 1 - 1 +val prop4: Long = 1 - 1 +val prop5: Double = 1.0 - 1.0 +val prop6: Float = 1.0.toFloat() - 1.0.toFloat() + +@Ann(1 - 1, 1 - 1, 1 - 1, 1 - 1, 1.0 - 1.0, 1.0.toFloat() - 1.0.toFloat()) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt b/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt new file mode 100644 index 00000000000..50598ecd1f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +val prop1: Byte = 1 % 1 +val prop2: Short = 1 % 1 +val prop3: Int = 1 % 1 +val prop4: Long = 1 % 1 +val prop5: Double = 1.0 % 1.0 +val prop6: Float = 1.0.toFloat() % 1.0.toFloat() + +@Ann(1 % 1, 1 % 1, 1 % 1, 1 % 1, 1.0 % 1.0, 1.0.toFloat() % 1.0.toFloat()) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt b/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt new file mode 100644 index 00000000000..530fa00d3b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +val prop1: Byte = 1 * 1 +val prop2: Short = 1 * 1 +val prop3: Int = 1 * 1 +val prop4: Long = 1 * 1 +val prop5: Double = 1.0 * 1.0 +val prop6: Float = 1.0.toFloat() * 1.0.toFloat() + +@Ann(1 * 1, 1 * 1, 1 * 1, 1 * 1, 1.0 * 1.0, 1.0.toFloat() * 1.0.toFloat()) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt b/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt new file mode 100644 index 00000000000..5bdbdd66d8f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +val prop1: Byte = (1 + 2) * 2 +val prop2: Short = (1 + 2) * 2 +val prop3: Int = (1 + 2) * 2 +val prop4: Long = (1 + 2) * 2 +val prop5: Double = (1.0 + 2) * 2 +val prop6: Float = (1.toFloat() + 2) * 2 + +@Ann((1 + 2) * 2, (1 + 2) * 2, (1 + 2) * 2, (1 + 2) * 2, (1.0 + 2) * 2, (1.toFloat() + 2) * 2) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt new file mode 100644 index 00000000000..09cea81112c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +val prop1: Byte = 1 + 1 +val prop2: Short = 1 + 1 +val prop3: Int = 1 + 1 +val prop4: Long = 1 + 1 +val prop5: Double = 1.0 + 1.0 +val prop6: Float = 1.0.toFloat() + 1.0.toFloat() + +@Ann(1 + 1, 1 + 1, 1 + 1, 1 + 1, 1.0 + 1.0, 1.0.toFloat() + 1.0.toFloat()) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt b/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt new file mode 100644 index 00000000000..4f50749291f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Int, + val p2: Int, + val p3: Int, + val p4: Int, + val p5: Int +) + +const val prop1: Int = 1.plus(1) +const val prop2: Int = 1.minus(1) +const val prop3: Int = 1.times(1) +const val prop4: Int = 1.div(1) +const val prop5: Int = 1.mod(1) + +@Ann(prop1, prop2, prop3, prop4, prop5) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt new file mode 100644 index 00000000000..8390883c3e4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +const val prop1: Byte = -1 +const val prop2: Short = -1 +const val prop3: Int = -1 +const val prop4: Long = -1 +const val prop5: Double = -1.0 +const val prop6: Float = -1.0.toFloat() + +@Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt new file mode 100644 index 00000000000..f2cfb2ea80e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( + val p1: Byte, + val p2: Short, + val p3: Int, + val p4: Long, + val p5: Double, + val p6: Float +) + +const val prop1: Byte = +1 +const val prop2: Short = +1 +const val prop3: Int = +1 +const val prop4: Long = +1 +const val prop5: Double = +1.0 +const val prop6: Float = +1.0.toFloat() + +@Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass + +fun box(): String { + val annotation = MyClass::class.java.getAnnotation(Ann::class.java)!! + if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}" + if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}" + if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}" + if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}" + if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}" + if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/exclExcl/genericNull.kt b/backend.native/tests/external/codegen/blackbox/exclExcl/genericNull.kt new file mode 100644 index 00000000000..0d4f831dfb7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/exclExcl/genericNull.kt @@ -0,0 +1,12 @@ +fun foo(t: T) { + t!! +} + +fun box(): String { + try { + foo(null) + } catch (e: Exception) { + return "OK" + } + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/exclExcl/primitive.kt b/backend.native/tests/external/codegen/blackbox/exclExcl/primitive.kt new file mode 100644 index 00000000000..d7815756041 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/exclExcl/primitive.kt @@ -0,0 +1,5 @@ +fun box(): String { + 42!! + 42.toLong()!! + return "OK"!! +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/executionOrder.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/executionOrder.kt new file mode 100644 index 00000000000..38cdf5f0d5b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/executionOrder.kt @@ -0,0 +1,19 @@ +var result = "" + +fun getReceiver() : Int { + result += "getReceiver->" + return 1 +} + +fun getFun(b : Int.(Int)->Unit): Int.(Int)->Unit { + result += "getFun()->" + return b +} + +fun box(): String { + getReceiver().(getFun({ result +="End" }))(1) + + if(result != "getFun()->getReceiver->End") return "fail $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1061.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1061.kt new file mode 100644 index 00000000000..051768c9c74 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1061.kt @@ -0,0 +1,7 @@ +//KT-1061 Can't call function defined as a val + +object X { + val doit = { i: Int -> i } +} + +fun box() : String = if (X.doit(3) == 3) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1249.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1249.kt new file mode 100644 index 00000000000..8078f5443fe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1249.kt @@ -0,0 +1,12 @@ +//KT-1249 IllegalStateException invoking function property +class TestClass(val body : () -> Unit) : Any() { + fun run() { + body() + } +} + +fun box() : String { + TestClass({}).run() + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1290.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1290.kt new file mode 100644 index 00000000000..19f03dc8883 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1290.kt @@ -0,0 +1,14 @@ +//KT-1290 Method property in constructor causes NPE + +class Foo(val filter: (T) -> Boolean) { + public fun bar(tee: T) : Boolean { + return filter(tee); + } +} + +fun foo() = Foo({ i: Int -> i < 5 }).bar(2) + +fun box() : String { + if (!foo()) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1776.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1776.kt new file mode 100644 index 00000000000..5174d4cc374 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1776.kt @@ -0,0 +1,20 @@ +interface Expr { + public fun ttFun() : Int = 12 +} + +class Num(val value : Int) : Expr + +fun Expr.sometest() : Int { + if (this is Num) { + value + return value + } + return 0; +} + + +fun box() : String { + if (Num(11).sometest() != 11) return "fail ${Num(11).sometest()}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953.kt new file mode 100644 index 00000000000..c7f72f666f5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953.kt @@ -0,0 +1,9 @@ +fun box(): String { + val sb = StringBuilder() + operator fun String.unaryPlus() { + sb.append(this) + } + + +"OK" + return sb.toString()!! +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953_class.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953_class.kt new file mode 100644 index 00000000000..e2feab63b56 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt1953_class.kt @@ -0,0 +1,14 @@ +class A { + private val sb: StringBuilder = StringBuilder() + + operator fun String.unaryPlus() { + sb.append(this) + } + + fun foo(): String { + +"OK" + return sb.toString()!! + } +} + +fun box(): String = A().foo() diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3285.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3285.kt new file mode 100644 index 00000000000..2874bcdb2e8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3285.kt @@ -0,0 +1,32 @@ +var sayResult = "" + +class NoiseMaker { + fun say(str: String) { sayResult += str } +} + +fun noiseMaker(f: NoiseMaker.() -> Unit) { + val noiseMaker = NoiseMaker() + noiseMaker.f() +} + +abstract class Pet { + fun NoiseMaker.playWith(friend: T) { + say("Playing with " + friend) + } + + abstract fun play(): Unit +} + +class Doggy(): Pet() { + override fun play() = noiseMaker { + say("Time to play! ") + playWith("my owner!") + } +} + +fun box(): String { + Doggy().play() + if (sayResult != "Time to play! Playing with my owner!") return "fail: $sayResult" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3298.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3298.kt new file mode 100644 index 00000000000..d0f83531a69 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3298.kt @@ -0,0 +1,13 @@ +var result = "" +fun result(r: String) { result = r } + +object Foo { + private operator fun String.unaryPlus() = "(" + this + ")" + + fun foo() = { result(+"Stuff") }() +} + +fun box(): String { + Foo.foo() + return if (result == "(Stuff)") "OK" else "Fail $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt new file mode 100644 index 00000000000..c1ddef88264 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun test(cl: Int.() -> Int):Int = 11.cl() + +class Foo { + val a = test { this } +} + +fun box(): String { + if (Foo().a != 11) return "fail" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3969.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3969.kt new file mode 100644 index 00000000000..1e34286ea50 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3969.kt @@ -0,0 +1,19 @@ +var result = "Fail" + +class A + +operator fun A.inc(s: String = "OK"): A { + result = s + return this +} + +fun box(): String { + var a = A() + a++ + if (result != "OK") return "Fail 1" + + result = "Fail" + ++a + + return result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt4228.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt4228.kt new file mode 100644 index 00000000000..9906d20305f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt4228.kt @@ -0,0 +1,14 @@ +class A { + companion object +} + +val foo: Any.() -> Unit = {} + +fun test() { + A.(foo)() +} + +fun box(): String { + test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt475.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt475.kt new file mode 100644 index 00000000000..f81998986f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt475.kt @@ -0,0 +1,17 @@ + +fun box() : String { + val array = ArrayList() + array.add("0") + array.add("1") + array.add("2") + array.last = "5" + return if(array.length == 3 && array.last == "5") "OK" else "fail" +} + +var ArrayList.length : Int + get() = size + set(value: Int) = throw Error() + +var ArrayList.last : T + get() = get(size-1)!! + set(el : T) { set(size-1, el) } diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt5467.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt5467.kt new file mode 100644 index 00000000000..5d5ab0473a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt5467.kt @@ -0,0 +1,20 @@ +fun String.foo() : String { + fun Int.bar() : String { + fun Long.baz() : String { + val x = this@foo + val y = this@bar + val z = this@baz + return "$x $y $z" + } + return 0L.baz() + } + return 42.bar() +} + +fun box() : String { + val result = "OK".foo() + + if (result != "OK 42 0") return "fail: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt new file mode 100644 index 00000000000..3596dfd5378 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package kt606 + +//KT-606 wrong resolved call + +class StandardPipelineFactory(val config : ChannelPipeline.() -> Unit) : ChannelPipelineFactory { + override fun getPipeline() : ChannelPipeline { + val pipeline : ChannelPipeline = DefaultChannelPipeline() + pipeline.config() + return pipeline + } +} + +interface ChannelPipeline { + fun print(any: Any) +} + +class DefaultChannelPipeline : ChannelPipeline { + override fun print(any: Any) { + System.out?.println(any) + } + +} + +interface ChannelPipelineFactory { + fun getPipeline() : ChannelPipeline +} + +fun box() : String { + StandardPipelineFactory({ print("OK") }).getPipeline() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt865.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt865.kt new file mode 100644 index 00000000000..b461ec16a08 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt865.kt @@ -0,0 +1,17 @@ +class Template() { + val collected = ArrayList() + + operator fun String.unaryPlus() { + collected.add(this@unaryPlus) + } + + fun test() { + + "239" + } +} + +fun box() : String { + val u = Template() + u.test() + return if(u.collected.size == 1 && u.collected.get(0) == "239") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/nested2.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/nested2.kt new file mode 100644 index 00000000000..9c0aecd0ffb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/nested2.kt @@ -0,0 +1,8 @@ +fun box() : String { + val y = 12 + val op = { x:Int -> (x + y).toString() } + + val op2 : Int.(Int) -> String = { op(this + it) } + + return if("27" == 5.op2(10)) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/shared.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/shared.kt new file mode 100644 index 00000000000..3cf651590a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/shared.kt @@ -0,0 +1,13 @@ +infix fun T.mustBe(t : T) { + assert("$this must be $t") {this == t} +} + +inline fun assert(message : String, condition : () -> Boolean) { + if (!condition()) + throw AssertionError(message) +} + +fun box() : String { + "lala" mustBe "lala" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/simple.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/simple.kt new file mode 100644 index 00000000000..101e52661bf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/simple.kt @@ -0,0 +1,5 @@ +fun StringBuilder.first() = this.get(0) + +fun foo() = StringBuilder("foo").first() + +fun box() = if (foo() == 'f') "OK" else "Fail ${foo()}" diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/thisMethodInObjectLiteral.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/thisMethodInObjectLiteral.kt new file mode 100644 index 00000000000..cf541e2edb4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/thisMethodInObjectLiteral.kt @@ -0,0 +1,15 @@ +class Test { + private fun T.self() = object{ + fun calc() : T { + return this@self + } + } + + fun box() : Int { + return 1.self().calc() + 1 + } +} + +fun box() : String { + return if (Test().box() == 2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/virtual.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/virtual.kt new file mode 100644 index 00000000000..cc8a6a72f1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/virtual.kt @@ -0,0 +1,24 @@ +class Request(val path: String) { + +} + +class Handler() { + fun Int.times(op: ()-> Unit) { + for(i in 0..this) + op() + } + +// fun Request.getPath() : String { +// val sb = java.lang.StringBuilder() +// 10.times { +// sb.append(path)?.append(this) +// } +// return sb.toString() as String +// } + + fun Request.getPath() = path + + fun test(request: Request) = request.getPath() +} + +fun box() : String = if(Handler().test(Request("239")) == "239") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt new file mode 100644 index 00000000000..80f001027b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun StringBuilder.takeFirst(): Char { + if (this.length == 0) return 0.toChar() + val c = this.get(0) + this.deleteCharAt(0) + return c +} + +fun foo(expr: StringBuilder): Int { + val c = expr.takeFirst() + when(c) { + 0.toChar() -> throw Exception("zero") + else -> throw Exception("nonzero" + c) + } +} + +fun box(): String { + try { + foo(StringBuilder()) + return "Fail" + } + catch (e: Exception) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/accessorForPrivateSetter.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/accessorForPrivateSetter.kt new file mode 100644 index 00000000000..6dae405db6d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/accessorForPrivateSetter.kt @@ -0,0 +1,21 @@ +class A { + var result = "Fail" + + private var Int.foo: String + get() = result + private set(value) { + result = value + } + + fun run(): String { + class O { + fun run() { + 42.foo = "OK" + } + } + O().run() + return (-42).foo + } +} + +fun box() = A().run() diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValForPrimitiveType.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValForPrimitiveType.kt new file mode 100644 index 00000000000..787ea1c0245 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValForPrimitiveType.kt @@ -0,0 +1,39 @@ +val T.valProp: T + get() = this + +class A { + val int: Int = 0 + val long: Long = 0.toLong() + val short: Short = 0.toShort() + val byte: Byte = 0.toByte() + val double: Double = 0.0 + val float: Float = 0.0f + val char: Char = '0' + val bool: Boolean = false + + operator fun invoke() { + int.valProp + long.valProp + short.valProp + byte.valProp + double.valProp + float.valProp + char.valProp + bool.valProp + } +} + +fun box(): String { + 0.valProp + false.valProp + '0'.valProp + 0.0.valProp + 0.0f.valProp + 0.toByte().valProp + 0.toShort().valProp + 0.toLong().valProp + + A()() + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt new file mode 100644 index 00000000000..3b76322ec67 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.io.Serializable + +val T.valProp: T where T : Number, T : Serializable + get() = this + +fun box(): String { + 0.valProp + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/genericVarForPrimitiveType.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericVarForPrimitiveType.kt new file mode 100644 index 00000000000..a96514698c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericVarForPrimitiveType.kt @@ -0,0 +1,40 @@ +var T.varProp: T + get() = this + set(value: T) {} + +class A { + var int: Int = 0 + var long: Long = 0.toLong() + var short: Short = 0.toShort() + var byte: Byte = 0.toByte() + var double: Double = 0.0 + var float: Float = 0.0f + var char: Char = '0' + var bool: Boolean = false + + operator fun invoke() { + int.varProp = int + long.varProp = long + short.varProp = short + byte.varProp = byte + double.varProp = double + float.varProp = float + char.varProp = char + bool.varProp = bool + } +} + +fun box(): String { + 0.varProp = 0 + false.varProp = false + '0'.varProp = '0' + 0.0.varProp = 0.0 + 0.0f.varProp = 0.0f + 0.toByte().varProp = 0.toByte() + 0.toShort().varProp = 0.toShort() + 0.toLong().varProp = 0.toLong() + + A()() + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/inClass.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClass.kt new file mode 100644 index 00000000000..7f1d8387e59 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClass.kt @@ -0,0 +1,12 @@ +class Test { + val Int.foo: String + get() = "OK" + + fun test(): String { + return 1.foo + } +} + +fun box(): String { + return Test().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassLongTypeInReceiver.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassLongTypeInReceiver.kt new file mode 100644 index 00000000000..f4a3c12530b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassLongTypeInReceiver.kt @@ -0,0 +1,28 @@ +class Test { + var doubleStorage = "fail" + var longStorage = "fail" + + var Double.foo: String + get() = doubleStorage + set(value) { + doubleStorage = value + } + + var Long.bar: String + get() = longStorage + set(value) { + longStorage = value + } + + fun test(): String { + val d = 1.0 + d.foo = "O" + val l = 1L + l.bar = "K" + return d.foo + l.bar + } +} + +fun box(): String { + return Test().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithGetter.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithGetter.kt new file mode 100644 index 00000000000..e14ca8e686f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithGetter.kt @@ -0,0 +1,14 @@ +class Test { + val Int.foo: String + get() { + return "OK" + } + + fun test(): String { + return 1.foo + } +} + +fun box(): String { + return Test().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateGetter.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateGetter.kt new file mode 100644 index 00000000000..b16ace4a6f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateGetter.kt @@ -0,0 +1,14 @@ +class Test { + private val Int.foo: String + get() { + return "OK" + } + + fun test(): String { + return 1.foo + } +} + +fun box(): String { + return Test().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateSetter.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateSetter.kt new file mode 100644 index 00000000000..de02691a5ac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithPrivateSetter.kt @@ -0,0 +1,19 @@ +class Test { + var storage = "Fail" + + var Int.foo: String + get() = storage + private set(str: String) { + storage = str + } + + fun test(): String { + val i = 1 + i.foo = "OK" + return i.foo + } +} + +fun box(): String { + return Test().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithSetter.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithSetter.kt new file mode 100644 index 00000000000..c562b29e92e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/inClassWithSetter.kt @@ -0,0 +1,19 @@ +class Test { + var storage = "Fail" + + var Int.foo: String + get() = storage + set(value) { + storage = value + } + + fun test(): String { + val i = 1 + i.foo = "OK" + return i.foo + } +} + +fun box(): String { + return Test().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897.kt new file mode 100644 index 00000000000..728323b1c64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897.kt @@ -0,0 +1,41 @@ +object Test { + var z = "0" + var l = 0L + + fun changeObject(): String { + "1".someProperty += 1 + return z + } + + fun changeLong(): Long { + 2L.someProperty -= 1 + return l + } + + var String.someProperty: Int + get() { + return this.length + } + set(left) { + z += this + left + } + + var Long.someProperty: Long + get() { + return l + } + set(left) { + l += this + left + } + +} + +fun box(): String { + val changeObject = Test.changeObject() + if (changeObject != "012") return "fail 1: $changeObject" + + val changeLong = Test.changeLong() + if (changeLong != 1L) return "fail 1: $changeLong" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897_topLevel.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897_topLevel.kt new file mode 100644 index 00000000000..9ff0dd42c22 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/kt9897_topLevel.kt @@ -0,0 +1,38 @@ +var z = "0" +var l = 0L + +fun changeObject(): String { + "1".someProperty += 1 + return z +} + +fun changeLong(): Long { + 2L.someProperty -= 1 + return l +} + +var String.someProperty: Int + get() { + return this.length + } + set(left) { + z += this + left + } + +var Long.someProperty: Long + get() { + return l + } + set(left) { + l += this + left + } + +fun box(): String { + val changeObject = changeObject() + if (changeObject != "012") return "fail 1: $changeObject" + + val changeLong = changeLong() + if (changeLong != 1L) return "fail 1: $changeLong" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/topLevel.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/topLevel.kt new file mode 100644 index 00000000000..df0abcea24e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/topLevel.kt @@ -0,0 +1,6 @@ +val Int.foo: String + get() = "OK" + +fun box(): String { + return 1.foo +} diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/topLevelLongTypeInReceiver.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/topLevelLongTypeInReceiver.kt new file mode 100644 index 00000000000..b00288453a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/topLevelLongTypeInReceiver.kt @@ -0,0 +1,22 @@ +var fooStorage = "Fail" +var barStorage = "Fail" + +var Double.foo: String + get() = fooStorage + set(value) { + fooStorage = value + } + +var Long.bar: String + get() = barStorage + set(value) { + barStorage = value + } + +fun box(): String { + val d = 1.0 + d.foo = "O" + val l = 1L + l.bar = "K" + return d.foo + l.bar +} diff --git a/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt new file mode 100644 index 00000000000..3e9f2809d2a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +package foo + +class WithNative { + companion object { + @JvmStatic external fun bar(l: Long, s: String): Double + } +} + +object ObjWithNative { + @JvmStatic external fun bar(l: Long, s: String): Double +} + +fun box(): String { + var d = 0.0 + try { + d = WithNative.bar(1, "") + return "Link error expected" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "foo.WithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message + } + + try { + d = ObjWithNative.bar(1, "") + return "Link error expected on object" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 2: " + e.message + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt new file mode 100644 index 00000000000..e29f625e0f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +class C { + companion object { + private @JvmStatic external fun foo() + } + + fun bar() { + foo() + } +} + +fun box(): String { + try { + C().bar() + return "Link error expected" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "C.foo()V") return "Fail 1: " + e.message + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt b/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt new file mode 100644 index 00000000000..7d2baed13fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +package foo + +object ObjWithNative { + external fun foo(x: Int = 1): Double + + @JvmStatic external fun bar(l: Long, s: String = ""): Double +} + +external fun topLevel(x: Int = 1): Double + +fun box(): String { + var d = 0.0 + + try { + d = ObjWithNative.bar(1) + return "Link error expected on object" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message + } + + try { + d = ObjWithNative.foo() + return "Link error expected on object" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "foo.ObjWithNative.foo(I)D") return "Fail 2: " + e.message + } + + try { + d = topLevel() + return "Link error expected on object" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "foo.WithDefaultArgKt.topLevel(I)D") return "Fail 3: " + e.message + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fakeOverride/diamondFunction.kt b/backend.native/tests/external/codegen/blackbox/fakeOverride/diamondFunction.kt new file mode 100644 index 00000000000..da73cd28d7f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fakeOverride/diamondFunction.kt @@ -0,0 +1,31 @@ +interface T { + fun foo(): Unit +} + +open class A : T { + override fun foo() {} +} + +interface B : T + +class C : A(), B +class D : B, A() +class E : A(), B, T +class F : B, A(), T +class G : A(), T, B +class H : B, T, A() +class I : T, A(), B +class J : T, B, A() + +fun box(): String { + C().foo() + D().foo() + E().foo() + F().foo() + G().foo() + H().foo() + I().foo() + J().foo() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fakeOverride/function.kt b/backend.native/tests/external/codegen/blackbox/fakeOverride/function.kt new file mode 100644 index 00000000000..af0e02f4f49 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fakeOverride/function.kt @@ -0,0 +1,35 @@ +interface T { + fun foo(): Unit +} + +open class A : T { + override fun foo(): Unit {} +} + +class B : A(), T +class C : T, A() + +interface U : T +class D : U, A() +class E : A(), U +class F : U, T, A() +class G : T, U, A() +class H : U, A(), T +class I : T, A(), U +class J : A(), U, T +class K : A(), T, U + +fun box(): String { + B().foo() + C().foo() + D().foo() + E().foo() + F().foo() + G().foo() + H().foo() + I().foo() + J().foo() + K().foo() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fakeOverride/propertyGetter.kt b/backend.native/tests/external/codegen/blackbox/fakeOverride/propertyGetter.kt new file mode 100644 index 00000000000..c032e3ab837 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fakeOverride/propertyGetter.kt @@ -0,0 +1,37 @@ +interface T { + val foo: String +} + +open class A : T { + override val foo: String = "" +} + +class B : A(), T +class C : T, A() + +interface U : T + +class D : U, A() +class E : A(), U +class F : U, T, A() +class G : T, U, A() +class H : U, A(), T +class I : T, A(), U +class J : A(), U, T +class K : A(), T, U + +fun box(): String { + B().foo + C().foo + + D().foo + E().foo + F().foo + G().foo + H().foo + I().foo + J().foo + K().foo + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fakeOverride/propertySetter.kt b/backend.native/tests/external/codegen/blackbox/fakeOverride/propertySetter.kt new file mode 100644 index 00000000000..c2f623ba448 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fakeOverride/propertySetter.kt @@ -0,0 +1,18 @@ +interface T { + var result: String +} + +open class A : T { + override var result: String + get() = "" + set(value) {} +} + +class B : A(), T +class C : T, A() + +fun box(): String { + B().result = "" + C().result = "" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fieldRename/constructorAndClassObject.kt b/backend.native/tests/external/codegen/blackbox/fieldRename/constructorAndClassObject.kt new file mode 100644 index 00000000000..7bf67aa45a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fieldRename/constructorAndClassObject.kt @@ -0,0 +1,16 @@ +class Test(val prop: String) { + + companion object { + public val prop : String = "CO"; + } + +} + + +fun box() : String { + val obj = Test("OK"); + + if (Test.prop != "CO") return "fail1"; + + return obj.prop; +} diff --git a/backend.native/tests/external/codegen/blackbox/fieldRename/delegates.kt b/backend.native/tests/external/codegen/blackbox/fieldRename/delegates.kt new file mode 100644 index 00000000000..83501722a0e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fieldRename/delegates.kt @@ -0,0 +1,28 @@ +import kotlin.reflect.KProperty + +public open class TestDelegate(private val initializer: () -> T) { + private var value: T? = null + + operator open fun getValue(thisRef: Any?, desc: KProperty<*>): T { + if (value == null) { + value = initializer() + } + return value!! + } + + operator open fun setValue(thisRef: Any?, desc: KProperty<*>, svalue : T) { + value = svalue + } +} + +class A {} +class B {} + +public val A.s: String by TestDelegate( {"OK2"}) +public val B.s: String by TestDelegate( {"OK"}) + +fun box() : String { + if (A().s != "OK2") return "fail1" + + return B().s +} diff --git a/backend.native/tests/external/codegen/blackbox/fieldRename/genericPropertyWithItself.kt b/backend.native/tests/external/codegen/blackbox/fieldRename/genericPropertyWithItself.kt new file mode 100644 index 00000000000..ea584c3a917 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fieldRename/genericPropertyWithItself.kt @@ -0,0 +1,14 @@ +public class MPair ( + public val first: A +) { + override fun equals(o: Any?): Boolean { + val t = o as MPair<*> + return first == t.first + } +} + +fun box(): String { + val a = MPair("O") + a.equals(a) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/finallyAndFinally.kt b/backend.native/tests/external/codegen/blackbox/finally/finallyAndFinally.kt new file mode 100644 index 00000000000..e902bc8746f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/finallyAndFinally.kt @@ -0,0 +1,39 @@ +class MyString { + var s = "" + operator fun plus(x : String) : MyString { + s += x + return this + } + + override fun toString(): String { + return s + } +} + + +fun test1() : MyString { + var r = MyString() + try { + r + "Try1" + + try { + r + "Try2" + if (true) + return r + } finally { + r + "Finally2" + if (true) { + return r + } + } + + return r + } finally { + r + "Finally1" + } +} + + +fun box(): String { + return if (test1().toString() == "Try1Try2Finally2Finally1") "OK" else "fail: ${test1()}" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/kt3549.kt b/backend.native/tests/external/codegen/blackbox/finally/kt3549.kt new file mode 100644 index 00000000000..8e6f09f2aff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/kt3549.kt @@ -0,0 +1,41 @@ +fun test1() : String { + var s = ""; + try { + try { + s += "Try"; + throw Exception() + } catch (x : Exception) { + s += "Catch"; + throw x + } finally { + s += "Finally"; + } + } catch (x : Exception) { + return s + } +} + +fun test2() : String { + var s = ""; + + try { + s += "Try"; + throw Exception() + } catch (x : Exception) { + s += "Catch"; + } finally { + s += "Finally"; + } + + return s +} + + + +fun box() : String { + if (test1() != "TryCatchFinally") return "fail1: ${test1()}" + + if (test2() != "TryCatchFinally") return "fail2: ${test2()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/finally/kt3706.kt b/backend.native/tests/external/codegen/blackbox/finally/kt3706.kt new file mode 100644 index 00000000000..923e3aa045a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/kt3706.kt @@ -0,0 +1,16 @@ +fun f(): Int { + try { + return 0 + } + finally { + try { // culprit ?? remove this try-catch and it works. + } catch (ignore: Exception) { + } + } +} + +fun box(): String { + if (f() != 0) return "fail1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/kt3867.kt b/backend.native/tests/external/codegen/blackbox/finally/kt3867.kt new file mode 100644 index 00000000000..8e41ea804b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/kt3867.kt @@ -0,0 +1,46 @@ +fun fail() = if (true) throw RuntimeException() else 1 + +fun test1(): String { + var r = "" + try { + try { + r += "Try" + return r + } catch (e: RuntimeException) { + r += "Catch" + return r + } + finally { + r += "Finally" + fail() + } + } catch (e: RuntimeException) { + return r + } +} + +fun test2(): String { + var r = "" + try { + try { + r += "Try" + } catch (e: RuntimeException) { + r += "Catch" + } + finally { + r += "Finally" + fail() + } + } catch (e: RuntimeException) { + return r + } + return r + "Fail" +} + +fun box(): String { + if (test1() != "TryFinally") return "fail1: ${test1()}" + + if (test2() != "TryFinally") return "fail2: ${test2()}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/kt3874.kt b/backend.native/tests/external/codegen/blackbox/finally/kt3874.kt new file mode 100644 index 00000000000..fa0a4259d12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/kt3874.kt @@ -0,0 +1,35 @@ +fun test1(): String { + var r = "" + for (i in 1..2) { + try { + r += "O" + continue + } finally { + r += "K" + break + } + } + return r +} + +fun test2(): String { + var r = "" + for (i in 1..2) { + try { + r += "O" + break + } finally { + r += "K" + continue + } + } + return r +} + +fun box(): String { + if (test1() != "OK") return "fail1: ${test1()}" + + if (test2() != "OKOK") return "fail2: ${test2()}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/kt3894.kt b/backend.native/tests/external/codegen/blackbox/finally/kt3894.kt new file mode 100644 index 00000000000..83930d88fbd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/kt3894.kt @@ -0,0 +1,36 @@ +class MyString { + var s = "" + operator fun plus(x : String) : MyString { + s += x + return this + } + + override fun toString(): String { + return s + } +} + +fun test1() : MyString { + var r = MyString() + while (true) { + try { + r + "Try" + + if (true) { + r + "Break" + break + } + + } finally { + return r + "Finally" + } + } +} + + + +fun box(): String { + if (test1().toString() != "TryBreakFinally") return "fail1: ${test1().toString()}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/kt4134.kt b/backend.native/tests/external/codegen/blackbox/finally/kt4134.kt new file mode 100644 index 00000000000..24e4750d089 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/kt4134.kt @@ -0,0 +1,15 @@ +fun io(s: R, a: (R) -> T): T { + try { + return a(s) + } finally { + try { + s.toString() + } catch(e: Exception) { + //NOP + } + } +} + +fun box() : String { + return io(("OK"), {it}) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/loopAndFinally.kt b/backend.native/tests/external/codegen/blackbox/finally/loopAndFinally.kt new file mode 100644 index 00000000000..88425e55ac0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/loopAndFinally.kt @@ -0,0 +1,69 @@ +//KT-3869 Loops and finally: outer finally block not run + +class MyString { + var s = "" + operator fun plus(x : String) : MyString { + s += x + return this + } + + override fun toString(): String { + return s + } +} + +fun test1() : MyString { + var r = MyString() + try { + r + "Try" + + while(r.toString() != "") { + return r + "Loop" + } + + return r + "Fail" + } finally { + r + "Finally" + } +} + +fun test2() : MyString { + var r = MyString() + try { + r + "Try" + + do { + if (r.toString() != "") { + return r + "Loop" + } + } while (r.toString() != "") + + return r + "Fail" + } finally { + r + "Finally" + } +} + +fun test3() : MyString { + var r = MyString() + try { + r + "Try" + + for(i in 1..2) { + r + "Loop" + return r + } + + return r + "Fail" + } finally { + r + "Finally" + } +} + +fun box(): String { + if (test1().toString() != "TryLoopFinally") return "fail1: ${test1()}" + if (test2().toString() != "TryLoopFinally") return "fail2: ${test2()}" + if (test3().toString() != "TryLoopFinally") return "fail3: ${test3()}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/notChainCatch.kt b/backend.native/tests/external/codegen/blackbox/finally/notChainCatch.kt new file mode 100644 index 00000000000..18e5573b318 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/notChainCatch.kt @@ -0,0 +1,98 @@ +fun unsupportedEx() { + if (true) throw UnsupportedOperationException() +} + +fun runtimeEx() { + if (true) throw RuntimeException() +} + +fun test1() : String { + var s = ""; + try { + try { + s += "Try"; + unsupportedEx() + } catch (x : UnsupportedOperationException) { + s += "Catch"; + runtimeEx() + } catch (e: RuntimeException) { + s += "WrongCatch" + } + } catch (x : RuntimeException) { + return s + } + return s + "Failed" +} + +fun test1WithFinally() : String { + var s = ""; + try { + try { + s += "Try"; + unsupportedEx() + } catch (x : UnsupportedOperationException) { + s += "Catch"; + runtimeEx() + } catch (e: RuntimeException) { + s += "WrongCatch" + } finally { + s += "Finally" + } + } catch (x : RuntimeException) { + return s + } + return s + "Failed" +} + +fun test2() : String { + var s = ""; + try { + try { + s += "Try"; + unsupportedEx() + return s + } catch (x : UnsupportedOperationException) { + s += "Catch"; + runtimeEx() + return s + } catch (e: RuntimeException) { + s += "WrongCatch" + } + } catch (x : RuntimeException) { + return s + } + return s + "Failed" +} + +fun test2WithFinally() : String { + var s = ""; + try { + try { + s += "Try"; + unsupportedEx() + return s + } catch (x : UnsupportedOperationException) { + s += "Catch"; + runtimeEx() + return s + } catch (e: RuntimeException) { + s += "WrongCatch" + } finally { + s += "Finally" + } + } catch (x : RuntimeException) { + return s + } + return s + "Failed" +} + + + +fun box() : String { + if (test1() != "TryCatch") return "fail1: ${test1()}" + if (test1WithFinally() != "TryCatchFinally") return "fail2: ${test1WithFinally()}" + + if (test2() != "TryCatch") return "fail3: ${test2()}" + if (test2WithFinally() != "TryCatchFinally") return "fail4: ${test2WithFinally()}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/finally/tryFinally.kt b/backend.native/tests/external/codegen/blackbox/finally/tryFinally.kt new file mode 100644 index 00000000000..39928fbec60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/tryFinally.kt @@ -0,0 +1,45 @@ +fun unsupportedEx() { + if (true) throw UnsupportedOperationException() +} + +fun runtimeEx() { + if (true) throw RuntimeException() +} + +fun test1WithFinally() : String { + var s = ""; + try { + try { + s += "Try"; + unsupportedEx() + } finally { + s += "Finally" + } + } catch (x : RuntimeException) { + return s + } + return s + "Failed" +} + + +fun test2WithFinally() : String { + var s = ""; + try { + try { + s += "Try"; + unsupportedEx() + return s + } finally { + s += "Finally" + } + } catch (x : RuntimeException) { + return s + } +} + +fun box() : String { + if (test1WithFinally() != "TryFinally") return "fail2: ${test1WithFinally()}" + + if (test2WithFinally() != "TryFinally") return "fail4: ${test2WithFinally()}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/finally/tryLoopTry.kt b/backend.native/tests/external/codegen/blackbox/finally/tryLoopTry.kt new file mode 100644 index 00000000000..0a969975070 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/tryLoopTry.kt @@ -0,0 +1,36 @@ +//test for appropriate + +class MyString { + var s = "" + operator fun plus(x : String) : MyString { + s += x + return this + } + + override fun toString(): String { + return s + } +} + + +fun test1() : MyString { + var r = MyString() + try { + r + "Try1" + for(i in 1..1) { + try { + r + "Try2" + } finally { + return r + "Finally2" + } + } + + } finally { + r + "Finally1" + } + return r + "Fail" +} + +fun box(): String { + return if (test1().toString() == "Try1Try2Finally2Finally1") "OK" else "fail: ${test1()}" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/charBuffer.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/charBuffer.kt new file mode 100644 index 00000000000..7d7f2702e91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/charBuffer.kt @@ -0,0 +1,13 @@ +// TARGET_BACKEND: JVM + +// FULL_JDK + +import java.nio.CharBuffer + +fun box(): String { + val cb = CharBuffer.wrap("OK") + cb.position(1) + val o = cb[0] + val k = (cb as CharSequence).get(0) + return o.toString() + k +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/classpath.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/classpath.kt new file mode 100644 index 00000000000..6277a2ffc6c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/classpath.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM + +// FULL_JDK + +import sun.nio.cs.ext.Big5 +import sun.net.spi.nameservice.dns.DNSNameService +import javax.crypto.Cipher +import com.sun.crypto.provider.SunJCE +import sun.nio.ByteBuffered + +fun box(): String { + val a = Big5() // charsets.jar + val c = DNSNameService() // dnsns.ajr + val e : Cipher? = null // jce.jar + val f : SunJCE? = null // sunjce_provider.jar + val j : ByteBuffered? = null // rt.jar + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/ifInWhile.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/ifInWhile.kt new file mode 100644 index 00000000000..8831f244021 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/ifInWhile.kt @@ -0,0 +1,15 @@ +// TARGET_BACKEND: JVM + +// FULL_JDK + +fun box() : String { + val processors = Runtime.getRuntime()!!.availableProcessors() + var threadNum = 1 + while(threadNum <= 1024) { + if(threadNum < 2 * processors) + threadNum += 1 + else + threadNum *= 2 + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/intCountDownLatchExtension.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/intCountDownLatchExtension.kt new file mode 100644 index 00000000000..de02f10104e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/intCountDownLatchExtension.kt @@ -0,0 +1,25 @@ +// TARGET_BACKEND: JVM + +// FULL_JDK + +import java.util.concurrent.atomic.AtomicInteger +import java.util.concurrent.CountDownLatch +import java.util.concurrent.locks.ReentrantLock + +fun Int.latch(op: CountDownLatch.() -> T) : T { + val cdl = CountDownLatch(this) + val res = cdl.op() + cdl.await() + return res +} + +fun id(op: () -> Unit) = op() + +fun box() : String { + 1.latch{ + id { + countDown() + } + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/kt434.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/kt434.kt new file mode 100644 index 00000000000..1037c13e217 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/kt434.kt @@ -0,0 +1,17 @@ +// TARGET_BACKEND: JVM + +// FULL_JDK + +import java.net.* + +fun String.decodeURI(encoding : String) : String? = + try { + URLDecoder.decode(this, encoding) + } + catch (e : Throwable) { + null + } + +fun box() : String { + return if("hhh".decodeURI("") == null) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt new file mode 100644 index 00000000000..2a08c9eff57 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt @@ -0,0 +1,54 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FULL_JDK + +class C { + companion object { + val defaultGetter: Int = 1 + external get + + var defaultSetter: Int = 1 + external get + external set + } + + val defaultGetter: Int = 1 + external get + + var defaultSetter: Int = 1 + external get + external set +} + +val defaultGetter: Int = 1 + external get + +var defaultSetter: Int = 1 + external get + external set + +fun check(body: () -> Unit, signature: String): String? { + try { + body() + return "Link error expected" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != signature) return "Fail $signature: " + e.message + } + + return null +} + +fun box(): String { + return check({defaultGetter}, "NativePropertyAccessorsKt.getDefaultGetter()I") + ?: check({defaultSetter = 1}, "NativePropertyAccessorsKt.setDefaultSetter(I)V") + + ?: check({C.defaultGetter}, "C\$Companion.getDefaultGetter()I") + ?: check({C.defaultSetter = 1}, "C\$Companion.setDefaultSetter(I)V") + + ?: check({C().defaultGetter}, "C.getDefaultGetter()I") + ?: check({C().defaultSetter = 1}, "C.setDefaultSetter(I)V") + + ?: "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt new file mode 100644 index 00000000000..08679b45376 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FULL_JDK + +package foo + +class WithNative { + external fun foo() +} + +fun box(): String { + try { + WithNative().foo() + return "Link error expected" + } + catch (e: java.lang.UnsatisfiedLinkError) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt new file mode 100644 index 00000000000..2a168c7d954 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FULL_JDK + +package foo + +external fun bar(l: Long, s: String): Double + +fun box(): String { + var d = 0.0 + + try { + d = bar(1, "") + return "Link error expected on object" + } + catch (e: java.lang.UnsatisfiedLinkError) { + if (e.message != "foo.TopLevelKt.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/platformTypeAssertionStackTrace.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/platformTypeAssertionStackTrace.kt new file mode 100644 index 00000000000..b61651eedad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/platformTypeAssertionStackTrace.kt @@ -0,0 +1,24 @@ +// TARGET_BACKEND: JVM + +// FULL_JDK + +import java.util.* + +fun box(): String { + val a = ArrayList() as AbstractList + a.add(null) + try { + val b: String = a[0] + return "Fail: an exception should be thrown" + } catch (e: IllegalStateException) { + val st = (e as java.lang.Throwable).getStackTrace() + if (st.size < 5) { + return "Fail: very small stack trace, should at least have current function and JUnit reflective calls: ${Arrays.toString(st)}" + } + val top = st[0] + if (!(top.getClassName() == "PlatformTypeAssertionStackTraceKt" && top.getMethodName() == "box")) { + return "Fail: top stack trace element should be PlatformTypeAssertionStackTraceKt.box() from default package, but was $top" + } + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt new file mode 100644 index 00000000000..78b256c5c95 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FULL_JDK + +import org.w3c.dom.Element +import org.xml.sax.InputSource +import javax.xml.parsers.DocumentBuilderFactory +import java.io.StringReader + +class MyElement(e: Element): Element by e { + fun bar() = "OK" +} + +fun box() : String { + val factory = DocumentBuilderFactory.newInstance()!!; + val builder = factory.newDocumentBuilder()!!; + val source = InputSource(StringReader("")); + val doc = builder.parse(source)!!; + val myElement = MyElement(doc.getDocumentElement()!!) + return myElement.getTagName()!! +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/coerceVoidToArray.kt b/backend.native/tests/external/codegen/blackbox/functions/coerceVoidToArray.kt new file mode 100644 index 00000000000..695a3a50187 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/coerceVoidToArray.kt @@ -0,0 +1,16 @@ +fun a(): IntArray? = null + +fun b(): Nothing = throw Exception() + +fun foo(): IntArray = a() ?: b() + + +fun box(): String { + try { + foo() + } catch (e: Exception) { + return "OK" + } + + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/coerceVoidToObject.kt b/backend.native/tests/external/codegen/blackbox/functions/coerceVoidToObject.kt new file mode 100644 index 00000000000..660ea0d44ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/coerceVoidToObject.kt @@ -0,0 +1,16 @@ +fun a(): String? = null + +fun b(): Nothing = throw Exception() + +fun foo(): String = a() ?: b() + + +fun box(): String { + try { + foo() + } catch (e: Exception) { + return "OK" + } + + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt b/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt new file mode 100644 index 00000000000..5fc534c6a91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt @@ -0,0 +1,8 @@ +// TODO: Enable when JS backend gets support of Java class library +// IGNORE_BACKEND: JS +fun ok(b: Boolean) = if (b) "OK" else "Fail" + +fun box(): String { + val data = java.util.Arrays.asList("foo", "bar")!! + return ok(data.contains("foo")) +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs.kt new file mode 100644 index 00000000000..726a4d4db10 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs.kt @@ -0,0 +1,12 @@ +open abstract class B { + fun foo(arg: Int = 239 + 1) : Int = arg +} + +class C() : B() { +} + +fun box() : String { + if(C().foo(10) != 10) return "fail" + if(C().foo() != 240) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs1.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs1.kt new file mode 100644 index 00000000000..5666dd5603d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs1.kt @@ -0,0 +1,10 @@ +fun T.toPrefixedString(prefix: String = "", suffix: String="") = prefix + this.toString() + suffix + +fun box() : String { + if("mama".toPrefixedString(suffix="321", prefix="papa") != "papamama321") return "fail" + if("mama".toPrefixedString(prefix="papa") != "papamama") return "fail" + if("mama".toPrefixedString("papa", "239") != "papamama239") return "fail" + if("mama".toPrefixedString("papa") != "papamama") return "fail" + if("mama".toPrefixedString() != "mama") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs2.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs2.kt new file mode 100644 index 00000000000..710cc126ad2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs2.kt @@ -0,0 +1,34 @@ +class T4( + val c1: Boolean, + val c2: Boolean, + val c3: Boolean, + val c4: String +) { + override fun equals(o: Any?): Boolean { + if (o !is T4) return false; + return c1 == o.c1 && + c2 == o.c2 && + c3 == o.c3 && + c4 == o.c4 + } +} + +fun reformat( + str : String, + normalizeCase : Boolean = true, + uppercaseFirstLetter : Boolean = true, + divideByCamelHumps : Boolean = true, + wordSeparator : String = " " +) = + T4(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator) + + +fun box() : String { + val expected = T4(true, true, true, " ") + if(reformat("", true, true, true, " ") != expected) return "fail" + if(reformat("", true, true, true) != expected) return "fail" + if(reformat("", true, true) != expected) return "fail" + if(reformat("", true) != expected) return "fail" + if(reformat("") != expected) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs3.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs3.kt new file mode 100644 index 00000000000..df755765779 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs3.kt @@ -0,0 +1,15 @@ + +class C() { + fun Any.toMyPrefixedString(prefix: String = "", suffix: String="") : String = prefix + " " + suffix + + fun testReceiver() : String { + val res : String = "mama".toMyPrefixedString("111", "222") + return res + } + +} + +fun box() : String { + if(C().testReceiver() != "111 222") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs4.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs4.kt new file mode 100644 index 00000000000..b98b9a95d64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs4.kt @@ -0,0 +1,19 @@ +interface A { + fun bar2(arg: Int = 239) : Int + + fun bar(arg: Int = 240) : Int = bar2(arg/2) +} + +open abstract class B : A { + override fun bar2(arg: Int) : Int = arg +} + +class C : B() + +fun box() : String { + if(C().bar(10) != 5) return "fail" + if(C().bar() != 120) return "fail" + if(C().bar2() != 239) return "fail" + if(C().bar2(10) != 10) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs5.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs5.kt new file mode 100644 index 00000000000..91dc6f6be40 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs5.kt @@ -0,0 +1,13 @@ +open abstract class B { + abstract fun foo2(arg: Int = 239) : Int +} + +class C : B() { + override fun foo2(arg: Int) : Int = arg +} + +fun box() : String { + if(C().foo2() != 239) return "fail" + if(C().foo2(10) != 10) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs6.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs6.kt new file mode 100644 index 00000000000..90c4e943d5d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs6.kt @@ -0,0 +1,7 @@ +interface A { + fun foo(x: Int, y: Int = x + 20, z: Int = y * 2) = z +} + +class B : A {} + +fun box() = if (B().foo(1) == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/defaultargs7.kt b/backend.native/tests/external/codegen/blackbox/functions/defaultargs7.kt new file mode 100644 index 00000000000..107929fad00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/defaultargs7.kt @@ -0,0 +1,5 @@ +class A(val expected: Int) { + fun foo(x: Int, y: Int = x + 20, z: Int = y * 2) = z == expected +} + +fun box() = if (A(42).foo(1)) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/ea33909.kt b/backend.native/tests/external/codegen/blackbox/functions/ea33909.kt new file mode 100644 index 00000000000..f4022e8ba28 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/ea33909.kt @@ -0,0 +1,7 @@ +fun box(): String { + return justPrint(9.compareTo(4)) +} + +fun justPrint(value: Int): String { + return if (value > 0) "OK" else "Fail $value" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/fakeDescriptorWithSeveralOverridenOne.kt b/backend.native/tests/external/codegen/blackbox/functions/fakeDescriptorWithSeveralOverridenOne.kt new file mode 100644 index 00000000000..0086f8ab719 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/fakeDescriptorWithSeveralOverridenOne.kt @@ -0,0 +1,23 @@ +interface Named { + abstract fun getName() : String; +} + +interface MemberDescriptor : Named {} + +interface ClassifierDescriptor : Named {} + +interface ClassDescriptor : MemberDescriptor, ClassifierDescriptor {} + +class ClassDescriptorImpl : ClassDescriptor { + override fun getName(): String { + return "OK" + } +} + +class A(val descriptor : ClassDescriptor) { + val result : String = descriptor.getName() +} + +fun box(): String { + return A(ClassDescriptorImpl()).result +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpression.kt b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpression.kt new file mode 100644 index 00000000000..0936de3f951 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpression.kt @@ -0,0 +1,32 @@ +val foo1 = fun Any.(): String { +return "239" + this +} + +val foo2 = fun Int.(i : Int) : Int = this + i + +fun fooT1() = fun (t : T) = t.toString() + +annotation class A + +fun box() : String { + if(10.foo1() != "23910") return "foo1 fail" + if(10.foo2(1) != 11) return "foo2 fail" + + if(1.(fun Int.() = this + 1)() != 2) return "test 3 failed"; + if( (fun () = 1)() != 1) return "test 4 failed"; + if( (fun (i: Int) = i)(1) != 1) return "test 5 failed"; + if( 1.(fun Int.(i: Int) = i + this)(1) != 2) return "test 6 failed"; + if( (fooT1()("mama")) != "mama") return "test 7 failed"; + + val a = @A fun Int.() = this + 1 + if (1.a() != 2) return "test 8 failed" + val b = ( fun Int.() = this + 1) + if (1.b() != 2) return "test 9 failed" + val c = (c@ fun Int.() = this + 1) + if (1.c() != 2) return "test 10 failed" + + val d = d@ fun (): Int { return@d 4} + if (d() != 4) return "test 11 failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpressionWithThisReference.kt b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpressionWithThisReference.kt new file mode 100644 index 00000000000..a9e1d43173e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionExpressionWithThisReference.kt @@ -0,0 +1,34 @@ + +fun Int.thisRef1() = fun () = this +fun Int.thisRef2() = fun (): Int {return this} + +fun T.genericThisRef1() = fun () = this +fun T.genericThisRef2() = fun (): T {return this} + +val Int.valThisRef1: () -> Int get() = fun () = this +val Int.valThisRef2: () -> Int get() = fun (): Int {return this} + +val T.valGenericThisRef1: ()->T get() = fun () = this +val T.valGenericThisRef2: ()->T get() = fun (): T {return this} + +val T.withLabel1: ()->T get() = fun () = this@withLabel1 +val T.withLabel2: ()->T get() = fun (): T {return this@withLabel2} + +fun box(): String { + if (1.thisRef1()() != 1) return "Test 1 failed" + if (2.thisRef2()() != 2) return "Test 2 failed" + + if (3.genericThisRef1()() != 3) return "Test 3 failed" + if (4.genericThisRef2()() != 4) return "Test 4 failed" + + if (5.valThisRef1() != 5) return "Test 5 failed" + if (6.valThisRef2() != 6) return "Test 6 failed" + + if (7.valGenericThisRef1() != 7) return "Test 7 failed" + if (8.valGenericThisRef2() != 8) return "Test 8 failed" + + if ("bar".withLabel1() != "bar") return "Test 9 failed" + if ("bar".withLabel2() != "bar") return "Test 10 failed" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionLiteralExpression.kt b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionLiteralExpression.kt new file mode 100644 index 00000000000..5ee7f510702 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/functionLiteralExpression.kt @@ -0,0 +1,27 @@ +fun Any.foo1() : ()-> String { + return { "239" + this } +} + +fun Int.foo2() : (i : Int) -> Int { + return { x -> x + this } +} + +fun fooT1(t : T) = { t.toString() } + +fun fooT2(t: T) = { x:T -> t.toString() + x.toString() } + +object t + +fun box() : String { + if( (10.foo1())() != "23910") return "foo1 fail" + if( (10.foo2())(1) != 11 ) return "foo2 fail" + + if(1.(fun Int.() = this + 1)() != 2) return "test 3 failed"; + if( {1}() != 1) return "test 4 failed"; + if( {x : Int -> x}(1) != 1) return "test 5 failed"; + if( 1.(fun Int.(x: Int) = x + this)(1) != 2) return "test 6 failed"; + if( t.(fun Any.() = this)() != t) return "test 7 failed"; + if( (fooT1("mama"))() != "mama") return "test 8 failed"; + if( (fooT2("mama"))("papa") != "mamapapa") return "test 9 failed"; + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/underscoreParameters.kt b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/underscoreParameters.kt new file mode 100644 index 00000000000..b25ca696000 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/underscoreParameters.kt @@ -0,0 +1,3 @@ +fun foo(block: (String, String, String) -> String): String = block("O", "fail", "K") + +fun box() = foo(fun(x: String, _: String, y: String) = x + y) diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt b/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt new file mode 100644 index 00000000000..543a11e2632 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt @@ -0,0 +1,38 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun check(expected: String, obj: Any?) { + val actual = obj.toString() + if (actual != expected) + throw AssertionError("Expected: $expected, actual: $actual") +} + +fun box(): String { + check("() -> kotlin.Unit") + { -> } + check("() -> kotlin.Int") + { -> 42 } + check("(kotlin.String) -> kotlin.Long", + fun (s: String) = 42.toLong()) + check("(kotlin.Int, kotlin.Int) -> kotlin.Unit") + { x: Int, y: Int -> } + + check("kotlin.Int.() -> kotlin.Unit", + fun Int.() {}) + check("kotlin.Unit.() -> kotlin.Int?", + fun Unit.(): Int? = 42) + check("kotlin.String.(kotlin.String?) -> kotlin.Long", + fun String.(s: String?): Long = 42.toLong()) + check("kotlin.collections.List.(kotlin.collections.MutableSet<*>, kotlin.Nothing) -> kotlin.Unit", + fun List.(x: MutableSet<*>, y: Nothing) {}) + + check("(kotlin.IntArray, kotlin.ByteArray, kotlin.ShortArray, kotlin.CharArray, kotlin.LongArray, kotlin.BooleanArray, kotlin.FloatArray, kotlin.DoubleArray) -> kotlin.Array", + fun (ia: IntArray, ba: ByteArray, sa: ShortArray, ca: CharArray, la: LongArray, za: BooleanArray, fa: FloatArray, da: DoubleArray): Array = null!!) + + check("(kotlin.Array>>>) -> kotlin.Comparable", + fun (a: Array>>>): Comparable = null!!) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt new file mode 100644 index 00000000000..42b51515588 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun bar(): String { + return { t: T -> t }.toString() +} + +class Baz { + fun baz(v: V): String { + return (fun(t: List): V = v).toString() + } +} + +open class Foo>(val lambda: (T) -> U) +class Bar : Foo>({ listOf(it) }) + +fun box(): String { + assertEquals("(T) -> T", bar()) + assertEquals("(kotlin.collections.List) -> V", Baz().baz("")) + assertEquals("(T) -> kotlin.collections.List", Bar().lambda.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt new file mode 100644 index 00000000000..8788a8c350c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun check(expected: String, obj: Any?) { + val actual = obj.toString() + if (actual != expected) + throw AssertionError("Expected: $expected, actual: $actual") +} + +fun box(): String { + check("Function0") + { -> } + check("Function0") + { -> 42 } + check("Function1", + fun (s: String) = 42.toLong()) + check("Function2") + { x: Int, y: Int -> } + + check("Function1", + fun Int.() {}) + check("Function1", + fun Unit.(): Int? = 42) + check("Function2", + fun String.(s: String?): Long = 42.toLong()) + check("Function3, java.util.Set, ?, kotlin.Unit>", + fun List.(x: MutableSet<*>, y: Nothing) {}) + + check("Function8", + fun (ia: IntArray, ba: ByteArray, sa: ShortArray, ca: CharArray, la: LongArray, za: BooleanArray, fa: FloatArray, da: DoubleArray): Array = null!!) + + check("Function1[][][], java.lang.Comparable>", + fun (a: Array>>>): Comparable = null!!) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/infixRecursiveCall.kt b/backend.native/tests/external/codegen/blackbox/functions/infixRecursiveCall.kt new file mode 100644 index 00000000000..6670cdc54b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/infixRecursiveCall.kt @@ -0,0 +1,8 @@ +infix fun Int.test(x : Int) : Int { + if (this > 1) { + return (this - 1) test x + } + return this +} + +fun box() : String = if (10.test(10) == 1) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt new file mode 100644 index 00000000000..aa27b96d877 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val f = fun (s: String): String = s + val g = f as String.() -> String + if ("OK".g() != "OK") return "Fail 1" + + val h = fun String.(): String = this + val i = h as (String) -> String + if (i("OK") != "OK") return "Fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/extensionInvokeOnExpr.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/extensionInvokeOnExpr.kt new file mode 100644 index 00000000000..35496700fd7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/extensionInvokeOnExpr.kt @@ -0,0 +1,21 @@ +class A + +class B { + operator fun A.invoke() = "##" + operator fun A.invoke(i: Int) = "#${i}" +} + +fun foo() = A() + +fun B.test(): String { + if (A()() != "##") return "fail1" + if (A()(1) != "#1") return "fail2" + if (foo()() != "##") return "fail3" + if (foo()(42) != "#42") return "fail4" + if ((foo())(42) != "#42") return "fail5" + if ({ -> A()}()() != "##") return "fail6" + if ({ -> A()}()(37) != "#37") return "fail7" + return "OK" +} + +fun box(): String = B().test() diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt new file mode 100644 index 00000000000..f277bae8b6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt @@ -0,0 +1,14 @@ +class TestClass { + companion object { + inline operator fun invoke(task: () -> T) = task() + } +} + +fun box(): String { + val test1 = TestClass { "K" } + if (test1 != "K") return "fail1, 'test1' == $test1" + + val ok = "OK" + + val x = TestClass { return ok } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt new file mode 100644 index 00000000000..de3ac9fbc73 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt @@ -0,0 +1,10 @@ +class TestClass { + inline operator fun invoke(task: () -> T) = task() +} + +fun box(): String { + val test = TestClass() + val ok = "OK" + + val x = test { return ok } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/invoke.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/invoke.kt new file mode 100644 index 00000000000..15b6c093721 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/invoke.kt @@ -0,0 +1,28 @@ +package invoke + +fun test1(predicate: (Int) -> Int, i: Int) = predicate(i) + +fun test2(predicate: (Int) -> Int, i: Int) = predicate.invoke(i) + +class Method { + operator fun invoke(i: Int) = i +} + +fun test3(method: Method, i: Int) = method.invoke(i) + +fun test4(method: Method, i: Int) = method(i) + +class Method2 {} + +operator fun Method2.invoke(s: String) = s + +fun test5(method2: Method2, s: String) = method2(s) + +fun box() : String { + if (test1({ it }, 1) != 1) return "fail 1" + if (test2({ it }, 2) != 2) return "fail 2" + if (test3(Method(), 3) != 3) return "fail 3" + if (test4(Method(), 4) != 4) return "fail 4" + if (test5(Method2(), "s") != "s") return "fail5" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnExprByConvention.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnExprByConvention.kt new file mode 100644 index 00000000000..16e174b8db5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnExprByConvention.kt @@ -0,0 +1,20 @@ +//KT-3217 Invoke convention after function invocation doesn't work +//KT-2728 Can't compile A()() + +class A { + operator fun invoke() = "##" + operator fun invoke(i: Int) = "#${i}" +} + +fun foo() = A() + +fun box(): String { + if (A()() != "##") return "fail1" + if (A()(1) != "#1") return "fail2" + if (foo()() != "##") return "fail3" + if (foo()(42) != "#42") return "fail4" + if ((foo())(42) != "#42") return "fail5" + if ({ -> A()}()() != "##") return "fail6" + if ({ -> A()}()(37) != "#37") return "fail7" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt new file mode 100644 index 00000000000..5c28b925d97 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + public String getO() { + return "O"; + } +} + +// FILE: main.kt + +// KT-9522 Allow invoke convention for synthetic property + +operator fun String.invoke() = this + "K" + +fun box(): String { + return JavaClass().o(); +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3189.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3189.kt new file mode 100644 index 00000000000..be9a0f42107 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3189.kt @@ -0,0 +1,15 @@ +//KT-3189 Function invoke is called with no reason + +fun box(): String { + + val bad = Bad({ 1 }) + + return if (bad.test() == 1) "OK" else "fail" +} + +class Bad(val a: () -> Int) { + + fun test(): Int = a() + + operator fun invoke(): Int = 2 +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt new file mode 100644 index 00000000000..e5191fff338 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt @@ -0,0 +1,26 @@ +//KT-3190 Compiler crash if function called 'invoke' calls a closure +// IGNORE_BACKEND: JS +// JS backend does not allow to implement Function{N} interfaces + +fun box(): String { + val test = Cached({ it + 2 }) + return if (test(1) == 3) "OK" else "fail" +} + +class Cached(private val generate: (K)->V): Function1 { + val store = HashMap() + + // Everything works just fine if 'invoke' method is renamed to, for example, 'get' + override fun invoke(p1: K) = store.getOrPut(p1) { generate(p1) } +} + +//from library +fun MutableMap.getOrPut(key: K, defaultValue: ()-> V) : V { + if (this.containsKey(key)) { + return this.get(key) as V + } else { + val answer = defaultValue() + this.put(key, answer) + return answer + } +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3297.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3297.kt new file mode 100644 index 00000000000..026ac7a3b37 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3297.kt @@ -0,0 +1,17 @@ +//KT-3297 Calling the wrong function inside an extension method to the Function0 class + +infix fun Function0.or(alt: () -> R): R { + try { + return this() + } catch (e: Exception) { + return alt() + } +} + +fun box(): String { + return { + throw RuntimeException("fail") + } or { + "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3450getAndInvoke.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3450getAndInvoke.kt new file mode 100644 index 00000000000..012853d3a69 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3450getAndInvoke.kt @@ -0,0 +1,13 @@ +//KT-3450 get and invoke are not parsed in one expression + +public class A(val s: String) { + + operator fun get(i: Int) : A = A("$s + $i") + + operator fun invoke(builder : A.() -> String): String = builder() +} +fun x(y : String) : A = A(y) + +fun foo() = x("aaa")[42] { "$s!!" } + +fun box() = if (foo() == "aaa + 42!!") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3631invokeOnString.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3631invokeOnString.kt new file mode 100644 index 00000000000..8f18fbcb585 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3631invokeOnString.kt @@ -0,0 +1,5 @@ +//KT-3631 String.invoke doesn't work with literals + +operator fun String.invoke(i: Int) = "$this$i" + +fun box() = if ("a"(12) == "a12") "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3772.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3772.kt new file mode 100644 index 00000000000..622f571b489 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3772.kt @@ -0,0 +1,21 @@ +//KT-3772 Invoke and overload resolution ambiguity + +open class A { + fun invoke(f: A.() -> Unit) = 1 +} + +class B { + operator fun invoke(f: B.() -> Unit) = 2 +} + +open class C +val C.attr: A get() = A() + +open class D: C() +val D.attr: B get() = B() + + +fun box(): String { + val d = D() + return if (d.attr {} == 2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3821invokeOnThis.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3821invokeOnThis.kt new file mode 100644 index 00000000000..d15d396965a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3821invokeOnThis.kt @@ -0,0 +1,8 @@ +//KT-3821 Invoke convention doesn't work for `this` + +class A() { + operator fun invoke() = 42 + fun foo() = this() // Expecting a function type, but found A +} + +fun box() = if (A().foo() == 42) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt new file mode 100644 index 00000000000..7d8bb7ef55c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt @@ -0,0 +1,11 @@ +//KT-3822 Compiler crashes when use invoke convention with `this` in class which extends Function0 +// IGNORE_BACKEND: JS +// JS backend does not allow to implement Function{N} interfaces + +class B() : Function0 { + override fun invoke() = true + + fun foo() = this() // Exception +} + +fun box() = if (B().foo()) "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1038.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1038.kt new file mode 100644 index 00000000000..36770408c78 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1038.kt @@ -0,0 +1,64 @@ +//KT-1038 Cannot compile lazy iterators + +class YieldingIterator(val yieldingFunction : ()->T?) : Iterator +{ + var current : T? = yieldingFunction() + override fun next(): T { + val next = current; + if (next != null) + { + current = yieldingFunction() + return next + } + else throw IndexOutOfBoundsException() + } + override fun hasNext(): Boolean = current != null +} + +class YieldingIterable(val yielderFactory : ()->(()->T?)) : Iterable +{ + override fun iterator(): Iterator = YieldingIterator(yielderFactory()) +} + +public fun Iterable.lazy() : Iterable + { + return YieldingIterable { + val iterator = this.iterator(); + { if (iterator.hasNext()) iterator.next() else null } + } + } + +infix fun Iterable.where(predicate : (TItem)->Boolean) : Iterable + { + return YieldingIterable { + val iterator = this.iterator() + fun yielder() : TItem? { + while(iterator.hasNext()) + { + val next = iterator.next() + if (predicate(next)) + return next + } + return null + } + { yielder() } + } + } + +infix fun Iterable.select(selector : (TItem)->TResult) : Iterable + { + return YieldingIterable { + val iterator = this.iterator(); + { if(iterator.hasNext()) selector(iterator.next()) else null } + } + } + +fun box() : String { + val x = 0..100 + val filtered = x where { it % 2 == 0 } + val xx = x select { it * 2 } + var res = 0 + for (x in xx) + res += x + return if (res == 10100) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt new file mode 100644 index 00000000000..8db9c5299b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + + +interface MyIterator { + operator fun hasNext() : Boolean + operator fun next() : T +} + +operator fun T?.iterator() = object : MyIterator { + var hasNext = this@iterator != null + private set + override fun hasNext() = hasNext + + override fun next() : T { + if (hasNext) { + hasNext = false + return this@iterator!! + } + throw java.util.NoSuchElementException() + } +} + +fun box() : String { + var k = 0 + for (i in 1) { + k++ + } + return if(k == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1413.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1413.kt new file mode 100644 index 00000000000..15b496fb9b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1413.kt @@ -0,0 +1,26 @@ +package t + +interface I{ + fun f() +} + +class Test{ + fun foo(){ + val i : I = object : I { + override fun f() { + fun local(){ + bar() + } + local() + } + } + i.f() + } + + fun bar(){} +} + +fun box() : String { + Test().foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1649_1.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1649_1.kt new file mode 100644 index 00000000000..849bf5525ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1649_1.kt @@ -0,0 +1,18 @@ +interface A { + val method : (() -> Unit)? +} + +fun test(a : A) { + if (a.method != null) { + a.method!!() + } +} + +class B : A { + override val method = { } +} + +fun box(): String { + test(B()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1649_2.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1649_2.kt new file mode 100644 index 00000000000..33f420dc3f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1649_2.kt @@ -0,0 +1,18 @@ +interface A { + val method : () -> Unit? +} + +fun test(a : A) { + if (a.method != null) { + a.method!!() + } +} + +class B : A { + override val method = { } +} + +fun box(): String { + test(B()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt new file mode 100644 index 00000000000..ee3811c3548 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +public class RunnableFunctionWrapper(val f : () -> Unit) : Runnable { + public override fun run() { + f() + } +} + +fun box() : String { + var res = "" + RunnableFunctionWrapper({ res = "OK" }).run() + return res +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2270.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2270.kt new file mode 100644 index 00000000000..27d631e3d2f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2270.kt @@ -0,0 +1,6 @@ +class A( + val i : Int, + val j : Int = i +) + +fun box() = if (A(1).j == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2271.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2271.kt new file mode 100644 index 00000000000..efc623a6519 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2271.kt @@ -0,0 +1,3 @@ +fun foo(i: Int, j: Int = i) = j + +fun box() = if (foo(1) == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2280.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2280.kt new file mode 100644 index 00000000000..79debb72bdf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2280.kt @@ -0,0 +1,7 @@ +fun box(): String { + fun rmrf(i: Int) { + if (i > 0) rmrf(i - 1) + } + rmrf(5) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2481.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2481.kt new file mode 100644 index 00000000000..ea353c41cb1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2481.kt @@ -0,0 +1,14 @@ +fun box() = + B().method() + +public open class A(){ + public open fun method() : String = "OK" +} + +public class B(): A(){ + public override fun method() : String { + return ({ + super.method() + })() + } +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2716.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2716.kt new file mode 100644 index 00000000000..0ba57fd380a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2716.kt @@ -0,0 +1,11 @@ +package someTest + +public class Some private constructor(val v: String) { + companion object { + public fun init(v: String): Some { + return Some(v) + } + } +} + +fun box() = Some.init("OK").v diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2739.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2739.kt new file mode 100644 index 00000000000..296dd3bc8c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2739.kt @@ -0,0 +1,10 @@ +// KT-2739 Error type inferred for hashSet(Pair, Pair, Pair) + +fun foo(vararg ts: T): T? = null + +class Pair(a: A) + +fun box(): String { + val v = foo(Pair(1)) + return if (v == null) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt2929.kt b/backend.native/tests/external/codegen/blackbox/functions/kt2929.kt new file mode 100644 index 00000000000..4367923fc29 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt2929.kt @@ -0,0 +1,7 @@ +fun foo(): Int { + val a = "test" + val b = "test" + return a.compareTo(b) +} + +fun box(): String = if(foo() == 0) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt3214.kt b/backend.native/tests/external/codegen/blackbox/functions/kt3214.kt new file mode 100644 index 00000000000..8ff33fcad23 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt3214.kt @@ -0,0 +1,33 @@ +class A { + fun get(vararg x: Int) = x.size +} + +class B { + fun get(vararg x: Unit) = x.size +} + +fun test1(a: A): Int { + return a.get(1) +} + +fun test2(a: A): Int { + return a.get(1, 2) +} + +fun test3(b: B): Int { + return b.get(Unit, Unit) +} + + +fun box() : String { + var result = test1(A()) + if (result != 1) return "fail1: $result" + + result = test2(A()) + if (result != 2) return "fail2: $result" + + result = test3(B()) + if (result != 2) return "fail3: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt3313.kt b/backend.native/tests/external/codegen/blackbox/functions/kt3313.kt new file mode 100644 index 00000000000..5e2e887c2a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt3313.kt @@ -0,0 +1,7 @@ +fun foo(t: T) { +} + +fun box(): String { + foo(null) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt3573.kt b/backend.native/tests/external/codegen/blackbox/functions/kt3573.kt new file mode 100644 index 00000000000..e97d3620de0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt3573.kt @@ -0,0 +1,12 @@ +class Data + +fun newInit(f: Data.() -> Data) = Data().f() + +class TestClass { + val test: Data = newInit() { this } +} + +fun box() : String { + TestClass() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt3724.kt b/backend.native/tests/external/codegen/blackbox/functions/kt3724.kt new file mode 100644 index 00000000000..e1e5edac345 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt3724.kt @@ -0,0 +1,24 @@ +class Comment() { + var article = "" +} + +fun new(body: Comment.() -> Unit) : Comment { + val c = Comment() + c.body() + return c +} + +open class Request(val handler : Any.() -> Comment) { + val s = handler().article +} + + +class A : Request ({ + new { + this.article = "OK" + } +}) + +fun box() : String { + return A().s +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt395.kt b/backend.native/tests/external/codegen/blackbox/functions/kt395.kt new file mode 100644 index 00000000000..310640226e0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt395.kt @@ -0,0 +1,12 @@ +fun Any.with(operation : Any.() -> Any) = operation().toString() + +val f = { a : Int -> } + +fun box () : String { + return if(20.with { + this + } == "20") + "OK" + else + "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt785.kt b/backend.native/tests/external/codegen/blackbox/functions/kt785.kt new file mode 100644 index 00000000000..e3073856d42 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt785.kt @@ -0,0 +1,13 @@ +class A() { + var x : Int = 0 + + var z = { + x++ + } +} + +fun box() : String { + val a = A() + a.z() //problem is here + return if (a.x == 1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt873.kt b/backend.native/tests/external/codegen/blackbox/functions/kt873.kt new file mode 100644 index 00000000000..21c3dcd3338 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/kt873.kt @@ -0,0 +1,11 @@ +fun box() : String { + val fps : Double = 1.toDouble() + var mspf : Long + { + if ((fps.toInt() == 0)) + mspf = 0 + else + mspf = (((1000.0 / fps)).toLong()) + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunction.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunction.kt new file mode 100644 index 00000000000..b43377b6ab1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunction.kt @@ -0,0 +1,46 @@ +fun IntRange.forEach(body : (Int) -> Unit) { + for(i in this) { + body(i) + } +} + +fun box() : String { + var seed = 0 + + fun local(x: Int) { + fun deep() { + seed += x + } + fun deep2(x : Int) { + seed += x + } + fun Int.iter() { + seed += this + } + + deep() + deep2(-x) + x.iter() + seed += x + } + + for(i in 1..5) { + fun Int.iter() { + seed += this + } + + local(i) + (-i).iter() + } + + fun local2(y: Int) { + seed += y + } + + (1..5).forEach { + local2(it) + } + + + return if(seed == 30) "OK" else seed.toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/callInlineLocalInLambda.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/callInlineLocalInLambda.kt new file mode 100644 index 00000000000..a59a7507800 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/callInlineLocalInLambda.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x: String, block: (String) -> String) = block(x) + +fun box(): String { + fun bar(y: String) = y + "cde" + + val res = foo("abc") { bar(it) } + + assertEquals("abccde", res) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambda.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambda.kt new file mode 100644 index 00000000000..935d8b4963c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambda.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x: String, block: (String) -> String) = block(x) + +fun box(): String { + val res = foo("abc") { + fun bar(y: String) = y + "cde" + bar(it) + } + + assertEquals("abccde", res) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage1.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage1.kt new file mode 100644 index 00000000000..6609be78133 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage1.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x: String, block: (String) -> String) = block(x) + +fun box(): String { + val res = foo("abc") { + fun bar(y: String) = y + "cde" + foo(it) { bar(it) } + } + + assertEquals("abccde", res) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage2.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage2.kt new file mode 100644 index 00000000000..158e845f9ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage2.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x: String, block: (String) -> String) = block(x) +fun noInlineFoo(x: String, block: (String) -> String) = block(x) + +fun box(): String { + val res = foo("abc") { + fun bar(y: String) = y + "cde" + noInlineFoo(it) { bar(it) } + } + + assertEquals("abccde", res) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt2895.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt2895.kt new file mode 100644 index 00000000000..76db2bdc71e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt2895.kt @@ -0,0 +1,15 @@ +fun outer() { + fun inner(i: Int) { + if (i > 0){ + { + it: Int -> inner(0) // <- invocation of literal itself is generated instead + }.invoke(1) + } + } + inner(1) +} + +fun box(): String { + outer() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3308.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3308.kt new file mode 100644 index 00000000000..b97dfa7fb79 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3308.kt @@ -0,0 +1,5 @@ +fun box(): String { + fun foo(t: T) = t + + return foo("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3978.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3978.kt new file mode 100644 index 00000000000..03ba97cd9b7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt3978.kt @@ -0,0 +1,10 @@ +fun box() : String { + + + fun local(i: Int = 1) : Int { + return i + } + + return if (local() != 1) "fail" else "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119.kt new file mode 100644 index 00000000000..746e41ee392 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119.kt @@ -0,0 +1,12 @@ +fun foo(f: (Int?) -> Int): Int { + return f(0) +} + +fun box() : String { + infix operator fun Int?.plus(a: Int) : Int = a!! + 2 + + if (foo { it + 1 } != 3) return "Fail 1" + if (foo { it plus 1 } != 3) return "Fail 2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119_2.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119_2.kt new file mode 100644 index 00000000000..edb647f84a9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4119_2.kt @@ -0,0 +1,19 @@ +fun box(): String { + infix fun Int.foo(a: Int): Int = a + 2 + + val s = object { + fun test(): Int { + return 1 foo 1 + } + } + + fun local(): Int { + return 1 foo 1 + } + + if (s.test() != 3) return "Fail" + + if (local() != 3) return "Fail" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4514.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4514.kt new file mode 100644 index 00000000000..c767d3f0352 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4514.kt @@ -0,0 +1,9 @@ +fun box(): String { + fun String.f() = this + val vf: String.() -> String = { this } + + val localExt = "O".f() + "K"?.f() + if (localExt != "OK") return "localExt $localExt" + + return "O".vf() + "K"?.vf() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt new file mode 100644 index 00000000000..22c5f2595ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +var result = "Fail" + +val p = object : Runnable { + override fun run() { + fun T.id() = this + + result = "OK".id() + } +} + +fun box(): String { + p.run() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4783.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4783.kt new file mode 100644 index 00000000000..5d5d9d55f6a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4783.kt @@ -0,0 +1,18 @@ +class T(val value: Int) { +} + +fun local() : Int { + + operator fun T.get(s: Int): Int { + return s * this.value + } + + var t = T(11) + return t[2] +} + +fun box() : String { + if (local() != 22) return "fail1 ${local()} " + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4784.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4784.kt new file mode 100644 index 00000000000..404fce279be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4784.kt @@ -0,0 +1,20 @@ +open class T(var value: Int) {} + +fun plusAssign(): T { + + operator fun T.plusAssign(s: Int) { + value += s + } + + var t = T(1) + t += 1 + + return t +} + +fun box(): String { + val result = plusAssign().value + if (result != 2) return "fail 1: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt new file mode 100644 index 00000000000..d42b8a0b6b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class It(val id: String) + +fun box(): String { + val projectId = "projectId" + val it = It("it") + + + fun selectMetaRunnerId(): String { + operator fun Int?.inc() = (this ?: 0) + 1 + var counter: Int? = null + fun path(metaRunnerId: String) = counter != 2 + + var i = 0 + while (true) { + val name = projectId + "_" + it.id + (if (counter == null) "" else "_$counter") + if (!path(name)) { + return name + } + counter++ + + i++ + if (i > 2) return "Infinity loop: $counter" + } + } + val X = selectMetaRunnerId() + if (X != projectId + "_" + it.id + "_2") return "fail: $X" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/localExtensionOnNullableParameter.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/localExtensionOnNullableParameter.kt new file mode 100644 index 00000000000..709b1c9ac1e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/localExtensionOnNullableParameter.kt @@ -0,0 +1,21 @@ +open class T(var value: Int) {} + +fun localExtensionOnNullableParameter(): T { + + fun T.local(s: Int) { + value += s + } + + var t: T? = T(1) + t?.local(2) + + return t!! +} + + +fun box(): String { + val result = localExtensionOnNullableParameter().value + if (result != 3) return "fail 2: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/localFunctionInConstructor.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/localFunctionInConstructor.kt new file mode 100644 index 00000000000..5f294911561 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/localFunctionInConstructor.kt @@ -0,0 +1,15 @@ +class Test { + + val property:Int + init { + fun local():Int { + return 10; + } + property = local(); + } + +} + +fun box(): String { + return if (Test().property == 10) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/localReturnInsideFunctionExpression.kt b/backend.native/tests/external/codegen/blackbox/functions/localReturnInsideFunctionExpression.kt new file mode 100644 index 00000000000..5d3a5ad1a33 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localReturnInsideFunctionExpression.kt @@ -0,0 +1,10 @@ +fun simple() = fun (): Boolean { return true } + +fun withLabel() = l@ fun (): Boolean { return@l true } + +fun box(): String { + if (!simple()()) return "Test simple failed" + if (!withLabel()()) return "Test withLabel failed" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/nothisnoclosure.kt b/backend.native/tests/external/codegen/blackbox/functions/nothisnoclosure.kt new file mode 100644 index 00000000000..68369ae57eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/nothisnoclosure.kt @@ -0,0 +1,16 @@ +fun foo(x: Int) {} + +fun loop(times : Int) { + var left = times + while(left > 0) { + val u : (value : Int) -> Unit = { + foo(it) + } + u(left--) + } +} + +fun box() : String { + loop(5) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/functions/prefixRecursiveCall.kt b/backend.native/tests/external/codegen/blackbox/functions/prefixRecursiveCall.kt new file mode 100644 index 00000000000..7fe750fc4ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/prefixRecursiveCall.kt @@ -0,0 +1,8 @@ +operator fun String.unaryPlus() : String { + if (this == "") { + return "done" + } + return +"" +} + +fun box() : String = if (+"11" == "done") "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/recursiveCompareTo.kt b/backend.native/tests/external/codegen/blackbox/functions/recursiveCompareTo.kt new file mode 100644 index 00000000000..aeafd27f6e0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/recursiveCompareTo.kt @@ -0,0 +1,11 @@ +class C + +operator fun C.compareTo(o: C) : Int { + if (this == o) return 0 + if (o >= o) { + return 1 + } + return -1 +} + +fun box() : String = if (C() > C()) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/functions/recursiveIncrementCall.kt b/backend.native/tests/external/codegen/blackbox/functions/recursiveIncrementCall.kt new file mode 100644 index 00000000000..b5985d5606c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/recursiveIncrementCall.kt @@ -0,0 +1,12 @@ +operator fun String.inc() : String { + if (this == "") { + return "done" + } + var s = "" + return ++s +} + +fun box() : String { + var s = "11test" + return if (++s == "done") "OK" else "FAIL" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt new file mode 100644 index 00000000000..0cabc78122d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.internal.pcollections.HashPMap +import kotlin.test.* + +fun box(): String { + val map = HashPMap.empty()!! + + assertEquals(0, map.size()) + + assertFalse(map.containsKey("")) + assertFalse(map.containsKey("abacaba")) + assertEquals(null, map[""]) + assertEquals(null, map["lol"]) + + // Check that doesn't create a new map + assertEquals(map, map.minus("")) + + // Check that all empty()s are equal + val other = HashPMap.empty()!! + assertEquals(map, other) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt new file mode 100644 index 00000000000..14e802cfbaf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import java.util.* +import kotlin.reflect.jvm.internal.pcollections.HashPMap +import kotlin.test.* + +fun digitSum(number: Int): Int { + var x = number + var ans = 0 + while (x != 0) { + ans += x % 10 + x /= 10 + } + return ans +} + +val N = 1000000 + +fun box(): String { + var map = HashPMap.empty()!! + + for (x in 1..N) { + map = map.plus(x, digitSum(x))!! + } + + assertEquals(N, map.size()) + + // Check in reverse order just in case + for (x in N downTo 1) { + assertTrue(map.containsKey(x), "Not found: $x") + assertEquals(digitSum(x), map[x], "Incorrect value for $x") + } + + // Delete in random order + val list = (1..N).toCollection(ArrayList()) + Collections.shuffle(list, Random(42)) + for (x in list) { + map = map.minus(x)!! + } + + assertEquals(0, map.size()) + + for (x in 1..N) { + assertFalse(map.containsKey(x), "Incorrectly found: $x") + assertEquals(null, map[x], "Incorrectly found value for $x") + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt new file mode 100644 index 00000000000..9d7cc805597 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.internal.pcollections.HashPMap +import kotlin.test.* + +fun box(): String { + var map = HashPMap.empty()!! + + map = map.plus("lol", 42)!! + map = map.plus("lol", 239)!! + + assertEquals(1, map.size()) + assertTrue(map.containsKey("lol")) + assertFalse(map.containsKey("")) + assertEquals(239, map["lol"]) + assertEquals(null, map[""]) + + map = map.plus("", 0)!! + map = map.plus("", 2.71828)!! + map = map.plus("lol", 42)!! + map = map.plus("", 3.14)!! + + assertEquals(2, map.size()) + assertTrue(map.containsKey("lol")) + assertTrue(map.containsKey("")) + assertEquals(42, map["lol"]) + assertEquals(3.14, map[""]) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt new file mode 100644 index 00000000000..cd530ba7d6b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.internal.pcollections.HashPMap +import kotlin.test.* + +fun box(): String { + var map = HashPMap.empty()!! + + map = map.plus("lol", 42)!! + map = map.plus("lol", 42)!! + + assertEquals(1, map.size()) + assertTrue(map.containsKey("lol")) + assertFalse(map.containsKey("")) + assertEquals(42, map["lol"]) + assertEquals(null, map[""]) + + map = map.plus("", 0)!! + map = map.plus("", 0)!! + map = map.plus("lol", 42)!! + map = map.plus("", 0)!! + + assertEquals(2, map.size()) + assertTrue(map.containsKey("lol")) + assertTrue(map.containsKey("")) + assertEquals(42, map["lol"]) + assertEquals(0, map[""]) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt new file mode 100644 index 00000000000..737e202ed45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.internal.pcollections.HashPMap +import kotlin.test.* + +fun box(): String { + var map = HashPMap.empty()!! + + map = map.plus("lol", 42)!! + + assertEquals(1, map.size()) + assertTrue(map.containsKey("lol")) + assertFalse(map.containsKey("")) + assertEquals(42, map["lol"]) + assertEquals(null, map[""]) + + map = map.plus("", 0)!! + + assertEquals(2, map.size()) + assertTrue(map.containsKey("lol")) + assertTrue(map.containsKey("")) + assertEquals(42, map["lol"]) + assertEquals(0, map[""]) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt new file mode 100644 index 00000000000..ce5d691c41b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.internal.pcollections.HashPMap +import kotlin.test.* + +fun box(): String { + var map = HashPMap.empty()!! + + map = map.plus("lol", 42)!! + map = map.minus("lol")!! + + assertEquals(0, map.size()) + assertFalse(map.containsKey("lol")) + assertEquals(null, map["lol"]) + + map = map.plus("abc", "a")!! + map = map.minus("abc")!! + map = map.plus("abc", "d")!! + + assertEquals(1, map.size()) + assertTrue(map.containsKey("abc")) + assertEquals("d", map["abc"]) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/anyToReal.kt b/backend.native/tests/external/codegen/blackbox/ieee754/anyToReal.kt new file mode 100644 index 00000000000..3ba490d870e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/anyToReal.kt @@ -0,0 +1,15 @@ +fun box(): String { + val plusZero: Any = 0.0 + val minusZero: Any = -0.0 + if ((minusZero as Double) < (plusZero as Double)) return "fail 0" + + val plusZeroF: Any = 0.0F + val minusZeroF: Any = -0.0F + if ((minusZeroF as Float) < (plusZeroF as Float)) return "fail 1" + + if ((minusZero as Double) != (plusZero as Double)) return "fail 3" + + if ((minusZeroF as Float) != (plusZeroF as Float)) return "fail 4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt b/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt new file mode 100644 index 00000000000..a4298207118 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt @@ -0,0 +1,14 @@ +// IGNORE_BACKEND: JS +fun box(): String { + if ((-0.0 as Comparable) >= 0.0) return "fail 0" + if ((-0.0F as Comparable) >= 0.0F) return "fail 1" + + + if ((-0.0 as Comparable) == 0.0) return "fail 3" + if (-0.0 == (0.0 as Comparable)) return "fail 4" + + if ((-0.0F as Comparable) == 0.0F) return "fail 5" + if (-0.0F == (0.0F as Comparable)) return "fail 6" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt b/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt new file mode 100644 index 00000000000..415c6814408 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt @@ -0,0 +1,9 @@ +// IGNORE_BACKEND: JS +data class Test(val z1: Double, val z2: Double?) + +fun box(): String { + val x = Test(Double.NaN, Double.NaN) + val y = Test(Double.NaN, Double.NaN) + + return if (x == y) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/equalsDouble.kt b/backend.native/tests/external/codegen/blackbox/ieee754/equalsDouble.kt new file mode 100644 index 00000000000..28d5c90e7f6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/equalsDouble.kt @@ -0,0 +1,22 @@ +fun equals1(a: Double, b: Double) = a == b + +fun equals2(a: Double?, b: Double?) = a!! == b!! + +fun equals3(a: Double?, b: Double?) = a != null && b != null && a == b + +fun equals4(a: Double?, b: Double?) = if (a is Double && b is Double) a == b else null!! + +fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double) a == b else null!! + + +fun box(): String { + if (-0.0 != 0.0) return "fail 0" + if (!equals1(-0.0, 0.0)) return "fail 1" + if (!equals2(-0.0, 0.0)) return "fail 2" + if (!equals3(-0.0, 0.0)) return "fail 3" + if (!equals4(-0.0, 0.0)) return "fail 4" + if (!equals5(-0.0, 0.0)) return "fail 5" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/equalsFloat.kt b/backend.native/tests/external/codegen/blackbox/ieee754/equalsFloat.kt new file mode 100644 index 00000000000..26187f688d0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/equalsFloat.kt @@ -0,0 +1,22 @@ +fun equals1(a: Float, b: Float) = a == b + +fun equals2(a: Float?, b: Float?) = a!! == b!! + +fun equals3(a: Float?, b: Float?) = a != null && b != null && a == b + +fun equals4(a: Float?, b: Float?) = if (a is Float && b is Float) a == b else null!! + +fun equals5(a: Any?, b: Any?) = if (a is Float && b is Float) a == b else null!! + + +fun box(): String { + if (-0.0F != 0.0F) return "fail 0" + if (!equals1(-0.0F, 0.0F)) return "fail 1" + if (!equals2(-0.0F, 0.0F)) return "fail 2" + if (!equals3(-0.0F, 0.0F)) return "fail 3" + if (!equals4(-0.0F, 0.0F)) return "fail 4" + if (!equals5(-0.0F, 0.0F)) return "fail 5" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/equalsNullableDouble.kt b/backend.native/tests/external/codegen/blackbox/ieee754/equalsNullableDouble.kt new file mode 100644 index 00000000000..229629cb1e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/equalsNullableDouble.kt @@ -0,0 +1,30 @@ +fun equals1(a: Double, b: Double?) = a == b + +fun equals2(a: Double?, b: Double?) = a!! == b!! + +fun equals3(a: Double?, b: Double?) = a != null && a == b + +fun equals4(a: Double?, b: Double?) = if (a is Double) a == b else null!! + +fun equals5(a: Any?, b: Any?) = if (a is Double && b is Double?) a == b else null!! + +fun equals6(a: Any?, b: Any?) = if (a is Double? && b is Double) a == b else null!! + +fun equals7(a: Double?, b: Double?) = a == b + +fun equals8(a: Any?, b: Any?) = if (a is Double? && b is Double?) a == b else null!! + + +fun box(): String { + if (!equals1(-0.0, 0.0)) return "fail 1" + if (!equals2(-0.0, 0.0)) return "fail 2" + if (!equals3(-0.0, 0.0)) return "fail 3" + if (!equals4(-0.0, 0.0)) return "fail 4" + if (!equals5(-0.0, 0.0)) return "fail 5" + if (!equals6(-0.0, 0.0)) return "fail 6" + if (!equals7(-0.0, 0.0)) return "fail 7" + if (!equals8(-0.0, 0.0)) return "fail 8" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt b/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt new file mode 100644 index 00000000000..40409e20e4c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt @@ -0,0 +1,20 @@ +// IGNORE_BACKEND: JS +fun less1(a: Double, b: Double) = a.compareTo(b) == -1 + +fun less2(a: Double?, b: Double?) = a!!.compareTo(b!!) == -1 + +fun less3(a: Double?, b: Double?) = a != null && b != null && a.compareTo(b) == -1 + +fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a.compareTo(b) == -1 else null!! + +fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a.compareTo(b) == -1 else null!! + +fun box(): String { + if (!less1(-0.0, 0.0)) return "fail 1" + if (!less2(-0.0, 0.0)) return "fail 2" + if (!less3(-0.0, 0.0)) return "fail 3" + if (!less4(-0.0, 0.0)) return "fail 4" + if (!less5(-0.0, 0.0)) return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt b/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt new file mode 100644 index 00000000000..4a6f495d576 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt @@ -0,0 +1,21 @@ +// IGNORE_BACKEND: JS + +fun equals1(a: Double, b: Double) = a.equals(b) + +fun equals2(a: Double?, b: Double?) = a!!.equals(b!!) + +fun equals3(a: Double?, b: Double?) = a != null && b != null && a.equals(b) + +fun equals4(a: Double?, b: Double?) = if (a is Double && b is Double) a.equals(b) else null!! + + +fun box(): String { + if ((-0.0).equals(0.0)) return "fail 0" + if (equals1(-0.0, 0.0)) return "fail 1" + if (equals2(-0.0, 0.0)) return "fail 2" + if (equals3(-0.0, 0.0)) return "fail 3" + if (equals4(-0.0, 0.0)) return "fail 4" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/generic.kt b/backend.native/tests/external/codegen/blackbox/ieee754/generic.kt new file mode 100644 index 00000000000..6d621ffd2c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/generic.kt @@ -0,0 +1,18 @@ +// FILE: b.kt + +class Foo(val minus0: T, val plus0: T) { + +} + +fun box(): String { + val foo = Foo(-0.0, 0.0) + val fooF = Foo(-0.0F, 0.0F) + + if (foo.minus0 < foo.plus0) return "fail 0" + if (fooF.minus0 < fooF.plus0) return "fail 1" + + if (foo.minus0 != foo.plus0) return "fail 3" + if (fooF.minus0 != fooF.plus0) return "fail 4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/greaterDouble.kt b/backend.native/tests/external/codegen/blackbox/ieee754/greaterDouble.kt new file mode 100644 index 00000000000..2359ca5d077 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/greaterDouble.kt @@ -0,0 +1,20 @@ +fun greater1(a: Double, b: Double) = a > b + +fun greater2(a: Double?, b: Double?) = a!! > b!! + +fun greater3(a: Double?, b: Double?) = a != null && b != null && a > b + +fun greater4(a: Double?, b: Double?) = if (a is Double && b is Double) a > b else null!! + +fun greater5(a: Any?, b: Any?) = if (a is Double && b is Double) a > b else null!! + +fun box(): String { + if (0.0 > -0.0) return "fail 0" + if (greater1(0.0, -0.0)) return "fail 1" + if (greater2(0.0, -0.0)) return "fail 2" + if (greater3(0.0, -0.0)) return "fail 3" + if (greater4(0.0, -0.0)) return "fail 4" + if (greater5(0.0, -0.0)) return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/greaterFloat.kt b/backend.native/tests/external/codegen/blackbox/ieee754/greaterFloat.kt new file mode 100644 index 00000000000..ebcf4ef7147 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/greaterFloat.kt @@ -0,0 +1,20 @@ +fun greater1(a: Float, b: Float) = a > b + +fun greater2(a: Float?, b: Float?) = a!! > b!! + +fun greater3(a: Float?, b: Float?) = a != null && b != null && a > b + +fun greater4(a: Float?, b: Float?) = if (a is Float && b is Float) a > b else null!! + +fun greater5(a: Any?, b: Any?) = if (a is Float && b is Float) a > b else null!! + +fun box(): String { + if (0.0F > -0.0F) return "fail 0" + if (greater1(0.0F, -0.0F)) return "fail 1" + if (greater2(0.0F, -0.0F)) return "fail 2" + if (greater3(0.0F, -0.0F)) return "fail 3" + if (greater4(0.0F, -0.0F)) return "fail 4" + if (greater5(0.0F, -0.0F)) return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt b/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt new file mode 100644 index 00000000000..58a844412bc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt @@ -0,0 +1,49 @@ +// IGNORE_BACKEND: JS + +inline fun less(a: Comparable, b: Double): Boolean { + return a < b +} + +inline fun equals(a: Comparable, b: Comparable): Boolean { + return a == b +} + +inline fun > lessGeneric(a: T, b: Double): Boolean { + return a < b +} + +inline fun > equalsGeneric(a: T, b: Double): Boolean { + return a == b +} + +inline fun > lessReified(a: T, b: Double): Boolean { + return a < b +} + +inline fun > equalsReified(a: T, b: T): Boolean { + return a == b +} + +inline fun less754(a: Double, b: Double): Boolean { + return a < b +} + +inline fun equals754(a: Double, b: Double): Boolean { + return a == b +} + +fun box(): String { + if (!less(-0.0, 0.0)) return "fail 1" + if (equals(-0.0, 0.0)) return "fail 2" + + if (!lessGeneric(-0.0, 0.0)) return "fail 3" + if (equalsGeneric(-0.0, 0.0)) return "fail 4" + + if (!lessReified(-0.0, 0.0)) return "fail 5" + if (equalsReified(-0.0, 0.0)) return "fail 6" + + if (less754(-0.0, 0.0)) return "fail 7" + if (!equals754(-0.0, 0.0)) return "fail 8" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/lessDouble.kt b/backend.native/tests/external/codegen/blackbox/ieee754/lessDouble.kt new file mode 100644 index 00000000000..b25363bdb65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/lessDouble.kt @@ -0,0 +1,20 @@ +fun less1(a: Double, b: Double) = a < b + +fun less2(a: Double?, b: Double?) = a!! < b!! + +fun less3(a: Double?, b: Double?) = a != null && b != null && a < b + +fun less4(a: Double?, b: Double?) = if (a is Double && b is Double) a < b else null!! + +fun less5(a: Any?, b: Any?) = if (a is Double && b is Double) a < b else null!! + +fun box(): String { + if (-0.0 < 0.0) return "fail 0" + if (less1(-0.0, 0.0)) return "fail 1" + if (less2(-0.0, 0.0)) return "fail 2" + if (less3(-0.0, 0.0)) return "fail 3" + if (less4(-0.0, 0.0)) return "fail 4" + if (less5(-0.0, 0.0)) return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/lessFloat.kt b/backend.native/tests/external/codegen/blackbox/ieee754/lessFloat.kt new file mode 100644 index 00000000000..efea2decef4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/lessFloat.kt @@ -0,0 +1,20 @@ +fun less1(a: Float, b: Float) = a < b + +fun less2(a: Float?, b: Float?) = a!! < b!! + +fun less3(a: Float?, b: Float?) = a != null && b != null && a < b + +fun less4(a: Float?, b: Float?) = if (a is Float && b is Float) a < b else true + +fun less5(a: Any?, b: Any?) = if (a is Float && b is Float) a < b else true + +fun box(): String { + if (-0.0F < 0.0F) return "fail 0" + if (less1(-0.0F, 0.0F)) return "fail 1" + if (less2(-0.0F, 0.0F)) return "fail 2" + if (less3(-0.0F, 0.0F)) return "fail 3" + if (less4(-0.0F, 0.0F)) return "fail 4" + if (less5(-0.0F, 0.0F)) return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/nullableAnyToReal.kt b/backend.native/tests/external/codegen/blackbox/ieee754/nullableAnyToReal.kt new file mode 100644 index 00000000000..7c4a950202f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/nullableAnyToReal.kt @@ -0,0 +1,15 @@ +fun box(): String { + val plusZero: Any? = 0.0 + val minusZero: Any? = -0.0 + if ((minusZero as Double) < (plusZero as Double)) return "fail 0" + + val plusZeroF: Any? = 0.0F + val minusZeroF: Any? = -0.0F + if ((minusZeroF as Float) < (plusZeroF as Float)) return "fail 1" + + if ((minusZero as Double) != (plusZero as Double)) return "fail 3" + + if ((minusZeroF as Float) != (plusZeroF as Float)) return "fail 4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt b/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt new file mode 100644 index 00000000000..06160ead6c5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt @@ -0,0 +1,14 @@ +// IGNORE_BACKEND: JS +fun box(): String { + val plusZero: Double? = 0.0 + val minusZero: Double = -0.0 + if (plusZero?.equals(minusZero) ?: null!!) { + return "fail 1" + } + + if (plusZero?.compareTo(minusZero) ?: null!! != 1) { + return "fail 2" + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt b/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt new file mode 100644 index 00000000000..e3a06426db3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt @@ -0,0 +1,14 @@ +// IGNORE_BACKEND: JS +fun box(): String { + val zero: Any = 0.0 + val floatZero: Any = -0.0F + if (zero is Double && floatZero is Float) { + if (zero == floatZero) return "fail 1" + + if (zero <= floatZero) return "fail 2" + + return "OK" + } + + return "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/when.kt b/backend.native/tests/external/codegen/blackbox/ieee754/when.kt new file mode 100644 index 00000000000..c57947e17bf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/when.kt @@ -0,0 +1,21 @@ +fun box(): String { + val plusZero: Any = 0.0 + val minusZero: Any = -0.0 + if (plusZero is Double) { + when (plusZero) { + -0.0 -> { + } + else -> return "fail 1" + } + + if (minusZero is Double) { + when (plusZero) { + minusZero -> { + } + else -> return "fail 2" + } + } + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/whenNoSubject.kt b/backend.native/tests/external/codegen/blackbox/ieee754/whenNoSubject.kt new file mode 100644 index 00000000000..308c9a24cfe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/whenNoSubject.kt @@ -0,0 +1,26 @@ +fun box(): String { + val plusZero: Any = 0.0 + val minusZero: Any = -0.0 + if (plusZero is Double && minusZero is Double) { + when { + plusZero < minusZero -> { + return "fail 1" + } + + plusZero > minusZero -> { + return "fail 2" + } + else -> { + } + } + + + when { + plusZero == minusZero -> { + } + else -> return "fail 3" + } + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/arrayElement.kt b/backend.native/tests/external/codegen/blackbox/increment/arrayElement.kt new file mode 100644 index 00000000000..e74d4d23515 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/arrayElement.kt @@ -0,0 +1,69 @@ +fun box(): String { + val aByte: Array = arrayOf(1) + val bByte: ByteArray = byteArrayOf(1) + + val aShort: Array = arrayOf(1) + val bShort: ShortArray = shortArrayOf(1) + + val aInt: Array = arrayOf(1) + val bInt: IntArray = intArrayOf(1) + + val aLong: Array = arrayOf(1) + val bLong: LongArray = longArrayOf(1) + + val aFloat: Array = arrayOf(1.0f) + val bFloat: FloatArray = floatArrayOf(1.0f) + + val aDouble: Array = arrayOf(1.0) + val bDouble: DoubleArray = doubleArrayOf(1.0) + + aByte[0]-- + bByte[0]-- + if (aByte[0] != bByte[0]) return "Failed post-decrement Byte: ${aByte[0]} != ${bByte[0]}" + + aByte[0]++ + bByte[0]++ + if (aByte[0] != bByte[0]) return "Failed post-increment Byte: ${aByte[0]} != ${bByte[0]}" + + aShort[0]-- + bShort[0]-- + if (aShort[0] != bShort[0]) return "Failed post-decrement Short: ${aShort[0]} != ${bShort[0]}" + + aShort[0]++ + bShort[0]++ + if (aShort[0] != bShort[0]) return "Failed post-increment Short: ${aShort[0]} != ${bShort[0]}" + + aInt[0]-- + bInt[0]-- + if (aInt[0] != bInt[0]) return "Failed post-decrement Int: ${aInt[0]} != ${bInt[0]}" + + aInt[0]++ + bInt[0]++ + if (aInt[0] != bInt[0]) return "Failed post-increment Int: ${aInt[0]} != ${bInt[0]}" + + aLong[0]-- + bLong[0]-- + if (aLong[0] != bLong[0]) return "Failed post-decrement Long: ${aLong[0]} != ${bLong[0]}" + + aLong[0]++ + bLong[0]++ + if (aLong[0] != bLong[0]) return "Failed post-increment Long: ${aLong[0]} != ${bLong[0]}" + + aFloat[0]++ + bFloat[0]++ + if (aFloat[0] != bFloat[0]) return "Failed post-increment Float: ${aFloat[0]} != ${bFloat[0]}" + + aFloat[0]-- + bFloat[0]-- + if (aFloat[0] != bFloat[0]) return "Failed post-decrement Float: ${aFloat[0]} != ${bFloat[0]}" + + aDouble[0]++ + bDouble[0]++ + if (aDouble[0] != bDouble[0]) return "Failed post-increment Double: ${aDouble[0]} != ${bDouble[0]}" + + aDouble[0]-- + bDouble[0]-- + if (aDouble[0] != bDouble[0]) return "Failed post-decrement Double: ${aDouble[0]} != ${bDouble[0]}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/assignPlusOnSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/assignPlusOnSmartCast.kt new file mode 100644 index 00000000000..f3b84e034bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/assignPlusOnSmartCast.kt @@ -0,0 +1,8 @@ +public fun box() : String { + var i : Int? + i = 10 + // assignPlus on a smart cast should work + i += 1 + + return if (11 == i) "OK" else "fail i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/augmentedAssignmentWithComplexRhs.kt b/backend.native/tests/external/codegen/blackbox/increment/augmentedAssignmentWithComplexRhs.kt new file mode 100644 index 00000000000..cc9dccf660b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/augmentedAssignmentWithComplexRhs.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME +import kotlin.test.* + +var log = "" +var result = 20 +var doubleResult = 40.0 + +fun id(value: T) = value + +fun box(): String { + result += if (id("true") == "true") { + result += 10 + log += "true chosen;" + 3 + } + else { + 4 + } + + assertEquals(23, result) + + doubleResult += if (id("true") == "true") { + doubleResult += 100 + log += "true chosen;" + 2 + } + else { + 5 + } + + assertEquals(42, (doubleResult + 0.1).toInt()) + assertEquals("true chosen;true chosen;", log) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/classNaryGetSet.kt b/backend.native/tests/external/codegen/blackbox/increment/classNaryGetSet.kt new file mode 100644 index 00000000000..121ace263e0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/classNaryGetSet.kt @@ -0,0 +1,15 @@ +object A { + var x = 0 + + operator fun get(i1: Int, i2: Int, i3: Int): Int = x + + operator fun set(i1: Int, i2: Int, i3: Int, value: Int) { + x = value + } +} + +fun box(): String { + A.x = 0 + val xx = A[1, 2, 3]++ + return if (xx != 0 || A.x != 1) "Failed" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/classWithGetSet.kt b/backend.native/tests/external/codegen/blackbox/increment/classWithGetSet.kt new file mode 100644 index 00000000000..97d2925acb4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/classWithGetSet.kt @@ -0,0 +1,117 @@ +class AByte(var value: Byte) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: Byte) { + value = newValue + } +} + +class AShort(var value: Short) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: Short) { + value = newValue + } +} + +class AInt(var value: Int) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: Int) { + value = newValue + } +} + +class ALong(var value: Long) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: Long) { + value = newValue + } +} + +class AFloat(var value: Float) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: Float) { + value = newValue + } +} + +class ADouble(var value: Double) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: Double) { + value = newValue + } +} + +fun box(): String { + val aByte = AByte(1) + var bByte: Byte = 1 + + val aShort = AShort(1) + var bShort: Short = 1 + + val aInt = AInt(1) + var bInt: Int = 1 + + val aLong = ALong(1) + var bLong: Long = 1 + + val aFloat = AFloat(1.0f) + var bFloat: Float = 1.0f + + val aDouble = ADouble(1.0) + var bDouble: Double = 1.0 + + aByte[0]++ + bByte++ + if (aByte[0] != bByte) return "Failed post-increment Byte: ${aByte[0]} != $bByte" + + aByte[0]-- + bByte-- + if (aByte[0] != bByte) return "Failed post-decrement Byte: ${aByte[0]} != $bByte" + + aShort[0]++ + bShort++ + if (aShort[0] != bShort) return "Failed post-increment Short: ${aShort[0]} != $bShort" + + aShort[0]-- + bShort-- + if (aShort[0] != bShort) return "Failed post-decrement Short: ${aShort[0]} != $bShort" + + aInt[0]++ + bInt++ + if (aInt[0] != bInt) return "Failed post-increment Int: ${aInt[0]} != $bInt" + + aInt[0]-- + bInt-- + if (aInt[0] != bInt) return "Failed post-decrement Int: ${aInt[0]} != $bInt" + + aLong[0]++ + bLong++ + if (aLong[0] != bLong) return "Failed post-increment Long: ${aLong[0]} != $bLong" + + aLong[0]-- + bLong-- + if (aLong[0] != bLong) return "Failed post-decrement Long: ${aLong[0]} != $bLong" + + aFloat[0]++ + bFloat++ + if (aFloat[0] != bFloat) return "Failed post-increment Float: ${aFloat[0]} != $bFloat" + + aFloat[0]-- + bFloat-- + if (aFloat[0] != bFloat) return "Failed post-decrement Float: ${aFloat[0]} != $bFloat" + + aDouble[0]++ + bDouble++ + if (aDouble[0] != bDouble) return "Failed post-increment Double: ${aDouble[0]} != $bDouble" + + aDouble[0]-- + bDouble-- + if (aDouble[0] != bDouble) return "Failed post-decrement Double: ${aDouble[0]} != $bDouble" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/extOnLong.kt b/backend.native/tests/external/codegen/blackbox/increment/extOnLong.kt new file mode 100644 index 00000000000..9dce4e9da95 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/extOnLong.kt @@ -0,0 +1,8 @@ +operator fun Long.get(i: Int) = this +operator fun Long.set(i: Int, newValue: Long) {} + +fun box(): String { + var x = 0L + val y = x[0]++ + return if (y == 0L) "OK" else "Failed, y=$y" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/genericClassWithGetSet.kt b/backend.native/tests/external/codegen/blackbox/increment/genericClassWithGetSet.kt new file mode 100644 index 00000000000..04825a34f6c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/genericClassWithGetSet.kt @@ -0,0 +1,77 @@ +class A(var value: T) { + operator fun get(i: Int) = value + + operator fun set(i: Int, newValue: T) { + value = newValue + } +} + +fun box(): String { + val aByte = A(1) + var bByte: Byte = 1 + + val aShort = A(1) + var bShort: Short = 1 + + val aInt = A(1) + var bInt: Int = 1 + + val aLong = A(1) + var bLong: Long = 1 + + val aFloat = A(1.0f) + var bFloat: Float = 1.0f + + val aDouble = A(1.0) + var bDouble: Double = 1.0 + + aByte[0]++ + bByte++ + if (aByte[0] != bByte) return "Failed post-increment Byte: ${aByte[0]} != $bByte" + + aByte[0]-- + bByte-- + if (aByte[0] != bByte) return "Failed post-decrement Byte: ${aByte[0]} != $bByte" + + aShort[0]++ + bShort++ + if (aShort[0] != bShort) return "Failed post-increment Short: ${aShort[0]} != $bShort" + + aShort[0]-- + bShort-- + if (aShort[0] != bShort) return "Failed post-decrement Short: ${aShort[0]} != $bShort" + + aInt[0]++ + bInt++ + if (aInt[0] != bInt) return "Failed post-increment Int: ${aInt[0]} != $bInt" + + aInt[0]-- + bInt-- + if (aInt[0] != bInt) return "Failed post-decrement Int: ${aInt[0]} != $bInt" + + aLong[0]++ + bLong++ + if (aLong[0] != bLong) return "Failed post-increment Long: ${aLong[0]} != $bLong" + + aLong[0]-- + bLong-- + if (aLong[0] != bLong) return "Failed post-decrement Long: ${aLong[0]} != $bLong" + + aFloat[0]++ + bFloat++ + if (aFloat[0] != bFloat) return "Failed post-increment Float: ${aFloat[0]} != $bFloat" + + aFloat[0]-- + bFloat-- + if (aFloat[0] != bFloat) return "Failed post-decrement Float: ${aFloat[0]} != $bFloat" + + aDouble[0]++ + bDouble++ + if (aDouble[0] != bDouble) return "Failed post-increment Double: ${aDouble[0]} != $bDouble" + + aDouble[0]-- + bDouble-- + if (aDouble[0] != bDouble) return "Failed post-decrement Double: ${aDouble[0]} != $bDouble" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/memberExtOnLong.kt b/backend.native/tests/external/codegen/blackbox/increment/memberExtOnLong.kt new file mode 100644 index 00000000000..c51bf9b901d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/memberExtOnLong.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +object ExtProvider { + operator fun Long.get(i: Int) = this + operator fun Long.set(i: Int, newValue: Long) {} +} + +fun box(): String { + with (ExtProvider) { + var x = 0L + val y = x[0]++ + return if (y == 0L) "OK" else "Failed, y=$y" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/mutableListElement.kt b/backend.native/tests/external/codegen/blackbox/increment/mutableListElement.kt new file mode 100644 index 00000000000..b861d31e15d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/mutableListElement.kt @@ -0,0 +1,83 @@ +// WITH_RUNTIME + +fun box(): String { + val aByte = arrayListOf(1) + var bByte: Byte = 1 + + val aShort = arrayListOf(1) + var bShort: Short = 1 + + val aInt = arrayListOf(1) + var bInt: Int = 1 + + val aLong = arrayListOf(1) + var bLong: Long = 1 + + val aFloat = arrayListOf(1.0f) + var bFloat: Float = 1.0f + + val aDouble = arrayListOf(1.0) + var bDouble: Double = 1.0 + + aByte[0]-- + bByte-- + + if (aByte[0] != bByte) return "Failed post-decrement Byte: ${aByte[0]} != $bByte" + + aByte[0]++ + bByte++ + + if (aByte[0] != bByte) return "Failed post-increment Byte: ${aByte[0]} != $bByte" + + aShort[0]-- + bShort-- + + if (aShort[0] != bShort) return "Failed post-decrement Short: ${aShort[0]} != $bShort" + + aShort[0]++ + bShort++ + + if (aShort[0] != bShort) return "Failed post-increment Short: ${aShort[0]} != $bShort" + + aInt[0]-- + bInt-- + + if (aInt[0] != bInt) return "Failed post-decrement Int: ${aInt[0]} != $bInt" + + aInt[0]++ + bInt++ + + if (aInt[0] != bInt) return "Failed post-increment Int: ${aInt[0]} != $bInt" + + aLong[0]-- + bLong-- + + if (aLong[0] != bLong) return "Failed post-decrement Long: ${aLong[0]} != $bLong" + + aLong[0]++ + bLong++ + + if (aLong[0] != bLong) return "Failed post-increment Long: ${aLong[0]} != $bLong" + + aFloat[0]-- + bFloat-- + + if (aFloat[0] != bFloat) return "Failed post-decrement Float: ${aFloat[0]} != $bFloat" + + aFloat[0]++ + bFloat++ + + if (aFloat[0] != bFloat) return "Failed post-increment Float: ${aFloat[0]} != $bFloat" + + aDouble[0]-- + bDouble-- + + if (aDouble[0] != bDouble) return "Failed post-decrement Double: ${aDouble[0]} != $bDouble" + + aDouble[0]++ + bDouble++ + + if (aDouble[0] != bDouble) return "Failed post-increment Double: ${aDouble[0]} != $bDouble" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/nullable.kt b/backend.native/tests/external/codegen/blackbox/increment/nullable.kt new file mode 100644 index 00000000000..4802b8a7fbc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/nullable.kt @@ -0,0 +1,69 @@ +fun box(): String { + var aByte: Byte? = 0 + var bByte: Byte = 0 + + var aShort: Short? = 0 + var bShort: Short = 0 + + var aInt: Int? = 0 + var bInt: Int = 0 + + var aLong: Long? = 0 + var bLong: Long = 0 + + var aFloat: Float? = 0.0f + var bFloat: Float = 0.0f + + var aDouble: Double? = 0.0 + var bDouble: Double = 0.0 + + if (aByte != null) aByte-- + bByte-- + if (aByte != bByte) return "Failed post-decrement Byte: $aByte != $bByte" + + if (aByte != null) aByte++ + bByte++ + if (aByte != bByte) return "Failed post-increment Byte: $aByte != $bByte" + + if (aShort != null) aShort-- + bShort-- + if (aShort != bShort) return "Failed post-decrement Short: $aShort != $bShort" + + if (aShort != null) aShort++ + bShort++ + if (aShort != bShort) return "Failed post-increment Short: $aShort != $bShort" + + if (aInt != null) aInt-- + bInt-- + if (aInt != bInt) return "Failed post-decrement Int: $aInt != $bInt" + + if (aInt != null) aInt++ + bInt++ + if (aInt != bInt) return "Failed post-increment Int: $aInt != $bInt" + + if (aLong != null) aLong-- + bLong-- + if (aLong != bLong) return "Failed post-decrement Long: $aLong != $bLong" + + if (aLong != null) aLong++ + bLong++ + if (aLong != bLong) return "Failed post-increment Long: $aLong != $bLong" + + if (aFloat != null) aFloat-- + bFloat-- + if (aFloat != bFloat) return "Failed post-decrement Float: $aFloat != $bFloat" + + if (aFloat != null) aFloat++ + bFloat++ + if (aFloat != bFloat) return "Failed post-increment Float: $aFloat != $bFloat" + + if (aDouble != null) aDouble-- + bDouble-- + if (aDouble != bDouble) return "Failed post-decrement Double: $aDouble != $bDouble" + + if (aDouble != null) aDouble++ + bDouble++ + if (aDouble != bDouble) return "Failed post-increment Double: $aDouble != $bDouble" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementDoubleSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementDoubleSmartCast.kt new file mode 100644 index 00000000000..738a31c9697 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementDoubleSmartCast.kt @@ -0,0 +1,10 @@ +public fun box() : String { + var i : Int? + i = 10 + // We have "double" smart cast here: + // first on i and second on i++ + // Back-end should NOT think that both i and j are Int + val j: Int = i++ + + return if (j == 10 && 11 == i) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClass.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClass.kt new file mode 100644 index 00000000000..deb8df65d80 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClass.kt @@ -0,0 +1,12 @@ +interface Base +class Derived: Base +class Another: Base +operator fun Base.inc(): Derived { return Derived() } + +public fun box() : String { + var i : Base + i = Another() + val j = i++ + + return if (j is Another && i is Derived) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClassSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClassSmartCast.kt new file mode 100644 index 00000000000..3bc2442a3be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnClassSmartCast.kt @@ -0,0 +1,11 @@ +open class Base +class Derived: Base() +operator fun Derived.inc(): Derived { return Derived() } + +public fun box() : String { + var i : Base + i = Derived() + val j = i++ + + return if (j is Derived && i is Derived) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnShortSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnShortSmartCast.kt new file mode 100644 index 00000000000..0dec61d0503 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnShortSmartCast.kt @@ -0,0 +1,8 @@ +public fun box() : String { + var i : Short? + i = 10 + // Postfix increment on a smart casted short should work + val j = i++ + + return if (j!!.toInt() == 10 && i!!.toInt() == 11) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnSmartCast.kt new file mode 100644 index 00000000000..3da28a2d6e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixIncrementOnSmartCast.kt @@ -0,0 +1,9 @@ +public fun box() : String { + var i : Int? + i = 10 + // Postfix increment on a smart cast should work + // Specific: i.inc() type is Int but i and j types are both Int? + val j = i++ + + return if (j == 10 && 11 == i) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixNullableClassIncrement.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixNullableClassIncrement.kt new file mode 100644 index 00000000000..b6d22b07a1b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixNullableClassIncrement.kt @@ -0,0 +1,11 @@ +class MyClass + +operator fun MyClass?.inc(): MyClass? = null + +public fun box() : String { + var i : MyClass? + i = MyClass() + val j = i++ + + return if (j is MyClass && null == i) "OK" else "fail i = $i j = $j" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/postfixNullableIncrement.kt b/backend.native/tests/external/codegen/blackbox/increment/postfixNullableIncrement.kt new file mode 100644 index 00000000000..2564e3ed898 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/postfixNullableIncrement.kt @@ -0,0 +1,10 @@ +operator fun Int?.inc(): Int? = this + +fun init(): Int? { return 10 } + +public fun box() : String { + var i : Int? = init() + val j = i++ + + return if (j == 10 && 10 == i) "OK" else "fail i = $i j = $j" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClass.kt b/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClass.kt new file mode 100644 index 00000000000..6bc75ad060e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClass.kt @@ -0,0 +1,12 @@ +interface Base +class Derived: Base +class Another: Base +operator fun Base.inc(): Derived { return Derived() } + +public fun box() : String { + var i : Base + i = Another() + val j = ++i + + return if (j is Derived && i is Derived) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClassSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClassSmartCast.kt new file mode 100644 index 00000000000..c51f6d1d816 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnClassSmartCast.kt @@ -0,0 +1,11 @@ +open class Base +class Derived: Base() +operator fun Derived.inc(): Derived { return Derived() } + +public fun box() : String { + var i : Base + i = Derived() + val j = ++i + + return if (j is Derived && i is Derived) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnSmartCast.kt b/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnSmartCast.kt new file mode 100644 index 00000000000..80e48f4f78b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/prefixIncrementOnSmartCast.kt @@ -0,0 +1,8 @@ +public fun box() : String { + var i : Int? + i = 10 + // Prefix increment on a smart cast should work + val j = ++i + + return if (j == 11 && 11 == i) "OK" else "fail j = $j i = $i" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/prefixNullableClassIncrement.kt b/backend.native/tests/external/codegen/blackbox/increment/prefixNullableClassIncrement.kt new file mode 100644 index 00000000000..e8c98d7bce6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/prefixNullableClassIncrement.kt @@ -0,0 +1,11 @@ +class MyClass + +operator fun MyClass?.inc(): MyClass? = null + +public fun box() : String { + var i : MyClass? + i = MyClass() + val j = ++i + + return if (j == null && null == i) "OK" else "fail i = $i j = $j" +} diff --git a/backend.native/tests/external/codegen/blackbox/increment/prefixNullableIncrement.kt b/backend.native/tests/external/codegen/blackbox/increment/prefixNullableIncrement.kt new file mode 100644 index 00000000000..2c28b62ff11 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/prefixNullableIncrement.kt @@ -0,0 +1,10 @@ +operator fun Int?.inc(): Int? = this + +fun init(): Int? { return 10 } + +public fun box() : String { + var i : Int? = init() + val j = ++i + + return if (j == 10 && 10 == i) "OK" else "fail i = $i j = $j" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/createNestedClass.kt b/backend.native/tests/external/codegen/blackbox/innerNested/createNestedClass.kt new file mode 100644 index 00000000000..b5cd0e787ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/createNestedClass.kt @@ -0,0 +1,13 @@ +class A { + class B1 + class B2(val x: Int) + class B3(val x: Long, val y: Int) + class B4(val str: String) +} + + +fun box(): String { + A.B1() + val b2 = A.B2(A.B3(42, 42).y) + return A.B4("OK").str +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/createdNestedInOuterMember.kt b/backend.native/tests/external/codegen/blackbox/innerNested/createdNestedInOuterMember.kt new file mode 100644 index 00000000000..f4c0640c7ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/createdNestedInOuterMember.kt @@ -0,0 +1,14 @@ +fun foo(f: (Int) -> Int) = f(0) + +class Outer { + class Nested { + val y = foo { a -> a } + } + + fun bar(): String { + val a = Nested() + return "OK" + } +} + +fun box() = Outer().bar() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/extensionFun.kt b/backend.native/tests/external/codegen/blackbox/innerNested/extensionFun.kt new file mode 100644 index 00000000000..44ed11116dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/extensionFun.kt @@ -0,0 +1,31 @@ +class Outer { + class Nested + inner class Inner + + fun Inner.foo() { + Outer() + Nested() + Inner() + } + + fun Nested.bar() { + Outer() + Nested() + Inner() + } + + fun Outer.baz() { + Outer() + Nested() + Inner() + } + + fun box(): String { + Inner().foo() + Nested().bar() + baz() + return "OK" + } +} + +fun box() = Outer().box() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/extensionToNested.kt b/backend.native/tests/external/codegen/blackbox/innerNested/extensionToNested.kt new file mode 100644 index 00000000000..553ff99ae00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/extensionToNested.kt @@ -0,0 +1,9 @@ +class Test { + class Nested { + val value = "OK" + } +} + +fun Test.Nested.foo() = value + +fun box() = Test.Nested().foo() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/importNestedClass.kt b/backend.native/tests/external/codegen/blackbox/innerNested/importNestedClass.kt new file mode 100644 index 00000000000..8bb9fdc5376 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/importNestedClass.kt @@ -0,0 +1,18 @@ +import A.B +import A.B.C + +class A { + class B { + class C + } +} + +fun box(): String { + val a = A() + val b = B() + val ab = A.B() + val c = C() + val bc = B.C() + val abc = A.B.C() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/innerGeneric.kt b/backend.native/tests/external/codegen/blackbox/innerNested/innerGeneric.kt new file mode 100644 index 00000000000..36a6bda1e99 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/innerGeneric.kt @@ -0,0 +1,11 @@ +class Outer { + inner class Inner(val t: T) { + fun box() = t + } +} + +fun box(): String { + if (Outer().Inner("OK").box() != "OK") return "Fail" + val x: Outer.Inner = Outer().Inner("OK") + return x.box() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/innerGenericClassFromJava.kt b/backend.native/tests/external/codegen/blackbox/innerNested/innerGenericClassFromJava.kt new file mode 100644 index 00000000000..3490ee65894 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/innerGenericClassFromJava.kt @@ -0,0 +1,26 @@ +// TARGET_BACKEND: JVM +// FILE: JavaClass.java + +public abstract class JavaClass { + public static String test() { + return Test.INSTANCE.foo(new Outer("OK").new Inner(1)); + } +} + +// FILE: Kotlin.kt + +class Outer(val x: E) { + inner class Inner(val y: F) { + fun foo() = x.toString() + y.toString() + } +} + +object Test { + fun foo(x: Outer.Inner) = x.foo() +} + +fun box(): String { + val result = JavaClass.test() + if (result != "OK1") return "Fail: $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/innerJavaClass.kt b/backend.native/tests/external/codegen/blackbox/innerNested/innerJavaClass.kt new file mode 100644 index 00000000000..da291521d05 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/innerJavaClass.kt @@ -0,0 +1,22 @@ +// TARGET_BACKEND: JVM +// FILE: JavaClass.java + +public abstract class JavaClass { + public abstract InnerClass onCreateInner(); + + public class InnerClass { + + } +} + +// FILE: Kotlin.kt + +public class MyWallpaperService : JavaClass() { + override fun onCreateInner(): JavaClass.InnerClass = MyEngine() + + private inner class MyEngine : JavaClass.InnerClass() +} + +fun box(): String { + return if (MyWallpaperService().onCreateInner() != null) return "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/innerLabeledThis.kt b/backend.native/tests/external/codegen/blackbox/innerNested/innerLabeledThis.kt new file mode 100644 index 00000000000..34a50d00af6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/innerLabeledThis.kt @@ -0,0 +1,11 @@ +class Outer { + inner class Inner { + fun O() = this@Outer.O + val K = this@Outer.K() + } + + val O = "O" + fun K() = "K" +} + +fun box() = Outer().Inner().O() + Outer().Inner().K diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/innerSimple.kt b/backend.native/tests/external/codegen/blackbox/innerNested/innerSimple.kt new file mode 100644 index 00000000000..9159e24d84c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/innerSimple.kt @@ -0,0 +1,7 @@ +class Outer { + inner class Inner { + fun box() = "OK" + } +} + +fun box() = Outer().Inner().box() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/kt3132.kt b/backend.native/tests/external/codegen/blackbox/innerNested/kt3132.kt new file mode 100644 index 00000000000..afcee1c6ca1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/kt3132.kt @@ -0,0 +1,13 @@ +class Test { + interface Foo { } + + class FooImplNested: Foo { } + + inner class FooImplInner: Foo { } +} + +fun box(): String { + Test().FooImplInner() + Test.FooImplNested() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/kt3927.kt b/backend.native/tests/external/codegen/blackbox/innerNested/kt3927.kt new file mode 100644 index 00000000000..1e1efce9624 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/kt3927.kt @@ -0,0 +1,23 @@ +//KT-3927 Inner class cannot be instantiated with child instance of outer class + +abstract class Base { + inner class Inner { + fun o() = "O" + fun k() = "K" + } +} + +class Child : Base() + +fun box(): String { + var result = "" + result += Child().Inner().o() + + fun Child.f() { + result += Inner().k() + } + Child().f() + + return result +} + diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/kt5363.kt b/backend.native/tests/external/codegen/blackbox/innerNested/kt5363.kt new file mode 100644 index 00000000000..1f696893d3d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/kt5363.kt @@ -0,0 +1,13 @@ +class Outer { + class Nested{ + fun foo(s: String) = s.extension() + } + + companion object { + private fun String.extension(): String = this + } +} + +fun box(): String { + return Outer.Nested().foo("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/kt6804.kt b/backend.native/tests/external/codegen/blackbox/innerNested/kt6804.kt new file mode 100644 index 00000000000..edb201a622e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/kt6804.kt @@ -0,0 +1,13 @@ +class Outer { + class Nested { + fun fn() = s + } + + companion object { + private val s = "OK" + } +} + +fun box(): String { + return Outer.Nested().fn() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedClassInObject.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedClassInObject.kt new file mode 100644 index 00000000000..ec3f72d4b20 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedClassInObject.kt @@ -0,0 +1,10 @@ +object A { + class B + class C +} + +fun box(): String { + val b = A.B() + val c = A.C() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedClassObject.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedClassObject.kt new file mode 100644 index 00000000000..8e470a4e58e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedClassObject.kt @@ -0,0 +1,12 @@ +class Outer { + class Nested { + companion object { + val O = "O" + val K = "K" + } + } + + fun O() = Nested.O +} + +fun box() = Outer().O() + Outer.Nested.K diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedEnumConstant.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedEnumConstant.kt new file mode 100644 index 00000000000..d8ae583f3d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedEnumConstant.kt @@ -0,0 +1,8 @@ +class Outer { + enum class Nested { + O, + K + } +} + +fun box() = "${Outer.Nested.O}${Outer.Nested.K}" diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedGeneric.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedGeneric.kt new file mode 100644 index 00000000000..9cdea6814f5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedGeneric.kt @@ -0,0 +1,12 @@ +class Outer { + class Nested(val t: T) { + fun box() = t + } +} + +fun box(): String { + if (Outer.Nested("OK").box() != "OK") return "Fail" + + val x: Outer.Nested = Outer.Nested("OK") + return x.box() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedInPackage.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedInPackage.kt new file mode 100644 index 00000000000..a08a2098110 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedInPackage.kt @@ -0,0 +1,10 @@ +package Package + +class Outer { + class Nested { + val O = "O" + val K = "K" + } +} + +fun box() = Package.Outer.Nested().O + Outer.Nested().K diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedObjects.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedObjects.kt new file mode 100644 index 00000000000..185af172991 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedObjects.kt @@ -0,0 +1,9 @@ +object A { + object B { + object C { + val ok = "OK" + } + } +} + +fun box() = A.B.C.ok diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/nestedSimple.kt b/backend.native/tests/external/codegen/blackbox/innerNested/nestedSimple.kt new file mode 100644 index 00000000000..a9180148616 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/nestedSimple.kt @@ -0,0 +1,7 @@ +class Outer { + class Nested { + fun box() = "OK" + } +} + +fun box() = Outer.Nested().box() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClass.kt b/backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClass.kt new file mode 100644 index 00000000000..7de7c5cf0a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClass.kt @@ -0,0 +1,25 @@ +// See KT-9246 IllegalAccessError when trying to access protected nested class from parent class +// FILE: a.kt + +package a + +abstract class A { + protected class C { + fun result() = "OK" + } +} + +// FILE: b.kt + +package b + +import a.A + +class B : A() { + protected val c = A.C() + val result: String get() = c.result() +} + +fun box(): String { + return B().result +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClassFromJava.kt b/backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClassFromJava.kt new file mode 100644 index 00000000000..1dbc087f9c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/protectedNestedClassFromJava.kt @@ -0,0 +1,34 @@ +// See KT-8269 java.lang.IllegalAccessError on accessing protected inner class declared in Kotlin super class +// TARGET_BACKEND: JVM +// FILE: Test.kt + +package com.company + +import other.JavaClass + +open class Test { + protected class ProtectedClass +} + +fun box(): String { + JavaClass.test() + return "OK" +} + +// FILE: other/JavaClass.java + +package other; + +import com.company.Test; + +public class JavaClass { + static class JavaTest extends Test { + public static boolean foo(Object obj) { + return obj instanceof ProtectedClass; + } + } + + public static void test() { + JavaTest.foo(new Object()); + } +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepInnerHierarchy.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepInnerHierarchy.kt new file mode 100644 index 00000000000..08efa14a7ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepInnerHierarchy.kt @@ -0,0 +1,13 @@ +open class A(val s: String) { + open inner class B(s: String): A(s) + + open inner class C(s: String, additional: Double): B(s) + + open inner class D(other: Int, another: Long, s: String) : C(s, another.toDouble()) + + open inner class E : D(0, 42L, "OK") + + inner class F : E() +} + +fun box(): String = A("Fail").F().s diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepLocalHierarchy.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepLocalHierarchy.kt new file mode 100644 index 00000000000..760f7b0deae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/deepLocalHierarchy.kt @@ -0,0 +1,17 @@ +fun box(): String { + abstract class L1 { + abstract fun foo(): String + } + + open class L2(val s: String) : L1() { + override fun foo() = s + } + + open class L3(unused: Double, value: String = "OK") : L2(value) + + open class L4(i: Int, j: Long, z: Boolean, l: L3) : L3(3.14) + + class L5 : L4(0, 0L, false, L3(2.71, "Fail")) + + return L5().foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt new file mode 100644 index 00000000000..c218f292c1f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt @@ -0,0 +1,17 @@ +open class Father(val param: String) { + abstract inner class InClass { + fun work(): String { + return param + } + } + + inner class Child(p: String) : Father(p) { + inner class Child2 : Father.InClass { + constructor(): super() + } + } +} + +fun box(): String { + return Father("fail").Child("OK").Child2().work() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt new file mode 100644 index 00000000000..3dd19c2f3d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt @@ -0,0 +1,17 @@ +open class Father(val param: String) { + abstract inner class InClass { + fun work(): String { + return param + } + } + + inner class Child(p: String) : Father(p) { + inner class Child2 : Father.InClass() { + + } + } +} + +fun box(): String { + return Father("fail").Child("OK").Child2().work() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsOuter.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsOuter.kt new file mode 100644 index 00000000000..8db3bfa10ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/innerExtendsOuter.kt @@ -0,0 +1,15 @@ +// TARGET_BACKEND: JVM + +// When inner class extends its outer, there are two instances of the outer present in the inner: +// the enclosing one and the one in the super call. +// Here we test that symbols are resolved to the instance created via the super call. + +open class Outer(vararg val chars: Char) { + open inner class Inner(val s: String): Outer(s[0], s[1]) { + fun concat() = java.lang.String.valueOf(chars) + } + + fun value() = Inner("OK").concat() +} + +fun box() = Outer('F', 'a', 'i', 'l').value() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_1.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_1.kt new file mode 100644 index 00000000000..fe17fb4d085 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_1.kt @@ -0,0 +1,17 @@ +abstract class Father { + abstract inner class InClass { + abstract fun work(): String + } +} + +class Child : Father() { + val ChildInClass = object : Father.InClass() { + override fun work(): String { + return "OK" + } + } +} + +fun box(): String { + return Child().ChildInClass.work() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_2.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_2.kt new file mode 100644 index 00000000000..4753541d860 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/kt11833_2.kt @@ -0,0 +1,19 @@ +abstract class Father { + abstract inner class InClass { + abstract fun work(): String + } +} + +class Child : Father() { + fun test(): InClass { + return object : Father.InClass() { + override fun work(): String { + return "OK" + } + } + } +} + +fun box(): String { + return Child().test().work() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt new file mode 100644 index 00000000000..cf1db10e27c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt @@ -0,0 +1,17 @@ +class A { + fun bar(): Any { + return { + { + class Local : Inner() { + override fun toString() = foo() + } + Local() + }() + }() + } + + open inner class Inner + fun foo() = "OK" +} + +fun box(): String = A().bar().toString() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsInner.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsInner.kt new file mode 100644 index 00000000000..bd2fe48d847 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsInner.kt @@ -0,0 +1,21 @@ +open class Father(val param: String) { + abstract inner class InClass { + fun work(): String { + return param + } + } + + inner class Child(p: String) : Father(p) { + fun test(): InClass { + class Local : Father.InClass() { + + } + return Local() + } + + } +} + +fun box(): String { + return Father("fail").Child("OK").test().work() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt new file mode 100644 index 00000000000..f24ed933d5c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt @@ -0,0 +1,11 @@ +fun box(): String { + val result = "OK" + + open class Local(val ok: Boolean) { + fun result() = if (ok) result else "Fail" + } + + class Derived : Local(true) + + return Derived().result() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt new file mode 100644 index 00000000000..b2bb6dbd67a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt @@ -0,0 +1,16 @@ +fun box(): String { + val three = 3 + + open class Local(val one: Int) { + open fun value() = "$three$one" + } + + val four = 4 + + class Derived(val two: Int) : Local(1) { + override fun value() = super.value() + "$four$two" + } + + val result = Derived(2).value() + return if (result == "3142") "OK" else "Fail: $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt new file mode 100644 index 00000000000..298b0ec9162 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt @@ -0,0 +1,9 @@ +// KT-3581 + +open class A(val result: String = "OK") { +} + +fun box(): String { + val a = object : A() {} + return a.result +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassVararg.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassVararg.kt new file mode 100644 index 00000000000..b0bb4aed5d1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassVararg.kt @@ -0,0 +1,8 @@ +open class SomeClass(val some: Double, val other: Int, vararg val args: String) { + fun result() = args[1] +} + +fun box(): String { + return object : SomeClass(3.14, 42, "No", "OK", "Yes") { + }.result() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInner.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInner.kt new file mode 100644 index 00000000000..f02f1d4edc1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInner.kt @@ -0,0 +1,12 @@ +class A { + open inner class Inner(val result: String) + + fun box(): String { + val o = object : Inner("OK") { + fun ok() = result + } + return o.ok() + } +} + +fun box() = A().box() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt new file mode 100644 index 00000000000..c94d6ab49ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt @@ -0,0 +1,12 @@ +class A { + open inner class Inner(val result: String = "OK", val int: Int) + + fun box(): String { + val o = object : Inner(int = 0) { + fun ok() = result + } + return o.ok() + } +} + +fun box() = A().box() diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt new file mode 100644 index 00000000000..eef3131ae2b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt @@ -0,0 +1,17 @@ +fun box(): String { + val capture = "oh" + + class Local { + val captured = capture + + open inner class Inner(val d: Double = -1.0, val s: String, vararg val y: Int) { + open fun result() = "Fail" + } + + val obj = object : Inner(s = "OK") { + override fun result() = s + } + } + + return Local().obj.result() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt new file mode 100644 index 00000000000..b4fb7a47cee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt @@ -0,0 +1,15 @@ +fun box(): String { + class Local { + open inner class Inner(val s: String) { + open fun result() = "Fail" + } + + val realResult = "OK" + + val obj = object : Inner(realResult) { + override fun result() = s + } + } + + return Local().obj.result() +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt new file mode 100644 index 00000000000..35bb545eb82 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt @@ -0,0 +1,11 @@ +open class A(val s: String) + +fun box(): String { + class B { + val result = "OK" + + val f = object : A(result) {}.s + } + + return B().f +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt new file mode 100644 index 00000000000..834b1e5d824 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt @@ -0,0 +1,14 @@ +fun box(): String { + val d = 42.0 + val c = 'C' + + open class Local(val l: Long) { + fun foo(): Boolean = d == 42.0 && c == 'C' && l == 239L + } + + if (object : Local(239L) { + fun bar(): Boolean = foo() + }.bar()) return "OK" + + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt new file mode 100644 index 00000000000..e6fe2b05cf9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt @@ -0,0 +1,16 @@ +class A { + fun bar(): Any { + return { + { + object : Inner() { + override fun toString() = foo() + } + }() + }() + } + + open inner class Inner + fun foo() = "OK" +} + +fun box(): String = A().bar().toString() diff --git a/backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarInt.kt b/backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarInt.kt new file mode 100644 index 00000000000..619bfd3a800 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarInt.kt @@ -0,0 +1,11 @@ +fun box(): String { + var a: Int + a = 12 + fun f() { + foo(a) + } + + return "OK" +} + +fun foo(l: Int) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarLong.kt b/backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarLong.kt new file mode 100644 index 00000000000..7340eb15d14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/instructions/swap/swapRefToSharedVarLong.kt @@ -0,0 +1,13 @@ +//KT-3042 Attempt to split long or double on the stack excepion + +fun box(): String { + var a: Long + a = 12.toLong() + fun f() { + foo(a) + } + + return "OK" +} + +fun foo(l: Long) {} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/charToInt.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/charToInt.kt new file mode 100644 index 00000000000..371632e071c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/charToInt.kt @@ -0,0 +1,8 @@ +fun box(): String { + val x: Any = 'A' + var y = 0 + if (x is Char) { + y = x.toInt() + } + return if (y == 65) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt new file mode 100644 index 00000000000..66c9787e1d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(java.lang.Integer.MIN_VALUE, Int.MIN_VALUE) + assertEquals(java.lang.Byte.MAX_VALUE, Byte.MAX_VALUE) + +/* +// TODO: uncomment when callable references to object members are supported + assertEquals("MIN_VALUE", (Int.Companion::MIN_VALUE).name) + assertEquals("MAX_VALUE", (Double.Companion::MAX_VALUE).name) + assertEquals("MIN_VALUE", (Float.Companion::MIN_VALUE).name) + assertEquals("MAX_VALUE", (Long.Companion::MAX_VALUE).name) + assertEquals("MIN_VALUE", (Short.Companion::MIN_VALUE).name) + assertEquals("MAX_VALUE", (Byte.Companion::MAX_VALUE).name) +*/ + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/ea35953.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/ea35953.kt new file mode 100644 index 00000000000..a1acb1d7481 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/ea35953.kt @@ -0,0 +1,6 @@ +fun box(): String { + if (12.toString().equals("13")) { + return "Fail" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/incWithLabel.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/incWithLabel.kt new file mode 100644 index 00000000000..fff72ffb135 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/incWithLabel.kt @@ -0,0 +1,8 @@ +fun box(): String { + var x = 1 + (foo@ x)++ + ++(foo@ x) + + if (x != 3) return "Fail: $x" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt new file mode 100644 index 00000000000..93723cd3ebe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt @@ -0,0 +1,7 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String = + listOf('O', 'K').fold("", String::plus) diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt new file mode 100644 index 00000000000..d6dab66f544 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt @@ -0,0 +1,7 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String = + charArrayOf('O', 'K').fold("", String::plus) diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125.kt new file mode 100644 index 00000000000..c45ffb3f57c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125.kt @@ -0,0 +1,17 @@ +fun test(i: Int): Int { + return i +} + +fun box(): String { + var b = Byte.MAX_VALUE + b++ + var result = test(b.toInt()) + if (result != Byte.MIN_VALUE.toInt()) return "fail 1: $result" + + var s = Short.MIN_VALUE + s-- + result = test(s.toInt()) + if (result != Short.MAX_VALUE.toInt()) return "fail 2: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_2.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_2.kt new file mode 100644 index 00000000000..c9890efe644 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_2.kt @@ -0,0 +1,16 @@ +fun box(): String { + var aByte: Byte? = 0 + var bByte: Byte = 0 + + if (aByte != null) aByte-- + bByte-- + if (aByte != bByte) return "Failed post-decrement Byte: $aByte != $bByte" + + if (aByte != null) aByte++ + bByte++ + if (aByte != bByte) return "Failed post-increment Byte: $aByte != $bByte" + + aByte = null + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc.kt new file mode 100644 index 00000000000..f531e713ef5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc.kt @@ -0,0 +1,15 @@ +fun test(i: Int): Int { + return i +} + +fun box(): String { + var b = Byte.MAX_VALUE + var result = test(b.inc().toInt()) + if (result != Byte.MIN_VALUE.toInt()) return "fail 1: $result" + + var s = Short.MAX_VALUE + result = test(s.inc().toInt()) + if (result != Short.MIN_VALUE.toInt()) return "fail 2: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc_2.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc_2.kt new file mode 100644 index 00000000000..953ccf8dc76 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt12125_inc_2.kt @@ -0,0 +1,20 @@ +fun test(i: Int): Int { + return i +} + +fun box(): String { + var aByte: Byte? = 0 + var bByte: Byte = 0 + + if (aByte != null) { + if (aByte.dec() != bByte.dec()) return "Failed post-decrement Byte: ${aByte.dec()} != ${bByte.dec()}" + } + + if (aByte != null) { + if (aByte.inc() != bByte.inc()) return "Failed post-increment Byte: ${aByte.inc()} != ${bByte.inc()}" + } + + aByte = null + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt new file mode 100644 index 00000000000..07d3a22902f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var result = "Fail" + +var l = 10L +var d = 10.0 +var i = 10 + +fun foo(): Int { + result = "OK" + return 1 +} + +fun box(): String { + val javaClass = foo().javaClass + if (javaClass != 1.javaClass) return "fail 1" + + val lv = 3L + if (2L.javaClass != lv.javaClass) return "fail 2" + if (2L.javaClass != l.javaClass) return "fail 3" + + val dv = 3.0 + if (2.0.javaClass != dv.javaClass) return "fail 4" + if (2.0.javaClass != d.javaClass) return "fail 5" + + val iv = 3 + if (2.javaClass != iv.javaClass) return "fail 6" + if (2.javaClass != i.javaClass) return "fail 7" + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/longRangeWithExplicitDot.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/longRangeWithExplicitDot.kt new file mode 100644 index 00000000000..1ecc929824d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/longRangeWithExplicitDot.kt @@ -0,0 +1,6 @@ +fun box(): String { + val l: Long = 1 + val l2: Long = 2 + val r = l.rangeTo(l2) + return if (r.start == l && r.endInclusive == l2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/prefixIncDec.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/prefixIncDec.kt new file mode 100644 index 00000000000..612c91f3fa7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/prefixIncDec.kt @@ -0,0 +1,29 @@ +public var inc: Int = 0; + +public var propInc: Int = 0 + get() {++inc; return field} + set(a: Int) { + ++inc + field = a + } + +public var dec: Int = 0; + +public var propDec: Int = 0; + get() { --dec; return field} + set(a: Int) { + --dec + field = a + } + +fun box(): String { + ++propInc + if (inc != 3) return "fail in prefix increment: ${inc} != 3" + if (propInc != 1) return "fail in prefix increment: ${propInc} != 1" + + --propDec + if (dec != -3) return "fail in prefix decrement: ${dec} != -3" + if (propDec != -1) return "fail in prefix decrement: ${propDec} != -1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/rangeFromCollection.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/rangeFromCollection.kt new file mode 100644 index 00000000000..93d22ce72d0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/rangeFromCollection.kt @@ -0,0 +1,6 @@ +fun box(): String { + val list = ArrayList() + list.add(1..3) + list[0].start + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/stringFromCollection.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/stringFromCollection.kt new file mode 100644 index 00000000000..bd15b7bf3f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/stringFromCollection.kt @@ -0,0 +1,7 @@ +fun box(): String { + val list = ArrayList() + list.add("0") + list[0][0] + list[0].length + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt new file mode 100644 index 00000000000..cda62bbc05f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val s: String? = "OK" + val t: Throwable? = Throwable("test", null) + + val z = Throwable(s, t) + if (z.message !== s) return "fail 1: ${z.message}" + if (z.cause !== t) return "fail 2: ${z.cause}" + + val z2 = Throwable(s) + if (z2.message !== s) return "fail 3: ${z2.message}" + if (z2.cause !== null) return "fail 4: ${z2.cause}" + + val z3 = Throwable(t) + if (z3.message != "java.lang.Throwable: test") return "fail 5: ${z3.message}" + if (z3.cause !== t) return "fail 6: ${z2.cause}" + + val z4 = Throwable() + if (z4.message !== null) return "fail 7: ${z4.message}" + if (z4.cause !== null) return "fail 8: ${z4.cause}" + + return z.message!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt new file mode 100644 index 00000000000..a16dd9ea5a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import kotlin.reflect.KFunction2 +import kotlin.reflect.KFunction1 +import kotlin.reflect.KFunction0 + +fun box(): String { + val s: String? = "OK" + val t: Throwable? = Throwable("test", null) + var thr1: KFunction2 = ::Throwable + val z = thr1(s, t) + if (z.message !== s) return "fail 1: ${z.message}" + if (z.cause !== t) return "fail 2: ${z.cause}" + + var thr2: KFunction1 = ::Throwable + + val z2 = thr2(s) + if (z2.message !== s) return "fail 3: ${z2.message}" + if (z2.cause !== null) return "fail 4: ${z2.cause}" + + var thr3: KFunction1 = ::Throwable + val z3 = thr3(t) + if (z3.message != "java.lang.Throwable: test") return "fail 5: ${z3.message}" + if (z3.cause !== t) return "fail 6: ${z2.cause}" + + var thr4: KFunction0 = ::Throwable + val z4 = thr4() + if (z4.message !== null) return "fail 7: ${z4.message}" + if (z4.cause !== null) return "fail 8: ${z4.cause}" + + return z.message!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt new file mode 100644 index 00000000000..04ce96e10ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +var res = "" + +fun getM(): String { + res += "M" + return "OK" +} + +fun getT(): Throwable { + res += "T" + return Throwable("test", null) +} + +fun box(): String { + val z = Throwable(cause = getT(), message = getM()) + if (res != "TM") return "Wrong argument calculation order: $res" + return z.message!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt new file mode 100644 index 00000000000..27f9f1a11a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + if (239.toByte().toString() != (239.toByte() as Byte?).toString()) return "byte failed" + if (239.toShort().toString() != (239.toShort() as Short?).toString()) return "short failed" + if (239.toInt().toString() != (239.toInt() as Int?).toString()) return "int failed" + if (239.toFloat().toString() != (239.toFloat() as Float?).toString()) return "float failed" + if (239.toLong().toString() != (239.toLong() as Long?).toString()) return "long failed" + if (239.toDouble().toString() != (239.toDouble() as Double?).toString()) return "double failed" + if (true.toString() != (true as Boolean?).toString()) return "boolean failed" + if ('a'.toChar().toString() != ('a'.toChar() as Char?).toString()) return "char failed" + + if ("${239.toByte()}" != (239.toByte() as Byte?).toString()) return "byte template failed" + if ("${239.toShort()}" != (239.toShort() as Short?).toString()) return "short template failed" + if ("${239.toInt()}" != (239.toInt() as Int?).toString()) return "int template failed" + if ("${239.toFloat()}" != (239.toFloat() as Float?).toString()) return "float template failed" + if ("${239.toLong()}" != (239.toLong() as Long?).toString()) return "long template failed" + if ("${239.toDouble()}" != (239.toDouble() as Double?).toString()) return "double template failed" + if ("${true}" != (true as Boolean?).toString()) return "boolean template failed" + if ("${'a'.toChar()}" != ('a'.toChar() as Char?).toString()) return "char template failed" + + for(b in 0..255) { + if("${b.toByte()}" != (b.toByte() as Byte?).toString()) return "byte conversion failed" + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt new file mode 100644 index 00000000000..94a095f4ca6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt @@ -0,0 +1,51 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: JavaClass.java + +public class JavaClass { + + public static class C extends B { + public OutPair foo() { + return super.foo(); + } + + public In bar() { + return super.bar(); + } + } + + public static String test() { + A a = new C(); + + if (!a.foo().getX().equals("OK")) return "fail 1"; + if (!a.foo().getY().equals(123)) return "fail 2"; + + if (!a.bar().make("123").equals("123")) return "fail 3"; + + return "OK"; + } +} + +// FILE: main.kt + +class OutPair(val x: X, val y: Y) +class In { + fun make(x: Z): String = x.toString() +} + +@JvmSuppressWildcards(suppress = false) +interface A { + fun foo(): OutPair + fun bar(): In +} + +abstract class B : A { + override fun foo(): OutPair = OutPair("OK", 123) + override fun bar(): In = In() +} + +fun box(): String { + return JavaClass.test(); +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt new file mode 100644 index 00000000000..649b6570102 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: JavaClass.java + +public class JavaClass { + + public static class C extends B { + public OutPair foo() { + return super.foo(); + } + + public In bar() { + return super.bar(); + } + } + + public static String test() { + A a = new C(); + + if (!a.foo().getX().equals("OK")) return "fail 1"; + if (!a.foo().getY().equals(123)) return "fail 2"; + + if (!a.bar().make("123").equals("123")) return "fail 3"; + + return "OK"; + } +} + +// FILE: main.kt + +class OutPair(val x: X, val y: Y) +class In { + fun make(x: Z): String = x.toString() +} + +interface A { + fun foo(): OutPair<@JvmWildcard CharSequence, @JvmSuppressWildcards(false) Number> + fun bar(): In<@JvmWildcard String> +} + +abstract class B : A { + override fun foo(): OutPair = OutPair("OK", 123) + override fun bar(): In = In() +} + +fun box(): String { + return JavaClass.test(); +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt new file mode 100644 index 00000000000..e0afa4a629c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + public static String test() { + return MainKt.bar(MainKt.foo()); + } +} + +// FILE: main.kt + +class Pair(val x: X, val y: Y) + +class Inv(val x: T) + +fun foo(): Inv> = Inv(Pair("O", "K")) + +fun bar(inv: Inv>) = inv.x.x.toString() + inv.x.y + +fun box(): String { + return JavaClass.test(); +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt new file mode 100644 index 00000000000..4b1bab613c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: J.java + +import kotlin.Function; +import kotlin.jvm.functions.Function0; +import kotlin.jvm.functions.Function1; +import kotlin.jvm.functions.Function2; + +public class J { + public static String test(Function x) { + if (x instanceof Function1) return "Fail 1"; + if (x instanceof Function2) return "Fail 2"; + if (!(x instanceof Function0)) return "Fail 3"; + + return ((Function0) x).invoke(); + } +} + +// FILE: K.kt + +fun box(): String { + return J.test({ "OK" }) +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt new file mode 100644 index 00000000000..070e7d9859c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Test.java + +public class Test { + public static String invokeFoo() { + try { + ExtensionKt.foo(null); + } + catch (IllegalArgumentException e) { + try { + ExtensionKt.getBar(null); + } + catch (IllegalArgumentException f) { + return "OK"; + } + } + + return "Fail: assertion must have been fired"; + } +} + +// FILE: extension.kt + +fun Any.foo() { } + +val Any.bar: String get() = "" + +fun box(): String { + return Test.invokeFoo() +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/mapPut.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/mapPut.kt new file mode 100644 index 00000000000..c39287e7d2b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/mapPut.kt @@ -0,0 +1,10 @@ + +fun foo(k: K, v: V) { + val map = HashMap() + val old = map.put(k, v) +} + +fun box(): String { + foo("", "") + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt new file mode 100644 index 00000000000..4291d2aadc7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +data class A(var x: Int) : Cloneable { + public override fun clone(): A = A(x) +} + +fun box(): String { + val a = A(42) + val b = a.clone() + if (b != a) return "Fail equals" + if (b === a) return "Fail identity" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt new file mode 100644 index 00000000000..f55312285c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +data class A(var x: Int) : Cloneable { + public override fun clone(): A = super.clone() as A +} + +fun box(): String { + val a = A(42) + val b = a.clone() + if (a != b) return "Fail equals" + if (a === b) return "Fail identity" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt new file mode 100644 index 00000000000..da7a8ffbfbf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +data class A(var x: Int) : Cloneable { + public override fun clone(): A { + val result = super.clone() as A + result.x = 239 + return result + } +} + +fun box(): String { + val a = A(42) + val b = a.clone() + if (a == b) return "Fail: $a == $b" + if (a === b) return "Fail: $a === $b" + if (b.x != 239) return "Fail: b.x = ${b.x}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHashSet.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHashSet.kt new file mode 100644 index 00000000000..2ec3c2d0538 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHashSet.kt @@ -0,0 +1,12 @@ +// TARGET_BACKEND: JVM + +fun box(): String { + val a = HashSet() + a.add("live") + a.add("long") + a.add("prosper") + val b = a.clone() + if (a != b) return "Fail equals" + if (a === b) return "Fail identity" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHierarchy.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHierarchy.kt new file mode 100644 index 00000000000..123e036c5cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneHierarchy.kt @@ -0,0 +1,32 @@ +// TARGET_BACKEND: JVM + +open class A : Cloneable { + public override fun clone(): A = super.clone() as A +} + +open class B(var s: String) : A() { + override fun clone(): B = super.clone() as B +} + +open class C(s: String, var l: ArrayList): B(s) { + override fun clone(): C { + val result = super.clone() as C + result.l = l.clone() as ArrayList + return result + } +} + +fun box(): String { + val l = ArrayList() + l.add(true) + + val c = C("OK", l) + val d = c.clone() + + if (c.s != d.s) return "Fail s: ${d.s}" + if (c.l != d.l) return "Fail l: ${d.l}" + if (c.l === d.l) return "Fail list identity" + if (c === d) return "Fail identity" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt new file mode 100644 index 00000000000..c8ee5af7a71 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +data class A(val s: String) : Cloneable { + fun externalClone(): A = clone() as A +} + +fun box(): String { + val a = A("OK") + val b = a.externalClone() + if (a != b) return "Fail equals" + if (a === b) return "Fail identity" + return b.s +} diff --git a/backend.native/tests/external/codegen/blackbox/jdk/arrayList.kt b/backend.native/tests/external/codegen/blackbox/jdk/arrayList.kt new file mode 100644 index 00000000000..54a5b35886e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jdk/arrayList.kt @@ -0,0 +1,12 @@ + +fun box(): String { + val a = ArrayList() + a.add(74) + a.add(75) + val i: Int = a.get(0) + val j: Int = a.get(1) + if (i != 74) return "fail 1" + if (j != 75) return "fail 2" + if (a.size != 2) return "epic fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jdk/hashMap.kt b/backend.native/tests/external/codegen/blackbox/jdk/hashMap.kt new file mode 100644 index 00000000000..3574e445e4c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jdk/hashMap.kt @@ -0,0 +1,14 @@ + +fun box(): String { + val map: MutableMap = HashMap() + map.put("a", 1) + map.put("bb", 2) + map.put("ccc", 3) + map.put("dddd", 4) + if (map.get("a") != 1) return "fail 1" + if (map.size != 4) return "fail 2" + if (map.get("eeeee") != null) return "fail 3" + if (!map.containsKey("bb")) return "fail 4" + if (map.keys.contains("ffffff")) return "fail 5" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jdk/iteratingOverHashMap.kt b/backend.native/tests/external/codegen/blackbox/jdk/iteratingOverHashMap.kt new file mode 100644 index 00000000000..c53bd2d9b6f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jdk/iteratingOverHashMap.kt @@ -0,0 +1,24 @@ + +fun box() : String { + if (!testIteratingOverMap1()) return "fail 1" + if (!testIteratingOverMap2()) return "fail 2" + return "OK" +} + +fun testIteratingOverMap1() : Boolean { + val map = HashMap() + map.put("a", 1) + for (entry in map.entries) { + entry.setValue(2) + } + return map.get("a") == 2 +} + +fun testIteratingOverMap2() : Boolean { + val map : MutableMap = HashMap() + map.put("a", 1) + for (entry in map.entries) { + entry.setValue(2) + } + return map.get("a") == 2 +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/jdk/kt1397.kt b/backend.native/tests/external/codegen/blackbox/jdk/kt1397.kt new file mode 100644 index 00000000000..17130d18c96 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jdk/kt1397.kt @@ -0,0 +1,11 @@ + +class IntArrayList(): ArrayList() { + override fun get(index: Int): Int = super.get(index) +} + +fun box(): String { + val a = IntArrayList() + a.add(1) + a[0]++ + return if (a[0] == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt b/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt new file mode 100644 index 00000000000..fe51488d07a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +open class A { + @JvmField public val publicField = "1"; + @JvmField internal val internalField = "2"; + @JvmField protected val protectedField = "34"; + + fun test(): String { + return { + publicField + internalField + protectedField + }() + } +} + + +fun box(): String { + return if (A().test() == "1234") return "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt b/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt new file mode 100644 index 00000000000..ce336100876 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@JvmField public val publicField = "1"; +@JvmField internal val internalField = "23"; + +fun test(): String { + return { + publicField + internalField + }() +} + + +fun box(): String { + return if (test() == "123") return "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt b/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt new file mode 100644 index 00000000000..b560f9b1a9b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertFalse + +@JvmField public val field = "OK"; + +class A { + @JvmField public val field = "OK"; + + companion object { + @JvmField public val cfield = "OK"; + } +} + +object Object { + @JvmField public val field = "OK"; +} + + +fun box(): String { + var result = A().field + + checkNoAccessors(A::class.java) + checkNoAccessors(A.Companion::class.java) + checkNoAccessors(Object::class.java) + checkNoAccessors(Class.forName("CheckNoAccessorsKt")) + + return "OK" +} + +public fun checkNoAccessors(clazz: Class<*>) { + clazz.declaredMethods.forEach { + assertFalse(it.name.startsWith("get") || it.name.startsWith("set"), + "Class ${clazz.name} has accessor '${it.name}'" + ) + } +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt new file mode 100644 index 00000000000..b606ba10089 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt @@ -0,0 +1,45 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package zzz +import java.lang.reflect.Field +import kotlin.reflect.KProperty1 +import kotlin.test.assertEquals + +class A(val s1: String, val s2: String) { + @JvmField public val publicField = s1; + @JvmField internal val internalField = s2; + + fun testAccessors() { + checkAccessor(A::publicField, s1, this) + checkAccessor(A::internalField, s2, this) + } +} + + +/* +// TODO: uncomment when callable references to object members are supported +class AWithCompanion { + companion object { + @JvmField public val publicField = "1"; + @JvmField internal val internalField = "2"; + + fun testAccessors() { + checkAccessor(AWithCompanion.Companion::publicField, "1", AWithCompanion.Companion) + checkAccessor(AWithCompanion.Companion::internalField, "2", AWithCompanion.Companion) + } + } +} +*/ + +fun box(): String { + A("1", "2").testAccessors() + // AWithCompanion.testAccessors() + return "OK" +} + +public fun checkAccessor(prop: KProperty1, value: R, receiver: T) { + assertEquals(prop.get(receiver), value, "Property ${prop} has wrong value") +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt new file mode 100644 index 00000000000..912ce6a6d34 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package zzz +import java.lang.reflect.Field +import kotlin.reflect.KProperty1 +import kotlin.test.assertEquals + + +import kotlin.reflect.KMutableProperty1 +import kotlin.test.assertEquals + +class A(val s1: String, val s2: String) { + @JvmField public var publicField = s1; + @JvmField internal var internalField = s2; + + fun testAccessors() { + checkAccessor(A::class.members.firstOrNull { it.name == "publicField" } as KMutableProperty1, s1, "3", this) + checkAccessor(A::class.members.firstOrNull { it.name == "internalField" } as KMutableProperty1, s2, "4", this) + } +} + + +class AWithCompanion { + companion object { + @JvmField public var publicField = "1"; + @JvmField internal var internalField = "2"; + + fun testAccessors() { + checkAccessor(AWithCompanion.Companion::class.members.firstOrNull { it.name == "publicField" } as KMutableProperty1, "1", "3", AWithCompanion.Companion) + checkAccessor(AWithCompanion.Companion::class.members.firstOrNull { it.name == "internalField" } as KMutableProperty1, "2", "4", AWithCompanion.Companion) + } + } +} + +fun box(): String { + A("1", "2").testAccessors() + AWithCompanion.testAccessors() + return "OK" +} + +public fun checkAccessor(prop: KMutableProperty1, value: R, newValue: R, receiver: T) { + assertEquals(prop.get(receiver), value, "Property ${prop} has wrong value") + prop.set(receiver, newValue) + assertEquals(prop.get(receiver), newValue, "Property ${prop} has wrong value") +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt b/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt new file mode 100644 index 00000000000..2d4740950c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +public class Test { + public static String invokeMethodWithPublicField() { + C c = new C("OK"); + return c.foo; + } +} + +// FILE: simple.kt + +class C(@JvmField val foo: String) { + +} + +fun box(): String { + return Test.invokeMethodWithPublicField() +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt b/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt new file mode 100644 index 00000000000..7b7c0929e52 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class A { + @JvmField public val field = "OK"; + + companion object { + @JvmField public val cfield = "OK"; + } +} + +object Object { + @JvmField public val field = "OK"; +} + + +fun box(): String { + var result = A().field + + if (result != "OK") return "fail 1: $result" + if (A.cfield != "OK") return "fail 2: ${A.cfield}" + if (Object.field != "OK") return "fail 3: ${Object.field}" + + return "OK" + +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt b/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt new file mode 100644 index 00000000000..89fbbbcf73f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +public class Test { + public static String invokeMethodWithPublicField() { + C c = new C(); + return c.foo; + } +} + +// FILE: simple.kt + +class C { + @JvmField public val foo: String = "OK" +} + +fun box(): String { + return Test.invokeMethodWithPublicField() +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt b/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt new file mode 100644 index 00000000000..f254d7ce6c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +open class A { + @JvmField public val publicField = "1"; + @JvmField internal val internalField = "2"; + @JvmField protected val protectedfield = "3"; +} + + +class B : A() { + fun test(): String { + return super.publicField + super.internalField + super.protectedfield + } +} + + +fun box(): String { + return if (B().test() == "123") return "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt b/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt new file mode 100644 index 00000000000..e424074ca45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +open class A { + @JvmField public val publicField = "1"; + @JvmField internal val internalField = "2"; + @JvmField protected val protectedfield = "3"; +} + +open class B : A() { + +} + +open class C : B() { + fun test(): String { + return super.publicField + super.internalField + super.protectedfield + } +} + + +fun box(): String { + return if (C().test() == "123") return "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt new file mode 100644 index 00000000000..bf7521718ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package zzz +import java.lang.reflect.Field +import kotlin.test.assertEquals +import kotlin.reflect.KProperty0 + +@JvmField public val publicField = "1"; +@JvmField internal val internalField = "2"; + +fun testAccessors() { + val kProperty: KProperty0 = ::publicField + checkAccessor(kProperty, "1") + checkAccessor(::internalField, "2") +} + + +fun box(): String { + testAccessors() + return "OK" +} + +public fun checkAccessor(prop: KProperty0, value: R) { + assertEquals(prop.get(), value, "Property ${prop} has wrong value") +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt new file mode 100644 index 00000000000..731f7049236 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package test + +import kotlin.reflect.KMutableProperty0 +import kotlin.reflect.jvm.kotlinProperty +import kotlin.test.assertEquals + +public var publicField = "1" +internal var internalField = "2" + +fun testAccessors() { + val packageClass = Class.forName("test.TopLevelFieldReflectionKt") + packageClass.getDeclaredField("publicField").kotlinProperty + checkAccessor(packageClass.getDeclaredField("publicField").kotlinProperty as KMutableProperty0, "1", "3") + checkAccessor(packageClass.getDeclaredField("internalField").kotlinProperty as KMutableProperty0, "2", "4") +} + + +fun box(): String { + testAccessors() + return "OK" +} + +public fun < R> checkAccessor(prop: KMutableProperty0, value: R, newValue: R) { + assertEquals(prop.get(), value, "Property ${prop} has wrong value") + prop.set(newValue) + assertEquals(prop.get(), newValue, "Property ${prop} has wrong value") +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt b/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt new file mode 100644 index 00000000000..11f47596037 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.Field +import kotlin.reflect.jvm.javaField +import kotlin.reflect.KProperty +import kotlin.test.assertNotEquals +import java.lang.reflect.Modifier + +@JvmField public val publicField = "OK"; +@JvmField internal val internalField = "OK"; + +fun testVisibilities() { + checkVisibility(::publicField.javaField!!, Modifier.PUBLIC) + checkVisibility(::internalField.javaField!!, Modifier.PUBLIC) +} + +class A { + @JvmField public val publicField = "OK"; + @JvmField internal val internalField = "OK"; + @JvmField protected val protectedfield = "OK"; + + fun testVisibilities() { + checkVisibility(A::publicField.javaField!!, Modifier.PUBLIC) + checkVisibility(A::internalField.javaField!!, Modifier.PUBLIC) + checkVisibility(A::protectedfield.javaField!!, Modifier.PROTECTED) + } +} + + +class AWithCompanion { + companion object { + @JvmField public val publicField = "OK"; + @JvmField internal val internalField = "OK"; + @JvmField protected val protectedfield = "OK"; + + operator fun get(name: String) = AWithCompanion.Companion::class.members.single { it.name == name } as KProperty<*> + + fun testVisibilities() { + checkVisibility(this["publicField"].javaField!!, Modifier.PUBLIC) + checkVisibility(this["internalField"].javaField!!, Modifier.PUBLIC) + checkVisibility(this["protectedfield"].javaField!!, Modifier.PROTECTED) + } + } +} + +object Object { + @JvmField public val publicField = "OK"; + @JvmField internal val internalField = "OK"; + + operator fun get(name: String) = Object::class.members.single { it.name == name } as KProperty<*> + + fun testVisibilities() { + checkVisibility(this["publicField"].javaField!!, Modifier.PUBLIC) + checkVisibility(this["internalField"].javaField!!, Modifier.PUBLIC) + } +} + +fun box(): String { + A().testVisibilities() + AWithCompanion.testVisibilities() + Object.testVisibilities() + return "OK" +} + +public fun checkVisibility(field: Field, visibility: Int) { + assertNotEquals(field.modifiers and visibility, 0, "Field ${field} has wrong visibility") +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt b/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt new file mode 100644 index 00000000000..77a38072cb8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package zzz +import kotlin.reflect.KMutableProperty1 +import kotlin.test.assertEquals + +class A(val s1: String, val s2: String) { + @JvmField public var publicField = s1; + @JvmField internal var internalField = s2; + + fun testAccessors() { + val kMutableProperty: KMutableProperty1 = A::publicField + checkAccessor(kMutableProperty, s1, "3", this) + checkAccessor(A::internalField, s2, "4", this) + } +} + +fun box(): String { + A("1", "2").testAccessors() + return "OK" +} + +public fun checkAccessor(prop: KMutableProperty1, value: R, newValue: R, receiver: T) { + assertEquals(prop.get(receiver), value, "Property ${prop} has wrong value") + prop.set(receiver, newValue) + assertEquals(prop.get(receiver), newValue, "Property ${prop} has wrong value") +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt b/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt new file mode 100644 index 00000000000..9c315bae926 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@JvmName("bar") +fun foo() = "foo" + +fun box(): String { + val f = (::foo)() + if (f != "foo") return "Fail: $f" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt b/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt new file mode 100644 index 00000000000..74234f87391 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun List.foo() = "foo" + +@JvmName("fooInt") +fun List.foo() = "fooInt" + +fun box(): String { + val strings = listOf("", "").foo() + if (strings != "foo") return "Fail: $strings" + + val ints = listOf(1, 2).foo() + if (ints != "fooInt") return "Fail: $ints" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt b/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt new file mode 100644 index 00000000000..5503a586e42 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt @@ -0,0 +1,121 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// See: +// http://kotlinlang.org/docs/reference/java-interop.html#handling-signature-clashes-with-platformname +// https://youtrack.jetbrains.com/issue/KT-5524 + +val strs = listOf("abc", "def") +val ints = listOf(1, 2, 3) + +class C { + // Instance methods + + @JvmName("instMethodStr") + fun instMethod(list: List): String = "instMethodStr" + + @JvmName("instMethodInt") + fun instMethod(list: List): String = "instMethodInt" + + // Properties + + var rwProperty: Int + @JvmName("get_rwProperty") + get() = 123 + @JvmName("set_rwProperty") + set(v) {} + + var rwValue = 111 + + fun getRwProperty(): Int = rwValue + + fun setRwProperty(v: Int) { + rwValue = v + } + + // Extension methods + + class Inner + + @JvmName("extMethodWithGenericParamStr") + fun Inner.extMethodWithGenericParam(list: List): String = "extMethodWithGenericParamStr" + + @JvmName("extMethodWithGenericParamInt") + fun Inner.extMethodWithGenericParam(list: List): String = "extMethodWithGenericParamInt" + + // This is already covered by extMethodWithGenericParam(), but might be relevant for a platform + // with extension method code generation strategy different from Java 6. + + @JvmName("extMethodWithGenericReceiverStr") + fun List.extMethodWithGenericReceiver(): String = "extMethodWithGenericReceiverStr" + + @JvmName("extMethodWithGenericReceiverInt") + fun List.extMethodWithGenericReceiver(): String = "extMethodWithGenericReceiverInt" + + // Extension method vs instance method + + @JvmName("ambigMethod1") + fun ambigMethod(str: String): String = "ambigMethod1" + + @JvmName("ambigMethod2") + fun String.ambigMethod(): String = "ambigMethod2" + +} + +fun box(): String { + val c = C() + + // Instance methods: + // method signatures with erased types SHOULD NOT clash + + val test1 = c.instMethod(strs) + if (test1 != "instMethodStr") return "Fail: c.instMethod(strs)==$test1" + + val test2 = c.instMethod(ints) + if (test2 != "instMethodInt") return "Fail: c.instMethod(ints)==$test2" + + // Properties: + // property accessors SHOULD NOT clash with class methods + + val test3 = c.rwProperty + if (test3 != 123) return "Fail: c.rwProperty==$test3" + + val test3a = c.getRwProperty() + if (test3a != 111) return "Fail: c.getRwProperty()==$test3a" + + c.setRwProperty(444) + val test3b = c.rwProperty + if (test3b != 123) return "Fail: c.rwProperty==$test3b after c.setRwProperty(1234)" + val test3c = c.getRwProperty() + if (test3c != 444) return "Fail: c.getRwProperty()==$test3c after c.setRwProperty(1234)" + + // Extension methods: + // method signatures with erased types SHOULD NOT clash + + val test4 = with(c) { C.Inner().extMethodWithGenericParam(strs) } + if (test4 != "extMethodWithGenericParamStr") return "Fail: with(c) { C.Inner().extMethodWithGenericParam(strs) }==$test4" + + val test5 = with(c) { C.Inner().extMethodWithGenericParam(ints) } + if (test5 != "extMethodWithGenericParamInt") return "Fail: with(c) { C.Inner().extMethodWithGenericParam(ints) }==$test5" + + val test6 = with(c) { strs.extMethodWithGenericReceiver() } + if (test6 != "extMethodWithGenericReceiverStr") return "Fail: with(c) { strs.extMethodWithGenericReceiver() }==$test6" + + val test7 = with(c) { ints.extMethodWithGenericReceiver() } + if (test7 != "extMethodWithGenericReceiverInt") return "Fail: with(c) { ints.extMethodWithGenericReceiver() }==$test7" + + // Extension method SHOULD NOT clash with instance method with the same Java signature. + + val str = "abc" + + val test8 = with(c) { ambigMethod(str) } + if (test8 != "ambigMethod1") return "Fail: with(c) { ambigMethod(str) }==$test8" + + val test9 = with(c) { str.ambigMethod() } + if (test9 != "ambigMethod2") return "Fail: with(c) { str.ambigMethod() }==$test9" + + // Everything is fine. + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt new file mode 100644 index 00000000000..e174ddeaf27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: FakePlatformName.java + +import kotlin.jvm.JvmName; + +public class FakePlatformName { + @JvmName(name = "fake") + public String foo() { + return "foo"; + } + + public String fake() { + return "fake"; + } +} + +// FILE: FakePlatformName.kt + +fun box(): String { + val test1 = FakePlatformName().foo() + if (test1 != "foo") return "Failed: FakePlatformName().foo()==$test1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt new file mode 100644 index 00000000000..556e261147a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Foo.foo() + Bar.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Bar") +public fun bar(): String = "K" + +// FILE: foo.kt + +@file:JvmName("Foo") +public fun foo(): String = "O" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt new file mode 100644 index 00000000000..a245616bec7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: StringHolder.java + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface StringHolder { + public String value(); +} + +// FILE: fileFacade.kt + +@file:StringHolder("OK") + +fun box(): String = + Class.forName("FileFacadeKt").getAnnotation(StringHolder::class.java)?.value ?: "null" diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt new file mode 100644 index 00000000000..fcc261b3912 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Bar.java + +public class Bar { + public static String bar() { + return Foo.foo(); + } +} + +// FILE: foo.kt + +@file:JvmName("Foo") +public fun foo(): String = "OK" + +// FILE: simple.kt + +fun box(): String = Bar.bar() diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt b/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt new file mode 100644 index 00000000000..a8d040d104c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@JvmName("bar") +fun foo() = "foo" + +fun box(): String { + val f = foo() + if (f != "foo") return "Fail: $f" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt new file mode 100644 index 00000000000..43e1c9e3b28 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:JvmName("Test") +@file:JvmMultifileClass +package test + +fun foo(): String = bar() +fun bar(): String = qux() +fun qux(): String = "OK" + +fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt new file mode 100644 index 00000000000..2ce0fe101a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:JvmName("Test") +@file:JvmMultifileClass +package test + +fun foo(): String = bar() +fun bar(): String { + class Local(val x: String) + return Local("OK").x +} + +fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt new file mode 100644 index 00000000000..4438b665563 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:JvmName("Test") +@file:JvmMultifileClass +package test + +fun foo(): String = bar() +fun bar(): String { + open class LocalGeneric(val x: T) + class Derived(x: String) : LocalGeneric(x) + fun LocalGeneric.extFun() = this + fun localFun(x: LocalGeneric) = x + class Local3 { + fun method(x: LocalGeneric) = x.x + } + return Local3().method(localFun(Derived("OK")).extFun()) +} + +fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt b/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt new file mode 100644 index 00000000000..a47adf26e69 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +class TestIt { + @get:JvmName("getIsFries") + @set:JvmName("setIsFries") + var isFries: Boolean = true + + @get:JvmName("getIsUpdateable") + @set:JvmName("setIsUpdateable") + var isUpdateable: Boolean by Delegate +} + +object Delegate { + operator fun getValue(thiz: Any?, metadata: Any?) = true + operator fun setValue(thiz: Any?, metadata: Any?, value: Boolean) {} +} + +fun box(): String { + assertEquals( + listOf("getIsFries", "getIsUpdateable", "setIsFries", "setIsUpdateable"), + TestIt::class.java.declaredMethods.map { it.name }.sorted() + ) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt b/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt new file mode 100644 index 00000000000..2aa47694759 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var v: Int = 1 + @JvmName("vget") + get + @JvmName("vset") + set + +fun box(): String { + v += 1 + if (v != 2) return "Fail: $v" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt b/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt new file mode 100644 index 00000000000..2c2dfd58d11 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:JvmName("Util") +package test + +fun foo(): String = bar() +fun bar(): String = qux() +fun qux(): String = "OK" + +fun box(): String = foo() diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt new file mode 100644 index 00000000000..cf703761cf0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + companion object { + @JvmStatic @kotlin.jvm.JvmOverloads public fun foo(o: String, k: String = "K"): String { + return o + k + } + } +} + +fun box(): String { + val m = C::class.java.getMethod("foo", String::class.java) + return m.invoke(null, "O") as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt new file mode 100644 index 00000000000..a62e537a2b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", i1: Int, k: String = "K", i2: Int): String { + return o + k + } +} + +fun box(): String { + val c = C() + val m = c.javaClass.getMethod("foo", Int::class.java, Int::class.java) + return m.invoke(c, 1, 2) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt new file mode 100644 index 00000000000..3ff238d0cd1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + @kotlin.jvm.JvmOverloads public fun foo(d1: Double, d2: Double, status: String = "OK"): String { + return if (d1 + d2 == 3.0) status else "fail" + } +} + +fun box(): String { + val c = C() + val m = c.javaClass.getMethod("foo", Double::class.java, Double::class.java) + return m.invoke(c, 1.0, 2.0) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt new file mode 100644 index 00000000000..0aae67954a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { +} + +@kotlin.jvm.JvmOverloads fun C.foo(o: String, k: String = "K"): String { + return o + k +} + +fun box(): String { + val m = C::class.java.getClassLoader().loadClass("ExtensionMethodKt").getMethod("foo", C::class.java, String::class.java) + return m.invoke(null, C(), "O") as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt new file mode 100644 index 00000000000..09ebb5a0393 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +public class Test { + public static String invokeMethodWithOverloads() { + C c = new C(); + return c.foo("O"); + } +} + +// FILE: generics.kt + +class C { + @kotlin.jvm.JvmOverloads public fun foo(o: T, k: String = "K"): String = o.toString() + k +} + +fun box(): String { + return Test.invokeMethodWithOverloads() +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt new file mode 100644 index 00000000000..91a9b505ce7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt @@ -0,0 +1,15 @@ +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class Outer { + inner class Inner @JvmOverloads constructor(val s1: String, val s2: String = "OK") { + + } +} + +fun box(): String { + val outer = Outer() + val c = (Outer.Inner::class.java.getConstructor(Outer::class.java, String::class.java).newInstance(outer, "shazam")) + return c.s2 +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt new file mode 100644 index 00000000000..98cfcee8cb9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", k: String = "K"): String { + return o + k + } +} + +fun box(): String { + val c = C() + val m = c.javaClass.getMethod("foo") + return m.invoke(c) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt new file mode 100644 index 00000000000..ab05e21ca6c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + @kotlin.jvm.JvmOverloads public fun foo(o: String, k: String = "K"): String { + return o + k + } +} + +fun box(): String { + val c = C() + val m = c.javaClass.getMethod("foo", String::class.java) + return m.invoke(c, "O") as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt new file mode 100644 index 00000000000..d045299c61d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C @kotlin.jvm.JvmOverloads constructor(s1: String, s2: String = "K") { + public val status: String = s1 + s2 +} + +fun box(): String { + val c = (C::class.java.getConstructor(String::class.java).newInstance("O")) + return c.status +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt new file mode 100644 index 00000000000..cb324957d9a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt @@ -0,0 +1,10 @@ +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +private data class C(val status: String = "OK") + +fun box(): String { + val c = (C::class.java.getConstructor().newInstance()) + return c.status +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt new file mode 100644 index 00000000000..c07b24be0a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C(val i: Int) { + var status = "fail" + + @kotlin.jvm.JvmOverloads constructor(o: String, k: String = "K"): this(-1) { + status = o + k + } +} + +fun box(): String { + val c = (C::class.java.getConstructor(String::class.java).newInstance("O")) + return c.status +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt new file mode 100644 index 00000000000..6923ae42615 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + @kotlin.jvm.JvmOverloads public fun foo(s: String = "OK"): String { + return s + } +} + +fun box(): String { + val c = C() + val m = c.javaClass.getMethod("foo") + return m.invoke(c) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt new file mode 100644 index 00000000000..8cc52c85c91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +public class Test { + public static String invokeMethodWithOverloads() { + C c = new C(); + return c.foo(); + } +} + +// FILE: simple.kt + +class C { + @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", k: String = "K"): String = o + k +} + +fun box(): String { + return Test.invokeMethodWithOverloads() +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt new file mode 100644 index 00000000000..38ad4a6fec7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt @@ -0,0 +1,16 @@ +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + @JvmOverloads + fun foo(bar: Int = 0, vararg status: String) { + + } +} + +fun box(): String { + val c = C() + val m = c.javaClass.getMethod("foo", Array::class.java) + return if (m.isVarArgs) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt new file mode 100644 index 00000000000..96b60efbbcb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt @@ -0,0 +1,61 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +import java.lang.annotation.Annotation; + +class Test { + + public static String test1() throws NoSuchMethodException { + Annotation[] test1s = A.class.getMethod("test1").getAnnotations(); + for (Annotation test : test1s) { + String name = test.toString(); + if (name.contains("testAnnotation")) { + return "OK"; + } + } + return "fail"; + } + + public static String test2() throws NoSuchMethodException { + Annotation[] test2s = B.class.getMethod("test1").getAnnotations(); + for (Annotation test : test2s) { + String name = test.toString(); + if (name.contains("testAnnotation")) { + return "OK"; + } + } + return "fail"; + } + +} + +// FILE: test.kt + +@Retention(AnnotationRetention.RUNTIME) +annotation class testAnnotation + +class A { + + companion object { + val b: String = "OK" + + @JvmStatic @testAnnotation fun test1() = b + } +} + +object B { + val b: String = "OK" + + @JvmStatic @testAnnotation fun test1() = b +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt new file mode 100644 index 00000000000..35396139dc0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt @@ -0,0 +1,51 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + val b: String = "OK" + + @JvmStatic val c: String = "OK" + + @JvmStatic fun test1() : String { + return {b}() + } + + @JvmStatic fun test2() : String { + return {test1()}() + } + + fun test3(): String { + return {"1".test5()}() + } + + @JvmStatic fun test4(): String { + return {"1".test5()}() + } + + @JvmStatic fun String.test5() : String { + return {this + b}() + } + + fun test6(): String { + return {c}() + } +} + +fun box(): String { + if (A.test1() != "OK") return "fail 1" + + if (A.test2() != "OK") return "fail 2" + + if (A.test3() != "1OK") return "fail 3" + + if (A.test4() != "1OK") return "fail 4" + + if (with(A) {"1".test5()} != "1OK") return "fail 5" + + if (A.test6() != "OK") return "fail 6" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt new file mode 100644 index 00000000000..e0ecfa7107a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt @@ -0,0 +1,54 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class Test { + + public static String test1() { + return A.test1(); + } + + public static String test2() { + return A.test2(); + } + + public static String test3() { + return A.test3("JAVA"); + } + + public static String test4() { + return A.getC(); + } + +} + +// FILE: simpleCompanionObject.kt + +class A { + + companion object { + val b: String = "OK" + + @JvmStatic val c: String = "OK" + + @JvmStatic fun test1() = b + + @JvmStatic fun test2() = b + + @JvmStatic fun String.test3() = this + b + } +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + if (Test.test3() != "JAVAOK") return "fail 3" + + if (Test.test4() != "OK") return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt new file mode 100644 index 00000000000..4e04db4e5f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class B(var s: Int = 0) { + +} + +object A { + + fun test1(v: B) { + v += B(1000) + } + + @JvmStatic operator fun B.plusAssign(b: B) { + this.s += b.s + } +} + +fun box(): String { + + val b1 = B(11) + + with(A) { + b1 += B(1000) + } + + if (b1.s != 1011) return "fail 1" + + val b = B(11) + A.test1(b) + if (b.s != 1011) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt new file mode 100644 index 00000000000..b89aae3f56f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + @JvmStatic fun test(b: String = "OK") : String { + return b + } +} + +fun box(): String { + + if (A.test() != "OK") return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt new file mode 100644 index 00000000000..13b63e6c492 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt @@ -0,0 +1,46 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class Test { + public static String foo() { + return A.foo; + } + + public static String constBar() { + return A.constBar; + } + + public static String getBar() { + return A.getBar(); + } + + public static String baz() { + return A.baz(); + } +} + +// FILE: enumCompanionObject.kt + +enum class A { + ; + companion object { + @JvmField val foo: String = "OK" + + const val constBar: String = "OK" + + @JvmStatic val bar: String = "OK" + + @JvmStatic fun baz() = foo + } +} + +fun box(): String { + if (Test.foo() != "OK") return "Fail foo" + if (Test.constBar() != "OK") return "Fail bar" + if (Test.getBar() != "OK") return "Fail getBar" + if (Test.baz() != "OK") return "Fail baz" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt new file mode 100644 index 00000000000..e9608a14a81 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object AX { + + @JvmStatic val c: String = "OK" + + @JvmStatic fun aStatic(): String { + return AX.b() + } + + fun aNonStatic(): String { + return AX.b() + } + + @JvmStatic fun b(): String { + return "OK" + } + + fun getProperty(): String { + return AX.c + } + +} + +fun box() : String { + + if (AX.aStatic() != "OK") return "fail 1" + + if (AX.aNonStatic() != "OK") return "fail 2" + + if (AX.getProperty() != "OK") return "fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt new file mode 100644 index 00000000000..00e8b82009f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var holder = "" + +fun getA(): A { + holder += "OK" + return A +} + +object A { + @JvmStatic fun a(): String { + return holder + } +} + +fun box(): String { + return getA().a() +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt new file mode 100644 index 00000000000..3bceee477eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import O.p +import O.f +import C.Companion.p1 +import C.Companion.f1 + +object O { + @JvmStatic + fun f(): Int = 3 + + @JvmStatic + val p: Int = 6 +} + +class C { + companion object { + @JvmStatic + fun f1(): Int = 3 + + @JvmStatic + val p1: Int = 6 + } + +} + +fun box(): String { + if (p + f() != 9) return "fail" + if (p1 + f1() != 9) return "fail2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt new file mode 100644 index 00000000000..59612f27bd9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + @JvmStatic inline fun test(b: String = "OK") : String { + return b + } +} + +fun box(): String { + + if (A.test() != "OK") return "fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt new file mode 100644 index 00000000000..899dbd7a5ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var result = "fail 1" +object Foo { + @JvmStatic + private val a = "OK" + + fun foo() = run { result = a } +} + +fun box(): String { + Foo.foo() + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt new file mode 100644 index 00000000000..c8b4b060d4d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt @@ -0,0 +1,46 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object Test { + var z = "0" + var l = 0L + + fun changeObject(): String { + "1".someProperty += 1 + return z + } + + fun changeLong(): Long { + 2L.someProperty -= 1 + return l + } + + @JvmStatic var String.someProperty: Int + get() { + return this.length + } + set(left) { + z += this + left + } + + @JvmStatic var Long.someProperty: Long + get() { + return l + } + set(left) { + l += this + left + } + +} + +fun box(): String { + val changeObject = Test.changeObject() + if (changeObject != "012") return "fail 1: $changeObject" + + val changeLong = Test.changeLong() + if (changeLong != 1L) return "fail 1: $changeLong" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt new file mode 100644 index 00000000000..59765168dba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class Test { + + public static String test1() { + return A.test1(); + } + + public static String test2() { + return A.test2(); + } + + public static String test3() { + return A.test3("JAVA"); + } + + public static String test4() { + return A.getC(); + } + +} + +// FILE: simpleObject.kt + +object A { + + val b: String = "OK" + + @JvmStatic val c: String = "OK" + + @JvmStatic fun test1() = b + + @JvmStatic fun test2() = b + + @JvmStatic fun String.test3() = this + b +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + if (Test.test3() != "JAVAOK") return "fail 3" + + if (Test.test4() != "OK") return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt new file mode 100644 index 00000000000..fb3f7f80d7f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + @JvmStatic var a: Int = 1 + + var b: Int = 1 + @JvmStatic get + + var c: Int = 1 + @JvmStatic set + +} + +var holder = "" +fun getA(): A { + holder += "getA()" + return A +} + + +fun box(): String { + + var p = A.a++ + if (p != 1 || A.a != 2) return "fail 1" + + p = A.b++ + if (p != 1 || A.b != 2) return "fail 2" + + p = A.c++ + if (p != 1 || A.c != 2) return "fail 3" + + + p = getA().a++ + if (p != 2 || A.a != 3 || holder != "getA()") return "fail 4: $holder" + holder = "" + + p = getA().b++ + if (p != 2 || A.b != 3 || holder != "getA()") return "fail 5: $holder" + holder = "" + + p = getA().c++ + if (p != 2 || A.c != 3 || holder != "getA()") return "fail 6: $holder" + holder = "" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt new file mode 100644 index 00000000000..49c8691a0ed --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + @JvmStatic var a: Int = 1 + + var b: Int = 1 + @JvmStatic get + + var c: Int = 1 + @JvmStatic set + +} + +var holder = "" +fun getA(): A { + holder += "getA()" + return A +} + + +fun box(): String { + + var p = ++A.a + if (p != 2 || A.a != 2) return "fail 1" + + p = ++A.b + if (p != 2 || A.b != 2) return "fail 2" + + p = ++A.c + if (p != 2 || A.c != 2) return "fail 3" + + + p = ++getA().a + if (p != 3 || A.a != 3 || holder != "getA()") return "fail 4: $holder" + holder = "" + + p = ++getA().b + if (p != 3 || A.b != 3 || holder != "getA()") return "fail 5: $holder" + holder = "" + + p = ++getA().c + if (p != 3 || A.c != 3 || holder != "getA()") return "fail 6: $holder" + holder = "" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt new file mode 100644 index 00000000000..a1368cbe344 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + private @JvmStatic fun a(): String { + return "OK" + } + + object Z { + val p = a() + } +} + +fun box(): String { + return A.Z.p +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt new file mode 100644 index 00000000000..9ffb0728200 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: JavaClass.java +class JavaClass { + + + public static String test() + { + return TestApp.getValue(); + } +} + +// FILE: Kotlin.kt +open class TestApp { + companion object { + @JvmStatic + var value: String = "OK" + private set + } +} + + +fun box(): String { + return JavaClass.test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt new file mode 100644 index 00000000000..2c993d1070a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var holder = "" + +fun getA(): A { + holder += "getA()" + return A +} + +object A { + + @JvmStatic var a: Int = 1 + + var b: Int = 1 + @JvmStatic get + + var c: Int = 1 + @JvmStatic set + +} + + +fun box(): String { + + if (getA().a != 1 || holder != "getA()") return "fail 1: $holder" + holder = "" + + if (getA().b != 1 || holder != "getA()") return "fail 2: $holder" + holder = "" + + if (getA().c != 1 || holder != "getA()") return "fail 3: $holder" + holder = "" + + getA().a = 2 + if (getA().a != 2 || holder != "getA()getA()") return "fail 1: $holder" + holder = "" + + getA().b = 2 + if (getA().b != 2 || holder != "getA()getA()") return "fail 2: $holder" + holder = "" + + getA().c = 2 + if (getA().c != 2 || holder != "getA()getA()") return "fail 3: $holder" + holder = "" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt new file mode 100644 index 00000000000..a086272c31a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var result = "fail 2" +class Foo { + val b = { a } + val c = Runnable { result = a } + + companion object { + @JvmStatic + private val a = "OK" + } +} + +fun box(): String { + if (Foo().b() != "OK") return "fail 1" + + Foo().c.run() + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt new file mode 100644 index 00000000000..29ba5a9ce4d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +var result = "fail 2" +object Foo { + @JvmStatic + private val a = "OK" + + val b = { a } + val c = Runnable { result = a } +} + +fun box(): String { + if (Foo.b() != "OK") return "fail 1" + + Foo.c.run() + + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt new file mode 100644 index 00000000000..36f323850ea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object X { + @JvmStatic val x = "OK" + + fun fn(value : String = x): String = value +} + +fun box(): String { + return X.fn() +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt new file mode 100644 index 00000000000..62123966275 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +object A { + + val b: String = "OK" + + @JvmStatic val c: String = "OK" + + @JvmStatic fun test1() : String { + return b + } + + @JvmStatic fun test2() : String { + return test1() + } + + fun test3(): String { + return "1".test5() + } + + @JvmStatic fun test4(): String { + return "1".test5() + } + + @JvmStatic fun String.test5() : String { + return this + b + } +} + +fun box(): String { + if (A.test1() != "OK") return "fail 1" + + if (A.test2() != "OK") return "fail 2" + + if (A.test3() != "1OK") return "fail 3" + + if (A.test4() != "1OK") return "fail 4" + + if (with(A) {"1".test5()} != "1OK") return "fail 5" + + if (A.c != "OK") return "fail 6" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt new file mode 100644 index 00000000000..b43ac7ecd6d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class C { + companion object { + private @JvmStatic fun foo(): String { + return "OK" + } + } + + fun bar(): String { + return foo() + } +} + +fun box(): String { + return C().bar() +} diff --git a/backend.native/tests/external/codegen/blackbox/labels/labeledDeclarations.kt b/backend.native/tests/external/codegen/blackbox/labels/labeledDeclarations.kt new file mode 100644 index 00000000000..5b407c979fb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/labeledDeclarations.kt @@ -0,0 +1,16 @@ +data class A(val a: Int, val b: Int) + +fun box() : String +{ + a@ val x = 1 + b@ fun a() = 2 + c@ val (z, z2) = A(1, 2) + + if (x != 1) return "fail 1" + + if (a() != 2) return "fail 2" + + if (z != 1 || z2 != 2) return "fail 3" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/labels/propertyAccessor.kt b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessor.kt new file mode 100644 index 00000000000..b9973e82ddc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessor.kt @@ -0,0 +1,11 @@ +val Int.getter: Int + get() { + return this@getter + } + +fun box(): String { + val i = 1 + if (i.getter != 1) return "getter failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorFunctionLiteral.kt b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorFunctionLiteral.kt new file mode 100644 index 00000000000..6d26e930ed2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorFunctionLiteral.kt @@ -0,0 +1,13 @@ +val Int.getter: Int + get() { + return { + this@getter + }.invoke() + } + +fun box(): String { + val i = 1 + if (i.getter != 1) return "getter failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorInnerExtensionFun.kt b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorInnerExtensionFun.kt new file mode 100644 index 00000000000..1a57fc6e039 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorInnerExtensionFun.kt @@ -0,0 +1,28 @@ +val Int.getter: Int + get() { + val extFun: Int.() -> Int = { + this@getter + } + return this@getter.extFun() + } + + +var Int.setter: Int + get() = 1 + set(i: Int) { + val extFun: Int.() -> Int = { + this@setter + } + this@setter.extFun() + } + + +fun box(): String { + val i = 1 + if (i.getter != 1) return "getter failed" + + i.setter = 1 + if (i.setter != 1) return "setter failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorObject.kt b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorObject.kt new file mode 100644 index 00000000000..1fc9f25aa82 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/propertyAccessorObject.kt @@ -0,0 +1,19 @@ +interface Base { + fun foo(): Int +} + +val Int.getter: Int + get() { + return object : Base { + override fun foo(): Int { + return this@getter + } + }.foo() + } + +fun box(): String { + val i = 1 + if (i.getter != 1) return "getter failed" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/labels/propertyInClassAccessor.kt b/backend.native/tests/external/codegen/blackbox/labels/propertyInClassAccessor.kt new file mode 100644 index 00000000000..21cfd6428d9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/propertyInClassAccessor.kt @@ -0,0 +1,17 @@ +class Test { + val Int.innerGetter: Int + get() { + return this@innerGetter + } + + fun test(): Int { + val i = 1 + if (i.innerGetter != 1) return 0 + return 1 + } +} + +fun box(): String { + if (Test().test() != 1) return "inner getter or setter failed" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/exceptionInFieldInitializer.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/exceptionInFieldInitializer.kt new file mode 100644 index 00000000000..f086e0ca2ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/exceptionInFieldInitializer.kt @@ -0,0 +1,32 @@ +class A(val p: String) { + val prop: String = throw RuntimeException() +} + +class B(val p: String) { + val prop: String = if (p == "test") "OK" else throw RuntimeException() +} + +fun box(): String { + var result = "fail" + try { + if (A("test").prop != "OK") return "fail 1" + } + catch (e: RuntimeException) { + result = "OK" + } + if (result != "OK") return "fail 1: $result" + + + if (B("test").prop != "OK") return "fail 2" + + + result = "fail" + try { + if (B("fail").prop != "OK") return "fail 3" + } + catch (e: RuntimeException) { + return "OK" + } + + return "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/ifElse.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/ifElse.kt new file mode 100644 index 00000000000..0f683860b24 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/ifElse.kt @@ -0,0 +1,34 @@ +class A (val p: String, p1: String, p2: String) { + + var cond1 :String = "" + + var cond2 :String = "" + + val prop: String = if (p == "test") p1 else p2 + + val prop1 = if (cond1(p)) p1 else false + + val prop2 = if (cond2(p)) true else false + + fun cond1(p: String): Boolean { + cond1 = "cond1" + return p == "test" + } + + fun cond2(p: String): Boolean { + cond2 = "cond2" + return p == "test" + } +} + +fun box(): String { + val a = A("test", "OK", "fail") + + if (a.prop != "OK") return "fail 1" + + if (a.cond1 != "cond1") return "fail 2" + + if (a.cond2 != "cond2") return "fail 3" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/increment.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/increment.kt new file mode 100644 index 00000000000..40369fff4af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/increment.kt @@ -0,0 +1,31 @@ +var holder = "" +var globalA: A = A(-1) + get(): A { + holder += "getA" + return field + } + + +class A(val p: Int) { + + var prop = this + + operator fun inc(): A { + return A(p+1) + } + + +} + +fun box(): String { + var a = A(1) + ++a + if (a.p != 2) return "fail 1: ${a.p} $holder" + + globalA = A(1) + ++(globalA.prop) + val holderValue = holder; + if (globalA.p != 1 || globalA.prop.p != 2 || holderValue != "getA") return "fail 2: ${a.p} ${a.prop.p} ${holderValue}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateConstantCompare.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateConstantCompare.kt new file mode 100644 index 00000000000..f68757d7588 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateConstantCompare.kt @@ -0,0 +1,7 @@ +fun box(): String { + if (!(1 < 2)) { + return "fail" + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalse.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalse.kt new file mode 100644 index 00000000000..fd5ef04626e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalse.kt @@ -0,0 +1,7 @@ +fun box(): String { + if (!false) { + return "OK" + } else { + return "fail" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVar.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVar.kt new file mode 100644 index 00000000000..c4ad074824a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVar.kt @@ -0,0 +1,8 @@ +fun box(): String { + var p = 2 < 1; + if (!p) { + return "OK" + } else { + return "fail" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVarChain.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVarChain.kt new file mode 100644 index 00000000000..8f89b14fe90 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateFalseVarChain.kt @@ -0,0 +1,8 @@ +fun box(): String { + val p = 2 < 1; + if (!!!!!p) { + return "OK" + } else { + return "fail" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp.kt new file mode 100644 index 00000000000..58e15f4de93 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp.kt @@ -0,0 +1,9 @@ +val p: Int? = 1; +val z: Int? = 2; + +fun box(): String { + if (!(p!! == z!!)) { + return "OK" + } + return "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp2.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp2.kt new file mode 100644 index 00000000000..e1a13f17cc9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateObjectComp2.kt @@ -0,0 +1,9 @@ +val p: Int? = 1; +val z: Int? = 2; + +fun box(): String { + if (!(p!! < z!!)) { + return "fail" + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrue.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrue.kt new file mode 100644 index 00000000000..487ec8c27a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrue.kt @@ -0,0 +1,7 @@ +fun box(): String { + if (!true) { + return "fail" + } else { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrueVar.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrueVar.kt new file mode 100644 index 00000000000..2c651614453 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/negateTrueVar.kt @@ -0,0 +1,8 @@ +fun box(): String { + var p = 1 < 2; + if (!p) { + return "fail" + } else { + return "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/noOptimization.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/noOptimization.kt new file mode 100644 index 00000000000..1437d56484b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/noOptimization.kt @@ -0,0 +1,28 @@ +class A +class B + +var holder = 0 + +operator fun A.not(): A { + holder++ + return this; +} + +operator fun B.not(): Boolean { + holder++ + return false; +} + +fun box(): String { + !!!!!A() + if (holder != 5) return "fail 1" + + holder = 0; + if (!!!B() || holder != 1) return "fail 2" + + if (!B() != false) return "fail 3" + + if (!!B() != true) return "fail 4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssign.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssign.kt new file mode 100644 index 00000000000..8019455b3da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssign.kt @@ -0,0 +1,10 @@ +class Shape(var result: String) { + +} + +fun box(): String { + var a : Shape? = Shape("fail"); + a?.result = "OK"; + + return a!!.result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssignComplex.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssignComplex.kt new file mode 100644 index 00000000000..6dd9cac91de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeAssignComplex.kt @@ -0,0 +1,34 @@ +var holder = "" + +var mainShape: Shape? = null + +fun getShape(): Shape? { + holder += "getShape1()" + mainShape = Shape("fail") + return mainShape +} + +fun getOK(): String { + holder += "->OK" + return "OK" +} + + +class Shape(var result: String) { + + var innerShape: Shape? = null + + fun getShape2(): Shape? { + holder += "->getShape2()" + innerShape = Shape(result) + return innerShape + } +} + +fun box(): String { + getShape()?.getShape2()?.result = getOK(); + + if (holder != "getShape1()->getShape2()->OK") return "fail $holder" + + return mainShape!!.innerShape!!.result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeCallAndArray.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeCallAndArray.kt new file mode 100644 index 00000000000..90b61d66b5f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/safeCallAndArray.kt @@ -0,0 +1,11 @@ +class C { + fun calc() : String { + return "OK" + } +} + +fun box(): String? { + val c: C? = C() + val arrayList = arrayOf(c?.calc(), "") + return arrayList[0] +} diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/toString.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/toString.kt new file mode 100644 index 00000000000..a71276879e8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/toString.kt @@ -0,0 +1,12 @@ +class A (val p: String) { + + val _kind: String = "$p" + +} + +fun box(): String { + + if (A("OK")._kind != "OK") return "fail" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/tryCatchExpression.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/tryCatchExpression.kt new file mode 100644 index 00000000000..8617a79e1cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/tryCatchExpression.kt @@ -0,0 +1,13 @@ +class A { + val p : Int = try{ + 1 + } catch(e: Exception) { + throw RuntimeException() + } +} + +fun box() : String { + if (A().p != 1) return "fail 1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/when.kt b/backend.native/tests/external/codegen/blackbox/lazyCodegen/when.kt new file mode 100644 index 00000000000..3953b4f0b2c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/when.kt @@ -0,0 +1,15 @@ +class A (val p: String) { + + val _kind: String = when { + p == "test" -> "OK" + else -> "fail" + } + +} + +fun box(): String { + + if (A("test")._kind != "OK") return "fail" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInInitializer.kt b/backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInInitializer.kt new file mode 100644 index 00000000000..ef9b826ff07 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInInitializer.kt @@ -0,0 +1,13 @@ +class A { + var a: String = "Fail" + + init { + a = object { + override fun toString(): String = "OK" + }.toString() + } +} + +fun box() : String { + return A().a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInParameterInitializer.kt b/backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInParameterInitializer.kt new file mode 100644 index 00000000000..e5a27ccdbc4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/anonymousObjectInParameterInitializer.kt @@ -0,0 +1,9 @@ +class A( + val a: String = object { + override fun toString(): String = "OK" + }.toString() +) + +fun box() : String { + return A().a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/closureOfInnerLocalClass.kt b/backend.native/tests/external/codegen/blackbox/localClasses/closureOfInnerLocalClass.kt new file mode 100644 index 00000000000..c01ad313420 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/closureOfInnerLocalClass.kt @@ -0,0 +1,28 @@ +// Enable for JVM backend when KT-8120 gets fixed +// TARGET_BACKEND: JS + +fun box(): String { + var log = "" + + var s: Any? = null + for (t in arrayOf("1", "2", "3")) { + class C() { + val y = t + + inner class D() { + fun copyOuter() = C() + } + } + + if (s == null) { + s = C() + } + + val c = (s as C).D().copyOuter() + log += c.y + } + + if (log != "111") return "fail: ${log}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/closureOfLambdaInLocalClass.kt b/backend.native/tests/external/codegen/blackbox/localClasses/closureOfLambdaInLocalClass.kt new file mode 100644 index 00000000000..3cae7289280 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/closureOfLambdaInLocalClass.kt @@ -0,0 +1,38 @@ +fun box(): String { + var log = "" + + var s: Any? = null + for (t in arrayOf("1", "2", "3")) { + class A() { + fun foo() = { t } + } + + if (s == null) { + s = A() + } + + log += (s as A).foo()() + } + + if (log != "111") return "fail1: ${log}" + + s = null + log = "" + for (t in arrayOf("1", "2", "3")) { + class B() { + val y = t + + fun foo() = { y } + } + + if (s == null) { + s = B() + } + + log += (s as B).foo()() + } + + if (log != "111") return "fail2: ${log}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/closureWithSelfInstantiation.kt b/backend.native/tests/external/codegen/blackbox/localClasses/closureWithSelfInstantiation.kt new file mode 100644 index 00000000000..206ccc3d5f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/closureWithSelfInstantiation.kt @@ -0,0 +1,78 @@ +// Enable for JVM backend when KT-8120 gets fixed +// TARGET_BACKEND: JS + +fun box(): String { + val capturedInConstructor = 1 + val capturedInBody = 10 + var log = "" + + class A(var x: Int) { + var y = 0 + + fun copy(): A { + log += "A.copy;" + val result = A(x) + result.y += capturedInBody + return result + } + + init { + log += "A.;" + y += x + capturedInConstructor + } + } + + val a = A(100).copy() + if (a.y != 111) return "fail1a: ${a.y}" + if (a.x != 100) return "fail1b: ${a.x}" + + + class B(var x: Int) { + var y = 0 + + fun copier(): () -> B { + log += "B.copier;" + return { + log += "B.copy;" + val result = B(x) + result.y += capturedInBody + result + } + } + + init { + y += x + capturedInConstructor + log += "B.;" + } + } + + val b = B(100).copier()() + if (b.y != 111) return "fail2a: ${b.y}" + if (b.x != 100) return "fail2b: ${b.x}" + + class C(var x: Int) { + var y = 0 + + inner class D() { + fun copyOuter(): C { + log += "D.copyOuter;" + val result = C(x) + result.y += capturedInBody + return result + } + } + + init { + log += "C.;" + y += x + capturedInConstructor + } + } + + val c = C(100).D().copyOuter() + if (c.y != 111) return "fail3a: ${c.y}" + if (c.x != 100) return "fail3b: ${c.x}" + + if (log != "A.;A.copy;A.;B.;B.copier;B.copy;B.;C.;D.copyOuter;C.;") return "fail_log: $log" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/inExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/localClasses/inExtensionFunction.kt new file mode 100644 index 00000000000..0a4fbfbbbf0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/inExtensionFunction.kt @@ -0,0 +1,17 @@ +package test + +fun A.a(): String { + class B { + val b : String + get() = this@a.s + } + return B().b +} + +class A { + val s : String = "OK" +} + +fun box() : String { + return A().a() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/inExtensionProperty.kt b/backend.native/tests/external/codegen/blackbox/localClasses/inExtensionProperty.kt new file mode 100644 index 00000000000..6b0ed7cb97d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/inExtensionProperty.kt @@ -0,0 +1,18 @@ +package test + +val A.a: String + get() { + class B { + val b : String + get() = this@a.s + } + return B().b + } + +class A { + val s : String = "OK" +} + +fun box() : String { + return A().a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionFunction.kt new file mode 100644 index 00000000000..d7231d40d3d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionFunction.kt @@ -0,0 +1,24 @@ +package test + +class C(val s : String) { + fun A.a(): String { + class B { + val b : String + get() = this@a.s + this@C.s + } + return B().b + } + + fun test(a : A) : String { + return a.a() + } +} + +class A(val s: String) { + + +} + +fun box() : String { + return C("K").test(A("O")) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionProperty.kt b/backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionProperty.kt new file mode 100644 index 00000000000..6a628f41320 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/inLocalExtensionProperty.kt @@ -0,0 +1,23 @@ +package test + +class C(val s : String) { + val A.a: String + get() { + class B { + val b : String + get() = this@a.s + this@C.s + } + return B().b + } + + fun test(a : A) : String { + return a.a + } +} + +class A(val s: String) { +} + +fun box() : String { + return C("K").test(A("O")) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/innerClassInLocalClass.kt b/backend.native/tests/external/codegen/blackbox/localClasses/innerClassInLocalClass.kt new file mode 100644 index 00000000000..72d84e5ddac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/innerClassInLocalClass.kt @@ -0,0 +1,17 @@ +class A { + val a = 1 + fun calc () : Int { + class B() { + val b = 2 + inner class C { + val c = 3 + fun calc() = this@A.a + this@B.b + this.c + } + } + return B().C().calc() + } +} + +fun box() : String { + return if (A().calc() == 6) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/innerOfLocalCaptureExtensionReceiver.kt b/backend.native/tests/external/codegen/blackbox/localClasses/innerOfLocalCaptureExtensionReceiver.kt new file mode 100644 index 00000000000..ba3a0df632a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/innerOfLocalCaptureExtensionReceiver.kt @@ -0,0 +1,15 @@ +fun String.bar(): String { + open class Local { + fun result() = this@bar + } + + class Outer { + inner class Inner : Local() { + fun outer() = this@Outer + } + } + + return Outer().Inner().result() +} + +fun box() = "OK".bar() diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/kt2700.kt b/backend.native/tests/external/codegen/blackbox/localClasses/kt2700.kt new file mode 100644 index 00000000000..3baacf0b21f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/kt2700.kt @@ -0,0 +1,17 @@ +package a.b + +interface Test { + fun invoke(): String { + return "OK" + } +} + +private val a : Test = { + object : Test { + + } +}() + +fun box(): String { + return a.invoke(); +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/kt2873.kt b/backend.native/tests/external/codegen/blackbox/localClasses/kt2873.kt new file mode 100644 index 00000000000..6bb8dafadfd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/kt2873.kt @@ -0,0 +1,15 @@ +fun foo() : String { + val u = { + class B(val data : String) + B("OK").data + } + return u() +} + +fun main(args: Array) { + foo() +} + +fun box(): String { + return foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/kt3210.kt b/backend.native/tests/external/codegen/blackbox/localClasses/kt3210.kt new file mode 100644 index 00000000000..12c9b1cba6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/kt3210.kt @@ -0,0 +1,32 @@ +package org.example + +interface SomeTrait {} + +interface KotlinProcessor { + fun execute(callback: KotlinCallback?); +} + +interface KotlinCallback { + fun on(t : T); +} + +public class Test(name : String) : KotlinProcessor { + public override fun execute(callback: KotlinCallback?) { + if(callback != null) { + class InlineTrait : SomeTrait {} + + var inlineTrait = InlineTrait() + callback.on(inlineTrait) + } + } +} + +fun box() : String { + var f = "fail" + Test("OK").execute(object : KotlinCallback { + override fun on(t: SomeTrait) { + f = "OK" + } + }) + return f +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/kt3389.kt b/backend.native/tests/external/codegen/blackbox/localClasses/kt3389.kt new file mode 100644 index 00000000000..abb515b1688 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/kt3389.kt @@ -0,0 +1,14 @@ +package t + +class Reproduce { + + fun test(): String { + data class Foo(val bar: String, val baz: Int) + val foo = Foo("OK", 5) + return foo.bar + } +} + +fun box() : String { + return Reproduce().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/kt3584.kt b/backend.native/tests/external/codegen/blackbox/localClasses/kt3584.kt new file mode 100644 index 00000000000..21cdb764faa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/kt3584.kt @@ -0,0 +1,13 @@ +fun box(): String { + val s = "captured"; + + class A(val param: String = "OK") { + val s2 = s + param + } + + if (A().s2 != "capturedOK") return "fail 1: ${A().s2}" + + if (A("Test").s2 != "capturedTest") return "fail 2: ${A("Test").s2}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/kt4174.kt b/backend.native/tests/external/codegen/blackbox/localClasses/kt4174.kt new file mode 100644 index 00000000000..56a73053979 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/kt4174.kt @@ -0,0 +1,25 @@ +open class C(val s: String) { + fun test(): String { + return s + } +} + +class B(var x: String) { + fun foo(): String { + var s = "OK" + class Z : C(s) {} + return Z().test() + } + + fun foo2(): String { + class Y : C(x) {} + return Y().test() + } +} + + +fun box(): String { + val b = B("OK") + if (b.foo() != "OK") return "fail: ${b.foo()}" + return b.foo2() +} diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/localClass.kt b/backend.native/tests/external/codegen/blackbox/localClasses/localClass.kt new file mode 100644 index 00000000000..d8cdb7552fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/localClass.kt @@ -0,0 +1,12 @@ +class A { + fun a () : String { + class B() { + fun s() : String = "OK" + } + return B().s() + } +} + +fun box() : String { + return A().a() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/localClassCaptureExtensionReceiver.kt b/backend.native/tests/external/codegen/blackbox/localClasses/localClassCaptureExtensionReceiver.kt new file mode 100644 index 00000000000..89ee7e3754f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/localClassCaptureExtensionReceiver.kt @@ -0,0 +1,14 @@ +class Outer { + fun String.id(): String { + class Local(unused: Long) { + fun result() = this@id + fun outer() = this@Outer + } + + return Local(42L).result() + } + + fun result(): String = "OK".id() +} + +fun box() = Outer().result() diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/localClassInInitializer.kt b/backend.native/tests/external/codegen/blackbox/localClasses/localClassInInitializer.kt new file mode 100644 index 00000000000..0dafae38048 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/localClassInInitializer.kt @@ -0,0 +1,19 @@ +class A { + var a: String = "Fail" + + init { + open class B() { + open fun s() : String = "O" + } + + val o = object : B() { + override fun s(): String = "K" + } + + a = B().s() + o.s() + } +} + +fun box() : String { + return A().a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/localClassInParameterInitializer.kt b/backend.native/tests/external/codegen/blackbox/localClasses/localClassInParameterInitializer.kt new file mode 100644 index 00000000000..2b5c62666e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/localClassInParameterInitializer.kt @@ -0,0 +1,17 @@ +class A( + val a: String = { + open class B() { + open fun s() : String = "O" + } + + val o = object : B() { + override fun s(): String = "K" + } + + B().s() + o.s() + }() +) + +fun box() : String { + return A().a +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/localDataClass.kt b/backend.native/tests/external/codegen/blackbox/localClasses/localDataClass.kt new file mode 100644 index 00000000000..33cf16258d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/localDataClass.kt @@ -0,0 +1,17 @@ +fun box(): String { + val capturedInConstructor = 1 + + data class A(var x: Int) { + var y = 0 + + init { + y += x + capturedInConstructor + } + } + + val a = A(100).copy() + if (a.y != 101) return "fail1a: ${a.y}" + if (a.x != 100) return "fail1b: ${a.x}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/localExtendsInnerAndReferencesOuterMember.kt b/backend.native/tests/external/codegen/blackbox/localClasses/localExtendsInnerAndReferencesOuterMember.kt new file mode 100644 index 00000000000..f5520406363 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/localExtendsInnerAndReferencesOuterMember.kt @@ -0,0 +1,14 @@ +class A { + fun box(): String { + class Local : Inner() { + val u = foo() + } + val u = Local().u + return if (u == 42) "OK" else "Fail $u" + } + + open inner class Inner + fun foo() = 42 +} + +fun box() = A().box() diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/noclosure.kt b/backend.native/tests/external/codegen/blackbox/localClasses/noclosure.kt new file mode 100644 index 00000000000..8f9417505e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/noclosure.kt @@ -0,0 +1,11 @@ +fun box(): String { + open class K { + val o = "O" + } + + class Bar : K() { + val k = "K" + } + + return K().o + Bar().k +} diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/object.kt b/backend.native/tests/external/codegen/blackbox/localClasses/object.kt new file mode 100644 index 00000000000..a96a9237f68 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/object.kt @@ -0,0 +1,7 @@ +fun box(): String { + val k = object { + val ok = "OK" + } + + return k.ok +} diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/ownClosureOfInnerLocalClass.kt b/backend.native/tests/external/codegen/blackbox/localClasses/ownClosureOfInnerLocalClass.kt new file mode 100644 index 00000000000..c978f8b9c62 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/ownClosureOfInnerLocalClass.kt @@ -0,0 +1,24 @@ +fun box(): String { + var log = "" + + var s: Any? = null + for (t in arrayOf("1", "2", "3")) { + class C() { + val y = t + + inner class D() { + fun foo() = "($y;$t)" + } + } + + if (s == null) { + s = C() + } + + log += (s as C).D().foo() + } + + if (log != "(1;1)(1;1)(1;1)") return "fail: ${log}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/withclosure.kt b/backend.native/tests/external/codegen/blackbox/localClasses/withclosure.kt new file mode 100644 index 00000000000..b9dc2f5bee3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/withclosure.kt @@ -0,0 +1,8 @@ +fun box(): String { + val x = "OK" + class Aaa { + val y = x + } + + return Aaa().y +} diff --git a/backend.native/tests/external/codegen/blackbox/mangling/field.kt b/backend.native/tests/external/codegen/blackbox/mangling/field.kt new file mode 100644 index 00000000000..389a0e00412 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/field.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package test + +internal val noMangling = 1; + +class Z { + internal var noMangling = 1; +} + +fun box(): String { + val clazz = Z::class.java + val classField = clazz.getDeclaredField("noMangling") + if (classField == null) return "Class internal backing field should exist" + + val topLevel = Class.forName("test.FieldKt").getDeclaredField("noMangling") + if (topLevel == null) return "Top level internal backing field should exist" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/mangling/fun.kt b/backend.native/tests/external/codegen/blackbox/mangling/fun.kt new file mode 100644 index 00000000000..a60718ec110 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/fun.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package test + +internal fun noMangling() = 1; + +class Z { + internal fun mangled() = 1; +} + +fun box(): String { + val clazz = Z::class.java + val declaredMethods = clazz.declaredMethods + + val mangled = declaredMethods.firstOrNull { + it.name.startsWith("mangled$") + } + if (mangled == null) return "Class internal function should exist" + + val topLevel = Class.forName("test.FunKt").getMethod("noMangling") + if (topLevel == null) return "Top level internal function should exist" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/mangling/internalOverride.kt b/backend.native/tests/external/codegen/blackbox/mangling/internalOverride.kt new file mode 100644 index 00000000000..b8ac1e207a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/internalOverride.kt @@ -0,0 +1,29 @@ +open class A { + internal open val field = "AF" + + internal open fun test(): String = "AM" +} + +fun invokeOnA(a: A) = a.test() + a.field + +class Z : A() { + override val field: String = "ZF" + + override fun test(): String = "ZM" +} + +fun box() : String { + var invokeOnA = invokeOnA(A()) + if (invokeOnA != "AMAF") return "fail 1: $invokeOnA" + + invokeOnA = invokeOnA(Z()) + if (invokeOnA != "ZMZF") return "fail 2: $invokeOnA" + + val z = Z().test() + if (z != "ZM") return "fail 3: $z" + + val f = Z().field + if (f != "ZF") return "fail 4: $f" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/mangling/internalOverrideSuperCall.kt b/backend.native/tests/external/codegen/blackbox/mangling/internalOverrideSuperCall.kt new file mode 100644 index 00000000000..64424c1dd80 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/internalOverrideSuperCall.kt @@ -0,0 +1,21 @@ +open class A { + internal open val field = "F" + + internal open fun test(): String = "A" +} + +class Z : A() { + override fun test(): String = super.test() + + override val field = super.field +} + +fun box() : String { + val z = Z().test() + if (z != "A") return "fail 1: $z" + + val f = Z().field + if (f != "F") return "fail 2: $f" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt b/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt new file mode 100644 index 00000000000..a4c370be34f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass extends A { + public String test() { + return "Java"; + } +} + +// FILE: test.kt + +open class A { + internal open fun test(): String = "Kotlin" +} + +fun box(): String { + if (A().test() != "Kotlin") return "fail 1: ${A().test()}" + + if (JavaClass().test() != "Java") return "fail 2: ${JavaClass().test()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/mangling/publicOverride.kt b/backend.native/tests/external/codegen/blackbox/mangling/publicOverride.kt new file mode 100644 index 00000000000..0087a1fbc66 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/publicOverride.kt @@ -0,0 +1,29 @@ +open class A { + internal open val field = "AF" + + internal open fun test(): String = "AM" +} + +fun invokeOnA(a: A) = a.test() + a.field + +class Z : A() { + public override val field: String = "ZF" + + public override fun test(): String = "ZM" +} + +fun box() : String { + var invokeOnA = invokeOnA(A()) + if (invokeOnA != "AMAF") return "fail 1: $invokeOnA" + + invokeOnA = invokeOnA(Z()) + if (invokeOnA != "ZMZF") return "fail 2: $invokeOnA" + + val z = Z().test() + if (z != "ZM") return "fail 3: $z" + + val f = Z().field + if (f != "ZF") return "fail 4: $f" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/mangling/publicOverrideSuperCall.kt b/backend.native/tests/external/codegen/blackbox/mangling/publicOverrideSuperCall.kt new file mode 100644 index 00000000000..422f510101e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/publicOverrideSuperCall.kt @@ -0,0 +1,21 @@ +open class A { + internal open val field = "F" + + internal open fun test(): String = "A" +} + +class Z : A() { + public override fun test(): String = super.test() + + public override val field = super.field +} + +fun box() : String { + val z = Z().test() + if (z != "A") return "fail 1: $z" + + val f = Z().field + if (f != "F") return "fail 2: $f" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/ComplexInitializer.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/ComplexInitializer.kt new file mode 100644 index 00000000000..14e38239d17 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/ComplexInitializer.kt @@ -0,0 +1,12 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + +fun A.getA() = this + +fun box() : String { + val (a, b) = A().getA().getA() + + return if (a == 1 && b == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVals.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVals.kt new file mode 100644 index 00000000000..9f438f3fe71 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVals.kt @@ -0,0 +1,9 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + +fun box() : String { + val (a, b) = A() + return if (a == 1 && b == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleValsExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleValsExtensions.kt new file mode 100644 index 00000000000..cab08120cb0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleValsExtensions.kt @@ -0,0 +1,10 @@ +class A { +} + +operator fun A.component1() = 1 +operator fun A.component2() = 2 + +fun box() : String { + val (a, b) = A() + return if (a == 1 && b == 2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVarsExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVarsExtensions.kt new file mode 100644 index 00000000000..525d1234901 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/SimpleVarsExtensions.kt @@ -0,0 +1,10 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + +fun box() : String { + var (a, b) = A() + a = b + return if (a == 2 && b == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/UnderscoreNames.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/UnderscoreNames.kt new file mode 100644 index 00000000000..12dfc941fb6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/UnderscoreNames.kt @@ -0,0 +1,14 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + +fun box() : String { + val (_, b) = A() + + val (a, _) = A() + + val (`_`, c) = A() + + return if (a == 1 && b == 2 && _ == 1 && c == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInFunctionLiteral.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInFunctionLiteral.kt new file mode 100644 index 00000000000..4bf9bdcd08c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInFunctionLiteral.kt @@ -0,0 +1,13 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + +fun box() : String { + val (a, b) = A() + + val run = { + a + } + return if (run() == 1 && b == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInLocalFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInLocalFunction.kt new file mode 100644 index 00000000000..91dfb1d7eb5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInLocalFunction.kt @@ -0,0 +1,13 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + +fun box() : String { + val (a, b) = A() + + fun run(): Int { + return a + } + return if (run() == 1 && b == 2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInObjectLiteral.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInObjectLiteral.kt new file mode 100644 index 00000000000..9e194386e6a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/ValCapturedInObjectLiteral.kt @@ -0,0 +1,16 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + + +fun box() : String { + val (a, b) = A() + + val local = object { + public fun run() : Int { + return a + } + } + return if (local.run() == 1 && b == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInFunctionLiteral.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInFunctionLiteral.kt new file mode 100644 index 00000000000..e0eb2cb5edd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInFunctionLiteral.kt @@ -0,0 +1,15 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + + +fun box() : String { + var (a, b) = A() + + val local = { + a = 3 + } + local() + return if (a == 3 && b == 2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInLocalFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInLocalFunction.kt new file mode 100644 index 00000000000..5c2a87c9d65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInLocalFunction.kt @@ -0,0 +1,15 @@ +class A { +} + +operator fun A.component1() = 1 +operator fun A.component2() = 2 + +fun box() : String { + var (a, b) = A() + + fun local() { + a = 3 + } + local() + return if (a == 3 && b == 2) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInObjectLiteral.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInObjectLiteral.kt new file mode 100644 index 00000000000..48534b362c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/VarCapturedInObjectLiteral.kt @@ -0,0 +1,17 @@ +class A { + operator fun component1() = 1 + operator fun component2() = 2 +} + + +fun box() : String { + var (a, b) = A() + + val local = object { + public fun run() { + a = 3 + } + } + local.run() + return if (a == 3 && b == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/component.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/component.kt new file mode 100644 index 00000000000..efd446f8df6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/component.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +class S(val a: String, val b: String) { + operator fun component1() : String = a + operator fun component2() : String = b +} + +operator fun S.component3() = ((a + b) as String).substring(2) + +class Tester() { + fun box() : String { + val (o,k,ok,ok2) = S("O","K") + return o + k + ok + ok2 + } + + operator fun S.component4() = ((a + b) as String).substring(2) +} + +fun box() = Tester().box() diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclFor.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclFor.kt new file mode 100644 index 00000000000..d3fce253d5a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclFor.kt @@ -0,0 +1,21 @@ +class C(val i: Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 +} + +fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..fb470307de3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentExtensions.kt @@ -0,0 +1,22 @@ +class C(val i: Int) { +} + +operator fun C.component1() = i + 1 +operator fun C.component2() = i + 2 + +fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..344e2051fc9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,24 @@ +class C(val i: Int) { +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 + + fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val l = ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..2b223cd505e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,24 @@ +class C(val i: Int) { +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 +} + +fun M.doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForValCaptured.kt new file mode 100644 index 00000000000..a744e0370ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/MultiDeclForValCaptured.kt @@ -0,0 +1,21 @@ +class C(val i: Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 +} + +fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(C(0)) + l.add(C(1)) + l.add(C(2)) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..e9facb62192 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt @@ -0,0 +1,19 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(0) + l.add(1) + l.add(2) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..7afc1023d61 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,19 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(0) + l.add(1) + l.add(2) + val s = doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..499b2e18356 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,21 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 + + fun doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val l = ArrayList() + l.add(0) + l.add(1) + l.add(2) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..b20eb9d7453 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,21 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 +} + +fun M.doTest(l : ArrayList): String { + var s = "" + for ((a, b) in l) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val l = ArrayList() + l.add(0) + l.add(1) + l.add(2) + val s = M().doTest(l) + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclFor.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclFor.kt new file mode 100644 index 00000000000..ceabb3396b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclFor.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + operator fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, b) in C(0)..C(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..edcd9c1188e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentExtensions.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun rangeTo(c: C) = Range(this, c) +} +operator fun C.component1() = i + 1 +operator fun C.component2() = i + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in C(0)..C(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..3692148f5b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,38 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun rangeTo(c: C) = Range(this, c) +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in C(0)..C(2)) { + s += "$a:$b;" + } + return s + } +} + + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..80258eee8e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,37 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun rangeTo(c: C) = Range(this, c) +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in C(0)..C(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForValCaptured.kt new file mode 100644 index 00000000000..4687822bb09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/MultiDeclForValCaptured.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + operator fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, b) in C(0)..C(2)) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNames.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNames.kt new file mode 100644 index 00000000000..ff9d07f1f46 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNames.kt @@ -0,0 +1,43 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + operator fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, _) in C(0)..C(2)) { + s += "$a;" + } + + for ((_, b) in C(1)..C(3)) { + s += "$b;" + } + + for ((_, `_`) in C(2)..C(4)) { + s += "$_;" + } + + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1;2;3;3;4;5;4;5;6;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt new file mode 100644 index 00000000000..644125c9809 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt @@ -0,0 +1,15 @@ +class A { + operator fun component1() = "O" + operator fun component2(): String = throw RuntimeException("fail 0") + operator fun component3() = "K" +} + +fun box(): String { + val aA = Array(1) { A() } + + for ((x, _, z) in aA) { + return x + z + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt new file mode 100644 index 00000000000..1c746927ffc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + infix fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, b) in C(0) rangeTo C(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..2a3ce2cf5b7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + infix fun rangeTo(c: C) = Range(this, c) +} +operator fun C.component1() = i + 1 +operator fun C.component2() = i + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in C(0) rangeTo C(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..86973dd8f4f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,38 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun rangeTo(c: C) = Range(this, c) +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in C(0).rangeTo(C(2))) { + s += "$a:$b;" + } + return s + } +} + + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..43c353d5735 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,37 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + infix fun rangeTo(c: C) = Range(this, c) +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in C(0) rangeTo C(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt new file mode 100644 index 00000000000..b09acb4b8aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + infix fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, b) in C(0) rangeTo C(2)) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..68454565301 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt @@ -0,0 +1,15 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..f1d711a42e2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,15 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..b5cade5f662 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,17 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..22ed58c8d10 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,17 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..132c532501f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt @@ -0,0 +1,15 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..fcb229e7f75 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,15 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..664233c2d14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,17 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..99e71d259f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,17 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt new file mode 100644 index 00000000000..be1dacd3f39 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, b) in C(0).rangeTo(C(2))) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..08eb7d8914d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + fun rangeTo(c: C) = Range(this, c) +} +operator fun C.component1() = i + 1 +operator fun C.component2() = i + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in C(0).rangeTo(C(2))) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..1efc37832ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,38 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + fun rangeTo(c: C) = Range(this, c) +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in C(0).rangeTo(C(2))) { + s += "$a:$b;" + } + return s + } +} + + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..7daff02f89c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,37 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + fun rangeTo(c: C) = Range(this, c) +} + +class M { + operator fun C.component1() = i + 1 + operator fun C.component2() = i + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in C(0).rangeTo(C(2))) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt new file mode 100644 index 00000000000..8df7e251bf5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt @@ -0,0 +1,34 @@ +class Range(val from : C, val to: C) { + operator fun iterator() = It(from, to) +} + +class It(val from: C, val to: C) { + var c = from.i + + operator fun next(): C { + val next = C(c) + c++ + return next + } + + operator fun hasNext(): Boolean = c <= to.i +} + +class C(val i : Int) { + operator fun component1() = i + 1 + operator fun component2() = i + 2 + fun rangeTo(c: C) = Range(this, c) +} + +fun doTest(): String { + var s = "" + for ((a, b) in C(0).rangeTo(C(2))) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..68454565301 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt @@ -0,0 +1,15 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..f1d711a42e2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,15 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..b5cade5f662 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,17 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..22ed58c8d10 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,17 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in 0.rangeTo(2)) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..c8bc4ce6e61 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt @@ -0,0 +1,23 @@ +fun f(l : Long) { + l.rangeTo(l) +} +fun box(): String { + return "OK" +} + + +//operator fun Long.component1() = this + 1 +//operator fun Long.component2() = this + 2 +// +//fun doTest(): String { +// var s = "" +// for ((a, b) in 0.toLong().rangeTo(2.toLong())) { +// s += "$a:$b;" +// } +// return s +//} +// +//fun box(): String { +// val s = doTest() +// return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +//} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..fcb229e7f75 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,15 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..664233c2d14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,17 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..99e71d259f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,17 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in 0.toLong().rangeTo(2.toLong())) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..5f60ba33287 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt @@ -0,0 +1,15 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0..2) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..fd0f6dac885 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,15 @@ +operator fun Int.component1() = this + 1 +operator fun Int.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0..2) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..e1a6673c11a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,17 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in 0..2) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..1a20e756f0f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,17 @@ +class M { + operator fun Int.component1() = this + 1 + operator fun Int.component2() = this + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in 0..2) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt new file mode 100644 index 00000000000..85f78eabcdc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt @@ -0,0 +1,15 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong()..2.toLong()) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt new file mode 100644 index 00000000000..8bf72ec08d7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt @@ -0,0 +1,15 @@ +operator fun Long.component1() = this + 1 +operator fun Long.component2() = this + 2 + +fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong()..2.toLong()) { + s += {"$a:$b;"}() + } + return s +} + +fun box(): String { + val s = doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt new file mode 100644 index 00000000000..a11156329f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt @@ -0,0 +1,17 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 + + fun doTest(): String { + var s = "" + for ((a, b) in 0.toLong()..2.toLong()) { + s += "$a:$b;" + } + return s + } +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt new file mode 100644 index 00000000000..3ee641f67f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt @@ -0,0 +1,17 @@ +class M { + operator fun Long.component1() = this + 1 + operator fun Long.component2() = this + 2 +} + +fun M.doTest(): String { + var s = "" + for ((a, b) in 0.toLong()..2.toLong()) { + s += "$a:$b;" + } + return s +} + +fun box(): String { + val s = M().doTest() + return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/kt9828_hashMap.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/kt9828_hashMap.kt new file mode 100644 index 00000000000..8793aef1b14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/kt9828_hashMap.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME + +fun box(): String { + val hashMap = HashMap() + hashMap.put("one", 1) + hashMap.put("two", 2) + for ((key, value) in hashMap) { + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/returnInElvis.kt b/backend.native/tests/external/codegen/blackbox/multiDecl/returnInElvis.kt new file mode 100644 index 00000000000..9f381d75225 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/returnInElvis.kt @@ -0,0 +1,22 @@ +data class Z(val p: String, val k: String) + + +fun create(p: Boolean): Z? { + return if (p) { + Z("O", "K") + } + else { + null; + } +} + +fun test(p: Boolean): String { + val (a, b) = create(p) ?: return "null" + return a + b +} + +fun box(): String { + if (test(false) != "null") return "fail 1: ${test(false)}" + + return test(true) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt new file mode 100644 index 00000000000..15f84a670f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: box.kt + +package test + +import b.bar + +fun box(): String = bar() + +// FILE: caller.kt + +package b + +import a.foo + +fun bar(): String = foo() + +// FILE: multifileClass.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +fun foo(): String = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt new file mode 100644 index 00000000000..b3a4e722da9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1.kt + +import a.* + +fun box(): String { + if (foo() != "OK") return "Fail function" + if (constOK != "OK") return "Fail const" + if (valOK != "OK") return "Fail val" + varOK = "OK" + if (varOK != "OK") return "Fail var" + + return "OK" +} + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +fun foo(): String = "OK" +const val constOK: String = "OK" +val valOK: String = "OK" +var varOK: String = "Hmmm?" diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt new file mode 100644 index 00000000000..8321c2fa48e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: 1.kt + +import a.OK + +fun box(): String { + val okRef = ::OK + + val annotations = okRef.annotations + if (annotations.size != 1) { + return "Failed, annotations: $annotations" + } + + return okRef.get() +} + +// FILE: 2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +annotation class A + +@A +const val OK: String = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt new file mode 100644 index 00000000000..f73279c3667 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: box.kt + +package test + +import a.foo + +fun box(): String = foo { "OK" } + +// FILE: foo.kt + +@file:[JvmName("A") JvmMultifileClass] +package a + +inline fun foo(body: () -> String): String = zee(body()) + +// FILE: zee.kt + +@file:[JvmName("A") JvmMultifileClass] +package a + +public fun zee(x: String): String = x diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt new file mode 100644 index 00000000000..100835833e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt @@ -0,0 +1,38 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: box.kt + +import a.* + +fun box(): String = OK + +// FILE: part1.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val O: String = "O" + +// FILE: part2.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val K: String = "K" + +// FILE: part3.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val OK: String = O + K + +// FILE: irrelevant.kt + +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val X: Nothing = throw AssertionError("X should not be initialized") + diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt new file mode 100644 index 00000000000..91f6d1df1d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = "K" + +// FILE: foo.kt + +@file:[JvmName("Util") JvmMultifileClass] +public fun foo(): String = "O" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt new file mode 100644 index 00000000000..d94dcffa63e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = barx() + +public fun foox(): String = "O" + +// FILE: foo.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun foo(): String = foox() + +public fun barx(): String = "K" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt new file mode 100644 index 00000000000..13257d5f58b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = barx() + +private fun barx(): String = "K" + +// FILE: foo.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun foo(): String = foox() + +private fun foox(): String = "O" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt new file mode 100644 index 00000000000..0d13be7ca55 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = (::ok)() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +fun ok() = "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt new file mode 100644 index 00000000000..ca6fc4d1684 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = okInline() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +internal val ok = run { "OK" } + +internal inline fun okInline() = + ::ok.get() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt new file mode 100644 index 00000000000..7a27fc8cdb0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = OK.okRef.get() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private val ok = run { "OK" } + +object OK { + val okRef = ::ok +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt new file mode 100644 index 00000000000..aaa7a4166d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = ::OK.get() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val OK = run { "OK" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt new file mode 100644 index 00000000000..bdee592eae1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = barx() + +public fun foox(): String = "O" + +// FILE: foo.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun foo(): String = foox() + +public fun barx(): String = "K" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt new file mode 100644 index 00000000000..b629685d651 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt @@ -0,0 +1,42 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = OK + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val O = run { "O" } + +// FILE: part2.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +const val K = "K" + +// FILE: part3.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val OK: String = run { O + K } + +// FILE: irrelevantPart.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val X1: Nothing = + throw AssertionError("X1 should not be initialized") + +// FILE: reallyIrrelevantPart.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val X2: Nothing = + throw AssertionError("X2 should not be initialized") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt new file mode 100644 index 00000000000..4027459bad3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = OK + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val OK: String by lazy { "OK" } \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt new file mode 100644 index 00000000000..c3a023375e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = ok() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private val OK = run { "OK" } + +fun ok() = OK \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt new file mode 100644 index 00000000000..c8107509fde --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = OK + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +public val OK = run { "OK" } diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt new file mode 100644 index 00000000000..3d163158d70 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = ok() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private fun overlapping() = "oops #1" + +// FILE: part2.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private fun overlapping() = "OK" + +fun ok() = overlapping() + +// FILE: part3.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private fun overlapping() = "oops #2" diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt new file mode 100644 index 00000000000..dfd668b8539 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = ok() + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private val overlapping = run { "oops #1" } + +// FILE: part2.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private val overlapping = run { "OK" } + +fun ok() = overlapping + +// FILE: part3.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private val overlapping = run { "oops #2" } diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt new file mode 100644 index 00000000000..d580bddf00a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = J.ok() + +// FILE: part1.kt +@file:[JvmName("MC") JvmMultifileClass] +package a + +val O = run { "O" } +const val K = "K" + +inline fun ok(): String { + return O + K +} + +// FILE: J.java +import a.MC; + +public class J { + public static String ok() { + return MC.ok(); + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt new file mode 100644 index 00000000000..27d37a53101 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = ok {} + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +val O = run { "O" } +const val K = "K" + +inline fun ok(block: () -> Unit): String { + block() + return O + K +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt new file mode 100644 index 00000000000..7560746a303 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS +// FILE: box.kt + +import a.* + +fun box(): String = OK().ok + +// FILE: part1.kt +@file:[JvmName("MultifileClass") JvmMultifileClass] +package a + +private val reallyOk = run { "OK" } + +class OK() { + val ok = reallyOk +} diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt new file mode 100644 index 00000000000..3915ab9f80c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: foo.kt +@file:JvmName("Util") +@file:JvmMultifileClass +package test + +private const val x = "O" + +fun foo() = x + +// FILE: bar.kt +@file:JvmName("Util") +@file:JvmMultifileClass +package test + +private const val x = "K" + +fun bar() = x + +// FILE: test.kt +package test + +fun box(): String = foo() + bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt new file mode 100644 index 00000000000..21d03a144af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1/part.kt + +@file:JvmName("Foo") +@file:JvmMultifileClass +package test + +fun foo(): String = "O" + +// FILE: 2/part.kt + +@file:JvmName("Bar") +@file:JvmMultifileClass +package test + +fun bar(): String = "K" + +// FILE: box.kt + +package test + +fun box(): String = foo() + bar() diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt6895.kt b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt6895.kt new file mode 100644 index 00000000000..4e6fb1160a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt6895.kt @@ -0,0 +1,26 @@ +// TARGET_BACKEND: JVM + +// WITH_RUNTIME + +import java.util.concurrent.locks.ReentrantReadWriteLock +import kotlin.concurrent.write + +class UpdateableThing { + private val lock = ReentrantReadWriteLock() + private var updateCount = 0 + + fun performUpdates(block: () -> T): T { + lock.write { + ++updateCount + val result = block() + --updateCount + + return result + } + } +} + + +fun box(): String { + return UpdateableThing().performUpdates { "OK" } +} diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt9644let.kt b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt9644let.kt new file mode 100644 index 00000000000..2972f593a56 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/kt9644let.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME + +fun foo() { + with(1) { + return (1..2).forEach { it } + } +} + +fun box(): String { + foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt new file mode 100644 index 00000000000..cf3088cc0dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt @@ -0,0 +1,177 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import java.io.Closeable + +class MyException(message: String) : Exception(message) + +class Holder(var value: String) { + operator fun plusAssign(s: String?) { + value += s + if (s != "closed") { + value += "->" + } + } +} + +class TestLocal() : Closeable { + + var status = Holder("") + + private fun underMutexFun() { + status += "called" + } + + fun local(): Holder { + use { + underMutexFun() + } + return status + } + + + fun nonLocalSimple(): Holder { + use { + underMutexFun() + return status + } + return Holder("fail") + } + + fun nonLocalWithException(): Holder { + use { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += e.message!! + return status + } + } + return Holder("fail") + } + + fun nonLocalWithFinally(): Holder { + use { + try { + underMutexFun() + return Holder("fail") + } finally { + status += "finally" + return status + } + } + return Holder("fail") + } + + fun nonLocalWithExceptionAndFinally(): Holder { + use { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += e.message + return status + } finally { + status += "finally" + } + } + return Holder("fail") + } + + fun nonLocalWithExceptionAndFinallyWithReturn(): Holder { + use { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += e.message + return Holder("fail") + } finally { + status += "finally" + return status + } + } + return Holder("fail") + } + + fun nonLocalNestedWithException(): Holder { + use { + try { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += "exception" + return Holder("fail") + } finally { + status += "finally1" + return status + } + } finally { + status += "finally2" + } + } + return Holder("fail") + } + + fun nonLocalNestedFinally(): Holder { + use { + try { + try { + underMutexFun() + return status + } finally { + status += "finally1" + status + } + } finally { + status += "finally2" + } + } + return Holder("fail") + } + + override fun close() { + status += "closed" + } +} + +fun box(): String { + var callable = TestLocal() + var result = callable.local() + if (result.value != "called->closed") return "fail local: " + result.value + + callable = TestLocal() + result = callable.nonLocalSimple() + if (result.value != "called->closed") return "fail nonLocalSimple: " + result.value + + callable = TestLocal() + result = callable.nonLocalWithException() + if (result.value != "called->exception->closed") return "fail nonLocalWithException: " + result.value + + callable = TestLocal() + result = callable.nonLocalWithFinally() + if (result.value != "called->finally->closed") return "fail nonLocalWithFinally: " + result.value + + callable = TestLocal() + result = callable.nonLocalWithExceptionAndFinally() + if (result.value != "called->exception->finally->closed") return "fail nonLocalWithExceptionAndFinally: " + result.value + + callable = TestLocal() + result = callable.nonLocalWithExceptionAndFinallyWithReturn() + if (result.value != "called->exception->finally->closed") return "fail nonLocalWithExceptionAndFinallyWithReturn: " + result.value + + callable = TestLocal() + result = callable.nonLocalNestedWithException() + if (result.value != "called->exception->finally1->finally2->closed") return "fail nonLocalNestedWithException: " + result.value + + callable = TestLocal() + result = callable.nonLocalNestedFinally() + if (result.value != "called->finally1->finally2->closed") return "fail nonLocalNestedFinally: " + result.value + + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt new file mode 100644 index 00000000000..531a91db81f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt @@ -0,0 +1,190 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import java.io.Closeable +import kotlin.test.assertTrue +import kotlin.test.fail +import kotlin.test.assertEquals + +class MyException(message: String) : Exception(message) + +class Holder(var value: String) { + operator fun plusAssign(s: String?) { + value += s + if (s != "closed") { + value += "->" + } + } +} + +class TestLocal() : Closeable { + + var status = Holder("") + + private fun underMutexFun() { + status += "called" + } + + fun local(): Holder { + use { + underMutexFun() + } + return status + } + + + fun nonLocalSimple(): Holder { + use { + underMutexFun() + return status + } + return Holder("fail") + } + + fun nonLocalWithException(): Holder { + use { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += e.message!! + return status + } + } + return Holder("fail") + } + + fun nonLocalWithFinally(): Holder { + use { + try { + underMutexFun() + return Holder("fail") + } finally { + status += "finally" + return status + } + } + return Holder("fail") + } + + fun nonLocalWithExceptionAndFinally(): Holder { + use { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += e.message + return status + } finally { + status += "finally" + } + } + return Holder("fail") + } + + fun nonLocalWithExceptionAndFinallyWithReturn(): Holder { + use { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += e.message + return Holder("fail") + } finally { + status += "finally" + return status + } + } + return Holder("fail") + } + + fun nonLocalNestedWithException(): Holder { + use { + try { + try { + underMutexFun() + throw MyException("exception") + } catch (e: MyException) { + status += "exception" + return Holder("fail") + } finally { + status += "finally1" + return status + } + } finally { + status += "finally2" + } + } + return Holder("fail") + } + + fun nonLocalNestedFinally(): Holder { + use { + try { + try { + underMutexFun() + return status + } finally { + status += "finally1" + status + } + } finally { + status += "finally2" + } + } + return Holder("fail") + } + + override fun close() { + status += "closed" + throw MyException("error") + } +} + +fun box(): String { + assertError(1,"called->closed") { + local() + } + + assertError(2, "called->closed") { + nonLocalSimple() + } + + assertError(3, "called->exception->closed") { + nonLocalWithException() + } + + assertError(4, "called->finally->closed") { + nonLocalWithFinally() + } + + assertError(5, "called->exception->finally->closed") { + nonLocalWithExceptionAndFinally() + } + + assertError(6, "called->exception->finally->closed") { + nonLocalWithExceptionAndFinallyWithReturn() + } + + assertError(7, "called->exception->finally1->finally2->closed") { + nonLocalNestedWithException() + } + + assertError(8, "called->finally1->finally2->closed") { + nonLocalNestedFinally() + } + + return "OK" +} + +public fun assertError(index: Int, expected: String, l: TestLocal.()->Unit) { + val testLocal = TestLocal() + try { + testLocal.l() + fail("fail $index: no error") + } catch (e: Exception) { + assertEquals(expected, testLocal.status.value, "failed on $index") + } +} diff --git a/backend.native/tests/external/codegen/blackbox/objectIntrinsics/objects.kt b/backend.native/tests/external/codegen/blackbox/objectIntrinsics/objects.kt new file mode 100644 index 00000000000..3eddefd5794 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objectIntrinsics/objects.kt @@ -0,0 +1,94 @@ +package foo + +fun box(): String { + try { + testCompanionObjectAccess() + testInCall() + testDoubleConstants() + testFloatConstants() + testLocalFun() + testTopLevelFun() + testVarTopField() + } + catch (e: Throwable) { + return "Error: \n" + e + } + + return "OK" +} + +fun testCompanionObjectAccess() { + val i = Int + val d = Double + val f = Float + val l = Long + val sh = Short + val b = Byte + val ch = Char + val st = String + val en = Enum +} + +fun testInCall() { + test(Int) + test(Double) + test(Float) + test(Long) + test(Short) + test(Byte) + test(Char) + test(String) + test(Enum) +} + +fun testDoubleConstants() { + val pi = Double.POSITIVE_INFINITY + val ni = Double.NEGATIVE_INFINITY + val nan = Double.NaN + + myAssertEquals(pi, Double.POSITIVE_INFINITY) + myAssertEquals(ni, Double.NEGATIVE_INFINITY) +} + +fun testFloatConstants() { + val pi = Float.POSITIVE_INFINITY + val ni = Float.NEGATIVE_INFINITY + val nan = Float.NaN + + myAssertEquals(pi, Float.POSITIVE_INFINITY) + myAssertEquals(ni, Float.NEGATIVE_INFINITY) +} + +fun testLocalFun() { + fun Int.Companion.LocalFun() : String = "LocalFun" + myAssertEquals("LocalFun", Int.LocalFun()) +} + +fun testTopLevelFun() { + myAssertEquals("TopFun", Int.TopFun()) +} + +fun testVarTopField() { + myAssertEquals(0, Int.TopField) + + Int.TopField++ + myAssertEquals(1, Int.TopField) + + Int.TopField += 5 + myAssertEquals(6, Int.TopField) +} + +fun test(a: Any) {} + +var _field: Int = 0 +var Int.Companion.TopField : Int + get() = _field + set(value) { _field = value }; + +fun Int.Companion.TopFun() : String = "TopFun" + +fun myAssertEquals(a: T, b: T) { + if (a != b) throw Exception("$a != $b") +} + + diff --git a/backend.native/tests/external/codegen/blackbox/objects/anonymousObjectPropertyInitialization.kt b/backend.native/tests/external/codegen/blackbox/objects/anonymousObjectPropertyInitialization.kt new file mode 100644 index 00000000000..4765e8858ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/anonymousObjectPropertyInitialization.kt @@ -0,0 +1,14 @@ +interface T { + fun foo(): String +} + +val o = object : T { + val a = "OK" + val f = { + a + }() + + override fun foo() = f +} + +fun box() = o.foo() diff --git a/backend.native/tests/external/codegen/blackbox/objects/classCallsProtectedInheritedByCompanion.kt b/backend.native/tests/external/codegen/blackbox/objects/classCallsProtectedInheritedByCompanion.kt new file mode 100644 index 00000000000..454a3815e24 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/classCallsProtectedInheritedByCompanion.kt @@ -0,0 +1,11 @@ +open class A { + protected fun foo() = "OK" +} + +class B { + companion object : A() + + fun bar() = foo() +} + +fun box() = B().bar() diff --git a/backend.native/tests/external/codegen/blackbox/objects/flist.kt b/backend.native/tests/external/codegen/blackbox/objects/flist.kt new file mode 100644 index 00000000000..9da8a335ad7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/flist.kt @@ -0,0 +1,53 @@ +public abstract class FList() { + public abstract val head: T + public abstract val tail: FList + public abstract val empty: Boolean + + companion object { + val emptyFList = object: FList() { + public override val head: Any + get() = throw UnsupportedOperationException(); + + public override val tail: FList + get() = this + + public override val empty: Boolean + get() = true + } + } + + operator fun plus(head: T): FList = object : FList() { + override public val head: T + get() = head + + override public val empty: Boolean + get() = false + + override public val tail: FList + get() = this@FList + } +} + +public fun emptyFList(): FList = FList.emptyFList as FList + +public fun FList.reverse(where: FList = emptyFList()) : FList = + if(empty) where else tail.reverse(where + head) + +operator fun FList.iterator(): Iterator = object: Iterator { + private var cur: FList = this@iterator + + override public fun next(): T { + val res = cur.head + cur = cur.tail + return res + } + override public fun hasNext(): Boolean = !cur.empty +} + +fun box() : String { + var r = "" + for(s in (emptyFList() + "O" + "K").reverse()) { + r += s + } + return r +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/initializationOrder.kt b/backend.native/tests/external/codegen/blackbox/objects/initializationOrder.kt new file mode 100644 index 00000000000..2281132636b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/initializationOrder.kt @@ -0,0 +1,16 @@ +var result = "OK" + +class A { + companion object { + var z = result + + fun patchResult() { + result = "fail" + } + } +} + +fun box(): String { + A.patchResult() + return A.z +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt new file mode 100644 index 00000000000..b4885512f5e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +public open class Test() { + open public fun test() : Unit { + System.out?.println(hello) + } + companion object { + private val hello : String? = "Hello" + } +} + +fun box() : String { + Test().test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt11117.kt b/backend.native/tests/external/codegen/blackbox/objects/kt11117.kt new file mode 100644 index 00000000000..439f80a6723 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt11117.kt @@ -0,0 +1,16 @@ +class A(val value: String) + +fun A.test(): String { + val o = object { + val z: String + init { + val x = value + "K" + z = x + } + } + return o.z +} + +fun box(): String { + return A("O").test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1136.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1136.kt new file mode 100644 index 00000000000..9caf5855971 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1136.kt @@ -0,0 +1,50 @@ +// TARGET_BACKEND: JVM + +public object SomeObject { + private val workerThread = object : Thread() { + override fun run() { + foo() + } + } + + init { + workerThread.start() + } + + private fun foo() : Unit { + } +} + +public class SomeClass() { + inner class Inner { + val copy = list + } + + private val list = ArrayList() + var status : Throwable? = null + private val workerThread = object : Thread() { + public override fun run() { + try { + list.add("123") + list.add("33") + Inner().copy.add("444") + } + catch(t: Throwable) { + status = t + } + } + } + + init { + workerThread.start() + workerThread.join() + } +} + +public fun box(): String { + var obj = SomeClass() + return if (obj.status == null) "OK" else { + (obj.status as java.lang.Throwable).printStackTrace() + "failed" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1186.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1186.kt new file mode 100644 index 00000000000..6100f7092fa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1186.kt @@ -0,0 +1,28 @@ +enum class Color(val rgb : Int) { + RED(0xFF0000), + GREEN(0x00FF00), + BLUE(0x0000FF) +} + +enum class Direction { + NORTH, + SOUTH, + WEST, + EAST +} + +fun bar(c: Color) = when (c) { + Color.RED -> 1 + Color.GREEN -> 2 + Color.BLUE -> 3 +} + +fun foo(d: Direction) = when(d) { + Direction.NORTH -> 1 + Direction.SOUTH -> 2 + Direction.WEST -> 3 + Direction.EAST -> 4 +} + +fun box() : String = + if (foo(Direction.EAST) == 4 && bar(Color.GREEN) == 2) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1600.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1600.kt new file mode 100644 index 00000000000..e9f111a98b3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1600.kt @@ -0,0 +1,8 @@ +abstract class Foo { + fun hello(id: T) = "O$id" +} + +class Bar: Foo() { +} + +fun box() = Bar().hello("K") diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt new file mode 100644 index 00000000000..933f3aef48c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + return object { + fun foo(): String { + val f = {} + object : Runnable { + public override fun run() { + f() + } + } + return "OK" + } + }.foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2398.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2398.kt new file mode 100644 index 00000000000..a8b11518d1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2398.kt @@ -0,0 +1,18 @@ +class C { + public object Obj { + val o = "O" + + object InnerObj { + fun k() = "K" + } + + class D { + val ko = "KO" + } + } +} + +fun box(): String { + val res = C.Obj.o + C.Obj.InnerObj.k() + C.Obj.D().ko + return if (res == "OKKO") "OK" else "Fail: $res" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2663.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2663.kt new file mode 100644 index 00000000000..b7dad56133f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2663.kt @@ -0,0 +1,10 @@ +fun box() : String { + var a = 1 + + object { + init { + a = 2 + } + } + return if (a == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt new file mode 100644 index 00000000000..041a1970cb9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box() : String { + var a = 1 + + (object: Runnable { + override public fun run() { + a = 2 + } + }).run() + return if (a == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2675.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2675.kt new file mode 100644 index 00000000000..3cd63cc3262 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2675.kt @@ -0,0 +1,16 @@ +class A() { + + fun ok() = Foo.Bar.bar() + Foo.Bar.barv + + private object Foo { + fun foo() = "O" + val foov = "K" + + public object Bar { + fun bar() = foo() + val barv = foov + } + } +} + +fun box() = A().ok() diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2719.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2719.kt new file mode 100644 index 00000000000..908dbb3a1be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2719.kt @@ -0,0 +1,9 @@ +class Clazz { + companion object { + val a = object { + fun run(x: String) = x + } + } +} + +fun box() = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2822.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2822.kt new file mode 100644 index 00000000000..740aaf1698c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2822.kt @@ -0,0 +1,7 @@ +open class A { + fun foo() = "OK" +} + +fun box() = object : A() { + fun bar() = super.foo() +}.bar() diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt b/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt new file mode 100644 index 00000000000..1e2c249fd67 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +object Obj { + class Inner() { + fun ok() = "OK" + } +} + +fun box() : String { + val klass = Class.forName("Obj\$Inner")!! + val cons = klass.getConstructors()!![0] + val inner = cons.newInstance(*(arrayOfNulls(0) as Array)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt3684.kt b/backend.native/tests/external/codegen/blackbox/objects/kt3684.kt new file mode 100644 index 00000000000..53e742f1764 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt3684.kt @@ -0,0 +1,16 @@ +open class X(private val n: String) { + + fun foo(): String { + return object : X("inner") { + fun print(): String { + return n; + } + }.print() + } +} + + +fun box() : String { + return X("OK").foo() +} + diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt4086.kt b/backend.native/tests/external/codegen/blackbox/objects/kt4086.kt new file mode 100644 index 00000000000..2aa1ca343d8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt4086.kt @@ -0,0 +1,12 @@ +interface N + +open class Base(n: N) + +class Derived : Base(object: N{}) { + +} + +fun box() : String { + Derived() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt535.kt b/backend.native/tests/external/codegen/blackbox/objects/kt535.kt new file mode 100644 index 00000000000..5b5a9c22168 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt535.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class Identifier(t : T?, myHasDollar : Boolean) { + private val myT : T? + + public fun getName() : T? { return myT } + + companion object { + open public fun init(name : T?) : Identifier { + val id = Identifier(name, false) + return id + } + } + init { + myT = t + } +} + +fun box() : String { + var i3 : Identifier? = Identifier.init("name") + System.out?.println(i3?.getName()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt560.kt b/backend.native/tests/external/codegen/blackbox/objects/kt560.kt new file mode 100644 index 00000000000..74599a372ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt560.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package while_bug_1 + +import java.io.* + +open class AllEvenNum() { + + companion object { + open public fun main(args : Array?) : Unit { + var i : Int = 1 + while ((i <= 100)) { + { + if (((i % 2) == 0)) + { + System.out?.print((i.toString() + ",")) + } + + } + i = i + 1 + } + } + + } +} + +fun box() : String { + AllEvenNum.main(arrayOfNulls(0)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt694.kt b/backend.native/tests/external/codegen/blackbox/objects/kt694.kt new file mode 100644 index 00000000000..945e1298489 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/kt694.kt @@ -0,0 +1,18 @@ +enum class Test { + A, + B, + C +} + +fun checkA(a: Test) = when(a) { + Test.B -> false + Test.A -> true + else -> false +} + +fun box() : String { + if(!checkA(Test.A)) return "fail" + if( checkA(Test.C)) return "fail" + if( checkA(Test.B)) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/localFunctionInObjectInitializer_kt4516.kt b/backend.native/tests/external/codegen/blackbox/objects/localFunctionInObjectInitializer_kt4516.kt new file mode 100644 index 00000000000..c59e782da64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/localFunctionInObjectInitializer_kt4516.kt @@ -0,0 +1,17 @@ + +object O { + val mmmap = HashMap(); + + init { + fun doStuff() { + mmmap.put("two", 2) + } + doStuff() + } +} + +fun box(): String { + val r = O.mmmap["two"] + if (r != 2) return "Fail: $r" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/methodOnObject.kt b/backend.native/tests/external/codegen/blackbox/objects/methodOnObject.kt new file mode 100644 index 00000000000..bdff2a1fec1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/methodOnObject.kt @@ -0,0 +1,5 @@ +object A { + fun result() = "OK" +} + +fun box(): String = A.result() diff --git a/backend.native/tests/external/codegen/blackbox/objects/nestedDerivedClassCallsProtectedFromCompanion.kt b/backend.native/tests/external/codegen/blackbox/objects/nestedDerivedClassCallsProtectedFromCompanion.kt new file mode 100644 index 00000000000..a9a05baa90e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/nestedDerivedClassCallsProtectedFromCompanion.kt @@ -0,0 +1,10 @@ +open class A { + companion object { + protected fun foo() = "OK" + } + class B : A() { + fun bar() = foo() + } +} + +fun box() = A.B().bar() diff --git a/backend.native/tests/external/codegen/blackbox/objects/nestedObjectWithSuperclass.kt b/backend.native/tests/external/codegen/blackbox/objects/nestedObjectWithSuperclass.kt new file mode 100644 index 00000000000..596801c7050 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/nestedObjectWithSuperclass.kt @@ -0,0 +1,18 @@ +open class A (val s: Int) { + open fun foo(): Int { + return s + } +} + +object Outer: A(1) { + object O: A(2) { + override fun foo(): Int { + val s = super.foo() + return s + 3 + } + } +} + +fun box() : String { + return if (Outer.O.foo() == 5) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectExtendsInnerAndReferencesOuterMember.kt b/backend.native/tests/external/codegen/blackbox/objects/objectExtendsInnerAndReferencesOuterMember.kt new file mode 100644 index 00000000000..def3f9f7616 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectExtendsInnerAndReferencesOuterMember.kt @@ -0,0 +1,12 @@ +class A { + val x: Any get() { + return object : Inner() { + override fun toString() = foo() + } + } + + open inner class Inner + fun foo() = "OK" +} + +fun box(): String = A().x.toString() diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectInLocalAnonymousObject.kt b/backend.native/tests/external/codegen/blackbox/objects/objectInLocalAnonymousObject.kt new file mode 100644 index 00000000000..f21c93edf75 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectInLocalAnonymousObject.kt @@ -0,0 +1,10 @@ +fun box(): String { + var boo = "OK" + var foo = object { + val bar = object { + val baz = boo + } + } + + return foo.bar.baz +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectInitialization_kt5523.kt b/backend.native/tests/external/codegen/blackbox/objects/objectInitialization_kt5523.kt new file mode 100644 index 00000000000..3238fe1f9ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectInitialization_kt5523.kt @@ -0,0 +1,6 @@ +object A { + val a = "OK" + val b = A.a +} + +fun box() = A.b diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectLiteral.kt b/backend.native/tests/external/codegen/blackbox/objects/objectLiteral.kt new file mode 100644 index 00000000000..e6030a1ccd9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectLiteral.kt @@ -0,0 +1,18 @@ +class C(x: Int, val y: Int) { + fun initChild(x0: Int): Any { + var x = x0 + return object { + override fun toString(): String { + x = x + y + return "child" + x + } + } + } + + val child = initChild(x) +} + +fun box(): String { + val c = C(10, 3) + return if (c.child.toString() == "child13" && c.child.toString() == "child16" && c.child.toString() == "child19") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectLiteralInClosure.kt b/backend.native/tests/external/codegen/blackbox/objects/objectLiteralInClosure.kt new file mode 100644 index 00000000000..49e19260616 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectLiteralInClosure.kt @@ -0,0 +1,17 @@ +package p + +private class C(val y: Int) { + val initChild = { -> + object { + override fun toString(): String { + return "child" + y + } + } + } +} + +fun box(): String { + val c = C(3).initChild + val x = c().toString() + return if (x == "child3") "OK" else x +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectVsClassInitialization_kt5291.kt b/backend.native/tests/external/codegen/blackbox/objects/objectVsClassInitialization_kt5291.kt new file mode 100644 index 00000000000..88ec3c5bb6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectVsClassInitialization_kt5291.kt @@ -0,0 +1,24 @@ +public inline fun T.with(f: T.() -> Unit): T { + this.f() + return this +} + +public class Cls { + val string = "Cls" + val buffer = StringBuilder().with { + append(string) + } +} + +public object Obj { + val string = "Obj" + val buffer = StringBuilder().with { + append(string) + } +} + +fun box(): String { + if (Cls().buffer.toString() != "Cls") return "Fail class" + if (Obj.buffer.toString() != "Obj") return "Fail object" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclass.kt b/backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclass.kt new file mode 100644 index 00000000000..31c004a45fb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclass.kt @@ -0,0 +1,16 @@ +open class A { + open fun foo(): Int { + return 2 + } +} + +object O: A() { + override fun foo(): Int { + val s = super.foo() + return s + 3 + } +} + +fun box() : String { + return if (O.foo() == 5) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclassAndTrait.kt b/backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclassAndTrait.kt new file mode 100644 index 00000000000..c239a3eff27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/objectWithSuperclassAndTrait.kt @@ -0,0 +1,21 @@ +open class A { + open fun foo(): Int { + return 2 + } +} + +interface T { + open fun foo(): Int { + return 3 + } +} + +object O: A(), T { + override fun foo(): Int { + return super.foo() + super.foo() + } +} + +fun box() : String { + return if (O.foo() == 5) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/privateExtensionFromInitializer_kt4543.kt b/backend.native/tests/external/codegen/blackbox/objects/privateExtensionFromInitializer_kt4543.kt new file mode 100644 index 00000000000..ffcb2ada647 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/privateExtensionFromInitializer_kt4543.kt @@ -0,0 +1,16 @@ +class A(val result: String) + +fun a(body: A.() -> String): String { + val r = A("OK") + return r.body() +} + +object C { + private fun A.f() = result + + val g = a { + f() + } +} + +fun box() = C.g diff --git a/backend.native/tests/external/codegen/blackbox/objects/privateFunctionFromClosureInInitializer_kt5582.kt b/backend.native/tests/external/codegen/blackbox/objects/privateFunctionFromClosureInInitializer_kt5582.kt new file mode 100644 index 00000000000..5b71ab435fe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/privateFunctionFromClosureInInitializer_kt5582.kt @@ -0,0 +1,20 @@ +interface T + +object Foo { + private fun foo(p: T) = p + + private val v: Int = { + val x = foo(O) + 42 + }() + + private object O : T + + val result = v +} + +fun box(): String { + val foo = Foo + if (foo.result != 42) return "Fail: ${foo.result}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/receiverInConstructor.kt b/backend.native/tests/external/codegen/blackbox/objects/receiverInConstructor.kt new file mode 100644 index 00000000000..b3b7a3dcb57 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/receiverInConstructor.kt @@ -0,0 +1,7 @@ +open class A(open val v: String) + +fun A.a(newv: String) = object: A("fail") { + override val v = this@a.v + newv +} + +fun box() = A("O").a("K").v diff --git a/backend.native/tests/external/codegen/blackbox/objects/safeAccess.kt b/backend.native/tests/external/codegen/blackbox/objects/safeAccess.kt new file mode 100644 index 00000000000..bbb2c6db410 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/safeAccess.kt @@ -0,0 +1,7 @@ +// KT-5159 + +object Test { + val a = "OK" +} + +fun box(): String = Test?.a diff --git a/backend.native/tests/external/codegen/blackbox/objects/simpleObject.kt b/backend.native/tests/external/codegen/blackbox/objects/simpleObject.kt new file mode 100644 index 00000000000..5b78c077a6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/simpleObject.kt @@ -0,0 +1,7 @@ +object A { + val x: Int = 610 +} + +fun box() : String { + return if (A.x != 610) "fail" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/thisInConstructor.kt b/backend.native/tests/external/codegen/blackbox/objects/thisInConstructor.kt new file mode 100644 index 00000000000..02f4ce346c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/thisInConstructor.kt @@ -0,0 +1,10 @@ +open class A(open val v: String) { +} + +open class B(open val v: String) { + fun a(newv: String) = object: A("fail") { + override val v = this@B.v + newv + } +} + +fun box() = B("O").a("K").v diff --git a/backend.native/tests/external/codegen/blackbox/objects/useAnonymousObjectAsIterator.kt b/backend.native/tests/external/codegen/blackbox/objects/useAnonymousObjectAsIterator.kt new file mode 100644 index 00000000000..4b492007eb1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/useAnonymousObjectAsIterator.kt @@ -0,0 +1,18 @@ +// KT-5869 + +operator fun Iterator.iterator(): Iterator = this + +fun box(): String { + val iterator = object : Iterator { + var i = 0 + override fun next() = i++ + override fun hasNext() = i < 5 + } + + var result = "" + for (i in iterator) { + result += i + } + + return if (result == "01234") "OK" else "Fail $result" +} diff --git a/backend.native/tests/external/codegen/blackbox/objects/useImportedMember.kt b/backend.native/tests/external/codegen/blackbox/objects/useImportedMember.kt new file mode 100644 index 00000000000..83b806eb024 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/useImportedMember.kt @@ -0,0 +1,50 @@ +import C.f +import C.p +import C.ext +import C.g1 +import C.g2 +import C.fromClass +import C.fromInterface +import C.genericFromSuper + +interface I { + fun T.fromInterface(): T = this + + fun genericFromSuper(g: G) = g +} + +open class BaseClass { + val T.fromClass: T + get() = this +} + +object C: BaseClass(), I { + fun f(s: Int) = 1 + fun f(s: String) = 2 + fun Boolean.f() = 3 + + var p: Int = 4 + val Int.ext: Int + get() = 6 + + fun g1(t: T): T = t + val T.g2: T + get() = this +} + +fun box(): String { + if (f(1) != 1) return "1" + if (f("s") != 2) return "2" + if (true.f() != 3) return "3" + if (p != 4) return "4" + p = 5 + if (p != 5) return "5" + if (5.ext != 6) return "6" + if (g1("7") != "7") return "7" + if ("8".g2 != "8") return "8" + if (9.fromInterface() != 9) return "9" + if ("10".fromClass != "10") return "10" + if (genericFromSuper("11") != "11") return "11" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/objects/useImportedMemberFromCompanion.kt b/backend.native/tests/external/codegen/blackbox/objects/useImportedMemberFromCompanion.kt new file mode 100644 index 00000000000..9523480b86a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/useImportedMemberFromCompanion.kt @@ -0,0 +1,52 @@ +import Class.C.f +import Class.C.p +import Class.C.ext +import Class.C.g1 +import Class.C.g2 +import Class.C.fromClass +import Class.C.fromInterface +import Class.C.genericFromSuper + +interface I { + fun T.fromInterface(): T = this + + fun genericFromSuper(g: G) = g +} + +open class BaseClass { + val T.fromClass: T + get() = this +} + +class Class { + companion object C: BaseClass(), I { + fun f(s: Int) = 1 + fun f(s: String) = 2 + fun Boolean.f() = 3 + + var p: Int = 4 + val Int.ext: Int + get() = 6 + + fun g1(t: T): T = t + val T.g2: T + get() = this + } +} + +fun box(): String { + if (f(1) != 1) return "1" + if (f("s") != 2) return "2" + if (true.f() != 3) return "3" + if (p != 4) return "4" + p = 5 + if (p != 5) return "5" + if (5.ext != 6) return "6" + if (g1("7") != "7") return "7" + if ("8".g2 != "8") return "8" + if (9.fromInterface() != 9) return "9" + if ("10".fromClass != "10") return "10" + if (genericFromSuper("11") != "11") return "11" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/annotatedAssignment.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/annotatedAssignment.kt new file mode 100644 index 00000000000..ef6ec161a84 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/annotatedAssignment.kt @@ -0,0 +1,13 @@ +@Target(AnnotationTarget.EXPRESSION) +annotation class Annotation + +fun box(): String { + var v = 0 + @Annotation v += 1 + 2 + if (v != 3) return "fail1" + + @Annotation v = 4 + if (v != 4) return "fail2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/assignmentOperations.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/assignmentOperations.kt new file mode 100644 index 00000000000..edbd763154e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/assignmentOperations.kt @@ -0,0 +1,36 @@ +class A() { + var x = 0 +} + +operator fun A.plusAssign(y: Int) { x += y } +operator fun A.minusAssign(y: Int) { x -= y } +operator fun A.timesAssign(y: Int) { x *= y } +operator fun A.divAssign(y: Int) { x /= y } +operator fun A.modAssign(y: Int) { x %= y } + +fun box(): String { + val original = A() + val a = original + + a += 1 + if (a !== original) return "Fail 1: $a !== $original" + if (a.x != 1) return "Fail 2: ${a.x} != 1" + + a -= 2 + if (a !== original) return "Fail 3: $a !== $original" + if (a.x != -1) return "Fail 4: ${a.x} != -1" + + a *= -10 + if (a !== original) return "Fail 5: $a !== $original" + if (a.x != 10) return "Fail 6: ${a.x} != 10" + + a /= 3 + if (a !== original) return "Fail 7: $a !== $original" + if (a.x != 3) return "Fail 8: ${a.x} != 3" + + a %= 2 + if (a !== original) return "Fail 9: $a !== $original" + if (a.x != 1) return "Fail 10: ${a.x} != 1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/augmentedAssignmentWithArrayLHS.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/augmentedAssignmentWithArrayLHS.kt new file mode 100644 index 00000000000..0c80cc8edb7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/augmentedAssignmentWithArrayLHS.kt @@ -0,0 +1,33 @@ +var log = "" + +fun foo(): Int { + log += "foo;" + return 1 +} +fun bar(): Int { + log += "bar;" + return 42 +} + +data class A(val x: Int) { + operator fun plus(other: A) = A(x + other.x) +} + +fun box(): String { + val array = arrayOf(0, 1) + array[foo()] += bar() + + if (array[0] != 0) return "fail1a: ${array[0]}" + if (array[1] != 43) return "fail1b: ${array[0]}" + + log += "!;" + + val objArray = arrayOf(A(0), A(1)) + objArray[foo()] += A(bar()) + if (objArray[0] != A(0)) return "fail2a: ${array[0]}" + if (objArray[1] != A(43)) return "fail2b: ${array[0]}" + + if (log != "foo;bar;!;foo;bar;") return "fail3: $log" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt new file mode 100644 index 00000000000..a8a367c3354 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun checkLess(x: Boolean, y: Boolean) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(false, true) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/comparable.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/comparable.kt new file mode 100644 index 00000000000..957816c8974 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/comparable.kt @@ -0,0 +1,16 @@ +interface A : Comparable + +class B(val x: Int) : A { + override fun compareTo(other: A) = x.compareTo((other as B).x) +} + +fun checkLess(x: A, y: A) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(B(0), B(1)) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleInt.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleInt.kt new file mode 100644 index 00000000000..9818affbfba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleInt.kt @@ -0,0 +1,10 @@ +fun checkLess(x: Double, y: Int) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(0.5, 1) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleLong.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleLong.kt new file mode 100644 index 00000000000..294560659ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/doubleLong.kt @@ -0,0 +1,10 @@ +fun checkLess(x: Double, y: Long) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(0.5, 1.toLong()) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionArray.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionArray.kt new file mode 100644 index 00000000000..7ca0f34b787 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionArray.kt @@ -0,0 +1,16 @@ +fun checkLess(x: Array, y: Array) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +operator fun Array.compareTo(other: Array) = size - other.size + +fun box(): String { + val a = arrayOfNulls(0) as Array + val b = arrayOfNulls(1) as Array + return checkLess(a, b) +} diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionObject.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionObject.kt new file mode 100644 index 00000000000..1f355ed16e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/extensionObject.kt @@ -0,0 +1,14 @@ +class A(val x: Int) + +operator fun A.compareTo(other: A) = x.compareTo(other.x) + +fun checkLess(x: A, y: A) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(A(0), A(1)) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intDouble.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intDouble.kt new file mode 100644 index 00000000000..a76709fe2db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intDouble.kt @@ -0,0 +1,10 @@ +fun checkLess(x: Int, y: Double) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(0, 0.5) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intLong.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intLong.kt new file mode 100644 index 00000000000..dc91a1d0d51 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/intLong.kt @@ -0,0 +1,10 @@ +fun checkLess(x: Int, y: Long) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(0, 123456789123.toLong()) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longDouble.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longDouble.kt new file mode 100644 index 00000000000..90e43d49215 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longDouble.kt @@ -0,0 +1,10 @@ +fun checkLess(x: Long, y: Double) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(0.toLong(), 0.5) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longInt.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longInt.kt new file mode 100644 index 00000000000..623a3a46e01 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/longInt.kt @@ -0,0 +1,10 @@ +fun checkLess(x: Long, y: Int) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + else -> "OK" +} + +fun box() = checkLess(-123456789123.toLong(), 0) diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/incDecOnObject.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/incDecOnObject.kt new file mode 100644 index 00000000000..0717061a9b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/incDecOnObject.kt @@ -0,0 +1,41 @@ +class X(var value: Long) + +operator fun X.inc(): X { + this.value++ + return this +} + +operator fun X.dec(): X { + this.value-- + return this +} + +class Z { + + public var counter: Int = 0; + + public var prop: X = X(0) + get() { + counter++; return field + } + set(a: X) { + counter++ + field = a; + } +} + +fun box(): String { + var z = Z() + z.prop++ + + if (z.counter != 2) return "fail in postfix increment: ${z.counter} != 2" + if (z.prop.value != 1.toLong()) return "fail in postfix increment: ${z.prop.value} != 1" + + z = Z() + z.prop-- + + if (z.counter != 2) return "fail in postfix decrement: ${z.counter} != 2" + if (z.prop.value != -1.toLong()) return "fail in postfix decrement: ${z.prop.value} != -1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201.kt new file mode 100644 index 00000000000..3ee91af468f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201.kt @@ -0,0 +1,15 @@ +interface Intf { + val aValue: String +} + +class ClassB { + val x = { "OK" } + + val value: Intf = object : Intf { + override val aValue = x() + } +} + +fun box() : String { + return ClassB().value.aValue +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201_2.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201_2.kt new file mode 100644 index 00000000000..b95b82d9172 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt14201_2.kt @@ -0,0 +1,27 @@ +class A { + val z: String = "OK" +} + +class B { + operator fun A.invoke(): String = z +} + +class ClassB { + val x = A() + + fun B.test(): String { + val value = object { + val z = x() + } + return value.z + } + + fun call(): String { + return B().test() + } + +} + +fun box(): String { + return ClassB().call() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4152.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4152.kt new file mode 100644 index 00000000000..bc3ad4eada0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4152.kt @@ -0,0 +1,29 @@ +public var inc: Int = 0; + +public var propInc: Int = 0 + get() {inc++; return field} + set(a: Int) { + inc++ + field = a + } + +public var dec: Int = 0; + +public var propDec: Int = 0; + get() { dec--; return field} + set(a: Int) { + dec-- + field = a + } + +fun box(): String { + propInc++ + if (inc != 2) return "fail in postfix increment: ${inc} != 2" + if (propInc != 1) return "fail in postfix increment: ${propInc} != 1" + + propDec-- + if (dec != -2) return "fail in postfix decrement: ${dec} != -2" + if (propDec != -1) return "fail in postfix decrement: ${propDec} != -1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt new file mode 100644 index 00000000000..ece3a7822ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt @@ -0,0 +1,9 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + operator fun Int?.inc() = (this ?: 0) + 1 + var counter: Int? = null + counter++ + return if (counter == 1) "OK" else "fail: $counter" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/nestedMaps.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/nestedMaps.kt new file mode 100644 index 00000000000..b459a515d6a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/nestedMaps.kt @@ -0,0 +1,13 @@ +object Map1 { + operator fun get(i: Int, j: Int) = Map2 +} + +object Map2 { + operator fun get(i: Int, j: Int) = 0 + operator fun set(i: Int, j: Int, newValue: Int) {} +} + +fun box(): String { + Map1[0, 0][0, 0]++ + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/operatorSetLambda.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/operatorSetLambda.kt new file mode 100644 index 00000000000..a791f7207c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/operatorSetLambda.kt @@ -0,0 +1,16 @@ +// See KT-14999 + +object Obj { + var key = "" + var value = "" + + operator fun set(k: String, v: ((String) -> Unit) -> Unit) { + key += k + v { value += it } + } +} + +fun box(): String { + Obj["O"] = label@{ it("K") } + return Obj.key + Obj.value +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/overloadedSet.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/overloadedSet.kt new file mode 100644 index 00000000000..839722da16a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/overloadedSet.kt @@ -0,0 +1,11 @@ +object A { + operator fun get(i: Int) = 1 + operator fun set(i: Int, j: Int) {} + operator fun set(i: Int, x: Any) { throw Exception() } +} + +fun box(): String { + A[0]++ + A[0] += 1 + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt new file mode 100644 index 00000000000..0d1cdd857dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt @@ -0,0 +1,11 @@ +// TARGET_BACKEND: JVM + +// LANGUAGE_VERSION: 1.0 +// FULL_JDK + +import java.math.BigInteger + +fun box(): String { + val m = BigInteger.valueOf(-2) % BigInteger.valueOf(3) + return if (m != BigInteger.valueOf(1)) "Fail: BigInteger(-2) mod BigInteger(3) == $m" else "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/remAssignmentOperation.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/remAssignmentOperation.kt new file mode 100644 index 00000000000..b0c2bf060c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/remAssignmentOperation.kt @@ -0,0 +1,17 @@ +class A() { + var x = 5 +} + +operator fun A.modAssign(y: Int) { throw RuntimeException("mod has been called instead of rem") } +operator fun A.remAssign(y: Int) { x %= y + 1 } + +fun box(): String { + val original = A() + val a = original + + a %= 2 + if (a !== original) return "Fail 1: $a !== $original" + if (a.x != 2) return "Fail 2: ${a.x} != 2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/remOverModOperation.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/remOverModOperation.kt new file mode 100644 index 00000000000..f10fe021e65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/remOverModOperation.kt @@ -0,0 +1,18 @@ +class A() { + var x = 5 + + operator fun mod(y: Int) { throw RuntimeException("mod has been called instead of rem") } + operator fun rem(y: Int) { x -= y } +} + +fun box(): String { + val a = A() + + a % 5 + + if (a.x != 0) { + return "Fail: a.x(${a.x}) != 0" + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/package/boxPrimitiveTypeInClinit.kt b/backend.native/tests/external/codegen/blackbox/package/boxPrimitiveTypeInClinit.kt new file mode 100644 index 00000000000..8b8377d314b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/boxPrimitiveTypeInClinit.kt @@ -0,0 +1,27 @@ +var xi = 0 +var xin : Int? = 0 +var xinn : Int? = null + +var xl = 0.toLong() +var xln : Long? = 0.toLong() +var xlnn : Long? = null + +var xb = 0.toByte() +var xbn : Byte? = 0.toByte() +var xbnn : Byte? = null + +var xf = 0.toFloat() +var xfn : Float? = 0.toFloat() +var xfnn : Float? = null + +var xd = 0.toDouble() +var xdn : Double? = 0.toDouble() +var xdnn : Double? = null + +var xs = 0.toShort() +var xsn : Short? = 0.toShort() +var xsnn : Short? = null + +fun box() : String { + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/package/checkCast.kt b/backend.native/tests/external/codegen/blackbox/package/checkCast.kt new file mode 100644 index 00000000000..ffdfa30042b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/checkCast.kt @@ -0,0 +1,15 @@ +class C(val x: Int) { + override fun equals(rhs: Any?): Boolean { + if (rhs is C) { + val rhsC = rhs as C + return rhsC.x == x + } + return false + } +} + +fun box(): String { + val c1 = C(10) + val c2 = C(10) + return if (c1 == c2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/package/incrementProperty.kt b/backend.native/tests/external/codegen/blackbox/package/incrementProperty.kt new file mode 100644 index 00000000000..07f0a112195 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/incrementProperty.kt @@ -0,0 +1,14 @@ +class Slot() { + var vitality: Int = 10000 + + fun increaseVitality(delta: Int) { + vitality += delta + if (vitality > 65535) vitality = 65535; + } +} + +fun box(): String { + val s = Slot() + s.increaseVitality(1000) + return if (s.vitality == 11000) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt b/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt new file mode 100644 index 00000000000..86f2ee7c61f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String? { + val log = System.getProperty("boxtest.log") + System.clearProperty("boxtest.log") // test can be run twice + return if (log == "bca") "OK" else log +} + +val b = log("b") +val c = log("c") +val a = log("a") + +fun log(message: String) { + val value = (System.getProperty("boxtest.log") ?: "") + message + System.setProperty("boxtest.log", value) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt b/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt new file mode 100644 index 00000000000..b0dfae5ae86 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// KT-2202 Wrong instruction for invoke private setter + +class A { + private fun f1() { } + fun foo() { + f1() + } +} + +class B { + private val foo = 1 + get + + fun foo() { + foo + } +} + +class C { + private var foo = 1 + get + set + + fun foo() { + foo = 2 + foo + } +} + +class D { + var foo = 1 + private set + + fun foo() { + foo = 2 + } +} + +fun box(): String { + A().foo() + B().foo() + C().foo() + D().foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt b/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt new file mode 100644 index 00000000000..f6fb183f274 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1.kt + +package test + +class A {} + +fun getMain(className: String): java.lang.reflect.Method { + val classLoader = A().javaClass.classLoader + return classLoader.loadClass(className).getDeclaredMethod("main", Array::class.java) +} + +fun box(): String { + val bMain = getMain("pkg.AKt") + val cMain = getMain("pkg.BKt") + + val args = Array(1, { "" }) + + bMain.invoke(null, args) + cMain.invoke(null, args) + + return args[0] +} + + + +// FILE: a.kt + +package pkg + +fun main(args: Array) { + args[0] += "O" +} + +// FILE: b.kt + +package pkg + +fun main(args: Array) { + args[0] += "K" +} diff --git a/backend.native/tests/external/codegen/blackbox/package/nullablePrimitiveNoFieldInitializer.kt b/backend.native/tests/external/codegen/blackbox/package/nullablePrimitiveNoFieldInitializer.kt new file mode 100644 index 00000000000..c0f72702d06 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/nullablePrimitiveNoFieldInitializer.kt @@ -0,0 +1,11 @@ +val zint : Int? = 1 +val zlong : Long? = 2 +val zbyte : Byte? = 3 +val zshort : Short? = 4 +val zchar : Char? = 'c' +val zdouble : Double? = 1.0 +val zfloat : Float? = 2.0.toFloat() + +fun box(): String { + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/package/packageLocalClassNotImportedWithDefaultImport.kt b/backend.native/tests/external/codegen/blackbox/package/packageLocalClassNotImportedWithDefaultImport.kt new file mode 100644 index 00000000000..7d185e9ee00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/packageLocalClassNotImportedWithDefaultImport.kt @@ -0,0 +1,24 @@ +// FILE: box.kt + +package a + +import pack.* + +class X : SomeClass() + +fun box(): String { + X() + return "OK" +} + +// FILE: file1.kt + +package kotlin.jvm + +private class SomeClass + +// FILE: file2.kt + +package pack + +public open class SomeClass diff --git a/backend.native/tests/external/codegen/blackbox/package/packageQualifiedMethod.kt b/backend.native/tests/external/codegen/blackbox/package/packageQualifiedMethod.kt new file mode 100644 index 00000000000..92aaf32b62e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/packageQualifiedMethod.kt @@ -0,0 +1,6 @@ +package Foo + fun bar() = 610 + +fun box(): String { + return if (Foo.bar() == 610) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/package/privateTopLevelPropAndVarInInner.kt b/backend.native/tests/external/codegen/blackbox/package/privateTopLevelPropAndVarInInner.kt new file mode 100644 index 00000000000..b61fd243ab9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/privateTopLevelPropAndVarInInner.kt @@ -0,0 +1,4 @@ +private var x = "O" +private fun f() = "K" + +fun box() = { x + f() }() diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/assign.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/assign.kt new file mode 100644 index 00000000000..97730470dfc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/assign.kt @@ -0,0 +1,8 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + var x = l[0] + x = 2 + if (x != 2) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/compareTo.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/compareTo.kt new file mode 100644 index 00000000000..288a8111d76 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/compareTo.kt @@ -0,0 +1,9 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0] < 2 + if (x != true) return "Fail: $x}" + val y = l[0].compareTo(2) + if (y != -1) return "Fail (y): $y}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/dec.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/dec.kt new file mode 100644 index 00000000000..04574676e01 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/dec.kt @@ -0,0 +1,14 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + var x = l[0] + var y = l[0] + l[0]-- + --l[0] + x-- + --y + if (l[0] != -1) return "Fail: ${l[0]}" + if (x != 0) return "Fail x: $x" + if (y != 0) return "Fail y: $y" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/div.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/div.kt new file mode 100644 index 00000000000..1d19aa08bde --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/div.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(2) + val x = l[0] / 2 + if (x != 1) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/equals.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/equals.kt new file mode 100644 index 00000000000..f11e683d8cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/equals.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0] == 2 + if (x != false) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/hashCode.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/hashCode.kt new file mode 100644 index 00000000000..884ce0f7752 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/hashCode.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0].hashCode() + if (x != 1) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt new file mode 100644 index 00000000000..e47f119d4ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val l = java.util.ArrayList() + l.add(1000) + + val x = l[0] === 1000 + if (x) return "Fail: $x" + val x1 = l[0] === 1 + if (x1) return "Fail 1: $x" + val x2 = l[0] === l[0] + if (!x2) return "Fail 2: $x" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/inc.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/inc.kt new file mode 100644 index 00000000000..25de0090050 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/inc.kt @@ -0,0 +1,14 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + var x = l[0] + var y = l[0] + l[0]++ + ++l[0] + x++ + ++y + if (l[0] != 3) return "Fail: ${l[0]}" + if (x != 2) return "Fail x: $x" + if (y != 2) return "Fail y: $y" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/minus.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/minus.kt new file mode 100644 index 00000000000..cf14e881a9a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/minus.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0] - 1 + if (x != 0) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/mod.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/mod.kt new file mode 100644 index 00000000000..f72a03f668d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/mod.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(2) + val x = l[0] % 2 + if (x != 0) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/not.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/not.kt new file mode 100644 index 00000000000..0c280a8febc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/not.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(true) + val x = !l[0] + if (x) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/notEquals.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/notEquals.kt new file mode 100644 index 00000000000..0f57a857b28 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/notEquals.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0] != 1 + if (x != false) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plus.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plus.kt new file mode 100644 index 00000000000..97b8744ab0d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plus.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0] + 1 + if (x != 2) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plusAssign.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plusAssign.kt new file mode 100644 index 00000000000..cc3512f76a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/plusAssign.kt @@ -0,0 +1,10 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + var x = l[0] + x += 1 + l[0] += 1 + if (l[0] != 2) return "Fail: ${l[0]}" + if (x != 2) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/rangeTo.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/rangeTo.kt new file mode 100644 index 00000000000..ceb1961f5df --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/rangeTo.kt @@ -0,0 +1,10 @@ +fun box(): String { + val l = ArrayList() + l.add(2) + val sb = StringBuilder() + for (i in l[0]..3) { + sb.append(i) + } + if (sb.toString() != "23") return "Fail: $sb}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/times.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/times.kt new file mode 100644 index 00000000000..939bc056018 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/times.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0] * 2 + if (x != 2) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toShort.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toShort.kt new file mode 100644 index 00000000000..429eaf77336 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toShort.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = l[0].toShort() + if (x != 1.toShort()) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toString.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toString.kt new file mode 100644 index 00000000000..3ad15f84649 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/toString.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = "${l[0]}" + if (x != "1") return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryMinus.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryMinus.kt new file mode 100644 index 00000000000..30ed37ccf3b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryMinus.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = -l[0] + if (x != -1) return "Fail: $x" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryPlus.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryPlus.kt new file mode 100644 index 00000000000..c987878a3a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/unaryPlus.kt @@ -0,0 +1,7 @@ +fun box(): String { + val l = ArrayList() + l.add(1) + val x = +l[0] + if (x != 1) return "Fail: $x}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt new file mode 100644 index 00000000000..46a6fed2e53 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt @@ -0,0 +1,61 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// This test checks that our bytecode is consistent with javac bytecode + +fun _assert(condition: Boolean) { + if (!condition) throw AssertionError("Fail") +} + +fun _assertFalse(condition: Boolean) = _assert(!condition) + +fun box(): String { + var dnan = java.lang.Double.NaN + if (System.nanoTime() < 0) dnan = 3.14 // To avoid possible compile-time const propagation + + _assertFalse(0.0 < dnan) + _assertFalse(0.0 > dnan) + _assertFalse(0.0 <= dnan) + _assertFalse(0.0 >= dnan) + _assertFalse(0.0 == dnan) + _assertFalse(dnan < 0.0) + _assertFalse(dnan > 0.0) + _assertFalse(dnan <= 0.0) + _assertFalse(dnan >= 0.0) + _assertFalse(dnan == 0.0) + _assertFalse(dnan < dnan) + _assertFalse(dnan > dnan) + _assertFalse(dnan <= dnan) + _assertFalse(dnan >= dnan) + _assertFalse(dnan == dnan) + + // Double.compareTo: "NaN is considered by this method to be equal to itself and greater than all other values" + _assert(0.0.compareTo(dnan) == -1) + _assert(dnan.compareTo(0.0) == 1) + _assert(dnan.compareTo(dnan) == 0) + + var fnan = java.lang.Float.NaN + if (System.nanoTime() < 0) fnan = 3.14f + + _assertFalse(0.0f < fnan) + _assertFalse(0.0f > fnan) + _assertFalse(0.0f <= fnan) + _assertFalse(0.0f >= fnan) + _assertFalse(0.0f == fnan) + _assertFalse(fnan < 0.0f) + _assertFalse(fnan > 0.0f) + _assertFalse(fnan <= 0.0f) + _assertFalse(fnan >= 0.0f) + _assertFalse(fnan == 0.0f) + _assertFalse(fnan < fnan) + _assertFalse(fnan > fnan) + _assertFalse(fnan <= fnan) + _assertFalse(fnan >= fnan) + _assertFalse(fnan == fnan) + + _assert(0.0.compareTo(fnan) == -1) + _assert(fnan.compareTo(0.0) == 1) + _assert(fnan.compareTo(fnan) == 0) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNullCallsFun.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNullCallsFun.kt new file mode 100644 index 00000000000..0948f0eb0b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNullCallsFun.kt @@ -0,0 +1,13 @@ +var entered = 0 + +fun foo(t: T): T { + entered++ + return t +} + +fun box(): String { + if (foo(null) == null) {} + if (null == foo(null)) {} + if (foo(null) == foo(null)) {} + return if (entered == 4) "OK" else "Fail $entered" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/ea35963.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/ea35963.kt new file mode 100644 index 00000000000..6d58f3f2de4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/ea35963.kt @@ -0,0 +1,6 @@ +fun box(): String { + if (1 != 0) { + 1 + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/equalsHashCodeToString.kt new file mode 100644 index 00000000000..7d4684e70bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/equalsHashCodeToString.kt @@ -0,0 +1,60 @@ +fun box(): String { + val b: Byte = 42 + val c: Char = 'z' + val s: Short = 239 + val i: Int = -1 + val j: Long = -42L + val f: Float = 3.14f + val d: Double = -2.72 + val z: Boolean = true + + b.equals(b) + b == b + b.hashCode() + b.toString() + "$b" + + c.equals(c) + c == c + c.hashCode() + c.toString() + "$c" + + s.equals(s) + s == s + s.hashCode() + s.toString() + "$s" + + i.equals(i) + i == i + i.hashCode() + i.toString() + "$i" + + j.equals(j) + j == j + j.hashCode() + j.toString() + "$j" + + f.equals(f) + f == f + f.hashCode() + f.toString() + "$f" + + d.equals(d) + d == d + d.hashCode() + d.toString() + "$d" + + z.equals(z) + z == z + z.hashCode() + z.toString() + "$z" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/incrementByteCharShort.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/incrementByteCharShort.kt new file mode 100644 index 00000000000..59b3f12b2ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/incrementByteCharShort.kt @@ -0,0 +1,22 @@ +fun byteArg(b: Byte) {} +fun charArg(c: Char) {} +fun shortArg(s: Short) {} + +fun box(): String { + var b = 42.toByte() + b++ + ++b + byteArg(b) + + var c = 'x' + c++ + ++c + charArg(c) + + var s = 239.toShort() + s++ + ++s + shortArg(s) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/intLiteralIsNotNull.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/intLiteralIsNotNull.kt new file mode 100644 index 00000000000..d9f9d0420f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/intLiteralIsNotNull.kt @@ -0,0 +1 @@ +fun box() = if (10!! == 10) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1054.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1054.kt new file mode 100644 index 00000000000..6393e3a0ec0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1054.kt @@ -0,0 +1,17 @@ +fun box() : String { + return if(true.and(true)) "OK" else "fail" +} + +fun Boolean.and(other : Boolean) : Boolean{ + if(other == true) { + if(this == true){ + return true ; + } + else{ + return false; + } + } + else { + return false; + } +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1055.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1055.kt new file mode 100644 index 00000000000..1a03f1e3b6b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1055.kt @@ -0,0 +1,6 @@ +fun box() : String { + val a = "lala" + if(a !== a) return "fail 1" + if(a === a) return "OK" + return "fail 2" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1093.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1093.kt new file mode 100644 index 00000000000..f1b56508700 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1093.kt @@ -0,0 +1,8 @@ +val f : (Any) -> String = { it.toString() } + +fun box() : String { + if(!(f === f)) return "fail 1" + if(!(f == f)) return "fail 2" + if(!(f.equals(f))) return "fail 3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt13023.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt13023.kt new file mode 100644 index 00000000000..602654d9563 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt13023.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + val b = 'b' + val c = 'c' + assertEquals('c', b + 1) + assertEquals('a', b - 1) + assertEquals(1, c - b) + + val list = listOf('b', 'a') + assertEquals('c', list[0] + 1) + assertEquals('a', list[0] - 1) + assertEquals(1, list[0] - list[1]) + assertEquals(1, list[0] - 'a') + assertEquals(1, 'b' - list[1]) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt14868.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt14868.kt new file mode 100644 index 00000000000..1416af7135b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt14868.kt @@ -0,0 +1,6 @@ + +fun box(): String { + val x: Number = 75 + + return "O" + x.toChar() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1508.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1508.kt new file mode 100644 index 00000000000..28e534afe39 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1508.kt @@ -0,0 +1,6 @@ +fun test( n : Number ) = n.toInt().toLong() + n.toLong() + +fun box() : String { + val n : Number = 10 + return if(test(n) == 20.toLong()) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1634.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1634.kt new file mode 100644 index 00000000000..8cdc1a36907 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt1634.kt @@ -0,0 +1,4 @@ +fun box(): String { + !true + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2251.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2251.kt new file mode 100644 index 00000000000..d75041090e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2251.kt @@ -0,0 +1,39 @@ +class A(var b: Byte) { + fun c(d: Short) = (b + d.toByte()).toChar() +} + +fun box() : String { + if(A(10.toByte()).c(20.toShort()) != 30.toByte().toChar()) return "plus failed" + + var x = 20.toByte() + var y = 20.toByte() + val foo = { + x++ + ++x + } + + if(++x != 21.toByte() || x++ != 21.toByte() || foo() != 24.toByte() || x != 24.toByte()) return "shared byte fail" + if(++y != 21.toByte() || y++ != 21.toByte() || y != 22.toByte()) return "byte fail" + + var xs = 20.toShort() + var ys = 20.toShort() + val foos = { + xs++ + ++xs + } + + if(++xs != 21.toShort() || xs++ != 21.toShort() || foos() != 24.toShort() || xs != 24.toShort()) return "shared short fail" + if(++ys != 21.toShort() || ys++ != 21.toShort() || ys != 22.toShort()) return "short fail" + + var xc = 20.toChar() + var yc = 20.toChar() + val fooc = { + xc++ + ++xc + } + + if(++xc != 21.toChar() || xc++ != 21.toChar() || fooc() != 24.toChar() || xc != 24.toChar()) return "shared char fail" + if(++yc != 21.toChar() || yc++ != 21.toChar() || yc != 22.toChar()) return "char fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2269.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2269.kt new file mode 100644 index 00000000000..e1896168c8f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2269.kt @@ -0,0 +1,13 @@ +fun box() : String { + 230?.toByte()?.hashCode() + 9.hashCode() + + if(230.equals(9.toByte())) { + return "fail" + } + + if(230 == 9.toByte().toInt()) { + return "fail" + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2275.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2275.kt new file mode 100644 index 00000000000..4dc1296a0e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2275.kt @@ -0,0 +1,5 @@ +fun box(): String { + (0.toLong() as Number?)?.toByte() + (0 as Int?)?.toDouble() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt239.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt239.kt new file mode 100644 index 00000000000..f36b32743d8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt239.kt @@ -0,0 +1,5 @@ +fun box() : String { + val i : Int? = 0 + val j = i?.plus(3) //verify error + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt242.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt242.kt new file mode 100644 index 00000000000..c1a99510817 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt242.kt @@ -0,0 +1,19 @@ +fun box() : String { + val i: Int? = 7 + val j: Int? = null + val k = 7 + + //verify errors + if (i == 7) {} + if (7 == i) {} + + if (j == 7) {} + if (7 == j) {} + + if (i == k) {} + if (k == i) {} + + if (j == k) {} + if (k == j) {} + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt new file mode 100644 index 00000000000..732c92f87ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box() : String { + val t = java.lang.String.copyValueOf(java.lang.String("s").toCharArray()) + val i = java.lang.Integer.MAX_VALUE + val j = java.lang.Integer.valueOf(15) + val s = java.lang.String.valueOf(1) + val l = java.util.Collections.emptyList() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt248.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt248.kt new file mode 100644 index 00000000000..0607b21341f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt248.kt @@ -0,0 +1,7 @@ +fun box() : String { + val b = true as? Boolean //exception + val i = 1 as Int //exception + val j = 1 as Int? //ok + val s = "s" as String //ok + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2768.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2768.kt new file mode 100644 index 00000000000..b2b0ec976ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2768.kt @@ -0,0 +1,17 @@ +fun assertEquals(a: T, b: T) { + if (a != b) throw AssertionError("$a != $b") +} + +fun box(): String { + val bytePos = 128.toByte() // Byte.MAX_VALUE + 1 + assertEquals(-128, bytePos.toInt()) // correct, wrapped to Byte.MIN_VALUE + + val shortPos = 32768.toShort() // Short.MAX_VALUE + 1 + assertEquals(-32768, shortPos.toInt()) // correct, wrapped to Short.MIN_VALUE + + assertEquals((-128).toByte().toString(), "-128") + // TODO: KT-2780 + // assertEquals((-128.toByte()).toString(), "-128") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2794.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2794.kt new file mode 100644 index 00000000000..bd6c80dced5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt2794.kt @@ -0,0 +1,6 @@ +fun box () : String { + val b = 4.toByte() + val s = 5.toShort() + val c: Char = 'A' + return if( "$b" == "4" && " $b" == " 4" && "$s" == "5" && " $s" == " 5" && "$c" == "A" && " $c" == " A") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3078.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3078.kt new file mode 100644 index 00000000000..cd834c89b2f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3078.kt @@ -0,0 +1,7 @@ +fun box(): String { + if (1 >= 1.9) return "Fail #1" + if (1.compareTo(1.1) >= 0) return "Fail #2" + if (1.9 <= 1) return "Fail #3" + if (1.1.compareTo(1) <= 0) return "Fail #4" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3517.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3517.kt new file mode 100644 index 00000000000..535f32308cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3517.kt @@ -0,0 +1,6 @@ +// KT-3517 Can't call .equals() on a boolean + +fun box(): String { + val a = false + return if (true.equals(true) && a.equals(false)) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3576.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3576.kt new file mode 100644 index 00000000000..955272f0faa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3576.kt @@ -0,0 +1,9 @@ +object TestObject { + val testFloat: Float = 0.9999.toFloat() + val otherFloat: Float = 1.01.toFloat() +} + +fun box(): String { + return if (TestObject.testFloat.equals(0.9999.toFloat()) + && TestObject.otherFloat.equals(1.01.toFloat())) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3613.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3613.kt new file mode 100644 index 00000000000..c578f93fb7e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt3613.kt @@ -0,0 +1,6 @@ +fun foo(): Int? = 42 + +fun box(): String { + if (foo()!! > 239) return "Fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4097.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4097.kt new file mode 100644 index 00000000000..04cc01c3f3a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4097.kt @@ -0,0 +1,15 @@ +fun box(): String { + val shouldBeTrue = 555555555555555555L in 123456789123456789L..987654321987654321L + if (!shouldBeTrue) return "Fail 1" + + val shouldBeFalse = 5000000000L in 6000000000L..9000000000L + if (shouldBeFalse) return "Fail 2" + + if (123123123123L !in 100100100100L..200200200200L) return "Fail 3" + + return when (9876543210) { + in 2000000000L..3333333333L -> "Fail 4" + !in 8888888888L..9999999999L -> "Fail 5" + else -> "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4098.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4098.kt new file mode 100644 index 00000000000..a74f18feeac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4098.kt @@ -0,0 +1,10 @@ +fun box(): String { + val c: Char? = '0' + c!!.toInt() + + "123456"?.get(0)!!.toInt() + + "123456"!!.get(0).toInt() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4210.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4210.kt new file mode 100644 index 00000000000..4f3b16d0e6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4210.kt @@ -0,0 +1,16 @@ +fun box(): String { + val s: String? = "abc" + val c = s?.get(0)!! - 'b' + if (c != -1) return "Fail c: $c" + + val d = 'b' - s?.get(2)!! + if (d != -1) return "Fail d: $d" + + val e = s?.get(2)!! - s?.get(0)!! + if (e != 2) return "Fail e: $e" + + val f = s?.get(2)!!.minus(s?.get(0)!!) + if (f != 2) return "Fail f: $f" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4251.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4251.kt new file mode 100644 index 00000000000..eda602589c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt4251.kt @@ -0,0 +1,5 @@ +fun box(): String { + val a: Char? = 'a' + val result = a!! < 'b' + return if (result) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt446.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt446.kt new file mode 100644 index 00000000000..c148b490f81 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt446.kt @@ -0,0 +1,5 @@ +fun box(): String { + var s = "s" + s += 1 + return if (s == "s1") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt518.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt518.kt new file mode 100644 index 00000000000..f1ec08f1c2f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt518.kt @@ -0,0 +1,15 @@ + +fun foo(i : Int?, a : Any?) { + i?.plus(1) + if (i != null) { + i + 1 + if (a is String) { + a[0] + } + } +} + +fun box () : String { + foo(2, "239") + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt6590_identityEquals.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt6590_identityEquals.kt new file mode 100644 index 00000000000..f21a8f1f6a7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt6590_identityEquals.kt @@ -0,0 +1,15 @@ +fun box(): String { + val i: Int = 10000 + if (!(i === i)) return "Fail int ===" + if (i !== i) return "Fail int !==" + + val j: Long = 123L + if (!(j === j)) return "Fail long ===" + if (j !== j) return "Fail long !==" + + val d: Double = 3.14 + if (!(d === d)) return "Fail double ===" + if (d !== d) return "Fail double !==" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt665.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt665.kt new file mode 100644 index 00000000000..b8bd69b6550 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt665.kt @@ -0,0 +1,12 @@ +fun f(x: Long, zzz: Long = 1): Long +{ + return if (x <= 1) zzz + else f(x-1, x*zzz) +} + +fun box() : String +{ + val six: Long = 6; + if (f(six) != 720.toLong()) return "Fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt new file mode 100644 index 00000000000..8f2247c860f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun escapeChar(c : Char) : String? = when (c) { + '\\' -> "\\\\" + '\n' -> "\\n" + '"' -> "\\\"" + else -> "" + c +} + +fun String.escape(i : Int = 0, result : String = "") : String = + if (i == length) result + else escape(i + 1, result + escapeChar(get(i))) + +fun box() : String { + val s = " System.out?.println(\"fun escapeChar(c : Char) : String? = when (c) {\");\n System.out?.println(\" '\\\\\\\\' => \\\"\\\\\\\\\\\\\\\\\\\"\");\n System.out?.println(\" '\\\\n' => \\\"\\\\\\\\n\\\"\");\n System.out?.println(\" '\\\"' => \\\"\\\\\\\\\\\\\\\"\\\"\");\n System.out?.println(\" else => String.valueOf(c)\");\n System.out?.println(\"}\");\n System.out?.println();\n System.out?.println(\"fun String.escape(i : Int = 0, result : String = \\\"\\\") : String =\");\n System.out?.println(\" if (i == length) result\");\n System.out?.println(\" else escape(i + 1, result + escapeChar(this.get(i)))\");\n System.out?.println();\n System.out?.println(\"fun main(args : Array) {\");\n System.out?.println(\" val s = \\\"\" + s.escape() + \"\\\";\");\n System.out?.println(s);\n}\n"; + System.out?.println("fun escapeChar(c : Char) : String? = when (c) {"); + System.out?.println(" '\\\\' => \"\\\\\\\\\""); + System.out?.println(" '\\n' => \"\\\\n\""); + System.out?.println(" '\"' => \"\\\\\\\"\""); + System.out?.println(" else => String.valueOf(c)"); + System.out?.println("}"); + System.out?.println(); + System.out?.println("fun String.escape(i : Int = 0, result : String = \"\") : String ="); + System.out?.println(" if (i == length) result"); + System.out?.println(" else escape(i + 1, result + escapeChar(this.get(i)))"); + System.out?.println(); + System.out?.println("fun main(args : Array) {"); + System.out?.println(" val s = \"" + s.escape() + "\";"); + System.out?.println(s); + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt711.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt711.kt new file mode 100644 index 00000000000..ffe360595a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt711.kt @@ -0,0 +1 @@ +fun box() = if ((1 ?: 0) == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt737.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt737.kt new file mode 100644 index 00000000000..bdf9a4f5af7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt737.kt @@ -0,0 +1,5 @@ +fun box(): String { + if (3.compareTo(2) != 1) return "Fail #1" + if (5.toByte().compareTo(10.toLong()) >= 0) return "Fail #2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt new file mode 100644 index 00000000000..272785c4b6f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package demo_range + +operator fun Int?.rangeTo(other : Int?) : IntRange = this!!.rangeTo(other!!) + +fun box() : String { + val x : Int? = 10 + val y : Int? = 12 + + for (i in x..y) + System.out?.println(i.inv()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt new file mode 100644 index 00000000000..834c75863cc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package bitwise_demo + +fun Long?.shl(bits : Int?) : Long = this!!.shl(bits!!) + +fun box() : String { + val x : Long? = 10 + val y : Int? = 12 + + System.out?.println(x.shl(y)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt new file mode 100644 index 00000000000..b23412aba94 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package demo_range + +operator fun Int?.unaryPlus() : Int = this!!.unaryPlus() +operator fun Int?.dec() : Int = this!!.dec() +operator fun Int?.inc() : Int = this!!.inc() +operator fun Int?.unaryMinus() : Int = this!!.unaryMinus() + +fun box() : String { + val x : Int? = 10 + System.out?.println(x?.inv())// * x?.unaryPlus() * x?.dec() * x?.unaryMinus() as Number) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt new file mode 100644 index 00000000000..0e546d0a21d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package demo_long + +fun Long?.inv() : Long = this!!.inv() + +fun box() : String { + val x : Long? = 10 + System.out?.println(x.inv()) + return if(x.inv() == -11.toLong()) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt828.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt828.kt new file mode 100644 index 00000000000..06e63bec23c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt828.kt @@ -0,0 +1,15 @@ +package demo + +fun box() : String { + var res : Boolean = true + res = (res and false) + res = (res or false) + res = (res xor false) + res = (true and false) + res = (true or false) + res = (true xor false) + res = (!true) + res = (true && false) + res = (true || false) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt877.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt877.kt new file mode 100644 index 00000000000..094c5f88fae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt877.kt @@ -0,0 +1,9 @@ +fun box() : String { + var a : Int = -1 + if((+a) != -1) return "fail 1" + a = 1 + if((+a) != 1) return "fail 2" + if((+-1) != -1) return "fail 3" + if((-+a) != -1) return "fail 4" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt882.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt882.kt new file mode 100644 index 00000000000..15da30a150e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt882.kt @@ -0,0 +1,7 @@ +val _0 : Double = 0.0 +val _0dbl : Double = 0.toDouble() + +fun box() : String { + if(_0 != _0dbl) return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt887.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt887.kt new file mode 100644 index 00000000000..c03be7c8835 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt887.kt @@ -0,0 +1,5 @@ +class Book(val name: String) : Comparable { + override fun compareTo(other: Book) = name.compareTo(other.name) +} + +fun box() = if(Book("239").compareTo(Book("932")) != 0) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt new file mode 100644 index 00000000000..20643927da8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +package bottles + +fun box() : String { + var bottles = 10 + while (bottles > 0) { + print(bottlesOfBeer(bottles) + " on the wall, ") + println(bottlesOfBeer(bottles) + ".") + print("Take one down, pass it around, ") + if (--bottles == 0) { + println("no more bottles of beer on the wall.") + } + else { + println(bottlesOfBeer(bottles) + " on the wall.") + } + } + return "OK" +} + +fun bottlesOfBeer(count : Int) : String { + val result = StringBuilder() + result += count + result += if (count > 1) " bottles of beer" else " bottle of beer" + return result.toString() ?: "" +} + +// An excerpt from the standard library +fun print(message : String) { System.out?.print(message) } +fun println(message : String) { System.out?.println(message) } +operator fun StringBuilder.plusAssign(o : Any) { append(o) } +val Array.isEmpty : Boolean get() = size == 0 diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/nullAsNullableIntIsNull.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/nullAsNullableIntIsNull.kt new file mode 100644 index 00000000000..a9273088e10 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/nullAsNullableIntIsNull.kt @@ -0,0 +1,9 @@ +fun box(): String { + try { + if ((null as Int?)!! == 10) return "Fail #1" + return "Fail #2" + } + catch (e: Exception) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/nullableCharBoolean.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/nullableCharBoolean.kt new file mode 100644 index 00000000000..ddc86b85777 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/nullableCharBoolean.kt @@ -0,0 +1,9 @@ +fun box(): String { + val c: Char? = 'a' + if (c!! - 'a' != 0) return "Fail c" + + val b: Boolean? = false + if (b!!) return "Fail b" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt new file mode 100644 index 00000000000..793b5d22f11 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: FortyTwoExtractor.java + +public class FortyTwoExtractor { + private Number fortyTwo = new FortyTwo(); + + public int intValue() { + return fortyTwo.intValue(); + } +} + +// FILE: FortyTwoExtractor.kt + +class FortyTwo : Number() { + override fun toByte() = 42.toByte() + + override fun toShort() = 42.toShort() + + override fun toInt() = 42 + + override fun toLong() = 42L + + override fun toFloat() = 42.0f + + override fun toDouble() = 42.0 + + override fun toChar() = 42.toChar() +} + +fun box(): String { + val extractor = FortyTwoExtractor() + if (extractor.intValue() != 42) return "FAIL" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/rangeTo.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/rangeTo.kt new file mode 100644 index 00000000000..7d55b63daf9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/rangeTo.kt @@ -0,0 +1,62 @@ +fun box(): String { + val b: Byte = 42 + val c: Char = 'z' + val s: Short = 239 + val i: Int = -1 + val j: Long = -42L + + b.rangeTo(b) + b..b + b.rangeTo(s) + b..s + b.rangeTo(i) + b..i + b.rangeTo(j) + b..j + + c.rangeTo(c) + c..c + + s.rangeTo(b) + s..b + s.rangeTo(s) + s..s + s.rangeTo(i) + s..i + s.rangeTo(j) + s..j + + i.rangeTo(b) + i..b + i.rangeTo(s) + i..s + i.rangeTo(i) + i..i + i.rangeTo(j) + i..j + + j.rangeTo(b) + j..b + j.rangeTo(s) + j..s + j.rangeTo(i) + j..i + j.rangeTo(j) + j..j + + return "OK" +} + +/* +fun main(args: Array) { + val s = "bcsij" + for (i in s) { + for (j in s) { + if ((i == 'c') != (j == 'c')) continue + println(" $i.rangeTo($j)") + println(" $i..$j") + } + println() + } +} +*/ diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt new file mode 100644 index 00000000000..2d708f05c2d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class L(var a: T) {} + +fun foo() = L(5).a + +fun box(): String { + val x: Any = foo() + return if (x is Integer) "OK" else "Fail $x" +} diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/unboxComparable.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/unboxComparable.kt new file mode 100644 index 00000000000..870989087fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/unboxComparable.kt @@ -0,0 +1,5 @@ +fun foo(x: Int) = x + +fun bar(x: Comparable) = if (x is Int) foo(x) else 0 + +fun box() = if (bar(42) == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/private/arrayConvention.kt b/backend.native/tests/external/codegen/blackbox/private/arrayConvention.kt new file mode 100644 index 00000000000..5d778552e83 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/private/arrayConvention.kt @@ -0,0 +1,21 @@ +var result = "fail" + +private operator fun X.get(name: String) = name + "K" +private operator fun X.set(name: String, v: String) { + result = v +} + +class X { + fun test() : String { + if (this["O"] != "OK") return "fail 1: ${this["O"]}" + + this["O"] += "K" + if (result != "OKK") return "fail 2: ${result}" + + return "OK" + } +} + +fun box(): String { + return X().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/private/kt9855.kt b/backend.native/tests/external/codegen/blackbox/private/kt9855.kt new file mode 100644 index 00000000000..03e1658e1a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/private/kt9855.kt @@ -0,0 +1,15 @@ +class MyString(var content : String) + +object Greeter { + fun sayHello(name : String): String { + var result = MyString(name) + result += "K" + return result.content + } +} + +private operator fun MyString.plus(suffix: String) : MyString = MyString("${this.content}$suffix") + +fun box(): String { + return Greeter.sayHello("O") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/base.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/base.kt new file mode 100644 index 00000000000..f856a95217b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/base.kt @@ -0,0 +1,9 @@ +// See also KT-6299 +public open class Outer private constructor() { + class Inner: Outer() +} + +fun box(): String { + val outer = Outer.Inner() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/captured.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/captured.kt new file mode 100644 index 00000000000..83b38054d77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/captured.kt @@ -0,0 +1,10 @@ +public open class Outer private constructor(val s: String) { + + companion object { + fun test () = { Outer("OK") }() + } +} + +fun box(): String { + return Outer.test().s +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/companion.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/companion.kt new file mode 100644 index 00000000000..482c81233a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/companion.kt @@ -0,0 +1,11 @@ +// See also KT-6299 +public open class Outer private constructor() { + companion object { + fun foo() = Outer() + } +} + +fun box(): String { + val outer = Outer.foo() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/inline.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/inline.kt new file mode 100644 index 00000000000..9b80c07d05a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/inline.kt @@ -0,0 +1,11 @@ +// See also KT-6299 +public open class Outer private constructor() { + companion object { + internal inline fun foo() = Outer() + } +} + +fun box(): String { + val outer = Outer.foo() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/inner.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/inner.kt new file mode 100644 index 00000000000..16c1734f08f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/inner.kt @@ -0,0 +1,15 @@ +// See also KT-6299 +public open class Outer private constructor(val s: String) { + inner class Inner: Outer("O") { + fun foo(): String { + return this.s + this@Outer.s + } + } + class Nested: Outer("K") + fun bar() = Inner() +} + +fun box(): String { + val inner = Outer.Nested().bar() + return inner.foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/kt4860.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/kt4860.kt new file mode 100644 index 00000000000..8b63d2b415f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/kt4860.kt @@ -0,0 +1,12 @@ +open class A private constructor() { + companion object : A() { + } + + class B: A() +} + +fun box(): String { + val a = A + val b = A.B() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/secondary.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/secondary.kt new file mode 100644 index 00000000000..6f59e0474b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/secondary.kt @@ -0,0 +1,9 @@ +// See also KT-6299 +public open class Outer private constructor(val x: Int) { + constructor(): this(42) +} + +fun box(): String { + val outer = Outer() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt new file mode 100644 index 00000000000..94aec529b5e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +// private constructors are transformed into synthetic +class PrivateConstructor private constructor() { + class Nested { val a = PrivateConstructor() } +} + +fun check(klass: Class<*>) { + var hasSynthetic = false + var hasSimple = false + for (method in klass.getDeclaredConstructors()) { + if (method.isSynthetic()) { + hasSynthetic = true + } + else { + hasSimple = true + } + } + if (hasSynthetic && hasSimple) return + throw AssertionError("Class should have both synthetic and non-synthetic constructor: ($hasSynthetic, $hasSimple)") +} + +fun box(): String { + check(PrivateConstructor::class.java) + // Also check that synthetic accessors really work + PrivateConstructor.Nested() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/withArguments.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/withArguments.kt new file mode 100644 index 00000000000..a53517a81dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/withArguments.kt @@ -0,0 +1,13 @@ +// See also KT-6299 +public open class Outer private constructor(val s: String, val f: Boolean = true) { + class Inner: Outer("xyz") + class Other: Outer("abc", true) + class Another: Outer("", false) +} + +fun box(): String { + val outer = Outer.Inner() + val other = Outer.Other() + val another = Outer.Another() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/withDefault.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/withDefault.kt new file mode 100644 index 00000000000..cb96e8dcb4b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/withDefault.kt @@ -0,0 +1,11 @@ +// See also KT-6299 +public open class Outer private constructor(val x: Int = 0) { + class Inner: Outer() + class Other: Outer(42) +} + +fun box(): String { + val outer = Outer.Inner() + val other = Outer.Other() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedClasses.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedClasses.kt new file mode 100644 index 00000000000..ff7f86f847a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedClasses.kt @@ -0,0 +1,12 @@ +// See also KT-6299 +public open class Outer private constructor(val p: Outer?) { + object First: Outer(null) + class Other(p: Outer = First): Outer(p) +} + +fun box(): String { + val second = Outer.Other() + val third = Outer.Other(second) + val fourth = Outer.Other(third) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedObjects.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedObjects.kt new file mode 100644 index 00000000000..549e13912ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/withLinkedObjects.kt @@ -0,0 +1,13 @@ +// See also KT-6299 +public open class Outer private constructor(val p: Outer?) { + object Inner: Outer(null) + object Other: Outer(Inner) + object Another: Outer(Other) +} + +fun box(): String { + val outer = Outer.Inner + val other = Outer.Other + val another = Outer.Another + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/withVarargs.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/withVarargs.kt new file mode 100644 index 00000000000..f7791f1968c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/withVarargs.kt @@ -0,0 +1,13 @@ +// See also KT-6299 +public open class Outer private constructor(val s: String, vararg i: Int) { + class Inner: Outer("xyz") + class Other: Outer("abc", 1, 2, 3) + class Another: Outer("", 42) +} + +fun box(): String { + val outer = Outer.Inner() + val other = Outer.Other() + val another = Outer.Another() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateProperty.kt b/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateProperty.kt new file mode 100644 index 00000000000..b898fa5689e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateProperty.kt @@ -0,0 +1,52 @@ +class A { + private var foo = 1 + get() { + return 1 + } + + fun foo() { + foo = 5 + foo + } +} + +class B { + private val foo = 1 + get + + fun foo() { + foo + } +} + +class C { + private var foo = 1 + get + set + + fun foo() { + foo = 2 + foo + } +} + +class D { + private var foo = 1 + set(i: Int) { + field = i + 1 + } + + fun foo() { + foo = 5 + foo + } +} + +fun box(): String { + A().foo() + B().foo() + C().foo() + D().foo() + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt b/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt new file mode 100644 index 00000000000..881f5eae288 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class D { + var foo = 1 + private set + + fun foo() { + foo = 2 + } +} + +fun box(): String { + D().foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/augmentedAssignmentsAndIncrements.kt b/backend.native/tests/external/codegen/blackbox/properties/augmentedAssignmentsAndIncrements.kt new file mode 100644 index 00000000000..0b8af84ffe1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/augmentedAssignmentsAndIncrements.kt @@ -0,0 +1,147 @@ +// Enable when KT-14833 is fixed. +// TARGET_BACKEND: JS +import kotlin.reflect.KProperty + +var a = 0 + +var b: Int + get() = a + set(v: Int) { + a = v + } + +class A { + var c: Int + get() = a + set(v: Int) { + a = v + } +} + +var A.d: Int + get() = a + set(v: Int) { + a = v + } + +var Int.e: Int + get() = a + set(v: Int) { + a = v + } + +object SimpleDelegate { + operator fun getValue(thisRef: Any?, desc: KProperty<*>): Int { + return a + } + + operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: Int) { + a = value + } +} + +var f by SimpleDelegate + +fun box(): String { + if (b++ != 0) return "fail b++: $b" + if (++b != 2) return "fail ++b: $b" + if (--b != 1) return "fail --b: $b" + if (b-- != 1) return "fail b--: $b" + b += 10 + if (b != 10) return "fail b +=: $b" + b *= 10 + if (b != 100) return "fail b *=: $b" + b /= 5 + if (b != 20) return "fail b /=: $b" + b -= 10 + if (b != 10) return "fail b -=: $b" + b %= 7 + if (b != 3) return "fail b %=: $b" + + var q = A() + + a = 0 + if (q.c++ != 0) return "fail q.c++: ${q.c}" + if (++q.c != 2) return "fail ++q.c: ${q.c}" + if (--q.c != 1) return "fail --q.c: ${q.c}" + if (q.c-- != 1) return "fail q.c--: ${q.c}" + q.c += 10 + if (q.c != 10) return "fail q.c +=: ${q.c}" + q.c *= 10 + if (q.c != 100) return "fail q.c *=: ${q.c}" + q.c /= 5 + if (q.c != 20) return "fail q.c /=: ${q.c}" + q.c -= 10 + if (q.c != 10) return "fail q.c -=: ${q.c}" + q.c %= 7 + if (q.c != 3) return "fail q.c %=: ${q.c}" + + a = 0 + if (q.d++ != 0) return "fail q.d++: ${q.d}" + if (++q.d != 2) return "fail ++q.d: ${q.d}" + if (--q.d != 1) return "fail --q.d: ${q.d}" + if (q.d-- != 1) return "fail q.d--: ${q.d}" + q.d += 10 + if (q.d != 10) return "fail q.d +=: ${q.d}" + q.d *= 10 + if (q.d != 100) return "fail q.d *=: ${q.d}" + q.d /= 5 + if (q.d != 20) return "fail q.d /=: ${q.d}" + q.d -= 10 + if (q.d != 10) return "fail q.d -=: ${q.d}" + q.d %= 7 + if (q.d != 3) return "fail q.d %=: ${q.d}" + + a = 0 + if (0.e++ != 0) return "fail 0.e++: ${0.e}" + if (++0.e != 2) return "fail ++0.e: ${0.e}" + if (--0.e != 1) return "fail --0.e: ${0.e}" + if (0.e-- != 1) return "fail 0.e--: ${0.e}" + 0.e += 10 + if (0.e != 10) return "fail 0.e +=: ${0.e}" + 0.e *= 10 + if (0.e != 100) return "fail 0.e *=: ${0.e}" + 0.e /= 5 + if (0.e != 20) return "fail 0.e /=: ${0.e}" + 0.e -= 10 + if (0.e != 10) return "fail 0.e -=: ${0.e}" + 0.e %= 7 + if (0.e != 3) return "fail 0.e %=: ${0.e}" + + a = 0 + if (f++ != 0) return "fail f++: $f" + if (++f != 2) return "fail ++f: $f" + if (--f != 1) return "fail --f: $f" + if (f-- != 1) return "fail f--: $f" + f += 10 + if (f != 10) return "fail f +=: $f" + f *= 10 + if (f != 100) return "fail f *=: $f" + f /= 5 + if (f != 20) return "fail f /=: $f" + f -= 10 + if (f != 10) return "fail f -=: $f" + f %= 7 + if (f != 3) return "fail f %=: $f" + + + var g by SimpleDelegate + + a = 0 + if (g++ != 0) return "fail g++: $g" + if (++g != 2) return "fail ++g: $g" + if (--g != 1) return "fail --g: $g" + if (g-- != 1) return "fail g--: $g" + g += 10 + if (g != 10) return "fail g +=: $g" + g *= 10 + if (g != 100) return "fail g *=: $g" + g /= 5 + if (g != 20) return "fail g /=: $g" + g -= 10 + if (g != 10) return "fail g -=: $g" + g %= 7 + if (g != 3) return "fail g %=: $g" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/classArtificialFieldInsideNested.kt b/backend.native/tests/external/codegen/blackbox/properties/classArtificialFieldInsideNested.kt new file mode 100644 index 00000000000..a33fcca3c74 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/classArtificialFieldInsideNested.kt @@ -0,0 +1,15 @@ +abstract class Your { + abstract val your: String + + fun foo() = your +} + +class My { + val back = "O" + val my: String + get() = object : Your() { + override val your = back + }.foo() + "K" +} + +fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLambda.kt b/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLambda.kt new file mode 100644 index 00000000000..121ac3426b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLambda.kt @@ -0,0 +1,6 @@ +class My { + val my: String = "O" + get() = { field }() + "K" +} + +fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLocalInSetter.kt b/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLocalInSetter.kt new file mode 100644 index 00000000000..e6e1c9f17f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideLocalInSetter.kt @@ -0,0 +1,18 @@ +class My { + var my: String = "U" + get() = { field }() + set(arg) { + class Local { + fun foo() { + field = arg + "K" + } + } + Local().foo() + } +} + +fun box(): String { + val m = My() + m.my = "O" + return m.my +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideNested.kt b/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideNested.kt new file mode 100644 index 00000000000..0ac00ddb630 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/classFieldInsideNested.kt @@ -0,0 +1,14 @@ +abstract class Your { + abstract val your: String + + fun foo() = your +} + +class My { + val my: String = "O" + get() = object : Your() { + override val your = field + }.foo() + "K" +} + +fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/classObjectProperties.kt b/backend.native/tests/external/codegen/blackbox/properties/classObjectProperties.kt new file mode 100644 index 00000000000..1a48f5eb5f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/classObjectProperties.kt @@ -0,0 +1,58 @@ +class Test { + + companion object { + + public val prop1 : Int = 10 + + public var prop2 : Int = 11 + private set + + public val prop3: Int = 12 + get() { + return field + } + + var prop4 : Int = 13 + + fun incProp4() { + prop4++ + } + + + public var prop5 : Int = 14 + + public var prop7 : Int = 20 + set(i: Int) { + field++ + } + } + +} + + +fun box(): String { + val t = Test; + + if (t.prop1 != 10) return "fail1"; + + if (t.prop2 != 11) return "fail2"; + + if (t.prop3 != 12) return "fail3"; + + if (t.prop4 != 13) return "fail4"; + + t.incProp4() + if (t.prop4 != 14) return "fail4.inc"; + + if (t.prop5 != 14) return "fail5"; + + t.prop5 = 1414 + if (t.prop5 != 1414) return "fail6"; + + if (t.prop7 != 20) return "fail7"; + + t.prop7 = 1000000 + if (t.prop7 != 21) return "fail8"; + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/classPrivateArtificialFieldInsideNested.kt b/backend.native/tests/external/codegen/blackbox/properties/classPrivateArtificialFieldInsideNested.kt new file mode 100644 index 00000000000..af1660a58da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/classPrivateArtificialFieldInsideNested.kt @@ -0,0 +1,15 @@ +abstract class Your { + abstract val your: String + + fun foo() = your +} + +class My { + private val back = "O" + val my: String + get() = object : Your() { + override val your = back + }.foo() + "K" +} + +fun box() = My().my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt b/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt new file mode 100644 index 00000000000..aeabb33ec7a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Test.java + +public class Test extends java.util.ArrayList { + public final int size() { + return 56; + } +} + +// FILE: test.kt + +class OurTest : Test() + +fun box(): String { + val t = OurTest() + val x: MutableCollection = t + + if (t.size != 56) return "fail 1: ${t.size}" + if (x.size != 56) return "fail 1: ${x.size}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt b/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt new file mode 100644 index 00000000000..ed6b0fff889 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt @@ -0,0 +1,112 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J extends A { + + public boolean okField = false; + + public int getValProp() { + return 123; + } + + public int getVarProp() { + return 456; + } + + public void setVarProp(int x) { + okField = true; + } + + public int isProp() { + return 789; + } + + public void setProp(int x) { + okField = true; + } +} + +// FILE: test.kt + +open class A { + open val valProp: Int = -1 + open var varProp: Int = -1 + open var isProp: Int = -1 +} + +class B : J() { + override val valProp: Int = super.valProp + 1 + override var varProp: Int + set(value) { + super.varProp = value + } + get() = super.varProp + 1 + + override var isProp: Int + set(value) { + super.isProp = value + } + get() = super.isProp + 1 +} + +fun box(): String { + val j = J() + var a: A = j + + if (j.valProp != 123) return "fail 1" + if (a.valProp != 123) return "fail 2" + + j.varProp = -1 + if (!j.okField) return "fail 3" + j.okField = false + + a.varProp = -1 + if (!j.okField) return "fail 4" + j.okField = false + + if (j.varProp != 456) return "fail 5" + if (a.varProp != 456) return "fail 6" + + j.isProp = -1 + if (!j.okField) return "fail 7" + j.okField = false + + a.isProp = -1 + if (!j.okField) return "fail 8" + j.okField = false + + if (j.isProp != 789) return "fail 9" + if (a.isProp != 789) return "fail 10" + + val b = B() + a = b + + if (b.valProp != 124) return "fail 11" + if (a.valProp != 124) return "fail 12" + + b.varProp = -1 + if (!b.okField) return "fail 13" + b.okField = false + + a.varProp = -1 + if (!b.okField) return "fail 14" + b.okField = false + + if (b.varProp != 457) return "fail 15" + if (a.varProp != 457) return "fail 16" + + b.isProp = -1 + if (!b.okField) return "fail 17" + b.okField = false + + a.isProp = -1 + if (!b.okField) return "fail 18" + b.okField = false + + if (b.isProp != 790) return "fail 19" + if (a.isProp != 790) return "fail 20" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionFieldInsideLambda.kt b/backend.native/tests/external/codegen/blackbox/properties/companionFieldInsideLambda.kt new file mode 100644 index 00000000000..4e4f60b9df7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/companionFieldInsideLambda.kt @@ -0,0 +1,8 @@ +class My { + companion object { + val my: String = "O" + get() = { field }() + "K" + } +} + +fun box() = My.my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt b/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt new file mode 100644 index 00000000000..5b6d2431ba0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J { + public static int f() { + return A.Companion.getI1() + A.Companion.getI2() + B.Named.getI1() + B.Named.getI2(); + } +} + +// FILE: test.kt + +class A { + companion object { + val i1 = 1 + val i2 = 2 + } +} + +class B { + companion object Named { + val i1 = 3 + val i2 = 4 + } +} + +fun box(): String { + return if (J.f() == A.i1 + A.i2 + B.i1 + B.i2) "OK" else "Fail: ${J.f()}" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt b/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt new file mode 100644 index 00000000000..e70f5eb112c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt @@ -0,0 +1,53 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class Test { + String test() { + String s; + + s = Klass.NAME; + if (!s.equals("Klass")) throw new AssertionError("Fail class: " + s); + + s = Klass.JVM_NAME; + if (!s.equals("JvmKlass")) throw new AssertionError("Fail jvm class: " + s); + + s = Trait.NAME; + if (!s.equals("Trait")) throw new AssertionError("Fail interface: " + s); + + s = Enoom.NAME; + if (!s.equals("Enum")) throw new AssertionError("Fail enum: " + s); + + s = Enoom.JVM_NAME; + if (!s.equals("JvmEnum")) throw new AssertionError("Fail jvm enum: " + s); + + return "OK"; + } +} + +// FILE: test.kt + +class Klass { + companion object { + const val NAME = "Klass" + @JvmField val JVM_NAME = "JvmKlass" + } +} + +interface Trait { + companion object { + const val NAME = "Trait" + } +} + +enum class Enoom { + ; + companion object { + const val NAME = "Enum" + @JvmField val JVM_NAME = "JvmEnum" + } +} + +fun box() = Test().test() diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionPrivateField.kt b/backend.native/tests/external/codegen/blackbox/properties/companionPrivateField.kt new file mode 100644 index 00000000000..7a4b94e7aaa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/companionPrivateField.kt @@ -0,0 +1,10 @@ +class My { + companion object { + private val my: String = "O" + get() = field + "K" + + fun getValue() = my + } +} + +fun box() = My.getValue() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionPrivateFieldInsideLambda.kt b/backend.native/tests/external/codegen/blackbox/properties/companionPrivateFieldInsideLambda.kt new file mode 100644 index 00000000000..7219fcd4d3d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/companionPrivateFieldInsideLambda.kt @@ -0,0 +1,10 @@ +class My { + companion object { + private val my: String = "O" + get() = { field }() + "K" + + fun getValue() = my + } +} + +fun box() = My.getValue() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt b/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt new file mode 100644 index 00000000000..79a9bcacf1e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +@file:JvmName("XYZ") +import java.lang.reflect.Modifier + +private const val privateConst: Int = 1 +public const val publicConst: Int = 3 + +public object A { + private const val privateConst: Int = 1 + public const val publicConst: Int = 3 +} + +public class B { + companion object { + private const val privateConst: Int = 1 + protected const val protectedConst: Int = 2 + public const val publicConst: Int = 3 + } +} + +fun check(clazz: Class<*>, expectProtected: Boolean = true) { + val fields = clazz.declaredFields.filter { it.name.contains("Const") } + + assert(fields.all { Modifier.isStatic(it.modifiers) }) { "`$clazz` contains non-static fields" } + + assert(Modifier.isPrivate(fields.single { it.name.contains("private") }.modifiers)) { + "`$clazz`.privateConst is not private" + } + + assert(Modifier.isPublic(fields.single { it.name.contains("public") }.modifiers)) { + "`$clazz`.publicConst is not public" + } + + if (expectProtected) { + assert(Modifier.isProtected(fields.single { it.name.contains("protected") }.modifiers)) { + "`$clazz`.protectedConst is not protected" + } + } +} + +fun box(): String { + check(A::class.java, false) + check(B::class.java) + check(Class.forName("XYZ"), false) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt b/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt new file mode 100644 index 00000000000..dd04bc2736e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +const val z = "OK" + +annotation class A(val value: String = z) + +@A +class Test + +fun box(): String { + return Test::class.java.getAnnotation(A::class.java).value +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt b/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt new file mode 100644 index 00000000000..1f9f1e9d830 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +interface KInt { + + companion object { + const val a = "a" + const val b = "b$a" + } +} + +fun box(): String { + val a = KInt::class.java.getField("a").get(null) + val b = KInt::class.java.getField("b").get(null) + + if (a !== KInt.a) return "fail 1: KInt.a !== KInt.Companion.a" + if (b !== KInt.b) return "fail 2: KInt.b !== KInt.Companion.b" + if (b !== "ba") return "fail 2: 'ba' !== KInt.Companion.b" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/field.kt b/backend.native/tests/external/codegen/blackbox/properties/field.kt new file mode 100644 index 00000000000..c03066671ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/field.kt @@ -0,0 +1,10 @@ +var my: String = "" + get() = field + "K" + set(arg) { + field = arg + } + +fun box(): String { + my = "O" + return my +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/fieldInClass.kt b/backend.native/tests/external/codegen/blackbox/properties/fieldInClass.kt new file mode 100644 index 00000000000..37ef0a06a9a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/fieldInClass.kt @@ -0,0 +1,6 @@ +class My { + val my: String = "O" + get() = field + "K" +} + +fun box() = My().my diff --git a/backend.native/tests/external/codegen/blackbox/properties/fieldInsideField.kt b/backend.native/tests/external/codegen/blackbox/properties/fieldInsideField.kt new file mode 100644 index 00000000000..e86fe70da9e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/fieldInsideField.kt @@ -0,0 +1,13 @@ +abstract class Your { + abstract val your: String + + fun foo() = your +} + +val my: String = "O" + get() = field + object: Your() { + override val your = "K" + get() = field + }.foo() + +fun box() = my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/fieldInsideLambda.kt b/backend.native/tests/external/codegen/blackbox/properties/fieldInsideLambda.kt new file mode 100644 index 00000000000..ebf3cb6cfb7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/fieldInsideLambda.kt @@ -0,0 +1,4 @@ +val my: String = "O" + get() = { field }() + "K" + +fun box() = my diff --git a/backend.native/tests/external/codegen/blackbox/properties/fieldInsideNested.kt b/backend.native/tests/external/codegen/blackbox/properties/fieldInsideNested.kt new file mode 100644 index 00000000000..cb49c6b46c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/fieldInsideNested.kt @@ -0,0 +1,12 @@ +abstract class Your { + abstract val your: String + + fun foo() = your +} + +val my: String = "O" + get() = object: Your() { + override val your = field + }.foo() + "K" + +fun box() = my \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/fieldSimple.kt b/backend.native/tests/external/codegen/blackbox/properties/fieldSimple.kt new file mode 100644 index 00000000000..be19a1f8d45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/fieldSimple.kt @@ -0,0 +1,4 @@ +val x: String = "OK" + get() = field + +fun box() = x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/generalAccess.kt b/backend.native/tests/external/codegen/blackbox/properties/generalAccess.kt new file mode 100644 index 00000000000..577d9ab7e13 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/generalAccess.kt @@ -0,0 +1,54 @@ +package As + +val staticProperty : String = "1" + +val String.staticExt: String get() = "1" + +open class A(val init: String) { + + open val property : String = init + + private val privateProperty : String = init + + val String.ext: String get() = "1" + + val Int.myInc : Int + get() = this + 1 + + open fun getPrivate() : String { + return privateProperty; + } + + open fun getExt() : String { + return "0".ext; + } + + public var backingField : Int = 0 + get() = field.myInc + set(s) { field = s } + +} + +open class B(init: String) : A("1") { + + override val property: String = init + + fun getOpenProperty(): String { + return super.property + } + + fun getWithBackingFieldProperty(): String { + return property + } +} + +fun box() : String { + val a = A("1"); + val b = B("0"); + a.backingField = 0 + val result = a.property + a.getPrivate() + staticProperty + "0".staticExt + a.getExt() + + a.backingField + a.backingField + + b.getOpenProperty() + b.property + b.getWithBackingFieldProperty() + + return if (result == "1111111100") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt new file mode 100644 index 00000000000..71177571d18 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + + private Boolean value; + + public Boolean isValue() { + return value; + } + + public void setValue(boolean value) { + this.value = value; + } +} + +// FILE: kotlin.kt + +fun box(): String { + val javaClass = JavaClass() + + if (javaClass.isValue != null) return "fail 1" + + javaClass.isValue = false + if (javaClass.isValue != false) return "fail 2" + + javaClass.isValue = true + if (javaClass.isValue != true) return "fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt new file mode 100644 index 00000000000..c746a8a07e2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + + private boolean value; + + public boolean isValue() { + return value; + } + + public void setValue(Boolean value) { + this.value = value; + } +} + +// FILE: kotlin.kt + +fun box(): String { + val javaClass = JavaClass() + + if (javaClass.isValue != false) return "fail 1" + + javaClass.isValue = true + + if (javaClass.isValue != true) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt10715.kt b/backend.native/tests/external/codegen/blackbox/properties/kt10715.kt new file mode 100644 index 00000000000..7449c1b5bfa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt10715.kt @@ -0,0 +1,17 @@ +fun box(): String { + var a = Base() + + val count = a.count + if (count != 0) return "fail 1: $count" + + val count2 = a.count + if (count2 != 1) return "fail 2: $count2" + + return "OK" + +} + +class Base { + var count: Int = 0 + get() = field++ +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt10729.kt b/backend.native/tests/external/codegen/blackbox/properties/kt10729.kt new file mode 100644 index 00000000000..9b0db522f25 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt10729.kt @@ -0,0 +1,20 @@ +class IntentionsBundle { + companion object { + fun message(key: String): String { + return key + BUNDLE + } + + fun message2(key: String): String { + return { key + BUNDLE }() + } + + private const val BUNDLE = "K" + } +} + + +fun box(): String { + if (IntentionsBundle.message("O") != "OK") return "fail 1: ${IntentionsBundle.message("O")}" + + return IntentionsBundle.message2("O") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt new file mode 100644 index 00000000000..20a19efbd94 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +public object RefreshQueue { + + private val any = Any() + + private val workerThread: Thread = Thread(object : Runnable { + override fun run() { + any.hashCode() + } + }); + + init { + workerThread.start() + } +} + +fun box() : String { + RefreshQueue + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1165.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1165.kt new file mode 100644 index 00000000000..0a32a58b9e2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1165.kt @@ -0,0 +1,13 @@ +public abstract class VirtualFile() { + public abstract val size : Long +} + +public class PhysicalVirtualFile : VirtualFile() { + public override val size: Long + get() = 11 +} + +fun box() : String { + PhysicalVirtualFile() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1168.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1168.kt new file mode 100644 index 00000000000..fc931784687 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1168.kt @@ -0,0 +1,15 @@ +public abstract class BaseClass() { + protected abstract val kind : String + + protected open val kind2 : String = " kind1" + + fun debug() = kind + kind2 +} + +public class Subclass : BaseClass() { + override val kind : String = "Physical" + + override val kind2 : String = " kind2" +} + +fun box():String = if(Subclass().debug() == "Physical kind2") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1170.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1170.kt new file mode 100644 index 00000000000..3b33740d7c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1170.kt @@ -0,0 +1,16 @@ +public abstract class BaseClass() { + open val kind : String = "BaseClass " + + fun getKindValue() : String { + return kind + } +} + +public class Subclass : BaseClass() { + override val kind : String = "Subclass " +} + +fun box(): String { + val r = Subclass().getKindValue() + Subclass().kind + return if(r == "Subclass Subclass ") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt b/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt new file mode 100644 index 00000000000..457f2f6d0fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +//WITH_RUNTIME + +class ThingTemplate { + val prop = 0 +} + +class ThingVal(template: ThingTemplate) { + val prop = template.prop +} + +class ThingVar(template: ThingTemplate) { + var prop = template.prop +} + + +fun box() : String { + val template = ThingTemplate(); + val javaClass = ThingTemplate::class.java + val field = javaClass.getDeclaredField("prop")!! + field.isAccessible = true + field.set(template, 1) + + val thingVal = ThingVal(template) + if (thingVal.prop != 1) return "fail 1" + + val thingVar = ThingVar(template) + if (thingVar.prop != 1) return "fail 2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt new file mode 100644 index 00000000000..493728dd71f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt @@ -0,0 +1,10 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +open class Base(val bar: String) + +class Foo(bar: String) : Base(bar) { + fun something() = (bar as java.lang.String).toUpperCase() +} + +fun box() = Foo("ok").something() diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1417.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1417.kt new file mode 100644 index 00000000000..665f45d22cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1417.kt @@ -0,0 +1,9 @@ +package pack + +open class A(val value: String ) + +class B(value: String) : A(value) { + override fun toString() = "B($value)"; +} + +fun box() = if (B("4").toString() == "B(4)") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt new file mode 100644 index 00000000000..d74107dd2b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +abstract class ClassValAbstract { + abstract var a: Int + + companion object { + val methods = (this as java.lang.Object).getClass()?.getClassLoader()?.loadClass("ClassValAbstract")?.getMethods()!! + } +} + +fun box() : String { + for(m in ClassValAbstract.methods) { + if (m!!.getName() == "getA") { + if(m!!.getModifiers() != 1025) + return "get failed" + } + if (m!!.getName() == "setA") { + if(m!!.getModifiers() != 1025) + return "set failed" + } + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt new file mode 100644 index 00000000000..851b0c61429 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface A { + val method : (() -> Unit )? + val test : Integer +} + +class AImpl : A { + override val method : (() -> Unit )? = { + } + override val test : Integer = Integer(777) +} + +fun test(a : A) { + val method = a.method + if (method != null) { + method() + } +} + +public fun box() : String { + AImpl().test + test(AImpl()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1714_minimal.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1714_minimal.kt new file mode 100644 index 00000000000..faec0d99269 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1714_minimal.kt @@ -0,0 +1,13 @@ +interface A { + val v: Int +} + +class AImpl : A { + override val v: Int = 5 +} + +public fun box() : String { + val a: A = AImpl() + a.v + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1892.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1892.kt new file mode 100644 index 00000000000..ae564c7fc93 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1892.kt @@ -0,0 +1,5 @@ +val Int.ext: () -> Int get() = { 5 } +val Long.ext: Long get() = 4.ext().toLong() //(c.kt:4) +val y: Long get() = 10L.ext + +fun box(): String = if (y == 5L) "OK" else "fail: $y" diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt2331.kt b/backend.native/tests/external/codegen/blackbox/properties/kt2331.kt new file mode 100644 index 00000000000..a96dd67bf6d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt2331.kt @@ -0,0 +1,14 @@ +class P { + var x : Int = 0 + private set + + fun foo() { + ({ x = 4 })() + } +} + +fun box() : String { + val p = P() + p.foo() + return if (p.x == 4) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt257.kt b/backend.native/tests/external/codegen/blackbox/properties/kt257.kt new file mode 100644 index 00000000000..299042d2f31 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt257.kt @@ -0,0 +1,20 @@ +class A(var t: T) {} +class B(val r: R) {} + +fun box() : String { + val ai = A(1) + val aai = A>(ai) + if(aai.t.t != 1) return "fail" +/* + aai.t.t = 2 + if(aai.t.t != 2) return "fail" + + if(ai.t != 2) return "fail" + if(aai.t != ai) return "fail" + if(aai.t !== ai) return "fail" + + val abi = A>(B(1)) + if(abi.t.r != 1) return "fail" +*/ + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt2655.kt b/backend.native/tests/external/codegen/blackbox/properties/kt2655.kt new file mode 100644 index 00000000000..3956fb3a17d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt2655.kt @@ -0,0 +1,20 @@ +interface TextField { + fun getText(): String + fun setText(text: String) +} + +class SimpleTextField : TextField { + private var text2 = "" + override fun getText() = text2 + override fun setText(text: String) { + this.text2 = text + } +} + +class TextFieldWrapper(textField: TextField) : TextField by textField + +fun box() : String { + val textField = TextFieldWrapper(SimpleTextField()) + textField.setText("OK") + return textField.getText() +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt2786.kt b/backend.native/tests/external/codegen/blackbox/properties/kt2786.kt new file mode 100644 index 00000000000..003ca536275 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt2786.kt @@ -0,0 +1,13 @@ +interface FooTrait { + val propertyTest: String +} + +class FooDelegate: FooTrait { + override val propertyTest: String = "OK" +} + +class DelegateTest(): FooTrait by FooDelegate() { + fun test() = propertyTest +} + +fun box() = DelegateTest().test() diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt2892.kt b/backend.native/tests/external/codegen/blackbox/properties/kt2892.kt new file mode 100644 index 00000000000..816b11009d7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt2892.kt @@ -0,0 +1,16 @@ +open class A +class B : A() { + fun foo() = 1 +} + +class Test { + val a : A = B() + private val b : B get() = a as B //'private' is important here + + fun outer() : Int { + fun inner() : Int = b.foo() //'no such field error' here + return inner() + } +} + +fun box() = if (Test().outer() == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt3118.kt b/backend.native/tests/external/codegen/blackbox/properties/kt3118.kt new file mode 100644 index 00000000000..b95ea4ad3b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt3118.kt @@ -0,0 +1,12 @@ +package testing + +class Test { + private val hello: String + get() { return "hello" } + + fun sayHello() : String = hello +} + +fun box(): String { + return if (Test().sayHello() == "hello") "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt3524.kt b/backend.native/tests/external/codegen/blackbox/properties/kt3524.kt new file mode 100644 index 00000000000..3fcdaaebcf1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt3524.kt @@ -0,0 +1,5 @@ +val i: Any = 12 + +fun box(): String { + return if (i == 12) "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt3551.kt b/backend.native/tests/external/codegen/blackbox/properties/kt3551.kt new file mode 100644 index 00000000000..ba6696e1417 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt3551.kt @@ -0,0 +1,23 @@ +class Identifier() { + private var myNullable : Boolean = false + set(l : Boolean) { + //do nothing + } + + fun getValue() : Boolean { + return myNullable + } + + companion object { + fun init(isNullable : Boolean) : Identifier { + val id = Identifier() + id.myNullable = isNullable + return id + } + } +} + +fun box() : String { + val id = Identifier.init(true) + return if (id.getValue() == false) return "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt3556.kt b/backend.native/tests/external/codegen/blackbox/properties/kt3556.kt new file mode 100644 index 00000000000..adce0368131 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt3556.kt @@ -0,0 +1,10 @@ +class Test { + val a : String = "1" + private val b : String get() = a + + fun outer() : Int { + return b.length + } +} + +fun box() = if (Test().outer() == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt3930.kt b/backend.native/tests/external/codegen/blackbox/properties/kt3930.kt new file mode 100644 index 00000000000..b03168b7f43 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt3930.kt @@ -0,0 +1,16 @@ +public abstract class Foo { + var isOpen = true + private set +} +public class Bar: Foo() { + inner class Baz { + fun call() { + val s = this@Bar + s.isOpen + } + } +} +fun box(): String { + Bar().Baz() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4140.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4140.kt new file mode 100644 index 00000000000..55c964df5b8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4140.kt @@ -0,0 +1,16 @@ +class TestObject() +{ + companion object { + var prop: Int = 1 + get() = field++ + } +} + +fun box(): String { + + if (TestObject.prop != 1) return "fail 1" + + if (TestObject.prop != 2) return "fail 2" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4252.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4252.kt new file mode 100644 index 00000000000..2780832a23c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4252.kt @@ -0,0 +1,23 @@ +class CallbackBlock {} + +public class Foo +{ + companion object { + private var bar = 0 + } + + init { + ++bar + } + + fun getBar(): Int = bar +} + +fun box() : String { + + val foo = Foo() + + if (foo.getBar() != 1) return "Fail"; + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4252_2.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4252_2.kt new file mode 100644 index 00000000000..c86578a72ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4252_2.kt @@ -0,0 +1,30 @@ +class Foo() { + companion object { + val bar = "OK"; + var boo = "FAIL"; + } + + val a = bar + var b = Foo.bar + val c: String + var d: String + + init { + c = bar + d = Foo.bar + boo = "O" + Foo.boo += "K" + } +} + +fun box(): String { + val foo = Foo() + + if (foo.a != "OK") return "foo.a != OK" + if (foo.b != "OK") return "foo.b != OK" + if (foo.c != "OK") return "foo.c != OK" + if (foo.d != "OK") return "foo.d != OK" + if (Foo.boo != "OK") return "Foo.boo != OK" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4340.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4340.kt new file mode 100644 index 00000000000..63a97eb0f44 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4340.kt @@ -0,0 +1,36 @@ +class A { + + var result: Int = 0; + + private val Int.times3: Int + get() = this * 3 + + private var Int.times: Int + get() = this * 4 + set(s: Int) { + result = this * s + } + + fun test(p: Int):Int { + return { + p.times3 + }() + } + + fun test2(p: Int, s: Int):Int { + { + p.times = s + }() + return result + } +} + +fun box() : String { + var result = A().test(3); + if (result != 9) return "fail1: $result" + + result = A().test2(2, 4); + if (result != 8) return "fail2: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4373.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4373.kt new file mode 100644 index 00000000000..41b781f2cfc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4373.kt @@ -0,0 +1,14 @@ +interface Tr { + val prop: T +} + +class A(a: Tr) : Tr by a + +fun eat(x: Int) {} + +fun box(): String { + eat(A(object : Tr { + override val prop = 42 + }).prop) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt new file mode 100644 index 00000000000..4b26b927544 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import kotlin.reflect.KProperty + +class D { + operator fun getValue(a: Any, p: KProperty<*>) { } +} + +object P { + val u = Unit + val v by D() + var w = Unit +} + +fun box(): String { + if (P.u != P.v) return "Fail uv" + P.w = Unit + if (P.w != P.u) return "Fail w" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt613.kt b/backend.native/tests/external/codegen/blackbox/properties/kt613.kt new file mode 100644 index 00000000000..4f55c044844 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt613.kt @@ -0,0 +1,15 @@ +package name + +class Test() { + var i = 5 + val ten = 10.toLong() + + fun Long.t() = this.toInt() + i++ + ++i + + fun tt() = ten.t() +} + +fun box() : String { + var m = Test() + return if((m.i)++ == 5 && ++(m.i) == 7 && m.tt() == 26) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt8928.kt b/backend.native/tests/external/codegen/blackbox/properties/kt8928.kt new file mode 100644 index 00000000000..bafc93f62b3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt8928.kt @@ -0,0 +1,16 @@ +class App { + fun init() { + s = "OK" + } + companion object { + var s: String = "Fail" + private set + + } +} + +fun box(): String { + App().init() + + return App.s +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt9603.kt b/backend.native/tests/external/codegen/blackbox/properties/kt9603.kt new file mode 100644 index 00000000000..ddbabfcc99b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/kt9603.kt @@ -0,0 +1,11 @@ +class A { + public var prop = "OK" + private set + + + fun test(): String { + return { prop }() + } +} + +fun box(): String = A().test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessor.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessor.kt new file mode 100644 index 00000000000..441bc5ec592 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessor.kt @@ -0,0 +1,20 @@ +public class A { + + fun setMyStr() { + str = "OK" + } + + fun getMyStr(): String { + return str + } + + private companion object { + private lateinit var str: String + } +} + +fun box(): String { + val a = A() + a.setMyStr() + return a.getMyStr() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt new file mode 100644 index 00000000000..eb0db631364 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +public class A { + + fun getMyStr(): String { + try { + val a = str + } catch (e: RuntimeException) { + return "OK" + } + + return "FAIL" + } + + private companion object { + private lateinit var str: String + } +} + +fun box(): String { + val a = A() + return a.getMyStr() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt new file mode 100644 index 00000000000..0c8a8eafe47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A { + private lateinit var str: String + + public fun getMyStr(): String { + try { + val a = str + } catch (e: RuntimeException) { + return "OK" + } + + return "FAIL" + } +} + +fun box(): String { + val a = A() + return a.getMyStr() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt new file mode 100644 index 00000000000..ca12a2442db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A { + public lateinit var str: String +} + +fun box(): String { + val a = A() + try { + a.str + } catch (e: RuntimeException) { + return "OK" + } + return "FAIL" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/override.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/override.kt new file mode 100644 index 00000000000..02d05d723be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/override.kt @@ -0,0 +1,21 @@ +interface Intf { + val str: String +} + +class A : Intf { + override lateinit var str: String + + fun setMyStr() { + str = "OK" + } + + fun getMyStr(): String { + return str + } +} + +fun box(): String { + val a = A() + a.setMyStr() + return a.getMyStr() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt new file mode 100644 index 00000000000..9b9ce777d53 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface Intf { + val str: String +} + +class A : Intf { + override lateinit var str: String + + fun getMyStr(): String { + try { + val a = str + } catch (e: RuntimeException) { + return "OK" + } + return "FAIL" + } +} + +fun box(): String { + val a = A() + return a.getMyStr() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetter.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetter.kt new file mode 100644 index 00000000000..75bdc125e64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetter.kt @@ -0,0 +1,12 @@ +class My { + lateinit var x: String + private set + + fun init() { x = "OK" } +} + +fun box(): String { + val my = My() + my.init() + return my.x +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetterFromLambda.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetterFromLambda.kt new file mode 100644 index 00000000000..80baa4ec688 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/privateSetterFromLambda.kt @@ -0,0 +1,12 @@ +class My { + lateinit var x: String + private set + + fun init(arg: String, f: (String) -> String) { x = f(arg) } +} + +fun box(): String { + val my = My() + my.init("O") { it + "K" } + return my.x +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/simpleVar.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/simpleVar.kt new file mode 100644 index 00000000000..b5314ead1c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/simpleVar.kt @@ -0,0 +1,9 @@ +class A { + public lateinit var str: String +} + +fun box(): String { + val a = A() + a.str = "OK" + return a.str +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt new file mode 100644 index 00000000000..5408bc46913 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import java.lang.reflect.Modifier + +public class A { + private lateinit var privateField: String + protected lateinit var protectedField: String + public lateinit var publicField: String + + fun test(): String { + val clazz = A::class.java + val cond = arrayListOf() + + if (!Modifier.isPrivate(clazz.getDeclaredField("privateField").modifiers)) cond += "NOT_PRIVATE" + if (!Modifier.isProtected(clazz.getDeclaredField("protectedField").modifiers)) cond += "NOT_PROTECTED" + if (!Modifier.isPublic(clazz.getDeclaredField("publicField").modifiers)) cond += "NOT_PUBLIC" + + try { + val a = privateField + } catch (e: UninitializedPropertyAccessException) { + return if (cond.isEmpty()) "OK" else cond.joinToString() + } + + return "EXCEPTION WAS NOT CAUGHT" + } +} + +fun box(): String { + return A().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDefaultAccessor.kt b/backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDefaultAccessor.kt new file mode 100644 index 00000000000..e8039fa4cc7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDefaultAccessor.kt @@ -0,0 +1,11 @@ +interface R> { + var value: T +} + +class A(override var value: Int): R + +fun box(): String { + val a = A(239) + a.value = 42 + return if (a.value == 42) "OK" else "Fail 1" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDelegateAccessor.kt b/backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDelegateAccessor.kt new file mode 100644 index 00000000000..008ef946010 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/primitiveOverrideDelegateAccessor.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +class Holder(var value: Int) { + operator fun getValue(that: Any?, desc: KProperty<*>) = value + operator fun setValue(that: Any?, desc: KProperty<*>, newValue: Int) { value = newValue } +} + +interface R> { + var value: T +} + +class A(start: Int) : R { + override var value: Int by Holder(start) +} + +fun box(): String { + val a = A(239) + a.value = 42 + return if (a.value == 42) "OK" else "Fail 1" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/privatePropertyInConstructor.kt b/backend.native/tests/external/codegen/blackbox/properties/privatePropertyInConstructor.kt new file mode 100644 index 00000000000..9a9e186c8de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/privatePropertyInConstructor.kt @@ -0,0 +1,18 @@ +class A( + private val x: String, + private var y: Double +) { + fun foo() { + val r = { + if (x != "abc") throw AssertionError("$x") + y = 0.0 + if (y != 0.0) throw AssertionError("$y") + } + r() + } +} + +fun box(): String { + A("abc", 3.14).foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/privatePropertyWithoutBackingField.kt b/backend.native/tests/external/codegen/blackbox/properties/privatePropertyWithoutBackingField.kt new file mode 100644 index 00000000000..e03074deaa0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/privatePropertyWithoutBackingField.kt @@ -0,0 +1,17 @@ +class Test { + private var i : Int + get() = 1 + set(i) {} + + fun foo() { + fun f() { + i = 2 + } + f() + } +} + +fun box(): String { + Test().foo() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt new file mode 100644 index 00000000000..bfda7a40b04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + + protected String FIELD = "OK"; + +} + +// FILE: Kotlin.kt + +package test + +import JavaClass + +class B : JavaClass() { + inline fun bar() = FIELD +} + +fun box() = B().bar() diff --git a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt new file mode 100644 index 00000000000..f03b492759c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: JavaBaseClass.java + +public class JavaBaseClass { + + private String field = "fail"; + + protected String getFoo() { + return field; + } + + protected void setFoo(String foo) { + field = foo; + } +} + +// FILE: kotlin.kt + +package z + +import JavaBaseClass + +object KotlinExtender : JavaBaseClass() { + @JvmStatic fun test(): String { + return runSlowly { + foo = "OK" + foo + } + } +} +fun runSlowly(f: () -> String): String { + return f() +} + +fun box(): String { + return KotlinExtender.test() +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt new file mode 100644 index 00000000000..81efe8b5294 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: JavaBaseClass.java + +public class JavaBaseClass { + + private String field = "fail"; + + protected String getFoo() { + return field; + } + + protected void setFoo(String foo) { + field = foo; + } +} + +// FILE: kotlin.kt + +package z + +import JavaBaseClass + +class A { + @JvmField var foo = "fail" + + companion object : JavaBaseClass() { + @JvmStatic fun test(): String { + return runSlowly { + foo = "OK" + foo + } + } + } +} +fun runSlowly(f: () -> String): String { + return f() +} + +fun box(): String { + val a = A() + a.foo = "Kotlin" + if (a.foo != "Kotlin") return "fail" + + return A.test() +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt b/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt new file mode 100644 index 00000000000..b9ddfd8776d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Test.java + +public abstract class Test { + protected final F value = null; +} + +// FILE: test.kt +// See KT-5445: Bad access to protected data in getfield + +class A : Test() { + fun foo(): String? = value + fun bar(): String? = this.value +} + +fun box(): String { + if (A().foo() != null) return "Fail 1" + if (A().bar() != null) return "Fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt b/backend.native/tests/external/codegen/blackbox/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt new file mode 100644 index 00000000000..678b82c784e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt @@ -0,0 +1,9 @@ +annotation class Anno + +@Anno val Int.foo: Int + get() = this + +@Anno val String.foo: Int + get() = 42 + +fun box() = if (42.foo == 42 && "OK".foo == 42) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/properties/typeInferredFromGetter.kt b/backend.native/tests/external/codegen/blackbox/properties/typeInferredFromGetter.kt new file mode 100644 index 00000000000..f4f042888b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/typeInferredFromGetter.kt @@ -0,0 +1,7 @@ +val x get() = "O" + +class A { + val y get() = "K" +} + +fun box() = x + A().y diff --git a/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt b/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt new file mode 100644 index 00000000000..bc4b0b5a388 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt @@ -0,0 +1,15 @@ +// IGNORE_BACKEND: JS +//WITH_REFLECT +class A { + @PublishedApi + internal fun published() = "OK" + + inline fun test() = published() + +} + +fun box() : String { + val clazz = A::class.java + if (clazz.getDeclaredMethod("published") == null) return "fail" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/publishedApi/simple.kt b/backend.native/tests/external/codegen/blackbox/publishedApi/simple.kt new file mode 100644 index 00000000000..4ad78979fd4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/publishedApi/simple.kt @@ -0,0 +1,16 @@ +// MODULE: lib +// FILE: lib.kt +class A { + + @PublishedApi + internal fun published() = "OK" + + inline fun test() = published() + +} + +// MODULE: main(lib) +// FILE: main.kt +fun box(): String { + return A().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/publishedApi/topLevel.kt b/backend.native/tests/external/codegen/blackbox/publishedApi/topLevel.kt new file mode 100644 index 00000000000..e2a33400e7d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/publishedApi/topLevel.kt @@ -0,0 +1,10 @@ +// MODULE: lib +// FILE: lib.kt +@PublishedApi +internal fun published() = "OK" + +inline fun test() = published() + +// MODULE: main(lib) +// FILE: main.kt +fun box() = test() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt new file mode 100644 index 00000000000..71b784e107f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class ComparablePair>(val first: T, val second: T) : Comparable> { + override fun compareTo(other: ComparablePair): Int { + val result = first.compareTo(other.first) + return if (result != 0) result else second.compareTo(other.second) + } +} + +fun > genericRangeTo(start: T, endInclusive: T) = start..endInclusive +operator fun Double.rangeTo(other: Double) = genericRangeTo(this, other) +// some weird inverted range +operator fun Float.rangeTo(other: Float) = object : ClosedFloatingPointRange { + override val endInclusive: Float = this@rangeTo + override val start: Float = other + override fun lessThanOrEquals(a: Float, b: Float) = a >= b +} + +fun check(x: Double, left: Double, right: Double): Boolean { + val result = x in left..right + val range = left..right + assert(result == x in range) { "Failed: unoptimized === unoptimized for custom double $range" } + return result +} + +fun check(x: Float, left: Float, right: Float): Boolean { + val result = x in left..right + val range = left..right + assert(result == x in range) { "Failed: unoptimized === unoptimized for standard float $range" } + return result +} + +fun box(): String { + assert("a" !in "b".."c") + assert("b" in "a".."d") + + assert(ComparablePair(2, 2) !in ComparablePair(1, 10)..ComparablePair(2, 1)) + assert(ComparablePair(2, 2) in ComparablePair(2, 0)..ComparablePair(2, 10)) + + assert(!check(-0.0, 0.0, 0.0)) + assert(check(Double.NaN, Double.NaN, Double.NaN)) + + assert(check(-0.0f, 0.0f, 0.0f)) + assert(!check(Float.NaN, Float.NaN, Float.NaN)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt new file mode 100644 index 00000000000..53a4b73663e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +operator fun Int.rangeTo(right: String): ClosedRange = this..this + 1 +operator fun Long.rangeTo(right: Double): ClosedRange = this..right.toLong() + 1 +operator fun String.rangeTo(right: Int): ClosedRange = this..this + +fun box(): String { + assert(0 !in 1.."a") + assert(1 in 1.."a") + + assert(0L !in 1L..2.0) + assert(2L in 1L..3.0) + + assert("a" !in "b"..1) + assert("a" in "a"..1) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt new file mode 100644 index 00000000000..59a939acf24 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + for (x in 1..10) { + assert(x in 1..10) + assert(x + 10 !in 1..10) + } + + var x = 0 + assert(0 !in 1..2) + + assert(++x in 1..1) + assert(++x !in 1..1) + + assert(sideEffect(x) in 2..3) + return "OK" +} + + +var invocationCounter = 0 +fun sideEffect(x: Int): Int { + ++invocationCounter + assert(invocationCounter == 1) + return x +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt new file mode 100644 index 00000000000..f7aa5bf5729 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun check(x: Double, left: Double, right: Double): Boolean { + val result = x in left..right + val manual = x >= left && x <= right + val range = left..right + assert(result == manual) { "Failed: optimized === manual for $range" } + assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } + return result +} + +fun checkUnoptimized(x: Double, range: ClosedRange): Boolean { + return x in range +} + +fun box(): String { + assert(check(1.0, 0.0, 2.0)) + assert(!check(1.0, -1.0, 0.0)) + + assert(check(Double.MIN_VALUE, 0.0, 1.0)) + assert(check(Double.MAX_VALUE, Double.MAX_VALUE - Double.MIN_VALUE, Double.MAX_VALUE)) + assert(!check(Double.NaN, Double.NaN, Double.NaN)) + assert(!check(0.0, Double.NaN, Double.NaN)) + + assert(check(-0.0, -0.0, +0.0)) + assert(check(-0.0, -0.0, -0.0)) + assert(check(-0.0, +0.0, +0.0)) + assert(check(+0.0, -0.0, -0.0)) + assert(check(+0.0, +0.0, +0.0)) + assert(check(+0.0, -0.0, +0.0)) + + var value = 0.0 + assert(++value in 1.0..1.0) + assert(++value !in 1.0..1.0) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt new file mode 100644 index 00000000000..8b21a83ad34 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun check(x: Float, left: Float, right: Float): Boolean { + val result = x in left..right + val manual = x >= left && x <= right + val range = left..right + assert(result == manual) { "Failed: optimized === manual for $range" } + assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } + return result +} + +fun checkUnoptimized(x: Float, range: ClosedRange): Boolean { + return x in range +} + +fun box(): String { + assert(check(1.0f, 0.0f, 2.0f)) + assert(!check(1.0f, -1.0f, 0.0f)) + + assert(check(Float.MIN_VALUE, 0.0f, 1.0f)) + assert(check(Float.MAX_VALUE, Float.MAX_VALUE - Float.MIN_VALUE, Float.MAX_VALUE)) + assert(!check(Float.NaN, Float.NaN, Float.NaN)) + assert(!check(0.0f, Float.NaN, Float.NaN)) + + assert(check(-0.0f, -0.0f, +0.0f)) + assert(check(-0.0f, -0.0f, -0.0f)) + assert(check(-0.0f, +0.0f, +0.0f)) + assert(check(+0.0f, -0.0f, -0.0f)) + assert(check(+0.0f, +0.0f, +0.0f)) + assert(check(+0.0f, -0.0f, +0.0f)) + + var value = 0.0f + assert(++value in 1.0f..1.0f) + assert(++value !in 1.0f..1.0f) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt new file mode 100644 index 00000000000..9f4a914c9d1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun check(x: Int, left: Int, right: Int): Boolean { + val result = x in left..right + val manual = x >= left && x <= right + val range = left..right + assert(result == manual) { "Failed: optimized === manual for $range" } + assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } + return result +} + +fun checkUnoptimized(x: Int, range: ClosedRange): Boolean { + return x in range +} + +fun box(): String { + assert(check(1, 0, 2)) + assert(!check(1, -1, 0)) + assert(!check(239, 239, 238)) + assert(check(239, 238, 239)) + + assert(check(Int.MIN_VALUE, Int.MIN_VALUE, Int.MIN_VALUE)) + assert(check(Int.MAX_VALUE, Int.MIN_VALUE, Int.MAX_VALUE)) + + var value = 0 + assert(++value in 1..1) + assert(++value !in 1..1) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt new file mode 100644 index 00000000000..8bf77137b1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun check(x: Long, left: Long, right: Long): Boolean { + val result = x in left..right + val manual = x >= left && x <= right + val range = left..right + assert(result == manual) { "Failed: optimized === manual for $range" } + assert(result == checkUnoptimized(x, range)) { "Failed: optimized === unoptimized for $range" } + return result +} + +fun checkUnoptimized(x: Long, range: ClosedRange): Boolean { + return x in range +} + +fun box(): String { + assert(check(1L, 0L, 2L)) + assert(!check(1L, -1L, 0L)) + assert(!check(239L, 239L, 238L)) + assert(check(239L, 238L, 239L)) + + assert(check(Long.MIN_VALUE, Long.MIN_VALUE, Long.MIN_VALUE)) + assert(check(Long.MAX_VALUE, Long.MIN_VALUE, Long.MAX_VALUE)) + + var value = 0L + assert(++value in 1L..1L) + assert(++value !in 1L..1L) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt new file mode 100644 index 00000000000..277550e0034 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class Value(val x: Int) : Comparable { + override fun compareTo(other: Value): Int { + throw AssertionError("Should not be called") + } +} + +class ValueRange(override val start: Value, + override val endInclusive: Value) : ClosedRange { + + override fun contains(value: Value): Boolean { + return value.x == 42 + } +} + +operator fun Value.rangeTo(other: Value): ClosedRange = ValueRange(this, other) + +fun box(): String { + assert(Value(42) in Value(1)..Value(2)) + assert(Value(41) !in Value(40)..Value(42)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt new file mode 100644 index 00000000000..8c39def7709 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun Long.inLongs(l: Long, r: Long): Boolean { + return this in l..r +} + +fun Double.inDoubles(l: Double, r: Double): Boolean { + return this in l..r +} + +fun box(): String { + assert(2L.inLongs(1L, 3L)) + assert(!2L.inLongs(0L, 1L)) + + assert(2.0.inDoubles(1.0, 3.0)) + assert(!2.0.inDoubles(0.0, 1.0)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt new file mode 100644 index 00000000000..0b8e25beb45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + assert(Long.MAX_VALUE !in Int.MIN_VALUE..Int.MAX_VALUE) + assert(Int.MAX_VALUE in Long.MIN_VALUE..Long.MAX_VALUE) + assert(Double.MAX_VALUE !in Float.MIN_VALUE..Float.MAX_VALUE) + assert(Float.MIN_VALUE in 0..1) + assert(2.0 !in 1..0) + assert(1.0f in 0L..2L) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt new file mode 100644 index 00000000000..46c3a39bbc7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun check(x: Any?): Boolean { + if (x is Int) { + return x in 239..240 + } + + throw java.lang.AssertionError() +} + +fun check(x: Any?, l: Any?, r: Any?): Boolean { + if (x is Int && l is Int && r is Int) { + return x in l..r + } + + throw java.lang.AssertionError() +} + + +fun box(): String { + assert(check(239)) + assert(check(239, 239, 240)) + assert(!check(238)) + assert(!check(238, 239, 240)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/rangeContainsString.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/rangeContainsString.kt new file mode 100644 index 00000000000..9e2c9269f96 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/rangeContainsString.kt @@ -0,0 +1,5 @@ +operator fun IntRange.contains(s: String): Boolean = true + +fun box(): String { + return if ("s" in 0..1) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/emptyDownto.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/emptyDownto.kt new file mode 100644 index 00000000000..41f9e9357a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/emptyDownto.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 5 downTo 10 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for 5 downTo 10: $list1" + } + + val list2 = ArrayList() + val range2 = 5.toByte() downTo 10.toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for 5.toByte() downTo 10.toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 5.toShort() downTo 10.toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for 5.toShort() downTo 10.toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 5.toLong() downTo 10.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for 5.toLong() downTo 10.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'a' downTo 'z' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for 'a' downTo 'z': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/emptyRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/emptyRange.kt new file mode 100644 index 00000000000..01f8c158cac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/emptyRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 10..5 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for 10..5: $list1" + } + + val list2 = ArrayList() + val range2 = 10.toByte()..(-5).toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for 10.toByte()..(-5).toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 10.toShort()..(-5).toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for 10.toShort()..(-5).toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 10.toLong()..-5.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for 10.toLong()..-5.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'z'..'a' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for 'z'..'a': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt new file mode 100644 index 00000000000..1f559bd7c76 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = (MinI + 5) downTo MinI step 3 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MinI + 5, MinI + 2)) { + return "Wrong elements for (MinI + 5) downTo MinI step 3: $list1" + } + + val list2 = ArrayList() + val range2 = (MinB + 5).toByte() downTo MinB step 3 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MinB + 5).toInt(), (MinB + 2).toInt())) { + return "Wrong elements for (MinB + 5).toByte() downTo MinB step 3: $list2" + } + + val list3 = ArrayList() + val range3 = (MinS + 5).toShort() downTo MinS step 3 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MinS + 5).toInt(), (MinS + 2).toInt())) { + return "Wrong elements for (MinS + 5).toShort() downTo MinS step 3: $list3" + } + + val list4 = ArrayList() + val range4 = (MinL + 5).toLong() downTo MinL step 3 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MinL + 5).toLong(), (MinL + 2).toLong())) { + return "Wrong elements for (MinL + 5).toLong() downTo MinL step 3: $list4" + } + + val list5 = ArrayList() + val range5 = (MinC + 5) downTo MinC step 3 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MinC + 5), (MinC + 2))) { + return "Wrong elements for (MinC + 5) downTo MinC step 3: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedDownTo.kt new file mode 100644 index 00000000000..5b7871e8f3f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedDownTo.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 8 downTo 3 step 2 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(8, 6, 4)) { + return "Wrong elements for 8 downTo 3 step 2: $list1" + } + + val list2 = ArrayList() + val range2 = 8.toByte() downTo 3.toByte() step 2 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(8, 6, 4)) { + return "Wrong elements for 8.toByte() downTo 3.toByte() step 2: $list2" + } + + val list3 = ArrayList() + val range3 = 8.toShort() downTo 3.toShort() step 2 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(8, 6, 4)) { + return "Wrong elements for 8.toShort() downTo 3.toShort() step 2: $list3" + } + + val list4 = ArrayList() + val range4 = 8.toLong() downTo 3.toLong() step 2.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(8, 6, 4)) { + return "Wrong elements for 8.toLong() downTo 3.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'd' downTo 'a' step 2 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('d', 'b')) { + return "Wrong elements for 'd' downTo 'a' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedRange.kt new file mode 100644 index 00000000000..f746a9fd09b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactSteppedRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 3..8 step 2 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 5, 7)) { + return "Wrong elements for 3..8 step 2: $list1" + } + + val list2 = ArrayList() + val range2 = 3.toByte()..8.toByte() step 2 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 5, 7)) { + return "Wrong elements for 3.toByte()..8.toByte() step 2: $list2" + } + + val list3 = ArrayList() + val range3 = 3.toShort()..8.toShort() step 2 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 5, 7)) { + return "Wrong elements for 3.toShort()..8.toShort() step 2: $list3" + } + + val list4 = ArrayList() + val range4 = 3.toLong()..8.toLong() step 2.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 5, 7)) { + return "Wrong elements for 3.toLong()..8.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'a'..'d' step 2 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('a', 'c')) { + return "Wrong elements for 'a'..'d' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt new file mode 100644 index 00000000000..76cd7241cbf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = (MaxI - 5)..MaxI step 3 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI - 5, MaxI - 2)) { + return "Wrong elements for (MaxI - 5)..MaxI step 3: $list1" + } + + val list2 = ArrayList() + val range2 = (MaxB - 5).toByte()..MaxB step 3 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MaxB - 5).toInt(), (MaxB - 2).toInt())) { + return "Wrong elements for (MaxB - 5).toByte()..MaxB step 3: $list2" + } + + val list3 = ArrayList() + val range3 = (MaxS - 5).toShort()..MaxS step 3 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MaxS - 5).toInt(), (MaxS - 2).toInt())) { + return "Wrong elements for (MaxS - 5).toShort()..MaxS step 3: $list3" + } + + val list4 = ArrayList() + val range4 = (MaxL - 5).toLong()..MaxL step 3 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MaxL - 5).toLong(), (MaxL - 2).toLong())) { + return "Wrong elements for (MaxL - 5).toLong()..MaxL step 3: $list4" + } + + val list5 = ArrayList() + val range5 = (MaxC - 5)..MaxC step 3 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MaxC - 5), (MaxC - 2))) { + return "Wrong elements for (MaxC - 5)..MaxC step 3: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt new file mode 100644 index 00000000000..a521436c2c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = (MaxI - 2)..MaxI + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI - 2, MaxI - 1, MaxI)) { + return "Wrong elements for (MaxI - 2)..MaxI: $list1" + } + + val list2 = ArrayList() + val range2 = (MaxB - 2).toByte()..MaxB + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MaxB - 2).toInt(), (MaxB - 1).toInt(), MaxB.toInt())) { + return "Wrong elements for (MaxB - 2).toByte()..MaxB: $list2" + } + + val list3 = ArrayList() + val range3 = (MaxS - 2).toShort()..MaxS + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MaxS - 2).toInt(), (MaxS - 1).toInt(), MaxS.toInt())) { + return "Wrong elements for (MaxS - 2).toShort()..MaxS: $list3" + } + + val list4 = ArrayList() + val range4 = (MaxL - 2).toLong()..MaxL + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL)) { + return "Wrong elements for (MaxL - 2).toLong()..MaxL: $list4" + } + + val list5 = ArrayList() + val range5 = (MaxC - 2)..MaxC + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MaxC - 2), (MaxC - 1), MaxC)) { + return "Wrong elements for (MaxC - 2)..MaxC: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt new file mode 100644 index 00000000000..a9189c72494 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = MaxI..MaxI + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI)) { + return "Wrong elements for MaxI..MaxI: $list1" + } + + val list2 = ArrayList() + val range2 = MaxB..MaxB + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(MaxB.toInt())) { + return "Wrong elements for MaxB..MaxB: $list2" + } + + val list3 = ArrayList() + val range3 = MaxS..MaxS + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(MaxS.toInt())) { + return "Wrong elements for MaxS..MaxS: $list3" + } + + val list4 = ArrayList() + val range4 = MaxL..MaxL + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(MaxL)) { + return "Wrong elements for MaxL..MaxL: $list4" + } + + val list5 = ArrayList() + val range5 = MaxC..MaxC + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf(MaxC)) { + return "Wrong elements for MaxC..MaxC: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt new file mode 100644 index 00000000000..43002d06489 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = MaxI..MinI + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for MaxI..MinI: $list1" + } + + val list2 = ArrayList() + val range2 = MaxB..MinB + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for MaxB..MinB: $list2" + } + + val list3 = ArrayList() + val range3 = MaxS..MinS + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for MaxS..MinS: $list3" + } + + val list4 = ArrayList() + val range4 = MaxL..MinL + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for MaxL..MinL: $list4" + } + + val list5 = ArrayList() + val range5 = MaxC..MinC + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for MaxC..MinC: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementDownTo.kt new file mode 100644 index 00000000000..302fd2bc7c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementDownTo.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 5 downTo 5 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(5)) { + return "Wrong elements for 5 downTo 5: $list1" + } + + val list2 = ArrayList() + val range2 = 5.toByte() downTo 5.toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(5)) { + return "Wrong elements for 5.toByte() downTo 5.toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 5.toShort() downTo 5.toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(5)) { + return "Wrong elements for 5.toShort() downTo 5.toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 5.toLong() downTo 5.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(5.toLong())) { + return "Wrong elements for 5.toLong() downTo 5.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'k' downTo 'k' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('k')) { + return "Wrong elements for 'k' downTo 'k': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementRange.kt new file mode 100644 index 00000000000..065acfd5333 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/oneElementRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 5..5 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(5)) { + return "Wrong elements for 5..5: $list1" + } + + val list2 = ArrayList() + val range2 = 5.toByte()..5.toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(5)) { + return "Wrong elements for 5.toByte()..5.toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 5.toShort()..5.toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(5)) { + return "Wrong elements for 5.toShort()..5.toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 5.toLong()..5.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(5.toLong())) { + return "Wrong elements for 5.toLong()..5.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'k'..'k' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('k')) { + return "Wrong elements for 'k'..'k': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/openRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/openRange.kt new file mode 100644 index 00000000000..c9a06cc49d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/openRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 1 until 5 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1 until 5: $list1" + } + + val list2 = ArrayList() + val range2 = 1.toByte() until 5.toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1.toByte() until 5.toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 1.toShort() until 5.toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1.toShort() until 5.toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 1.toLong() until 5.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1.toLong() until 5.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'a' until 'd' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('a', 'b', 'c')) { + return "Wrong elements for 'a' until 'd': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt new file mode 100644 index 00000000000..4540e7fe94f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = (MinI + 2) downTo MinI step 1 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MinI + 2, MinI + 1, MinI)) { + return "Wrong elements for (MinI + 2) downTo MinI step 1: $list1" + } + + val list2 = ArrayList() + val range2 = (MinB + 2).toByte() downTo MinB step 1 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MinB + 2).toInt(), (MinB + 1).toInt(), MinB.toInt())) { + return "Wrong elements for (MinB + 2).toByte() downTo MinB step 1: $list2" + } + + val list3 = ArrayList() + val range3 = (MinS + 2).toShort() downTo MinS step 1 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MinS + 2).toInt(), (MinS + 1).toInt(), MinS.toInt())) { + return "Wrong elements for (MinS + 2).toShort() downTo MinS step 1: $list3" + } + + val list4 = ArrayList() + val range4 = (MinL + 2).toLong() downTo MinL step 1 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MinL + 2).toLong(), (MinL + 1).toLong(), MinL)) { + return "Wrong elements for (MinL + 2).toLong() downTo MinL step 1: $list4" + } + + val list5 = ArrayList() + val range5 = (MinC + 2) downTo MinC step 1 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MinC + 2), (MinC + 1), MinC)) { + return "Wrong elements for (MinC + 2) downTo MinC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt new file mode 100644 index 00000000000..d0476a557a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = (MaxI - 2)..MaxI step 2 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI - 2, MaxI)) { + return "Wrong elements for (MaxI - 2)..MaxI step 2: $list1" + } + + val list2 = ArrayList() + val range2 = (MaxB - 2).toByte()..MaxB step 2 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MaxB - 2).toInt(), MaxB.toInt())) { + return "Wrong elements for (MaxB - 2).toByte()..MaxB step 2: $list2" + } + + val list3 = ArrayList() + val range3 = (MaxS - 2).toShort()..MaxS step 2 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MaxS - 2).toInt(), MaxS.toInt())) { + return "Wrong elements for (MaxS - 2).toShort()..MaxS step 2: $list3" + } + + val list4 = ArrayList() + val range4 = (MaxL - 2).toLong()..MaxL step 2 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MaxL - 2).toLong(), MaxL)) { + return "Wrong elements for (MaxL - 2).toLong()..MaxL step 2: $list4" + } + + val list5 = ArrayList() + val range5 = (MaxC - 2)..MaxC step 2 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MaxC - 2), MaxC)) { + return "Wrong elements for (MaxC - 2)..MaxC step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt new file mode 100644 index 00000000000..47264e0a172 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = MaxI..MaxI step 1 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI)) { + return "Wrong elements for MaxI..MaxI step 1: $list1" + } + + val list2 = ArrayList() + val range2 = MaxB..MaxB step 1 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(MaxB.toInt())) { + return "Wrong elements for MaxB..MaxB step 1: $list2" + } + + val list3 = ArrayList() + val range3 = MaxS..MaxS step 1 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(MaxS.toInt())) { + return "Wrong elements for MaxS..MaxS step 1: $list3" + } + + val list4 = ArrayList() + val range4 = MaxL..MaxL step 1 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(MaxL)) { + return "Wrong elements for MaxL..MaxL step 1: $list4" + } + + val list5 = ArrayList() + val range5 = MaxC..MaxC step 1 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf(MaxC)) { + return "Wrong elements for MaxC..MaxC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt new file mode 100644 index 00000000000..6e876bf9329 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = MaxI..MinI step 1 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for MaxI..MinI step 1: $list1" + } + + val list2 = ArrayList() + val range2 = MaxB..MinB step 1 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for MaxB..MinB step 1: $list2" + } + + val list3 = ArrayList() + val range3 = MaxS..MinS step 1 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for MaxS..MinS step 1: $list3" + } + + val list4 = ArrayList() + val range4 = MaxL..MinL step 1 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for MaxL..MinL step 1: $list4" + } + + val list5 = ArrayList() + val range5 = MaxC..MinC step 1 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for MaxC..MinC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt new file mode 100644 index 00000000000..86ee02ba72c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt @@ -0,0 +1,71 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + val range1 = MinI..MinI step 1 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MinI)) { + return "Wrong elements for MinI..MinI step 1: $list1" + } + + val list2 = ArrayList() + val range2 = MinB..MinB step 1 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(MinB.toInt())) { + return "Wrong elements for MinB..MinB step 1: $list2" + } + + val list3 = ArrayList() + val range3 = MinS..MinS step 1 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(MinS.toInt())) { + return "Wrong elements for MinS..MinS step 1: $list3" + } + + val list4 = ArrayList() + val range4 = MinL..MinL step 1 + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(MinL)) { + return "Wrong elements for MinL..MinL step 1: $list4" + } + + val list5 = ArrayList() + val range5 = MinC..MinC step 1 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf(MinC)) { + return "Wrong elements for MinC..MinC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedBackSequence.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedBackSequence.kt new file mode 100644 index 00000000000..3542aa875b8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedBackSequence.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (5 downTo 3).reversed() + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 4, 5)) { + return "Wrong elements for (5 downTo 3).reversed(): $list1" + } + + val list2 = ArrayList() + val range2 = (5.toByte() downTo 3.toByte()).reversed() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 4, 5)) { + return "Wrong elements for (5.toByte() downTo 3.toByte()).reversed(): $list2" + } + + val list3 = ArrayList() + val range3 = (5.toShort() downTo 3.toShort()).reversed() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 4, 5)) { + return "Wrong elements for (5.toShort() downTo 3.toShort()).reversed(): $list3" + } + + val list4 = ArrayList() + val range4 = (5.toLong() downTo 3.toLong()).reversed() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 4, 5)) { + return "Wrong elements for (5.toLong() downTo 3.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + val range5 = ('c' downTo 'a').reversed() + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('a', 'b', 'c')) { + return "Wrong elements for ('c' downTo 'a').reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyBackSequence.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyBackSequence.kt new file mode 100644 index 00000000000..dc259b75860 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyBackSequence.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (3 downTo 5).reversed() + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for (3 downTo 5).reversed(): $list1" + } + + val list2 = ArrayList() + val range2 = (3.toByte() downTo 5.toByte()).reversed() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for (3.toByte() downTo 5.toByte()).reversed(): $list2" + } + + val list3 = ArrayList() + val range3 = (3.toShort() downTo 5.toShort()).reversed() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for (3.toShort() downTo 5.toShort()).reversed(): $list3" + } + + val list4 = ArrayList() + val range4 = (3.toLong() downTo 5.toLong()).reversed() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for (3.toLong() downTo 5.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + val range5 = ('a' downTo 'c').reversed() + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for ('a' downTo 'c').reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyRange.kt new file mode 100644 index 00000000000..436528a5cd9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedEmptyRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (5..3).reversed() + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for (5..3).reversed(): $list1" + } + + val list2 = ArrayList() + val range2 = (5.toByte()..3.toByte()).reversed() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for (5.toByte()..3.toByte()).reversed(): $list2" + } + + val list3 = ArrayList() + val range3 = (5.toShort()..3.toShort()).reversed() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for (5.toShort()..3.toShort()).reversed(): $list3" + } + + val list4 = ArrayList() + val range4 = (5.toLong()..3.toLong()).reversed() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for (5.toLong()..3.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + val range5 = ('c'..'a').reversed() + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for ('c'..'a').reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedInexactSteppedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedInexactSteppedDownTo.kt new file mode 100644 index 00000000000..03d7e797926 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedInexactSteppedDownTo.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (8 downTo 3 step 2).reversed() + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(4, 6, 8)) { + return "Wrong elements for (8 downTo 3 step 2).reversed(): $list1" + } + + val list2 = ArrayList() + val range2 = (8.toByte() downTo 3.toByte() step 2).reversed() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(4, 6, 8)) { + return "Wrong elements for (8.toByte() downTo 3.toByte() step 2).reversed(): $list2" + } + + val list3 = ArrayList() + val range3 = (8.toShort() downTo 3.toShort() step 2).reversed() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(4, 6, 8)) { + return "Wrong elements for (8.toShort() downTo 3.toShort() step 2).reversed(): $list3" + } + + val list4 = ArrayList() + val range4 = (8.toLong() downTo 3.toLong() step 2.toLong()).reversed() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(4, 6, 8)) { + return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + val range5 = ('d' downTo 'a' step 2).reversed() + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('b', 'd')) { + return "Wrong elements for ('d' downTo 'a' step 2).reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedRange.kt new file mode 100644 index 00000000000..098c28bf0aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedRange.kt @@ -0,0 +1,47 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (3..5).reversed() + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(5, 4, 3)) { + return "Wrong elements for (3..5).reversed(): $list1" + } + + val list2 = ArrayList() + val range2 = (3.toShort()..5.toShort()).reversed() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(5, 4, 3)) { + return "Wrong elements for (3.toShort()..5.toShort()).reversed(): $list2" + } + + val list3 = ArrayList() + val range3 = (3.toLong()..5.toLong()).reversed() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(5, 4, 3)) { + return "Wrong elements for (3.toLong()..5.toLong()).reversed(): $list3" + } + + val list4 = ArrayList() + val range4 = ('a'..'c').reversed() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf('c', 'b', 'a')) { + return "Wrong elements for ('a'..'c').reversed(): $list4" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedSimpleSteppedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedSimpleSteppedRange.kt new file mode 100644 index 00000000000..43771a5928e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/reversedSimpleSteppedRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (3..9 step 2).reversed() + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3..9 step 2).reversed(): $list1" + } + + val list2 = ArrayList() + val range2 = (3.toByte()..9.toByte() step 2).reversed() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3.toByte()..9.toByte() step 2).reversed(): $list2" + } + + val list3 = ArrayList() + val range3 = (3.toShort()..9.toShort() step 2).reversed() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3.toShort()..9.toShort() step 2).reversed(): $list3" + } + + val list4 = ArrayList() + val range4 = (3.toLong()..9.toLong() step 2.toLong()).reversed() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3.toLong()..9.toLong() step 2.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + val range5 = ('c'..'g' step 2).reversed() + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('g', 'e', 'c')) { + return "Wrong elements for ('c'..'g' step 2).reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleDownTo.kt new file mode 100644 index 00000000000..ad8974021a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleDownTo.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 9 downTo 3 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9 downTo 3: $list1" + } + + val list2 = ArrayList() + val range2 = 9.toByte() downTo 3.toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9.toByte() downTo 3.toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 9.toShort() downTo 3.toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9.toShort() downTo 3.toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 9.toLong() downTo 3.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9.toLong() downTo 3.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'g' downTo 'c' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('g', 'f', 'e', 'd', 'c')) { + return "Wrong elements for 'g' downTo 'c': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRange.kt new file mode 100644 index 00000000000..306ab1d6ed0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 3..9 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3..9: $list1" + } + + val list2 = ArrayList() + val range2 = 3.toByte()..9.toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3.toByte()..9.toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = 3.toShort()..9.toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3.toShort()..9.toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = 3.toLong()..9.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3.toLong()..9.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'c'..'g' + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { + return "Wrong elements for 'c'..'g': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRangeWithNonConstantEnds.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRangeWithNonConstantEnds.kt new file mode 100644 index 00000000000..42a9d01dcf6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleRangeWithNonConstantEnds.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = (1 + 2)..(10 - 1) + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1 + 2)..(10 - 1): $list1" + } + + val list2 = ArrayList() + val range2 = (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte() + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte(): $list2" + } + + val list3 = ArrayList() + val range3 = (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort() + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort(): $list3" + } + + val list4 = ArrayList() + val range4 = (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()) + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()): $list4" + } + + val list5 = ArrayList() + val range5 = ("ace"[1])..("age"[1]) + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { + return "Wrong elements for (\"ace\"[1])..(\"age\"[1]): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedDownTo.kt new file mode 100644 index 00000000000..2b5ad22293a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedDownTo.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 9 downTo 3 step 2 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9 downTo 3 step 2: $list1" + } + + val list2 = ArrayList() + val range2 = 9.toByte() downTo 3.toByte() step 2 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9.toByte() downTo 3.toByte() step 2: $list2" + } + + val list3 = ArrayList() + val range3 = 9.toShort() downTo 3.toShort() step 2 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9.toShort() downTo 3.toShort() step 2: $list3" + } + + val list4 = ArrayList() + val range4 = 9.toLong() downTo 3.toLong() step 2.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9.toLong() downTo 3.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'g' downTo 'c' step 2 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('g', 'e', 'c')) { + return "Wrong elements for 'g' downTo 'c' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedRange.kt new file mode 100644 index 00000000000..132a8fc2a88 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/simpleSteppedRange.kt @@ -0,0 +1,57 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + val range1 = 3..9 step 2 + for (i in range1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3..9 step 2: $list1" + } + + val list2 = ArrayList() + val range2 = 3.toByte()..9.toByte() step 2 + for (i in range2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3.toByte()..9.toByte() step 2: $list2" + } + + val list3 = ArrayList() + val range3 = 3.toShort()..9.toShort() step 2 + for (i in range3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3.toShort()..9.toShort() step 2: $list3" + } + + val list4 = ArrayList() + val range4 = 3.toLong()..9.toLong() step 2.toLong() + for (i in range4) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3.toLong()..9.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + val range5 = 'c'..'g' step 2 + for (i in range5) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('c', 'e', 'g')) { + return "Wrong elements for 'c'..'g' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forByteProgressionWithIntIncrement.kt b/backend.native/tests/external/codegen/blackbox/ranges/forByteProgressionWithIntIncrement.kt new file mode 100644 index 00000000000..8596acc44fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forByteProgressionWithIntIncrement.kt @@ -0,0 +1,9 @@ +// WITH_RUNTIME + +fun box(): String { + for (element in 5.toByte()..1.toByte() step 255) { + return "Fail: iterating over an empty progression, element: $element" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInDownTo.kt new file mode 100644 index 00000000000..fd046640e37 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInDownTo.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0 + for (i in 4 downTo 1) { + sum = sum * 10 + i + } + assertEquals(4321, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt new file mode 100644 index 00000000000..45214ff7d0e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0 + val dt = 4 downTo 1 + for (i in dt) { + sum = sum * 10 + i + } + assertEquals(4321, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forLongInDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forLongInDownTo.kt new file mode 100644 index 00000000000..4d1e9793cce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forLongInDownTo.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0L + for (i in 4L downTo 1L) { + sum = sum * 10L + i + } + assertEquals(4321L, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forNullableIntInDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forNullableIntInDownTo.kt new file mode 100644 index 00000000000..26109378c1b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/forNullableIntInDownTo.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0 + for (i: Int? in 4 downTo 1) { + sum = sum * 10 + (i ?: 0) + } + assertEquals(4321, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCharSequenceIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCharSequenceIndices.kt new file mode 100644 index 00000000000..1600771fa32 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCharSequenceIndices.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +fun test(s: CharSequence): Int { + var result = 0 + for (i in s.indices) { + result = result * 10 + (i + 1) + } + return result +} + +fun box(): String { + val test = test("abcd") + if (test != 1234) return "Fail: $test" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt new file mode 100644 index 00000000000..ec23e8a7493 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun Collection.sumIndices(): Int { + var sum = 0 + for (i in indices) { + sum += i + } + return sum +} + +fun box(): String { + val list = listOf(0, 0, 0, 0) + val sum = list.sumIndices() + assertEquals(6, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionIndices.kt new file mode 100644 index 00000000000..f4b018a1ee8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInCollectionIndices.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0 + for (i in listOf(0, 0, 0, 0).indices) { + sum += i + } + assertEquals(6, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInNonOptimizedIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInNonOptimizedIndices.kt new file mode 100644 index 00000000000..b46b4812732 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInNonOptimizedIndices.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun sumIndices(coll: Collection<*>?): Int { + var sum = 0 + for (i in coll?.indices ?: return 0) { + sum += i + } + return sum +} + +fun box(): String { + assertEquals(6, sumIndices(listOf(0, 0, 0, 0))) + assertEquals(0, sumIndices(null)) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInObjectArrayIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInObjectArrayIndices.kt new file mode 100644 index 00000000000..db45263759f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInObjectArrayIndices.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0 + for (i in arrayOf("", "", "", "").indices) { + sum += i + } + assertEquals(6, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInPrimitiveArrayIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInPrimitiveArrayIndices.kt new file mode 100644 index 00000000000..e1e5fb603d7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forInPrimitiveArrayIndices.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + var sum = 0 + for (i in intArrayOf(0, 0, 0, 0).indices) { + sum += i + } + assertEquals(6, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInArrayIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInArrayIndices.kt new file mode 100644 index 00000000000..2fb6c207bda --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInArrayIndices.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun suppressBoxingOptimization(ni: Int?) {} + +fun box(): String { + var sum = 0 + for (i: Int? in arrayOf("", "", "", "").indices) { + suppressBoxingOptimization(i) + sum += i ?: 0 + } + assertEquals(6, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInCollectionIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInCollectionIndices.kt new file mode 100644 index 00000000000..295f66bf5c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/forNullableIntInCollectionIndices.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun suppressBoxingOptimization(ni: Int?) {} + +fun box(): String { + var sum = 0 + for (i: Int? in listOf("", "", "", "").indices) { + suppressBoxingOptimization(i) + sum += i ?: 0 + } + assertEquals(6, sum) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt new file mode 100644 index 00000000000..a702ad58de0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +abstract class BaseGeneric(val t: T) { + abstract fun iterate() +} + +class Derived(array: Array) : BaseGeneric>(array) { + var test = 0 + + override fun iterate() { + test = 0 + for (i in t.indices) { + test = test * 10 + (i + 1) + } + } +} + +fun box(): String { + val t = Derived(arrayOf("", "", "", "")) + t.iterate() + return if (t.test == 1234) "OK" else "Fail: ${t.test}" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt new file mode 100644 index 00000000000..6a66952d7d5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +abstract class BaseGeneric(val t: T) { + abstract fun iterate() +} + +class Derived(t: List) : BaseGeneric>(t) { + var test = 0 + + override fun iterate() { + test = 0 + for (i in t.indices) { + test = test * 10 + (i + 1) + } + } +} + +fun box(): String { + val t = Derived(listOf("", "", "", "")) + t.iterate() + return if (t.test == 1234) "OK" else "Fail: ${t.test}" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt new file mode 100644 index 00000000000..1ff6d06f18a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +abstract class BaseGeneric(val t: T) { + abstract fun iterate() +} + +class Derived(array: DoubleArray) : BaseGeneric(array) { + var test = 0 + + override fun iterate() { + test = 0 + for (i in t.indices) { + test = test * 10 + (i + 1) + } + } +} + +fun box(): String { + val t = Derived(doubleArrayOf(0.0, 0.0, 0.0, 0.0)) + t.iterate() + return if (t.test == 1234) "OK" else "Fail: ${t.test}" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt new file mode 100644 index 00000000000..adeb7decaed --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +abstract class BaseGeneric(val t: T) { + abstract fun iterate() +} + +class Derived(t: List) : BaseGeneric>(t) { + var test = 0 + + override fun iterate() { + test = 0 + for (i in t.indices) { + test = test * 10 + (i + 1) + } + } +} + +fun box(): String { + val t = Derived(listOf(1, 2, 3, 4)) + t.iterate() + return if (t.test == 1234) "OK" else "Fail: ${t.test}" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt new file mode 100644 index 00000000000..59eef6ee1e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun test(x: Any): Int { + var sum = 0 + if (x is IntArray) { + for (i in x.indices) { + sum = sum * 10 + i + } + } + return sum +} + +fun box(): String { + assertEquals(123, test(intArrayOf(0, 0, 0, 0))) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_CharSequence.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_CharSequence.kt new file mode 100644 index 00000000000..a0d45d7698e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_CharSequence.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun test(x: Any): Int { + var sum = 0 + if (x is String) { + for (i in x.indices) { + sum = sum * 10 + i + } + } + return sum +} + +fun box(): String { + assertEquals(123, test("0000")) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Collection.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Collection.kt new file mode 100644 index 00000000000..9bd4610d351 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Collection.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun test(x: Any): Int { + var sum = 0 + if (x is List<*>) { + for (i in x.indices) { + sum = sum * 10 + i + } + } + return sum +} + +fun box(): String { + assertEquals(123, test(listOf(0, 0, 0, 0))) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInRangeWithImplicitReceiver.kt new file mode 100644 index 00000000000..a29e5a77e5e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInRangeWithImplicitReceiver.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun Int.digitsUpto(end: Int): Int { + var sum = 0 + for (i in rangeTo(end)) { + sum = sum*10 + i + } + return sum +} + +fun box(): String { + assertEquals(1234, 1.digitsUpto(4)) + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forIntRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/forIntRange.kt new file mode 100644 index 00000000000..1dd52f48533 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forIntRange.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +fun box() : String { + val a = arrayOfNulls(3) + a[0] = "a" + a[1] = "b" + a[2] = "c" + + var result = 0 + for(i in a.indices) { + result += i + } + if (result != 3) return "FAIL" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt new file mode 100644 index 00000000000..8f9a4534ea6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun suppressBoxingOptimization(ni: Int?) {} + +fun Int.digitsUpto(end: Int): Int { + var sum = 0 + for (i: Int? in rangeTo(end)) { + suppressBoxingOptimization(i) + sum = sum*10 + i!! + } + return sum +} + +fun box(): String { + assertEquals(1234, 1.digitsUpto(4)) + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/emptyDownto.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/emptyDownto.kt new file mode 100644 index 00000000000..ac36fbd5d62 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/emptyDownto.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 5 downTo 10) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for 5 downTo 10: $list1" + } + + val list2 = ArrayList() + for (i in 5.toByte() downTo 10.toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for 5.toByte() downTo 10.toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 5.toShort() downTo 10.toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for 5.toShort() downTo 10.toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 5.toLong() downTo 10.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for 5.toLong() downTo 10.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'a' downTo 'z') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for 'a' downTo 'z': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/emptyRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/emptyRange.kt new file mode 100644 index 00000000000..e977c4b9461 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/emptyRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 10..5) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for 10..5: $list1" + } + + val list2 = ArrayList() + for (i in 10.toByte()..(-5).toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for 10.toByte()..(-5).toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 10.toShort()..(-5).toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for 10.toShort()..(-5).toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 10.toLong()..-5.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for 10.toLong()..-5.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'z'..'a') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for 'z'..'a': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt new file mode 100644 index 00000000000..558a57f9399 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in (MinI + 5) downTo MinI step 3) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MinI + 5, MinI + 2)) { + return "Wrong elements for (MinI + 5) downTo MinI step 3: $list1" + } + + val list2 = ArrayList() + for (i in (MinB + 5).toByte() downTo MinB step 3) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MinB + 5).toInt(), (MinB + 2).toInt())) { + return "Wrong elements for (MinB + 5).toByte() downTo MinB step 3: $list2" + } + + val list3 = ArrayList() + for (i in (MinS + 5).toShort() downTo MinS step 3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MinS + 5).toInt(), (MinS + 2).toInt())) { + return "Wrong elements for (MinS + 5).toShort() downTo MinS step 3: $list3" + } + + val list4 = ArrayList() + for (i in (MinL + 5).toLong() downTo MinL step 3) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MinL + 5).toLong(), (MinL + 2).toLong())) { + return "Wrong elements for (MinL + 5).toLong() downTo MinL step 3: $list4" + } + + val list5 = ArrayList() + for (i in (MinC + 5) downTo MinC step 3) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MinC + 5), (MinC + 2))) { + return "Wrong elements for (MinC + 5) downTo MinC step 3: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedDownTo.kt new file mode 100644 index 00000000000..1696d7a1cb9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedDownTo.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 8 downTo 3 step 2) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(8, 6, 4)) { + return "Wrong elements for 8 downTo 3 step 2: $list1" + } + + val list2 = ArrayList() + for (i in 8.toByte() downTo 3.toByte() step 2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(8, 6, 4)) { + return "Wrong elements for 8.toByte() downTo 3.toByte() step 2: $list2" + } + + val list3 = ArrayList() + for (i in 8.toShort() downTo 3.toShort() step 2) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(8, 6, 4)) { + return "Wrong elements for 8.toShort() downTo 3.toShort() step 2: $list3" + } + + val list4 = ArrayList() + for (i in 8.toLong() downTo 3.toLong() step 2.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(8, 6, 4)) { + return "Wrong elements for 8.toLong() downTo 3.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'd' downTo 'a' step 2) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('d', 'b')) { + return "Wrong elements for 'd' downTo 'a' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedRange.kt new file mode 100644 index 00000000000..b7aec1243ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactSteppedRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 3..8 step 2) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 5, 7)) { + return "Wrong elements for 3..8 step 2: $list1" + } + + val list2 = ArrayList() + for (i in 3.toByte()..8.toByte() step 2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 5, 7)) { + return "Wrong elements for 3.toByte()..8.toByte() step 2: $list2" + } + + val list3 = ArrayList() + for (i in 3.toShort()..8.toShort() step 2) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 5, 7)) { + return "Wrong elements for 3.toShort()..8.toShort() step 2: $list3" + } + + val list4 = ArrayList() + for (i in 3.toLong()..8.toLong() step 2.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 5, 7)) { + return "Wrong elements for 3.toLong()..8.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'a'..'d' step 2) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('a', 'c')) { + return "Wrong elements for 'a'..'d' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt new file mode 100644 index 00000000000..dfa5ea20c32 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in (MaxI - 5)..MaxI step 3) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI - 5, MaxI - 2)) { + return "Wrong elements for (MaxI - 5)..MaxI step 3: $list1" + } + + val list2 = ArrayList() + for (i in (MaxB - 5).toByte()..MaxB step 3) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MaxB - 5).toInt(), (MaxB - 2).toInt())) { + return "Wrong elements for (MaxB - 5).toByte()..MaxB step 3: $list2" + } + + val list3 = ArrayList() + for (i in (MaxS - 5).toShort()..MaxS step 3) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MaxS - 5).toInt(), (MaxS - 2).toInt())) { + return "Wrong elements for (MaxS - 5).toShort()..MaxS step 3: $list3" + } + + val list4 = ArrayList() + for (i in (MaxL - 5).toLong()..MaxL step 3) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MaxL - 5).toLong(), (MaxL - 2).toLong())) { + return "Wrong elements for (MaxL - 5).toLong()..MaxL step 3: $list4" + } + + val list5 = ArrayList() + for (i in (MaxC - 5)..MaxC step 3) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MaxC - 5), (MaxC - 2))) { + return "Wrong elements for (MaxC - 5)..MaxC step 3: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt new file mode 100644 index 00000000000..ce83c868428 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in (MaxI - 2)..MaxI) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI - 2, MaxI - 1, MaxI)) { + return "Wrong elements for (MaxI - 2)..MaxI: $list1" + } + + val list2 = ArrayList() + for (i in (MaxB - 2).toByte()..MaxB) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MaxB - 2).toInt(), (MaxB - 1).toInt(), MaxB.toInt())) { + return "Wrong elements for (MaxB - 2).toByte()..MaxB: $list2" + } + + val list3 = ArrayList() + for (i in (MaxS - 2).toShort()..MaxS) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MaxS - 2).toInt(), (MaxS - 1).toInt(), MaxS.toInt())) { + return "Wrong elements for (MaxS - 2).toShort()..MaxS: $list3" + } + + val list4 = ArrayList() + for (i in (MaxL - 2).toLong()..MaxL) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MaxL - 2).toLong(), (MaxL - 1).toLong(), MaxL)) { + return "Wrong elements for (MaxL - 2).toLong()..MaxL: $list4" + } + + val list5 = ArrayList() + for (i in (MaxC - 2)..MaxC) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MaxC - 2), (MaxC - 1), MaxC)) { + return "Wrong elements for (MaxC - 2)..MaxC: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt new file mode 100644 index 00000000000..90ccadc9f38 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in MaxI..MaxI) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI)) { + return "Wrong elements for MaxI..MaxI: $list1" + } + + val list2 = ArrayList() + for (i in MaxB..MaxB) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(MaxB.toInt())) { + return "Wrong elements for MaxB..MaxB: $list2" + } + + val list3 = ArrayList() + for (i in MaxS..MaxS) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(MaxS.toInt())) { + return "Wrong elements for MaxS..MaxS: $list3" + } + + val list4 = ArrayList() + for (i in MaxL..MaxL) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(MaxL)) { + return "Wrong elements for MaxL..MaxL: $list4" + } + + val list5 = ArrayList() + for (i in MaxC..MaxC) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf(MaxC)) { + return "Wrong elements for MaxC..MaxC: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt new file mode 100644 index 00000000000..251774b7a0d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in MaxI..MinI) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for MaxI..MinI: $list1" + } + + val list2 = ArrayList() + for (i in MaxB..MinB) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for MaxB..MinB: $list2" + } + + val list3 = ArrayList() + for (i in MaxS..MinS) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for MaxS..MinS: $list3" + } + + val list4 = ArrayList() + for (i in MaxL..MinL) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for MaxL..MinL: $list4" + } + + val list5 = ArrayList() + for (i in MaxC..MinC) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for MaxC..MinC: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementDownTo.kt new file mode 100644 index 00000000000..9a5fd5f8589 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementDownTo.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 5 downTo 5) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(5)) { + return "Wrong elements for 5 downTo 5: $list1" + } + + val list2 = ArrayList() + for (i in 5.toByte() downTo 5.toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(5)) { + return "Wrong elements for 5.toByte() downTo 5.toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 5.toShort() downTo 5.toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(5)) { + return "Wrong elements for 5.toShort() downTo 5.toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 5.toLong() downTo 5.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(5.toLong())) { + return "Wrong elements for 5.toLong() downTo 5.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'k' downTo 'k') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('k')) { + return "Wrong elements for 'k' downTo 'k': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementRange.kt new file mode 100644 index 00000000000..3d7dc4fec09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/oneElementRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 5..5) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(5)) { + return "Wrong elements for 5..5: $list1" + } + + val list2 = ArrayList() + for (i in 5.toByte()..5.toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(5)) { + return "Wrong elements for 5.toByte()..5.toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 5.toShort()..5.toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(5)) { + return "Wrong elements for 5.toShort()..5.toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 5.toLong()..5.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(5.toLong())) { + return "Wrong elements for 5.toLong()..5.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'k'..'k') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('k')) { + return "Wrong elements for 'k'..'k': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/openRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/openRange.kt new file mode 100644 index 00000000000..488600a9207 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/openRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 1 until 5) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1 until 5: $list1" + } + + val list2 = ArrayList() + for (i in 1.toByte() until 5.toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1.toByte() until 5.toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 1.toShort() until 5.toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1.toShort() until 5.toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 1.toLong() until 5.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(1, 2, 3, 4)) { + return "Wrong elements for 1.toLong() until 5.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'a' until 'd') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('a', 'b', 'c')) { + return "Wrong elements for 'a' until 'd': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt new file mode 100644 index 00000000000..8ce7d3333df --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in (MinI + 2) downTo MinI step 1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MinI + 2, MinI + 1, MinI)) { + return "Wrong elements for (MinI + 2) downTo MinI step 1: $list1" + } + + val list2 = ArrayList() + for (i in (MinB + 2).toByte() downTo MinB step 1) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MinB + 2).toInt(), (MinB + 1).toInt(), MinB.toInt())) { + return "Wrong elements for (MinB + 2).toByte() downTo MinB step 1: $list2" + } + + val list3 = ArrayList() + for (i in (MinS + 2).toShort() downTo MinS step 1) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MinS + 2).toInt(), (MinS + 1).toInt(), MinS.toInt())) { + return "Wrong elements for (MinS + 2).toShort() downTo MinS step 1: $list3" + } + + val list4 = ArrayList() + for (i in (MinL + 2).toLong() downTo MinL step 1) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MinL + 2).toLong(), (MinL + 1).toLong(), MinL)) { + return "Wrong elements for (MinL + 2).toLong() downTo MinL step 1: $list4" + } + + val list5 = ArrayList() + for (i in (MinC + 2) downTo MinC step 1) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MinC + 2), (MinC + 1), MinC)) { + return "Wrong elements for (MinC + 2) downTo MinC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt new file mode 100644 index 00000000000..d04d79446d7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in (MaxI - 2)..MaxI step 2) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI - 2, MaxI)) { + return "Wrong elements for (MaxI - 2)..MaxI step 2: $list1" + } + + val list2 = ArrayList() + for (i in (MaxB - 2).toByte()..MaxB step 2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf((MaxB - 2).toInt(), MaxB.toInt())) { + return "Wrong elements for (MaxB - 2).toByte()..MaxB step 2: $list2" + } + + val list3 = ArrayList() + for (i in (MaxS - 2).toShort()..MaxS step 2) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf((MaxS - 2).toInt(), MaxS.toInt())) { + return "Wrong elements for (MaxS - 2).toShort()..MaxS step 2: $list3" + } + + val list4 = ArrayList() + for (i in (MaxL - 2).toLong()..MaxL step 2) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf((MaxL - 2).toLong(), MaxL)) { + return "Wrong elements for (MaxL - 2).toLong()..MaxL step 2: $list4" + } + + val list5 = ArrayList() + for (i in (MaxC - 2)..MaxC step 2) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf((MaxC - 2), MaxC)) { + return "Wrong elements for (MaxC - 2)..MaxC step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt new file mode 100644 index 00000000000..c8ad40c7bd1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in MaxI..MaxI step 1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MaxI)) { + return "Wrong elements for MaxI..MaxI step 1: $list1" + } + + val list2 = ArrayList() + for (i in MaxB..MaxB step 1) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(MaxB.toInt())) { + return "Wrong elements for MaxB..MaxB step 1: $list2" + } + + val list3 = ArrayList() + for (i in MaxS..MaxS step 1) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(MaxS.toInt())) { + return "Wrong elements for MaxS..MaxS step 1: $list3" + } + + val list4 = ArrayList() + for (i in MaxL..MaxL step 1) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(MaxL)) { + return "Wrong elements for MaxL..MaxL step 1: $list4" + } + + val list5 = ArrayList() + for (i in MaxC..MaxC step 1) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf(MaxC)) { + return "Wrong elements for MaxC..MaxC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt new file mode 100644 index 00000000000..0ed56310b44 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in MaxI..MinI step 1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for MaxI..MinI step 1: $list1" + } + + val list2 = ArrayList() + for (i in MaxB..MinB step 1) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for MaxB..MinB step 1: $list2" + } + + val list3 = ArrayList() + for (i in MaxS..MinS step 1) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for MaxS..MinS step 1: $list3" + } + + val list4 = ArrayList() + for (i in MaxL..MinL step 1) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for MaxL..MinL step 1: $list4" + } + + val list5 = ArrayList() + for (i in MaxC..MinC step 1) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for MaxC..MinC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt new file mode 100644 index 00000000000..24afb460106 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +import java.lang.Integer.MAX_VALUE as MaxI +import java.lang.Integer.MIN_VALUE as MinI +import java.lang.Byte.MAX_VALUE as MaxB +import java.lang.Byte.MIN_VALUE as MinB +import java.lang.Short.MAX_VALUE as MaxS +import java.lang.Short.MIN_VALUE as MinS +import java.lang.Long.MAX_VALUE as MaxL +import java.lang.Long.MIN_VALUE as MinL +import java.lang.Character.MAX_VALUE as MaxC +import java.lang.Character.MIN_VALUE as MinC + +fun box(): String { + val list1 = ArrayList() + for (i in MinI..MinI step 1) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(MinI)) { + return "Wrong elements for MinI..MinI step 1: $list1" + } + + val list2 = ArrayList() + for (i in MinB..MinB step 1) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(MinB.toInt())) { + return "Wrong elements for MinB..MinB step 1: $list2" + } + + val list3 = ArrayList() + for (i in MinS..MinS step 1) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(MinS.toInt())) { + return "Wrong elements for MinS..MinS step 1: $list3" + } + + val list4 = ArrayList() + for (i in MinL..MinL step 1) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(MinL)) { + return "Wrong elements for MinL..MinL step 1: $list4" + } + + val list5 = ArrayList() + for (i in MinC..MinC step 1) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf(MinC)) { + return "Wrong elements for MinC..MinC step 1: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedBackSequence.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedBackSequence.kt new file mode 100644 index 00000000000..f4cd7ae0df6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedBackSequence.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (5 downTo 3).reversed()) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 4, 5)) { + return "Wrong elements for (5 downTo 3).reversed(): $list1" + } + + val list2 = ArrayList() + for (i in (5.toByte() downTo 3.toByte()).reversed()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 4, 5)) { + return "Wrong elements for (5.toByte() downTo 3.toByte()).reversed(): $list2" + } + + val list3 = ArrayList() + for (i in (5.toShort() downTo 3.toShort()).reversed()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 4, 5)) { + return "Wrong elements for (5.toShort() downTo 3.toShort()).reversed(): $list3" + } + + val list4 = ArrayList() + for (i in (5.toLong() downTo 3.toLong()).reversed()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 4, 5)) { + return "Wrong elements for (5.toLong() downTo 3.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + for (i in ('c' downTo 'a').reversed()) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('a', 'b', 'c')) { + return "Wrong elements for ('c' downTo 'a').reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyBackSequence.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyBackSequence.kt new file mode 100644 index 00000000000..9c2bab57838 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyBackSequence.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (3 downTo 5).reversed()) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for (3 downTo 5).reversed(): $list1" + } + + val list2 = ArrayList() + for (i in (3.toByte() downTo 5.toByte()).reversed()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for (3.toByte() downTo 5.toByte()).reversed(): $list2" + } + + val list3 = ArrayList() + for (i in (3.toShort() downTo 5.toShort()).reversed()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for (3.toShort() downTo 5.toShort()).reversed(): $list3" + } + + val list4 = ArrayList() + for (i in (3.toLong() downTo 5.toLong()).reversed()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for (3.toLong() downTo 5.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + for (i in ('a' downTo 'c').reversed()) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for ('a' downTo 'c').reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyRange.kt new file mode 100644 index 00000000000..c2442883533 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedEmptyRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (5..3).reversed()) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf()) { + return "Wrong elements for (5..3).reversed(): $list1" + } + + val list2 = ArrayList() + for (i in (5.toByte()..3.toByte()).reversed()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf()) { + return "Wrong elements for (5.toByte()..3.toByte()).reversed(): $list2" + } + + val list3 = ArrayList() + for (i in (5.toShort()..3.toShort()).reversed()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf()) { + return "Wrong elements for (5.toShort()..3.toShort()).reversed(): $list3" + } + + val list4 = ArrayList() + for (i in (5.toLong()..3.toLong()).reversed()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf()) { + return "Wrong elements for (5.toLong()..3.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + for (i in ('c'..'a').reversed()) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf()) { + return "Wrong elements for ('c'..'a').reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedInexactSteppedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedInexactSteppedDownTo.kt new file mode 100644 index 00000000000..63c431ab3c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedInexactSteppedDownTo.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (8 downTo 3 step 2).reversed()) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(4, 6, 8)) { + return "Wrong elements for (8 downTo 3 step 2).reversed(): $list1" + } + + val list2 = ArrayList() + for (i in (8.toByte() downTo 3.toByte() step 2).reversed()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(4, 6, 8)) { + return "Wrong elements for (8.toByte() downTo 3.toByte() step 2).reversed(): $list2" + } + + val list3 = ArrayList() + for (i in (8.toShort() downTo 3.toShort() step 2).reversed()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(4, 6, 8)) { + return "Wrong elements for (8.toShort() downTo 3.toShort() step 2).reversed(): $list3" + } + + val list4 = ArrayList() + for (i in (8.toLong() downTo 3.toLong() step 2.toLong()).reversed()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(4, 6, 8)) { + return "Wrong elements for (8.toLong() downTo 3.toLong() step 2.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + for (i in ('d' downTo 'a' step 2).reversed()) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('b', 'd')) { + return "Wrong elements for ('d' downTo 'a' step 2).reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedRange.kt new file mode 100644 index 00000000000..1d4e6649437 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedRange.kt @@ -0,0 +1,43 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (3..5).reversed()) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(5, 4, 3)) { + return "Wrong elements for (3..5).reversed(): $list1" + } + + val list2 = ArrayList() + for (i in (3.toShort()..5.toShort()).reversed()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(5, 4, 3)) { + return "Wrong elements for (3.toShort()..5.toShort()).reversed(): $list2" + } + + val list3 = ArrayList() + for (i in (3.toLong()..5.toLong()).reversed()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(5, 4, 3)) { + return "Wrong elements for (3.toLong()..5.toLong()).reversed(): $list3" + } + + val list4 = ArrayList() + for (i in ('a'..'c').reversed()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf('c', 'b', 'a')) { + return "Wrong elements for ('a'..'c').reversed(): $list4" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedSimpleSteppedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedSimpleSteppedRange.kt new file mode 100644 index 00000000000..be85c5020c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/reversedSimpleSteppedRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (3..9 step 2).reversed()) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3..9 step 2).reversed(): $list1" + } + + val list2 = ArrayList() + for (i in (3.toByte()..9.toByte() step 2).reversed()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3.toByte()..9.toByte() step 2).reversed(): $list2" + } + + val list3 = ArrayList() + for (i in (3.toShort()..9.toShort() step 2).reversed()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3.toShort()..9.toShort() step 2).reversed(): $list3" + } + + val list4 = ArrayList() + for (i in (3.toLong()..9.toLong() step 2.toLong()).reversed()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(9, 7, 5, 3)) { + return "Wrong elements for (3.toLong()..9.toLong() step 2.toLong()).reversed(): $list4" + } + + val list5 = ArrayList() + for (i in ('c'..'g' step 2).reversed()) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('g', 'e', 'c')) { + return "Wrong elements for ('c'..'g' step 2).reversed(): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleDownTo.kt new file mode 100644 index 00000000000..13bdb9a25e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleDownTo.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 9 downTo 3) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9 downTo 3: $list1" + } + + val list2 = ArrayList() + for (i in 9.toByte() downTo 3.toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9.toByte() downTo 3.toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 9.toShort() downTo 3.toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9.toShort() downTo 3.toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 9.toLong() downTo 3.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(9, 8, 7, 6, 5, 4, 3)) { + return "Wrong elements for 9.toLong() downTo 3.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'g' downTo 'c') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('g', 'f', 'e', 'd', 'c')) { + return "Wrong elements for 'g' downTo 'c': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRange.kt new file mode 100644 index 00000000000..3a074a477d1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 3..9) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3..9: $list1" + } + + val list2 = ArrayList() + for (i in 3.toByte()..9.toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3.toByte()..9.toByte(): $list2" + } + + val list3 = ArrayList() + for (i in 3.toShort()..9.toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3.toShort()..9.toShort(): $list3" + } + + val list4 = ArrayList() + for (i in 3.toLong()..9.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for 3.toLong()..9.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'c'..'g') { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { + return "Wrong elements for 'c'..'g': $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRangeWithNonConstantEnds.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRangeWithNonConstantEnds.kt new file mode 100644 index 00000000000..b242f085369 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleRangeWithNonConstantEnds.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in (1 + 2)..(10 - 1)) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1 + 2)..(10 - 1): $list1" + } + + val list2 = ArrayList() + for (i in (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte()) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte(): $list2" + } + + val list3 = ArrayList() + for (i in (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort()) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort(): $list3" + } + + val list4 = ArrayList() + for (i in (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong())) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 4, 5, 6, 7, 8, 9)) { + return "Wrong elements for (1.toLong() + 2.toLong())..(10.toLong() - 1.toLong()): $list4" + } + + val list5 = ArrayList() + for (i in ("ace"[1])..("age"[1])) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('c', 'd', 'e', 'f', 'g')) { + return "Wrong elements for (\"ace\"[1])..(\"age\"[1]): $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedDownTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedDownTo.kt new file mode 100644 index 00000000000..62dd8c70251 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedDownTo.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 9 downTo 3 step 2) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9 downTo 3 step 2: $list1" + } + + val list2 = ArrayList() + for (i in 9.toByte() downTo 3.toByte() step 2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9.toByte() downTo 3.toByte() step 2: $list2" + } + + val list3 = ArrayList() + for (i in 9.toShort() downTo 3.toShort() step 2) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9.toShort() downTo 3.toShort() step 2: $list3" + } + + val list4 = ArrayList() + for (i in 9.toLong() downTo 3.toLong() step 2.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(9, 7, 5, 3)) { + return "Wrong elements for 9.toLong() downTo 3.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'g' downTo 'c' step 2) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('g', 'e', 'c')) { + return "Wrong elements for 'g' downTo 'c' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedRange.kt new file mode 100644 index 00000000000..4552ee0f9f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/simpleSteppedRange.kt @@ -0,0 +1,52 @@ +// Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! +// WITH_RUNTIME + + +fun box(): String { + val list1 = ArrayList() + for (i in 3..9 step 2) { + list1.add(i) + if (list1.size > 23) break + } + if (list1 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3..9 step 2: $list1" + } + + val list2 = ArrayList() + for (i in 3.toByte()..9.toByte() step 2) { + list2.add(i) + if (list2.size > 23) break + } + if (list2 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3.toByte()..9.toByte() step 2: $list2" + } + + val list3 = ArrayList() + for (i in 3.toShort()..9.toShort() step 2) { + list3.add(i) + if (list3.size > 23) break + } + if (list3 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3.toShort()..9.toShort() step 2: $list3" + } + + val list4 = ArrayList() + for (i in 3.toLong()..9.toLong() step 2.toLong()) { + list4.add(i) + if (list4.size > 23) break + } + if (list4 != listOf(3, 5, 7, 9)) { + return "Wrong elements for 3.toLong()..9.toLong() step 2.toLong(): $list4" + } + + val list5 = ArrayList() + for (i in 'c'..'g' step 2) { + list5.add(i) + if (list5.size > 23) break + } + if (list5 != listOf('c', 'e', 'g')) { + return "Wrong elements for 'c'..'g' step 2: $list5" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt new file mode 100644 index 00000000000..d8fef0b509a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +operator fun Int.component1(): String { + return arrayListOf("zero", "one", "two", "three")[this] +} + +operator fun Int.component2(): Int { + return arrayListOf(0, 1, 4, 9)[this] +} + +fun box(): String { + val strings = arrayListOf() + val squares = arrayListOf() + + for ((str, sq) in 1..3) { + strings.add(str) + squares.add(sq) + } + + if (strings != arrayListOf("one", "two", "three")) return "FAIL: $strings" + if (squares != arrayListOf(1, 4, 9)) return "FAIL: $squares" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/progressionExpression.kt b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/progressionExpression.kt new file mode 100644 index 00000000000..2caf1a33808 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/progressionExpression.kt @@ -0,0 +1,12 @@ +fun box(): String { + var result = 0 + val intRange: IntProgression = 1..3 + for (i: Int? in intRange) { + result = sum(result, i) + } + return if (result == 6) "OK" else "fail: $result" +} + +fun sum(i: Int, z: Int?): Int { + return i + z!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeExpression.kt b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeExpression.kt new file mode 100644 index 00000000000..7cc906c09d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeExpression.kt @@ -0,0 +1,12 @@ +fun box(): String { + var result = 0 + val intRange = 1..3 + for (i: Int? in intRange) { + result = sum(result, i) + } + return if (result == 6) "OK" else "fail: $result" +} + +fun sum(i: Int, z: Int?): Int { + return i + z!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeLiteral.kt b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeLiteral.kt new file mode 100644 index 00000000000..52713ad8bf7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/rangeLiteral.kt @@ -0,0 +1,11 @@ +fun box(): String { + var result = 0 + for (i: Int? in 1..3) { + result = sum(result, i) + } + return if (result == 6) "OK" else "fail: $result" +} + +fun sum(i: Int, z: Int?): Int { + return i + z!! +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt new file mode 100644 index 00000000000..0d277d3c2bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun charRange(x: Char?, y: Char) = x?.rangeTo(y) +fun byteRange(x: Byte?, y: Byte) = x?.rangeTo(y) +fun shortRange(x: Short?, y: Short) = x?.rangeTo(y) +fun intRange(x: Int?, y: Int) = x?.rangeTo(y) +fun longRange(x: Long?, y: Long) = x?.rangeTo(y) +fun floatRange(x: Float?, y: Float) = x?.rangeTo(y) +fun dougleRange(x: Double?, y: Double) = x?.rangeTo(y) + +inline fun testSafeRange(x: T, y: T, expectStr: String, safeRange: (T?, T) -> R?) { + val rNull = safeRange(null, y) + assert (rNull == null) { "${T::class.simpleName}: Expected: null, got $rNull" } + + val rxy = safeRange(x, y) + assert (rxy?.toString() == expectStr) { "${T::class.simpleName}: Expected: $expectStr, got $rxy" } +} + +fun box(): String { + testSafeRange('0', '1', "0..1", ::charRange) + testSafeRange(0, 1, "0..1", ::byteRange) + testSafeRange(0, 1, "0..1", ::shortRange) + testSafeRange(0, 1, "0..1", ::intRange) + testSafeRange(0L, 1L, "0..1", ::longRange) + testSafeRange(0.0f, 1.0f, "0.0..1.0", ::floatRange) + testSafeRange(0.0, 1.0, "0.0..1.0", ::dougleRange) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt new file mode 100644 index 00000000000..27885b8bc64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +@Retention(AnnotationRetention.RUNTIME) +annotation class Anno + +fun box(): String { + val a = Anno::class.annotations + + if (a.size != 1) return "Fail 1: $a" + val ann = a.single() as? Retention ?: return "Fail 2: ${a.single()}" + assertEquals(AnnotationRetention.RUNTIME, ann.value) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt new file mode 100644 index 00000000000..dafe25a022e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +@Anno("J") +public class J { + @Anno("foo") + public static int foo = 42; + + @Anno("bar") + public static void bar() {} + + @Anno("constructor") + public J() {} +} + +// FILE: K.kt + +import kotlin.test.assertEquals + +annotation class Anno(val value: String) + +fun box(): String { + assertEquals("[@Anno(value=J)]", J::class.annotations.toString()) + assertEquals("[@Anno(value=foo)]", J::foo.annotations.toString()) + assertEquals("[@Anno(value=bar)]", J::bar.annotations.toString()) + assertEquals("[@Anno(value=constructor)]", ::J.annotations.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt new file mode 100644 index 00000000000..38db10486b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt @@ -0,0 +1,21 @@ +// IGNORE_BACKEND: JS +// WITH_REFLECT + +import kotlin.reflect.findAnnotation +import kotlin.test.assertNull + +annotation class Yes(val value: String) +annotation class No(val value: String) + +@Yes("OK") +@No("Fail") +class Foo + +class Bar + +fun box(): String { + assertNull(Bar::class.findAnnotation()) + assertNull(Bar::class.findAnnotation()) + + return Foo::class.findAnnotation()?.value ?: "Fail: no annotation" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt new file mode 100644 index 00000000000..3b4047a9349 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +annotation class Get +annotation class Set +annotation class SetParam + +var foo: String + @Get get() = "" + @Set set(@SetParam value) {} + +fun box(): String { + assert(::foo.getter.annotations.single() is Get) + assert(::foo.setter.annotations.single() is Set) + assert(::foo.setter.parameters.single().annotations.single() is SetParam) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt new file mode 100644 index 00000000000..1e78aaadbe2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +annotation class Ann(val value: String) + +@Ann("OK") +val property: String + get() = "" + +fun box(): String { + return (::property.annotations.single() as Ann).value +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt new file mode 100644 index 00000000000..9d3a3b87c6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +@Retention(AnnotationRetention.SOURCE) +annotation class SourceAnno + +@Retention(AnnotationRetention.BINARY) +annotation class BinaryAnno + +@Retention(AnnotationRetention.RUNTIME) +annotation class RuntimeAnno + +@SourceAnno +@BinaryAnno +@RuntimeAnno +fun box(): String { + assertEquals(listOf(RuntimeAnno::class.java), ::box.annotations.map { it.annotationClass.java }) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt new file mode 100644 index 00000000000..ab2f65bab77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) + +@Simple("OK") +class A + +fun box(): String { + return (A::class.annotations.single() as Simple).value +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt new file mode 100644 index 00000000000..70e1e19e147 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +annotation class Primary +annotation class Secondary + +class C @Primary constructor() { + @Secondary + constructor(s: String): this() +} + +fun box(): String { + val ans = C::class.constructors.map { it.annotations.single().annotationClass.java.simpleName }.sorted() + if (ans != listOf("Primary", "Secondary")) return "Fail: $ans" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt new file mode 100644 index 00000000000..7eabe205f37 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) + +@Simple("OK") +fun box(): String { + return (::box.annotations.single() as Simple).value +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt new file mode 100644 index 00000000000..c5e6cd2fe47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) + +fun test(@Simple("OK") x: Int) {} + +fun box(): String { + return (::test.parameters.single().annotations.single() as Simple).value +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt new file mode 100644 index 00000000000..0913732168a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) + +@property:Simple("OK") +val foo: Int = 0 + +fun box(): String { + return (::foo.annotations.single() as Simple).value +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt new file mode 100644 index 00000000000..7bc2f35ee6f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt @@ -0,0 +1,53 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +class Host { + companion object { + val x = 1 + var y = 2 + + val xx: Int + get() = x + + var yy: Int + get() = y + set(value) { y = value } + } +} + +val c_x = Host.Companion::x +val c_xx = Host.Companion::xx +val c_y = Host.Companion::y +val c_yy = Host.Companion::yy + +fun box(): String { + assertEquals(1, c_x.getter()) + assertEquals(1, c_x.getter.call()) + assertEquals(1, c_xx.getter()) + assertEquals(1, c_xx.getter.call()) + assertEquals(2, c_y.getter()) + assertEquals(2, c_y.getter.call()) + assertEquals(2, c_yy.getter()) + assertEquals(2, c_yy.getter.call()) + + c_y.setter(10) + assertEquals(10, c_y.getter()) + assertEquals(10, c_yy.getter()) + + c_yy.setter(20) + assertEquals(20, c_y.getter()) + assertEquals(20, c_yy.getter()) + + c_y.setter.call(100) + assertEquals(100, c_yy.getter.call()) + + c_yy.setter.call(200) + assertEquals(200, c_y.getter.call()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt new file mode 100644 index 00000000000..85043fc9d64 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt @@ -0,0 +1,12 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +fun String.foo(x: String) = this + x +fun String?.bar(x: String) = x + +fun box() = + (""::foo).call("O") + (null::bar).call("K") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt new file mode 100644 index 00000000000..233f9b5b37f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt @@ -0,0 +1,45 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +class C(val x: Int, var y: Int) + +val C.xx: Int + get() = x + +var C.yy: Int + get() = y + set(value) { y = value } + + +val c = C(1, 2) + +val c_xx = c::xx +val c_y = c::y +val c_yy = c::yy + +fun box(): String { + assertEquals(1, c_xx.getter()) + assertEquals(1, c_xx.getter.call()) + assertEquals(2, c_yy.getter()) + assertEquals(2, c_yy.getter.call()) + + c_y.setter(10) + assertEquals(10, c_yy.getter()) + + c_yy.setter(20) + assertEquals(20, c_y.getter()) + assertEquals(20, c_yy.getter()) + + c_y.setter.call(100) + assertEquals(100, c_yy.getter.call()) + + c_yy.setter.call(200) + assertEquals(200, c_y.getter.call()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt new file mode 100644 index 00000000000..69f0e53c2a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt @@ -0,0 +1,16 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class Outer(val x: String) { + inner class Inner(val y: String) { + fun foo() = x + y + } +} + +fun box(): String { + val innerCtor = Outer("O")::Inner + val inner = innerCtor.call("K") + return inner.foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt new file mode 100644 index 00000000000..19212abf35a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt @@ -0,0 +1,40 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +// FILE: J.java +public class J { + public final int finalField; + public String mutableField; + + public J(int f, String m) { + this.finalField = f; + this.mutableField = m; + } +} + +// FILE: K.kt +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun box(): String { + val j = J(0, "") + + val jf = j::finalField + val jm = j::mutableField + + assertEquals(0, jf.getter()) + assertEquals(0, jf.getter.call()) + assertEquals("", jm.getter()) + assertEquals("", jm.getter.call()) + + jm.setter("1") + assertEquals("1", j.mutableField) + + jm.setter.call("2") + assertEquals("2", j.mutableField) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt new file mode 100644 index 00000000000..0742577fcc4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt @@ -0,0 +1,35 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +// FILE: J.java +public class J { + private final int param; + + public J(int param) { + this.param = param; + } + + public String foo(int[] arr, Object[] arr2, Integer y) { + return "" + param + arr[0] + arr2[0] + y; + } +} + +// FILE: K.kt +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun box(): String { + val f = J(0)::foo + assertEquals( + listOf(IntArray::class.java, Array::class.java, Integer::class.java), + f.parameters.map { it.type.javaType } + ) + assertEquals(String::class.java, f.returnType.javaType) + + assertEquals("01A2", f.call(intArrayOf(1), arrayOf("A"), 2)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt new file mode 100644 index 00000000000..dd7311f95f4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt @@ -0,0 +1,53 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +class Host { + companion object { + @JvmStatic val x = 1 + @JvmStatic var y = 2 + + @JvmStatic val xx: Int + get() = x + + @JvmStatic var yy: Int + get() = y + set(value) { y = value } + } +} + +val c_x = Host.Companion::x +val c_xx = Host.Companion::xx +val c_y = Host.Companion::y +val c_yy = Host.Companion::yy + +fun box(): String { + assertEquals(1, c_x.getter()) + assertEquals(1, c_x.getter.call()) + assertEquals(1, c_xx.getter()) + assertEquals(1, c_xx.getter.call()) + assertEquals(2, c_y.getter()) + assertEquals(2, c_y.getter.call()) + assertEquals(2, c_yy.getter()) + assertEquals(2, c_yy.getter.call()) + + c_y.setter(10) + assertEquals(10, c_y.getter()) + assertEquals(10, c_yy.getter()) + + c_yy.setter(20) + assertEquals(20, c_y.getter()) + assertEquals(20, c_yy.getter()) + + c_y.setter.call(100) + assertEquals(100, c_yy.getter.call()) + + c_yy.setter.call(200) + assertEquals(200, c_y.getter.call()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt new file mode 100644 index 00000000000..1169f50791e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt @@ -0,0 +1,19 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +object Host { + @JvmStatic fun foo(x: String) = x +} + +class CompanionOwner { + companion object { + @JvmStatic fun bar(x: String) = x + } +} + +fun box(): String = + (Host::foo).call("O") + (CompanionOwner.Companion::bar).call("K") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt new file mode 100644 index 00000000000..3c6e3854f1c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt @@ -0,0 +1,51 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +object Host { + @JvmStatic val x = 1 + @JvmStatic var y = 2 + + @JvmStatic val xx: Int + get() = x + + @JvmStatic var yy: Int + get() = y + set(value) { y = value } +} + +val c_x = Host::x +val c_xx = Host::xx +val c_y = Host::y +val c_yy = Host::yy + +fun box(): String { + assertEquals(1, c_x.getter()) + assertEquals(1, c_x.getter.call()) + assertEquals(1, c_xx.getter()) + assertEquals(1, c_xx.getter.call()) + assertEquals(2, c_y.getter()) + assertEquals(2, c_y.getter.call()) + assertEquals(2, c_yy.getter()) + assertEquals(2, c_yy.getter.call()) + + c_y.setter(10) + assertEquals(10, c_y.getter()) + assertEquals(10, c_yy.getter()) + + c_yy.setter(20) + assertEquals(20, c_y.getter()) + assertEquals(20, c_yy.getter()) + + c_y.setter.call(100) + assertEquals(100, c_yy.getter.call()) + + c_yy.setter.call(200) + assertEquals(200, c_y.getter.call()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt new file mode 100644 index 00000000000..34f6aa7ecb1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt @@ -0,0 +1,14 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class C(val k: String) { + fun foo(s: String) = s + k +} + +fun box(): String = + C("K")::foo.call("O") + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt new file mode 100644 index 00000000000..0502c2a573d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt @@ -0,0 +1,50 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +class C(val x: Int, var y: Int) { + val xx: Int + get() = x + + var yy: Int + get() = y + set(value) { y = value } +} + +val c = C(1, 2) + +val c_x = c::x +val c_xx = c::xx +val c_y = c::y +val c_yy = c::yy + +fun box(): String { + assertEquals(1, c_x.getter()) + assertEquals(1, c_x.getter.call()) + assertEquals(1, c_xx.getter()) + assertEquals(1, c_xx.getter.call()) + assertEquals(2, c_y.getter()) + assertEquals(2, c_y.getter.call()) + assertEquals(2, c_yy.getter()) + assertEquals(2, c_yy.getter.call()) + + c_y.setter(10) + assertEquals(10, c_y.getter()) + assertEquals(10, c_yy.getter()) + + c_yy.setter(20) + assertEquals(20, c_y.getter()) + assertEquals(20, c_yy.getter()) + + c_y.setter.call(100) + assertEquals(100, c_yy.getter.call()) + + c_yy.setter.call(200) + assertEquals(200, c_y.getter.call()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt new file mode 100644 index 00000000000..81195ecda26 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt @@ -0,0 +1,19 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +object Host { + fun foo(x: String) = x +} + +class CompanionOwner { + companion object { + fun bar(x: String) = x + } +} + +fun box(): String = + (Host::foo).call("O") + (CompanionOwner.Companion::bar).call("K") \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt new file mode 100644 index 00000000000..2fb29097eb6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt @@ -0,0 +1,51 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +object Host { + val x = 1 + var y = 2 + + val xx: Int + get() = x + + var yy: Int + get() = y + set(value) { y = value } +} + +val c_x = Host::x +val c_xx = Host::xx +val c_y = Host::y +val c_yy = Host::yy + +fun box(): String { + assertEquals(1, c_x.getter()) + assertEquals(1, c_x.getter.call()) + assertEquals(1, c_xx.getter()) + assertEquals(1, c_xx.getter.call()) + assertEquals(2, c_y.getter()) + assertEquals(2, c_y.getter.call()) + assertEquals(2, c_yy.getter()) + assertEquals(2, c_yy.getter.call()) + + c_y.setter(10) + assertEquals(10, c_y.getter()) + assertEquals(10, c_yy.getter()) + + c_yy.setter(20) + assertEquals(20, c_y.getter()) + assertEquals(20, c_yy.getter()) + + c_y.setter.call(100) + assertEquals(100, c_yy.getter.call()) + + c_yy.setter.call(200) + assertEquals(200, c_y.getter.call()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt new file mode 100644 index 00000000000..8f87d022f96 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + private final int param; + + public J(int param) { + this.param = param; + } + + public String foo(int[] arr, Object[] arr2, Integer y) { + return "" + param + arr[0] + arr2[0] + y; + } +} + +// FILE: K.kt + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun box(): String { + val f = J::foo + assertEquals( + listOf(J::class.java, IntArray::class.java, Array::class.java, Integer::class.java), + f.parameters.map { it.type.javaType } + ) + assertEquals(String::class.java, f.returnType.javaType) + + assertEquals("01A2", f.call(J(0), intArrayOf(1), arrayOf("A"), 2)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt new file mode 100644 index 00000000000..9d585af73b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + private final String result; + + private J(String result) { + this.result = result; + } + + private String getResult() { + return result; + } +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.* + +fun box(): String { + val c = J::class.constructors.single() + assertFalse(c.isAccessible) + assertFailsWith(IllegalCallableAccessException::class) { c.call("") } + + c.isAccessible = true + assertTrue(c.isAccessible) + val j = c.call("OK") + + val m = J::class.members.single { it.name == "getResult" } + assertFalse(m.isAccessible) + assertFailsWith(IllegalCallableAccessException::class) { m.call(j)!! } + + m.isAccessible = true + return m.call(j) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt new file mode 100644 index 00000000000..302c20d1c9a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public static String foo(int x, int[] arr, Object[] arr2) { + return "" + x + arr[0] + arr2[0]; + } +} + +// FILE: K.kt + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun box(): String { + val f = J::foo + assertEquals(listOf(Integer.TYPE, IntArray::class.java, Array::class.java), f.parameters.map { it.type.javaType }) + assertEquals(String::class.java, f.returnType.javaType) + + assertEquals("01A", f.call(0, intArrayOf(1), arrayOf("A"))) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt new file mode 100644 index 00000000000..6db9e7b6249 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* + +enum class E + +fun box(): String { + try { + val c = E::class.constructors.single() + c.isAccessible = true + c.call() + return "Fail: constructing an enum class should not be allowed" + } + catch (e: Throwable) { + return "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt new file mode 100644 index 00000000000..36f3ce642e8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +class A { + private var foo: String = "" +} + +object O { + @JvmStatic + private var bar: String = "" +} + +class CounterTest(t: T) { + private var baz: String? = "" + private var generic: T = t +} + +fun box(): String { + val p = A::class.memberProperties.single() as KMutableProperty1 + p.isAccessible = true + try { + p.setter.call(A(), null) + return "Fail: exception should have been thrown" + } catch (e: IllegalArgumentException) {} + + + val o = O::class.memberProperties.single() as KMutableProperty1 + o.isAccessible = true + try { + o.setter.call(O, null) + return "Fail: exception should have been thrown" + } catch (e: IllegalArgumentException) {} + + + val c = CounterTest::class.memberProperties.single { it.name == "baz" } as KMutableProperty1, String?> + c.isAccessible = true + c.setter.call(CounterTest(""), null) // Should not fail, because CounterTest::baz is nullable + val d = CounterTest::class.memberProperties.single { it.name == "generic" } as KMutableProperty1, String?> + d.isAccessible = true + d.setter.call(CounterTest(""), null) // Also should not fail, because we can't be sure about nullability of 'generic' + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt new file mode 100644 index 00000000000..21908f9318b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A + +data class D(val s: String) + +fun box(): String { + val a = A() + assert(A::equals.call(a, a)) + assert(!A::equals.call(a, 0)) + assert(A::hashCode.call(a) == A::hashCode.call(a)) + assert(A::toString.call(a).startsWith("A@")) + + assert(D::equals.call(D("foo"), D("foo"))) + assert(!D::equals.call(D("foo"), D("bar"))) + assert(D::hashCode.call(D("foo")) == D::hashCode.call(D("foo"))) + assert(D::toString.call(D("foo")) == "D(s=foo)") + + assert(Int::equals.call(-1, -1)) + assert(Int::hashCode.call(0) != Int::hashCode.call(1)) + assert(Int::toString.call(42) == "42") + + assert(String::equals.call("beer", "beer")) + String::hashCode.call("beer") + + return String::toString.call("OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt new file mode 100644 index 00000000000..17e9d699a59 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.InvocationTargetException + +fun fail(message: String) { + throw AssertionError(message) +} + +fun box(): String { + try { + ::fail.call("OK") + } catch (e: InvocationTargetException) { + return e.getTargetException().message.toString() + } + + return "Fail: no exception was thrown" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt new file mode 100644 index 00000000000..5b881d33612 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +open class A { + fun foo() = "OK" +} + +class B : A() + +fun box(): String { + val foo = B::class.members.single { it.name == "foo" } + return foo.call(B()) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt new file mode 100644 index 00000000000..50047c43a7f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +open class A(val t: T) { + fun foo() = t +} + +class B(s: String) : A(s) + +fun box(): String { + val foo = B::class.members.single { it.name == "foo" } + return foo.call(B("OK")) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt new file mode 100644 index 00000000000..956544ac4cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt @@ -0,0 +1,108 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.isAccessible +import kotlin.reflect.KCallable +import kotlin.reflect.KFunction +import kotlin.reflect.KMutableProperty + +var foo: String = "" + +class A(private var bar: String = "") { + fun getBar() = A::bar +} + +object O { + @JvmStatic + private var baz: String = "" + + @JvmStatic + fun getBaz() = (O::class.members.single { it.name == "baz" } as KMutableProperty<*>).apply { isAccessible = true } + + fun getGetBaz() = O::class.members.single { it.name == "getBaz" } as KFunction<*> +} + +fun check(callable: KCallable<*>, vararg args: Any?) { + val expected = callable.parameters.size + val actual = args.size + + if (expected == actual) { + throw AssertionError("Bad test case: expected and actual number of arguments should differ (was $expected vs $actual)") + } + + val expectedExceptionMessage = "Callable expects $expected arguments, but $actual were provided." + + try { + callable.call(*args) + throw AssertionError("Fail: an IllegalArgumentException should have been thrown") + } catch (e: IllegalArgumentException) { + if (e.message != expectedExceptionMessage) { + // This most probably means that we don't check number of passed arguments in reflection + // and the default check from Java reflection yields an IllegalArgumentException, but with a not that helpful message + throw AssertionError("Fail: an exception with an unrecognized message was thrown: \"${e.message}\"" + + "\nExpected message was: $expectedExceptionMessage") + } + } +} + +fun box(): String { + check(::box, null) + check(::box, "") + + check(::A) + check(::A, null, "") + + check(O.getGetBaz()) + check(O.getGetBaz(), null, "") + + + val f = ::foo + check(f, null) + check(f, null, null) + check(f, arrayOf(null)) + check(f, "") + + check(f.getter, null) + check(f.getter, null, null) + check(f.getter, arrayOf(null)) + check(f.getter, "") + + check(f.setter) + check(f.setter, null, null) + check(f.setter, null, "") + + + val b = A().getBar() + + check(b) + check(b, null, null) + check(b, "", "") + + check(b.getter) + check(b.getter, null, null) + check(b.getter, "", "") + + check(b.setter) + check(b.setter, null) + check(b.setter, "") + + + val z = O.getBaz() + + check(z) + check(z, null, null) + check(z, "", "") + + check(z.getter) + check(z.getter, null, null) + check(z.getter, "", "") + + check(z.setter) + check(z.setter, null) + check(z.setter, "") + + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt new file mode 100644 index 00000000000..7b13dcfb2ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A { + class Nested(val result: String) + inner class Inner(val result: String) +} + +fun box(): String { + return (A::Nested).call("O").result + (A::Inner).call((::A).call(), "K").result +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt new file mode 100644 index 00000000000..16d438bf1e8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +object Obj { + @JvmStatic + fun foo() {} +} + +class C { + companion object { + @JvmStatic + fun bar() {} + } +} + +fun box(): String { + (Obj::class.members.single { it.name == "foo" }).call(Obj) + (C.Companion::class.members.single { it.name == "bar" }).call(C.Companion) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt new file mode 100644 index 00000000000..f94ce085bf1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +object Obj { + @JvmStatic + fun foo(s: String) {} + + @JvmStatic + fun bar() {} + + @JvmStatic + fun sly(obj: Obj) {} + + operator fun get(name: String) = Obj::class.members.single { it.name == name } +} + +fun box(): String { + // This should succeed + (Obj["foo"]).call(Obj, "") + (Obj["bar"]).call(Obj) + (Obj["sly"]).call(Obj, Obj) + + // This shouldn't: first argument should always be Obj + try { + (Obj["foo"]).call(null, "") + return "Fail foo" + } catch (e: IllegalArgumentException) {} + + try { + (Obj["bar"]).call("") + return "Fail bar" + } catch (e: IllegalArgumentException) {} + + try { + (Obj["sly"]).call(Obj) + return "Fail sly 1" + } catch (e: IllegalArgumentException) {} + + try { + (Obj["sly"]).call(null, Obj) + return "Fail sly 2" + } catch (e: IllegalArgumentException) {} + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt new file mode 100644 index 00000000000..494c79c6f0c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + class Local { + fun result(s: String) = s + } + + return Local::result.call(Local(), "OK") +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt new file mode 100644 index 00000000000..82fd1e055ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +var result = "Fail" + +class A { + fun foo(t: T) { + result = t as String + } +} + +fun box(): String { + (A::foo).call(A(), "OK") + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt new file mode 100644 index 00000000000..1ee9c138de4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.* + +class A(private var result: String) + +fun box(): String { + val a = A("abc") + + val p = A::class.declaredMemberProperties.single() as KMutableProperty1 + p.isAccessible = true + assertEquals("abc", p.call(a)) + assertEquals(Unit, p.setter.call(a, "def")) + assertEquals("def", p.getter.call(a)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt new file mode 100644 index 00000000000..587a262a1c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +val p0 = 1 +val Int.p1: Int get() = this +class A { + val Int.p2: Int get() = this +} + +var globalCounter = 0 + +var mp0 = 1 + set(value) { globalCounter += value } +var Int.mp1: Int + get() = this + set(value) { globalCounter += value } +class B { + var Int.mp2: Int + get() = this + set(value) { globalCounter += value } +} + + +fun box(): String { + assertEquals(1, (::p0).call()) + assertEquals(1, (::p0).getter.call()) + assertEquals(2, (Int::p1).call(2)) + assertEquals(2, (Int::p1).getter.call(2)) + val p2 = A::class.memberExtensionProperties.single() + assertEquals(3, p2.call(A(), 3)) + assertEquals(3, p2.getter.call(A(), 3)) + + assertEquals(1, (::mp0).call()) + assertEquals(1, (::mp0).getter.call()) + assertEquals(2, (Int::mp1).call(2)) + assertEquals(2, (Int::mp1).getter.call(2)) + val mp2 = B::class.memberExtensionProperties.single() as KMutableProperty2 + assertEquals(3, mp2.call(B(), 3)) + assertEquals(3, mp2.getter.call(B(), 3)) + + assertEquals(Unit, (::mp0).setter.call(1)) + assertEquals(Unit, (Int::mp1).setter.call(0, 3)) + assertEquals(Unit, mp2.setter.call(B(), 0, 5)) + if (globalCounter != 9) return "Fail: $globalCounter" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt new file mode 100644 index 00000000000..e9aca58f108 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +data class Foo(val id: String) { + fun getId() = -42 // Fail +} + +fun box(): String { + return Foo::id.call(Foo("OK")) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt new file mode 100644 index 00000000000..0869650c488 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun foo() {} + +class A { + fun bar() {} +} + +object O { + @JvmStatic fun baz() {} +} + +fun nullableUnit(unit: Boolean): Unit? = if (unit) Unit else null + +fun box(): String { + assertEquals(Unit, ::foo.call()) + assertEquals(Unit, A::bar.call(A())) + assertEquals(Unit, O::class.members.single { it.name == "baz" }.call(O)) + + assertEquals(Unit, (::nullableUnit).call(true)) + assertEquals(null, (::nullableUnit).call(false)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt new file mode 100644 index 00000000000..108e38c15b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A(val result: String) + +fun box(): String { + val a = (::A).call("OK") + return a.result +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt new file mode 100644 index 00000000000..f1db9dfba04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A { + fun foo(x: Int, y: Int) = x + y +} + +fun box(): String { + val x = (A::foo).call(A(), 42, 239) + if (x != 281) return "Fail: $x" + + try { + (A::foo).call() + return "Fail: no exception" + } + catch (e: Exception) {} + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt new file mode 100644 index 00000000000..dcd5328fef7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun String.foo(): Int = length + +var state = "Fail" + +fun bar(result: String) { + state = result +} + +fun box(): String { + val f = (String::foo).call("abc") + if (f != 3) return "Fail: $f" + + try { + (String::foo).call() + return "Fail: IllegalArgumentException should have been thrown" + } + catch (e: IllegalArgumentException) {} + + try { + (String::foo).call(42) + return "Fail: IllegalArgumentException should have been thrown" + } + catch (e: IllegalArgumentException) {} + + (::bar).call("OK") + return state +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt new file mode 100644 index 00000000000..0632f21ab4e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun String.extFun(k: String, s: String = "") = this + k + s + +fun box(): String { + val sExtFun = "O"::extFun + return sExtFun.callBy(mapOf(sExtFun.parameters[0] to "K")) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt new file mode 100644 index 00000000000..a6933bfecca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +val String.plusK: String + get() = this + "K" + +fun box(): String = + ("O"::plusK).getter.callBy(mapOf()) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt new file mode 100644 index 00000000000..406b38ba1b2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +object Host { + @JvmStatic fun concat(s1: String, s2: String, s3: String = "K", s4: String = "x") = + s1 + s2 + s3 + s4 +} + +fun box(): String { + val concat = Host::concat + val concatParams = concat.parameters + return concat.callBy(mapOf( + concatParams[0] to "", + concatParams[1] to "O", + concatParams[3] to "" + )) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt new file mode 100644 index 00000000000..ced45716d15 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class C { + companion object { + fun foo(a: String, b: String = "b") = a + b + } +} + +fun box(): String { + val f = C.Companion::class.members.single { it.name == "foo" } + + // Any object method currently requires the object instance passed + try { + f.callBy(mapOf( + f.parameters.single { it.name == "a" } to "a" + )) + return "Fail: IllegalArgumentException should have been thrown" + } + catch (e: IllegalArgumentException) { + // OK + } + + assertEquals("ab", f.callBy(mapOf( + f.parameters.first() to C, + f.parameters.single { it.name == "a" } to "a" + ))) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt new file mode 100644 index 00000000000..8b3aa1902cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun foo(a: String, b: String = "b", c: String, d: String = "d", e: String) = + a + b + c + d + e + +fun box(): String { + val p = ::foo.parameters + assertEquals("abcde", ::foo.callBy(mapOf( + p[0] to "a", + p[2] to "c", + p[4] to "e" + ))) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt new file mode 100644 index 00000000000..b37767f9bd2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun String.sum(other: String = "b") = this + other + +fun box(): String { + val f = String::sum + assertEquals("ab", f.callBy(mapOf(f.parameters.first() to "a"))) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt new file mode 100644 index 00000000000..3c726db6a38 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +// KT-12915 IAE on callBy of JvmStatic function with default arguments + +import kotlin.test.assertEquals + +class C { + companion object { + @JvmStatic + fun foo(a: String, b: String = "b") = a + b + } +} + +fun box(): String { + val f = C.Companion::class.members.single { it.name == "foo" } + + // Any object method currently requires the object instance passed + try { + f.callBy(mapOf( + f.parameters.single { it.name == "a" } to "a" + )) + return "Fail: IllegalArgumentException should have been thrown" + } + catch (e: IllegalArgumentException) { + // OK + } + + assertEquals("ab", f.callBy(mapOf( + f.parameters.first() to C, + f.parameters.single { it.name == "a" } to "a" + ))) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt new file mode 100644 index 00000000000..5b771b80caf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +object Obj { + @JvmStatic + fun foo(a: String, b: String = "b") = a + b +} + +fun box(): String { + val f = Obj::class.members.single { it.name == "foo" } + + // Any object method currently requires the object instance passed + try { + f.callBy(mapOf( + f.parameters.single { it.name == "a" } to "a" + )) + return "Fail: IllegalArgumentException should have been thrown" + } + catch (e: IllegalArgumentException) { + // OK + } + + assertEquals("ab", f.callBy(mapOf( + f.parameters.first() to Obj, + f.parameters.single { it.name == "a" } to "a" + ))) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt new file mode 100644 index 00000000000..978877391e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt @@ -0,0 +1,102 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +// Generate: +// (1..70).map { " p${"%02d".format(it)}: Int," }.joinToString("\n") + +class A { + fun foo( + p01: Int, + p02: Int, + p03: Int, + p04: Int, + p05: Int, + p06: Int, + p07: Int, + p08: Int, + p09: Int, + p10: Int, + p11: Int, + p12: Int, + p13: Int, + p14: Int, + p15: Int, + p16: Int, + p17: Int, + p18: Int, + p19: Int, + p20: Int, + p21: Int, + p22: Int, + p23: Int, + p24: Int, + p25: Int, + p26: Int, + p27: Int, + p28: Int, + p29: Int, + p30: Int, + p31: Int, + p32: Int, + p33: Int, + p34: Int, + p35: Int, + p36: Int, + p37: Int, + p38: Int, + p39: Int, + p40: Int, + p41: Int, + p42: Int = 239, + p43: Int, + p44: Int, + p45: Int, + p46: Int, + p47: Int, + p48: Int, + p49: Int, + p50: Int, + p51: Int, + p52: Int, + p53: Int, + p54: Int, + p55: Int, + p56: Int, + p57: Int, + p58: Int, + p59: Int, + p60: Int, + p61: Int, + p62: Int, + p63: Int, + p64: Int, + p65: Int, + p66: Int, + p67: Int, + p68: Int, + p69: Int, + p70: Int + ) { + assertEquals(1, p01) + assertEquals(41, p41) + assertEquals(239, p42) + assertEquals(43, p43) + assertEquals(70, p70) + } +} + +fun box(): String { + val f = A::class.members.single { it.name == "foo" } + val parameters = f.parameters + + f.callBy(mapOf( + parameters.first() to A(), + *((1..41) + (43..70)).map { i -> parameters[i] to i }.toTypedArray() + )) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt new file mode 100644 index 00000000000..16d765e8675 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt @@ -0,0 +1,100 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +// Generate: +// (1..70).map { " p${"%02d".format(it)}: Int = $it," }.joinToString("\n") + +class A { + fun foo( + p01: Int = 1, + p02: Int = 2, + p03: Int = 3, + p04: Int = 4, + p05: Int = 5, + p06: Int = 6, + p07: Int = 7, + p08: Int = 8, + p09: Int = 9, + p10: Int = 10, + p11: Int = 11, + p12: Int = 12, + p13: Int = 13, + p14: Int = 14, + p15: Int = 15, + p16: Int = 16, + p17: Int = 17, + p18: Int = 18, + p19: Int = 19, + p20: Int = 20, + p21: Int = 21, + p22: Int = 22, + p23: Int = 23, + p24: Int = 24, + p25: Int = 25, + p26: Int = 26, + p27: Int = 27, + p28: Int = 28, + p29: Int = 29, + p30: Int = 30, + p31: Int = 31, + p32: Int = 32, + p33: Int = 33, + p34: Int = 34, + p35: Int = 35, + p36: Int = 36, + p37: Int = 37, + p38: Int = 38, + p39: Int = 39, + p40: Int = 40, + p41: Int = 41, + p42: Int, + p43: Int = 43, + p44: Int = 44, + p45: Int = 45, + p46: Int = 46, + p47: Int = 47, + p48: Int = 48, + p49: Int = 49, + p50: Int = 50, + p51: Int = 51, + p52: Int = 52, + p53: Int = 53, + p54: Int = 54, + p55: Int = 55, + p56: Int = 56, + p57: Int = 57, + p58: Int = 58, + p59: Int = 59, + p60: Int = 60, + p61: Int = 61, + p62: Int = 62, + p63: Int = 63, + p64: Int = 64, + p65: Int = 65, + p66: Int = 66, + p67: Int = 67, + p68: Int = 68, + p69: Int = 69, + p70: Int = 70 + ) { + assertEquals(1, p01) + assertEquals(41, p41) + assertEquals(239, p42) + assertEquals(43, p43) + assertEquals(70, p70) + } +} + +fun box(): String { + val f = A::class.members.single { it.name == "foo" } + val parameters = f.parameters + f.callBy(mapOf( + parameters.first() to A(), + parameters.single { it.name == "p42" } to 239 + )) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt new file mode 100644 index 00000000000..028454b5880 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun foo(x: Int, y: Int = 2) = x + y + +fun box(): String { + try { + ::foo.callBy(mapOf()) + return "Fail: IllegalArgumentException must have been thrown" + } + catch (e: IllegalArgumentException) { + // OK + } + + try { + ::foo.callBy(mapOf(::foo.parameters.last() to 1)) + return "Fail: IllegalArgumentException must have been thrown" + } + catch (e: IllegalArgumentException) { + // OK + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt new file mode 100644 index 00000000000..386a6a768f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertNull + +fun foo(x: String? = "Fail") { + assertNull(x) +} + +fun box(): String { + ::foo.callBy(mapOf(::foo.parameters.single() to null)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt new file mode 100644 index 00000000000..c80f255e52c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import kotlin.test.assertEquals + +fun foo(result: String = "foo") { + assertEquals("box", result) + + // Check that this function was invoked directly and not through the "foo$default", i.e. there's no "foo$default" in the stack trace + val st = Thread.currentThread().stackTrace + for (i in 0..5) { + if ("foo\$default" in st[i].methodName) { + throw AssertionError("KCallable.call should invoke the method directly if all arguments are provided") + } + } +} + +fun box(): String { + ::foo.callBy(mapOf(::foo.parameters.single() to "box")) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt new file mode 100644 index 00000000000..a566381fe8b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun primitives( + boolean: Boolean = true, + character: Char = 'z', + byte: Byte = 5.toByte(), + short: Short = (-5).toShort(), + int: Int = 2000000000, + float: Float = -2.72f, + long: Long = 1000000000000000000L, + double: Double = 3.14159265359 +) { + assertEquals(true, boolean) + assertEquals('z', character) + assertEquals(5.toByte(), byte) + assertEquals((-5).toShort(), short) + assertEquals(2000000000, int) + assertEquals(-2.72f, float) + assertEquals(1000000000000000000L, long) + assertEquals(3.14159265359, double) +} + +fun box(): String { + ::primitives.callBy(emptyMap()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt new file mode 100644 index 00000000000..c2d4593dca2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.IllegalCallableAccessException +import kotlin.reflect.jvm.isAccessible + +class A { + private fun foo(default: Any? = this) { + } + + fun f() = A::foo +} + +fun box(): String { + val a = A() + val f = a.f() + + try { + f.callBy(mapOf(f.parameters.first() to a)) + return "Fail: IllegalCallableAccessException should have been thrown" + } + catch (e: IllegalCallableAccessException) { + // OK + } + + f.isAccessible = true + f.callBy(mapOf(f.parameters.first() to a)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt new file mode 100644 index 00000000000..d77a5fed678 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt @@ -0,0 +1,8 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A(val result: String = "OK") + +fun box(): String = ::A.callBy(mapOf()).result diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt new file mode 100644 index 00000000000..fdd597bb629 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A(val result: String = "OK") { + fun foo(x: Int = 42): String { + assert(x == 42) { x } + return result + } +} + +fun box(): String = A::foo.callBy(mapOf(A::foo.parameters.first() to A())) diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt new file mode 100644 index 00000000000..6cbadf84891 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt @@ -0,0 +1,8 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun foo(result: String = "OK") = result + +fun box(): String = ::foo.callBy(mapOf()) diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt new file mode 100644 index 00000000000..e3f7bdd7b72 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals("Deprecated", Deprecated::class.simpleName) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt new file mode 100644 index 00000000000..9f9e4546d62 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* +import kotlin.reflect.KClass + +fun box(): String { + val any = Array::class + val string = Array::class + + assertNotEquals>(any, string) + assertNotEquals>(any.java, string.java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt new file mode 100644 index 00000000000..3189b534969 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals("Any", Any::class.simpleName) + assertEquals("String", String::class.simpleName) + assertEquals("CharSequence", CharSequence::class.simpleName) + assertEquals("Number", Number::class.simpleName) + assertEquals("Int", Int::class.simpleName) + assertEquals("Long", Long::class.simpleName) + + assertEquals("Array", Array::class.simpleName) + assertEquals("Array", Array::class.simpleName) + + assertEquals("Companion", Int.Companion::class.simpleName) + assertEquals("Companion", Double.Companion::class.simpleName) + assertEquals("Companion", Char.Companion::class.simpleName) + + assertEquals("IntRange", IntRange::class.simpleName) + + assertEquals("List", List::class.simpleName) + + // TODO: this is wrong but should be fixed + assertEquals("List", MutableList::class.simpleName) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt new file mode 100644 index 00000000000..8433e8ff36f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +class Klass + +inline fun arrayClass(): KClass> = Array::class + +fun box(): String { + assertEquals("Array", arrayClass().simpleName) + assertEquals("Array", arrayClass().simpleName) + assertEquals("Array", arrayClass>().simpleName) + assertEquals("Array", arrayClass().simpleName) + assertEquals("Array", arrayClass().simpleName) + assertEquals("Array", arrayClass>().simpleName) + assertEquals("Array", arrayClass>().simpleName) + + // Should not be that way. Fix this test when backend is fixed. + assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) + assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) + assertEquals("[Ljava.lang.Object;", arrayClass>().jvmName) + assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) + assertEquals("[Ljava.lang.Object;", arrayClass().jvmName) + assertEquals("[Ljava.lang.Object;", arrayClass>().jvmName) + assertEquals("[Ljava.lang.Object;", arrayClass>().jvmName) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericClass.kt new file mode 100644 index 00000000000..c80289cb43b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericClass.kt @@ -0,0 +1,11 @@ +// WITH_REFLECT + +import kotlin.test.assertEquals + +class Generic + +fun box(): String { + val g = Generic::class + assertEquals("Generic", g.simpleName) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt new file mode 100644 index 00000000000..155e6db10d9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +class Klass +class Other + +inline fun simpleName(): String = + T::class.simpleName!! + +inline fun twoReifiedParams(): String = + "${T1::class.simpleName!!}, ${T2::class.simpleName!!}" + +inline fun myJavaClass(): Class = + T::class.java + +fun box(): String { + assertEquals("Klass", simpleName()) + assertEquals("Int", simpleName()) + assertEquals("Array", simpleName>()) + assertEquals("Error", simpleName()) + assertEquals("Klass, Other", twoReifiedParams()) + + assertEquals(String::class.java, myJavaClass()) + assertEquals(IntArray::class.java, myJavaClass()) + assertEquals(Klass::class.java, myJavaClass()) + assertEquals(Error::class.java, myJavaClass()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/simpleClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/simpleClassLiteral.kt new file mode 100644 index 00000000000..2749cd70720 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/simpleClassLiteral.kt @@ -0,0 +1,8 @@ +// WITH_REFLECT + +class A + +fun box(): String { + val klass = A::class + return if (klass.toString() == "class A") "OK" else "Fail: $klass" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt new file mode 100644 index 00000000000..b033ae9d1d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class Klass + +fun box(): String { + assertEquals("Klass", Klass::class.simpleName) + assertEquals("Date", java.util.Date::class.simpleName) + assertEquals("ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.simpleName) + assertEquals("Void", java.lang.Void::class.simpleName) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt new file mode 100644 index 00000000000..9f599996241 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt @@ -0,0 +1,51 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.* + +class A { + companion object C +} + +enum class E { + ENTRY; + companion object {} +} + +fun box(): String { + val obj = A::class.companionObject + assertNotNull(obj) + assertEquals("C", obj!!.simpleName) + + assertEquals(A.C, A::class.companionObjectInstance) + assertEquals(A.C, obj.objectInstance) + + assertNull(A.C::class.companionObject) + assertNull(A.C::class.companionObjectInstance) + + assertEquals(E.Companion, E::class.companionObjectInstance) + + assertEquals(String, String::class.companionObjectInstance) + assertEquals(String, String.Companion::class.objectInstance) + assertEquals(Enum, Enum::class.companionObjectInstance) + assertEquals(Enum, Enum.Companion::class.objectInstance) + assertEquals(Double, Double::class.companionObjectInstance) + assertEquals(Double, Double.Companion::class.objectInstance) + assertEquals(Float, Float::class.companionObjectInstance) + assertEquals(Float, Float.Companion::class.objectInstance) + assertEquals(Int, Int::class.companionObjectInstance) + assertEquals(Int, Int.Companion::class.objectInstance) + assertEquals(Long, Long::class.companionObjectInstance) + assertEquals(Long, Long.Companion::class.objectInstance) + assertEquals(Short, Short::class.companionObjectInstance) + assertEquals(Short, Short.Companion::class.objectInstance) + assertEquals(Byte, Byte::class.companionObjectInstance) + assertEquals(Byte, Byte.Companion::class.objectInstance) + assertEquals(Char, Char::class.companionObjectInstance) + assertEquals(Char, Char.Companion::class.objectInstance) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt new file mode 100644 index 00000000000..eb9735b9859 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt @@ -0,0 +1,76 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.createInstance +import kotlin.test.assertTrue +import kotlin.test.fail + +// Good classes + +class Simple +class PrimaryWithDefaults(val d1: String = "d1", val d2: Int = 2) +class Secondary(val s: String) { + constructor() : this("s") +} +class SecondaryWithDefaults(val s: String) { + constructor(x: Int = 0) : this(x.toString()) +} +class SecondaryWithDefaultsNoPrimary { + constructor(x: Int) {} + constructor(s: String = "") {} +} + +// Bad classes + +class NoNoArgConstructor(val s: String) { + constructor(x: Int) : this(x.toString()) +} +class NoArgAndDefault() { + constructor(x: Int = 0) : this() +} +class DefaultPrimaryAndDefaultSecondary(val s: String = "") { + constructor(x: Int = 0) : this(x.toString()) +} +class SeveralDefaultSecondaries { + constructor(x: Int = 0) {} + constructor(s: String = "") {} + constructor(d: Double = 3.14) {} +} +class PrivateConstructor private constructor() +object Object + +// ----------- + +inline fun test() { + val instance = T::class.createInstance() + assertTrue(instance is T) +} + +inline fun testFail() { + try { + T::class.createInstance() + fail("createInstance should have failed on ${T::class}") + } catch (e: Exception) { + // OK + } +} + +fun box(): String { + test() + test() + test() + test() + test() + test() + + testFail() + testFail() + testFail() + testFail() + testFail() + testFail() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt new file mode 100644 index 00000000000..b28ab68a537 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt @@ -0,0 +1,53 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: I.java + +public class I { + public static void publicStaticI() {} + public void publicMemberI() {} + private static void privateStaticI() {} + private void privateMemberI() {} +} + +// FILE: J.java + +public class J extends I { + public static void publicStaticJ() {} + public void publicMemberJ() {} + private static void privateStaticJ() {} + private void privateMemberJ() {} +} + +// FILE: K.kt + +import kotlin.reflect.full.declaredMembers +import kotlin.test.assertEquals + +open class K : J() { + open fun publicKFun() {} + private fun privateKFun() {} + var publicKProp = Unit + private val privateKProp = Unit +} + +class L : K() { + fun publicLFun() {} + private fun privateLFun() {} + val publicLProp = Unit + private var privateLProp = Unit +} + +inline fun test(vararg names: String) { + assertEquals(names.toSet(), T::class.declaredMembers.map { it.name }.toSet()) +} + +fun box(): String { + test("publicStaticI", "publicMemberI", "privateStaticI", "privateMemberI") + test("publicStaticJ", "publicMemberJ", "privateStaticJ", "privateMemberJ") + test("publicKFun", "privateKFun", "publicKProp", "privateKProp") + test("publicLFun", "privateLFun", "publicLProp", "privateLProp") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt new file mode 100644 index 00000000000..6ad4e01ba7b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt @@ -0,0 +1,45 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals +import kotlin.test.assertTrue +import kotlin.reflect.jvm.jvmName + +class Klass { + class Nested + companion object +} + +fun box(): String { + assertEquals("Klass", Klass::class.jvmName) + assertEquals("Klass\$Nested", Klass.Nested::class.jvmName) + assertEquals("Klass\$Companion", Klass.Companion::class.jvmName) + + assertEquals("java.lang.Object", Any::class.jvmName) + assertEquals("int", Int::class.jvmName) + assertEquals("[I", IntArray::class.jvmName) + assertEquals("java.util.List", List::class.jvmName) + assertEquals("java.util.List", MutableList::class.jvmName) + assertEquals("java.lang.String", String::class.jvmName) + assertEquals("java.lang.String", java.lang.String::class.jvmName) + + assertEquals("[Ljava.lang.Object;", Array::class.jvmName) + assertEquals("[Ljava.lang.Integer;", Array::class.jvmName) + assertEquals("[[Ljava.lang.String;", Array>::class.jvmName) + + assertEquals("java.util.Date", java.util.Date::class.jvmName) + assertEquals("kotlin.jvm.internal.Ref\$ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.jvmName) + assertEquals("java.lang.Void", java.lang.Void::class.jvmName) + + class Local + val l = Local::class.jvmName + assertTrue(l != null && l.startsWith("JvmNameKt\$") && "\$box\$" in l && l.endsWith("\$Local")) + + val obj = object {} + val o = obj.javaClass.kotlin.jvmName + assertTrue(o != null && o.startsWith("JvmNameKt\$") && "\$box\$" in o && o.endsWith("\$1")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/localClassSimpleName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/localClassSimpleName.kt new file mode 100644 index 00000000000..027c49b58a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/localClassSimpleName.kt @@ -0,0 +1,41 @@ +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +fun check(klass: KClass<*>, expectedName: String) { + assertEquals(expectedName, klass.simpleName) +} + +fun localInMethod() { + fun localInMethod(unused: Any?) { + class Local + check(Local::class, "Local") + + class `Local$With$Dollars` + check(`Local$With$Dollars`::class, "Local\$With\$Dollars") + } + localInMethod(null) + + class Local + check(Local::class, "Local") + + class `Local$With$Dollars` + check(`Local$With$Dollars`::class, "Local\$With\$Dollars") +} + +class LocalInConstructor { + init { + class Local + check(Local::class, "Local") + + class `Local$With$Dollars` + check(`Local$With$Dollars`::class, "Local\$With\$Dollars") + } +} + +fun box(): String { + localInMethod() + LocalInConstructor() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt new file mode 100644 index 00000000000..21cd7aaefbc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt @@ -0,0 +1,62 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import kotlin.reflect.KClass +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +class A { + companion object {} + inner class Inner + class Nested + private class PrivateNested +} + +fun nestedNames(c: KClass<*>) = c.nestedClasses.map { it.simpleName ?: throw AssertionError("Unnamed class: ${it.java}") }.sorted() + +fun box(): String { + // Kotlin class without nested classes + assertEquals(emptyList(), nestedNames(A.Inner::class)) + // Kotlin class with nested classes + assertEquals(listOf("Companion", "Inner", "Nested", "PrivateNested"), nestedNames(A::class)) + + // Java class without nested classes + assertEquals(emptyList(), nestedNames(Error::class)) + // Java class with nested classes + assertEquals(listOf("State", "UncaughtExceptionHandler"), nestedNames(Thread::class)) + + // Built-ins + assertEquals(emptyList(), nestedNames(Array::class)) + assertEquals(emptyList(), nestedNames(CharSequence::class)) + assertEquals(listOf("Companion"), nestedNames(String::class)) + + assertEquals(emptyList(), nestedNames(Collection::class)) + assertEquals(emptyList(), nestedNames(MutableCollection::class)) + assertEquals(emptyList(), nestedNames(List::class)) + assertEquals(emptyList(), nestedNames(MutableList::class)) + assertEquals(listOf("Entry"), nestedNames(Map::class)) + assertEquals(emptyList(), nestedNames(Map.Entry::class)) + assertEquals(emptyList(), nestedNames(MutableMap.MutableEntry::class)) + + // TODO: should be MutableEntry. Currently we do not distinguish between Map and MutableMap. + assertEquals(listOf("Entry"), nestedNames(MutableMap::class)) + + // Primitives + for (primitive in listOf(Byte::class, Double::class, Float::class, Int::class, Long::class, Short::class, Char::class)) { + assertEquals(listOf("Companion"), nestedNames(primitive)) + } + assertEquals(emptyList(), nestedNames(Boolean::class)) + + // Primitive arrays + for (primitiveArray in listOf( + ByteArray::class, DoubleArray::class, FloatArray::class, IntArray::class, + LongArray::class, ShortArray::class, CharArray::class, BooleanArray::class + )) { + assertEquals(emptyList(), nestedNames(primitiveArray)) + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt new file mode 100644 index 00000000000..f7fde340961 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public class Inner {} + + public static class Nested {} + + private static class PrivateNested {} + + // This anonymous class should not appear in 'nestedClasses' + private final Object o = new Object() {}; +} + +// FILE: K.kt + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(listOf("Inner", "Nested", "PrivateNested"), J::class.nestedClasses.map { it.simpleName!! }.sorted()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt new file mode 100644 index 00000000000..e9dedfaab85 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +object Obj { + fun foo() = 1 +} + +class A { + companion object { + fun foo() = 2 + } +} + +class B { + companion object Factory { + fun foo() = 3 + } +} + +class C + +fun box(): String { + assertEquals(1, Obj::class.objectInstance!!.foo()) + assertEquals(2, A.Companion::class.objectInstance!!.foo()) + assertEquals(3, B.Factory::class.objectInstance!!.foo()) + + assertEquals(null, C::class.objectInstance) + assertEquals(null, String::class.objectInstance) + assertEquals(Unit, Unit::class.objectInstance) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt new file mode 100644 index 00000000000..ebc3db577b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals +import kotlin.test.assertFalse + +fun box(): String { + val x = Int::class.javaPrimitiveType!!.kotlin + val y = Int::class.javaObjectType.kotlin + + assertEquals(x, y) + assertEquals(x.hashCode(), y.hashCode()) + assertFalse(x === y) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt new file mode 100644 index 00000000000..6e978c95b79 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt @@ -0,0 +1,41 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class Klass { + class Nested + companion object +} + +fun box(): String { + assertEquals("Klass", Klass::class.qualifiedName) + assertEquals("Klass.Nested", Klass.Nested::class.qualifiedName) + assertEquals("Klass.Companion", Klass.Companion::class.qualifiedName) + + assertEquals("kotlin.Any", Any::class.qualifiedName) + assertEquals("kotlin.Int", Int::class.qualifiedName) + assertEquals("kotlin.Int.Companion", Int.Companion::class.qualifiedName) + assertEquals("kotlin.IntArray", IntArray::class.qualifiedName) + assertEquals("kotlin.collections.List", List::class.qualifiedName) + assertEquals("kotlin.String", String::class.qualifiedName) + assertEquals("kotlin.String", java.lang.String::class.qualifiedName) + + assertEquals("kotlin.Array", Array::class.qualifiedName) + assertEquals("kotlin.Array", Array::class.qualifiedName) + assertEquals("kotlin.Array", Array>::class.qualifiedName) + + assertEquals("java.util.Date", java.util.Date::class.qualifiedName) + assertEquals("kotlin.jvm.internal.Ref.ObjectRef", kotlin.jvm.internal.Ref.ObjectRef::class.qualifiedName) + assertEquals("java.lang.Void", java.lang.Void::class.qualifiedName) + + class Local + assertEquals(null, Local::class.qualifiedName) + + val o = object {} + assertEquals(null, o.javaClass.kotlin.qualifiedName) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt new file mode 100644 index 00000000000..7be7d8ba0ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KTypeProjection +import kotlin.reflect.full.createType +import kotlin.reflect.full.starProjectedType +import kotlin.test.assertEquals + +class Foo + +fun box(): String { + val foo = Foo::class.starProjectedType + assertEquals(Foo::class, foo.classifier) + assertEquals(listOf(KTypeProjection.STAR, KTypeProjection.STAR), foo.arguments) + assertEquals(foo, Foo::class.createType(listOf(KTypeProjection.STAR, KTypeProjection.STAR))) + + assertEquals(String::class, String::class.starProjectedType.classifier) + assertEquals(listOf(), String::class.starProjectedType.arguments) + + val tp = Foo::class.typeParameters.first() + assertEquals(tp.createType(), tp.starProjectedType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt new file mode 100644 index 00000000000..963635d96ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +annotation class A1 + +annotation class A2(val k: KClass<*>, val s: A1) + +fun box(): String { + assertEquals(1, A1::class.constructors.size) + assertEquals(A1::class.primaryConstructor, A1::class.constructors.single()) + + val cs = A2::class.constructors + assertEquals(1, cs.size) + assertEquals(A2::class.primaryConstructor, cs.single()) + val params = cs.single().parameters + assertEquals(listOf("k", "s"), params.map { it.name }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt new file mode 100644 index 00000000000..ebc2986aeba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue + +interface Interface +object Obj + +class C { + companion object +} + +fun box(): String { + assertTrue(Interface::class.constructors.isEmpty()) + assertTrue(Obj::class.constructors.isEmpty()) + assertTrue(C.Companion::class.constructors.isEmpty()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt new file mode 100644 index 00000000000..fcb9d9cd6a7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class A + +fun box(): String { + assertEquals("", ::A.name) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt new file mode 100644 index 00000000000..a9eea1ba51a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt @@ -0,0 +1,57 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertNull +import kotlin.test.assertNotNull +import kotlin.reflect.* + +class OnlyPrimary + +class PrimaryWithSecondary(val s: String) { + constructor(x: Int) : this(x.toString()) + + override fun toString() = s +} + +class OnlySecondary { + constructor(s: String) +} + +class TwoSecondaries { + constructor(s: String) + constructor(d: Double) +} + +enum class En + +interface I +object O +class C { + companion object +} + +fun box(): String { + val p1 = OnlyPrimary::class.primaryConstructor + assertNotNull(p1) + assert(p1!!.call() is OnlyPrimary) + + val p2 = PrimaryWithSecondary::class.primaryConstructor + assertNotNull(p2) + assert(p2!!.call("beer").toString() == "beer") + + val p3 = OnlySecondary::class.primaryConstructor + assertNull(p3) + + val p4 = TwoSecondaries::class.primaryConstructor + assertNull(p4) + + assertNotNull(En::class.primaryConstructor) // TODO: maybe primaryConstructor should be null for enum classes + + assertNull(I::class.primaryConstructor) + assertNull(O::class.primaryConstructor) + assertNull(C.Companion::class.primaryConstructor) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt new file mode 100644 index 00000000000..5616aa8136a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import java.util.Collections +import kotlin.reflect.* +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +open class A private constructor(x: Int) { + public constructor(s: String): this(s.length) + constructor(): this("") +} + +class B : A("") + +class C { + class Nested + inner class Inner +} + +fun box(): String { + assertEquals(3, A::class.constructors.size) + assertEquals(1, B::class.constructors.size) + + assertTrue(Collections.disjoint(A::class.members, A::class.constructors)) + assertTrue(Collections.disjoint(B::class.members, B::class.constructors)) + + assertEquals(1, C.Nested::class.constructors.size) + assertEquals(1, C.Inner::class.constructors.size) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt new file mode 100644 index 00000000000..199834e9c70 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +annotation class Foo + +fun box(): String { + val foo = Foo::class.constructors.single().call() + assertEquals(Foo::class, foo.annotationClass) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt new file mode 100644 index 00000000000..054ea5fc4cf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +annotation class Anno(val klasses: Array> = arrayOf(String::class, Int::class)) + +fun box(): String { + val anno = Anno::class.constructors.single().callBy(emptyMap()) + assertEquals(listOf(String::class, Int::class), (anno.klasses as Array>).toList() /* TODO: KT-9453 */) + assertEquals("@Anno(klasses=[class java.lang.String, int])", anno.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt new file mode 100644 index 00000000000..3f0259d7088 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt @@ -0,0 +1,81 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public interface J { + @interface NoParams {} + + @interface OneDefault { + String s() default "OK"; + } + + @interface OneNonDefault { + String s(); + } + + @interface TwoParamsOneDefault { + String s(); + int x() default 42; + } + + @interface TwoNonDefaults { + String string(); + Class clazz(); + } + + @interface ManyDefaultParams { + int i() default 0; + String s() default ""; + double d() default 3.14; + } +} + +// FILE: K.kt + +import J.* +import kotlin.reflect.KClass +import kotlin.reflect.primaryConstructor +import kotlin.test.assertEquals +import kotlin.test.assertFails + +inline fun create(args: Map): T { + val ctor = T::class.constructors.single() + return ctor.callBy(args.mapKeys { entry -> ctor.parameters.single { it.name == entry.key } }) +} + +inline fun create(): T = create(emptyMap()) + +fun box(): String { + create() + + val t1 = create() + assertEquals("OK", t1.s) + assertFails { create(mapOf("s" to 42)) } + + val t2 = create(mapOf("s" to "OK")) + assertEquals("OK", t2.s) + assertFails { create() } + + val t3 = create(mapOf("s" to "OK")) + assertEquals("OK", t3.s) + assertEquals(42, t3.x) + val t4 = create(mapOf("s" to "OK", "x" to 239)) + assertEquals(239, t4.x) + assertFails { create(mapOf("s" to "Fail", "x" to "Fail")) } + + assertFails("KClass (not Class) instances should be passed as arguments") { + create(mapOf("clazz" to String::class.java, "string" to "Fail")) + } + + val t5 = create(mapOf("clazz" to String::class, "string" to "OK")) + assertEquals("OK", t5.string) + + val t6 = create() + assertEquals(0, t6.i) + assertEquals("", t6.s) + assertEquals(3.14, t6.d) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt new file mode 100644 index 00000000000..f1c1934d25b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt @@ -0,0 +1,53 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.reflect.primaryConstructor +import kotlin.test.assertEquals +import kotlin.test.assertFails + +annotation class NoParams +annotation class OneDefault(val s: String = "OK") +annotation class OneNonDefault(val s: String) +annotation class TwoParamsOneDefault(val s: String, val x: Int = 42) +annotation class TwoParamsOneDefaultKClass(val string: String, val klass: KClass<*> = Number::class) +annotation class TwoNonDefaults(val string: String, val klass: KClass<*>) + + +inline fun create(args: Map): T { + val ctor = T::class.constructors.single() + return ctor.callBy(args.mapKeys { entry -> ctor.parameters.single { it.name == entry.key } }) +} + +inline fun create(): T = create(emptyMap()) + +fun box(): String { + create() + + val t1 = create() + assertEquals("OK", t1.s) + assertFails { create(mapOf("s" to 42)) } + + val t2 = create(mapOf("s" to "OK")) + assertEquals("OK", t2.s) + assertFails { create() } + + val t3 = create(mapOf("s" to "OK")) + assertEquals("OK", t3.s) + assertEquals(42, t3.x) + val t4 = create(mapOf("s" to "OK", "x" to 239)) + assertEquals(239, t4.x) + assertFails { create(mapOf("s" to "Fail", "x" to "Fail")) } + + val t5 = create(mapOf("string" to "OK")) + assertEquals(Number::class, t5.klass as KClass<*> /* TODO: KT-9453 */) + + assertFails("KClass (not Class) instances should be passed as arguments") { + create(mapOf("klass" to String::class.java, "string" to "Fail")) + } + + val t6 = create(mapOf("klass" to String::class, "string" to "OK")) + return t6.string +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt new file mode 100644 index 00000000000..5959c1e2402 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt @@ -0,0 +1,93 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public interface J { + @interface NoParams {} + + @interface OneDefault { + String foo() default "foo"; + } + + @interface OneDefaultValue { + String value() default "value"; + } + + @interface OneNonDefault { + String foo(); + } + + @interface OneNonDefaultValue { + String value(); + } + + @interface TwoParamsOneDefault { + String string(); + Class clazz() default Object.class; + } + + @interface TwoParamsOneValueOneDefault { + String value(); + Class clazz() default Object.class; + } + + @interface TwoNonDefaults { + String string(); + Class clazz(); + } + + @interface ManyDefaults { + int i() default 0; + String s() default ""; + double d() default 3.14; + } +} + +// FILE: K.kt + +import J.* +import kotlin.reflect.KClass +import kotlin.reflect.primaryConstructor +import kotlin.test.assertEquals +import kotlin.test.assertFails + +inline fun create(vararg args: Any?): T = + T::class.constructors.single().call(*args) + +fun box(): String { + create() + + assertFails { create() } + assertFails { create("") } + assertFails { create("", "") } + + assertFails { create() } + create("") + assertFails { create("", "") } + + assertFails { create() } + assertFails { create("") } + + assertFails { create() } + create("") + + assertFails { create() } + assertFails { create("") } + assertFails { create("", Any::class) } + assertFails { create(Any::class, "") } + + assertFails { create() } + assertFails { create("") } + assertFails { create("", Any::class) } + assertFails { create(Any::class, "") } + + assertFails { create("", Any::class) } + assertFails { create(Any::class, "") } + + assertFails { create() } + assertFails { create(42, "Fail", 2.72) } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt new file mode 100644 index 00000000000..b4c197f4abd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt @@ -0,0 +1,38 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.reflect.primaryConstructor +import kotlin.test.assertEquals +import kotlin.test.assertFails + +annotation class NoParams +annotation class OneDefault(val s: String = "Fail") +annotation class TwoNonDefaults(val string: String, val klass: KClass<*>) + +inline fun create(vararg args: Any?): T = + T::class.constructors.single().call(*args) + +fun box(): String { + create() + assertFails { create("Fail") } + + assertFails { create() } + assertFails { create(42) } + val o = create("OK") + assertEquals("OK", o.s) + + assertFails("call() should fail because arguments were passed in an incorrect order") { + create(Any::class, "Fail") + } + assertFails("call() should fail because KClass (not Class) instances should be passed as arguments") { + create("Fail", Any::class.java) + } + + val k = create("OK", Int::class) + assertEquals(Int::class, k.klass as KClass<*> /* TODO: KT-9453 */) + + return k.string +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt new file mode 100644 index 00000000000..829b85ef26d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import java.lang.annotation.Retention +import java.lang.annotation.RetentionPolicy +import kotlin.test.assertEquals + +fun box(): String { + val ctor = Retention::class.constructors.single() + val r = ctor.callBy(mapOf( + ctor.parameters.single { it.name == "value" } to RetentionPolicy.RUNTIME + )) + assertEquals(RetentionPolicy.RUNTIME, r.value as RetentionPolicy) + assertEquals(Retention::class.java.classLoader, r.javaClass.classLoader) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt new file mode 100644 index 00000000000..a5c565c813d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt @@ -0,0 +1,50 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +annotation class Foo(val value: String) + +annotation class Anno( + val level: DeprecationLevel, + val klass: KClass<*>, + val foo: Foo, + val levels: Array, + val klasses: Array>, + val foos: Array +) + +@Anno( + DeprecationLevel.WARNING, + Number::class, + Foo("OK"), + arrayOf(DeprecationLevel.WARNING), + arrayOf(Number::class), + arrayOf(Foo("OK")) +) +fun foo() {} + +fun box(): String { + // Construct an annotation with exactly the same parameters, check that the proxy created by Kotlin and by Java reflection are the same and have the same hash code + val a1 = Anno::class.constructors.single().call( + DeprecationLevel.WARNING, + Number::class, + Foo::class.constructors.single().call("OK"), + arrayOf(DeprecationLevel.WARNING), + arrayOf(Number::class), + arrayOf(Foo::class.constructors.single().call("OK")) + ) + val a2 = ::foo.annotations.single() as Anno + + assertEquals(a1, a2) + assertEquals(a2, a1) + assertEquals(a1.hashCode(), a2.hashCode()) + + assertEquals("@Anno(level=WARNING, klass=class java.lang.Number, foo=@Foo(value=OK), " + + "levels=[WARNING], klasses=[class java.lang.Number], foos=[@Foo(value=OK)])", a1.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt new file mode 100644 index 00000000000..3a12d56a3e4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt @@ -0,0 +1,49 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package test + +annotation class A +annotation class B(val s: String) + +@A +@B("2") +fun javaReflectionAnnotationInstances() {} + +fun box(): String { + val createA = A::class.constructors.single() + + val a1 = createA.call() + if (a1.toString() != "@test.A()") return "Fail: toString does not correspond to the documentation of java.lang.annotation.Annotation#toString: $a1" + + val a2 = createA.call() + if (a1 === a2) return "Fail: instances created by the constructor should be different" + if (a1 != a2) return "Fail: any instance of A should be equal to any other instance of A" + if (a1.hashCode() != a2.hashCode()) return "Fail: hash codes of equal instances should be equal" + if (a1.hashCode() != 0) return "Fail: hashCode does not correspond to the documentation of java.lang.annotation.Annotation#hashCode: ${a1.hashCode()}" + + val createB = B::class.constructors.single() + val b1 = createB.call("1") + if (b1.toString() != "@test.B(s=1)") return "Fail: toString does not correspond to the documentation of java.lang.annotation.Annotation#toString: $b1" + if (b1 != b1) return "Fail: instance should be equal to itself" + + val b2 = createB.call("2") + if (b1 == b2) return "Fail: instances with different data should not be equal" + if (b1.hashCode() == b2.hashCode()) return "Fail: hash codes of different instances should very likely be also different" + + val a3 = ::javaReflectionAnnotationInstances.annotations.filterIsInstance().single() + if (a1 === a3) return "Fail: instance created by the constructor and the one obtained from Java reflection should be different" + if (a1 != a3) return "Fail: instance created by the constructor should be equal to the one obtained from Java reflection" + if (a3 != a1) return "Fail: instance obtained from Java reflection should be equal to the one created by the constructor" + if (a1.hashCode() != a3.hashCode()) return "Fail: hash codes of equal instances should be equal" + + val b3 = ::javaReflectionAnnotationInstances.annotations.filterIsInstance().single() + if (b2 === b3) return "Fail: instance created by the constructor and the one obtained from Java reflection should be different" + if (b2 != b3) return "Fail: instance created by the constructor should be equal to the one obtained from Java reflection" + if (b3 != b2) return "Fail: instance obtained from Java reflection should be equal to the one created by the constructor" + if (b2.hashCode() != b3.hashCode()) return "Fail: hash codes of equal instances should be equal" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt new file mode 100644 index 00000000000..75065734926 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt @@ -0,0 +1,66 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +annotation class D(val d: Double) +annotation class F(val f: Float) + +/* +// TODO: uncomment once KT-13887 is implemented +@D(Double.NaN) +fun dnan() {} + +@F(Float.NaN) +fun fnan() {} +*/ + +@D(-0.0) +fun dMinusZero() {} +@D(+0.0) +fun dPlusZero() {} + +@F(-0.0f) +fun fMinusZero() {} +@F(+0.0f) +fun fPlusZero() {} + +fun check(x: Any, y: Any) { + assertEquals(x, y) + assertEquals(y, x) + assertEquals(x.hashCode(), y.hashCode()) + assertEquals(x.toString(), y.toString()) +} + +fun checkNot(x: Any, y: Any) { + assertNotEquals(x, y) + assertNotEquals(y, x) + assertNotEquals(x.hashCode(), y.hashCode()) + assertNotEquals(x.toString(), y.toString()) +} + +fun box(): String { +/* + check(::dnan.annotations.single() as D, D::class.constructors.single().call(Double.NaN)) + check(::fnan.annotations.single() as F, F::class.constructors.single().call(Float.NaN)) +*/ + + val dmz = D::class.constructors.single().call(-0.0) + val dpz = D::class.constructors.single().call(+0.0) + val fmz = F::class.constructors.single().call(-0.0f) + val fpz = F::class.constructors.single().call(+0.0f) + check(::dMinusZero.annotations.single() as D, dmz) + check(::dPlusZero.annotations.single() as D, dpz) + check(::fMinusZero.annotations.single() as F, fmz) + check(::fPlusZero.annotations.single() as F, fpz) + + checkNot(dmz, dpz) + checkNot(fmz, fpz) + checkNot(dmz, fmz) + checkNot(dpz, fpz) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt new file mode 100644 index 00000000000..e47eca36fb8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +annotation class Anno(val equals: Boolean) + +fun box(): String { + val t = Anno::class.constructors.single().call(true) + val f = Anno::class.constructors.single().call(false) + assertEquals(true, t.equals) + assertEquals(false, f.equals) + assertNotEquals(t, f) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt new file mode 100644 index 00000000000..89ece702c25 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt @@ -0,0 +1,85 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +annotation class Anno( + val b: Byte, + val c: Char, + val d: Double, + val f: Float, + val i: Int, + val j: Long, + val s: Short, + val z: Boolean, + val ba: ByteArray, + val ca: CharArray, + val da: DoubleArray, + val fa: FloatArray, + val ia: IntArray, + val ja: LongArray, + val sa: ShortArray, + val za: BooleanArray, + val str: String, + val stra: Array +) + +@Anno( + 1.toByte(), + 'x', + 3.14, + -2.72f, + 42424242, + 239239239239239L, + 42.toShort(), + true, + byteArrayOf((-1).toByte()), + charArrayOf('y'), + doubleArrayOf(-3.14159), + floatArrayOf(2.7218f), + intArrayOf(424242), + longArrayOf(239239239239L), + shortArrayOf((-43).toShort()), + booleanArrayOf(false, true), + "lol", + arrayOf("rofl") +) +fun foo() {} + +fun box(): String { + // Construct an annotation with exactly the same parameters, check that the proxy created by Kotlin and by Java reflection are the same and have the same hash code + val a1 = Anno::class.constructors.single().call( + 1.toByte(), + 'x', + 3.14, + -2.72f, + 42424242, + 239239239239239L, + 42.toShort(), + true, + byteArrayOf((-1).toByte()), + charArrayOf('y'), + doubleArrayOf(-3.14159), + floatArrayOf(2.7218f), + intArrayOf(424242), + longArrayOf(239239239239L), + shortArrayOf((-43).toShort()), + booleanArrayOf(false, true), + "lol", + arrayOf("rofl") + ) + + val a2 = ::foo.annotations.single() as Anno + + assertEquals(a1, a2) + assertEquals(a2, a1) + assertEquals(a1.hashCode(), a2.hashCode()) + + assertEquals("@Anno(b=1, c=x, d=3.14, f=-2.72, i=42424242, j=239239239239239, s=42, z=true, " + + "ba=[-1], ca=[y], da=[-3.14159], fa=[2.7218], ia=[424242], ja=[239239239239], sa=[-43], za=[false, true], " + + "str=lol, stra=[rofl])", a1.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt new file mode 100644 index 00000000000..b39fb848952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +interface A { + fun f(): String +} + +inline fun foo(): A { + return object : A { + override fun f(): String { + return "OK" + } + } +} + +fun box(): String { + val y = foo() + + val enclosing = y.javaClass.getEnclosingMethod() + if (enclosing?.getName() != "foo") return "method: $enclosing" + + return y.f() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt new file mode 100644 index 00000000000..847f8f8c162 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + + val classInLambda = { + class Z {} + Z() + }() + + val enclosingMethod = classInLambda.javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" + + val enclosingClass = classInLambda.javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "ClassInLambdaKt\$box\$classInLambda\$1") return "enclosing class: $enclosingClass" + + val declaringClass = classInLambda.javaClass.getDeclaringClass() + if (declaringClass != null) return "class has a declaring class" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt new file mode 100644 index 00000000000..d296111afad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +val property = fun () {} + +fun box(): String { + val javaClass = property.javaClass + + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod != null) return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "FunctionExpressionInPropertyKt") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt new file mode 100644 index 00000000000..420b28cedc5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt @@ -0,0 +1,63 @@ +// WITH_RUNTIME +// IGNORE_BACKEND: JS + +interface Z { + private fun privateFun() = { "OK" } + + fun callPrivateFun() = privateFun() + + fun publicFun() = { "OK" } + + fun funWithDefaultArgs(s: () -> Unit = {}): () -> Unit + + val property: () -> Unit + get() = {} + + class Nested +} + +class Test : Z { + override fun funWithDefaultArgs(s: () -> Unit): () -> Unit { + return s + } + + fun funWithDefaultArgsInClass(s: () -> Unit = {}): () -> Unit { + return s + } +} + +fun box(): String { + + val privateFun = Test().callPrivateFun() + var enclosing = privateFun.javaClass.enclosingMethod!! + if (enclosing.name != "privateFun") return "fail 1: ${enclosing.name}" + if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 2: ${enclosing.getDeclaringClass().simpleName}" + + val publicFun = Test().publicFun() + enclosing = publicFun.javaClass.enclosingMethod!! + if (enclosing.name != "publicFun") return "fail 3: ${enclosing.name}" + if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 4: ${enclosing.getDeclaringClass().simpleName}" + + val property = Test().property + enclosing = property.javaClass.enclosingMethod!! + if (enclosing.name != "getProperty") return "fail 4: ${enclosing.name}" + if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 5: ${enclosing.getDeclaringClass().simpleName}" + + val defaultArgs = Test().funWithDefaultArgs() + enclosing = defaultArgs.javaClass.enclosingMethod!! + if (enclosing.name != "funWithDefaultArgs\$default") return "fail 6: ${enclosing.name}" + if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}" + if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 8: ${enclosing.getDeclaringClass().simpleName}" + + val defaultArgsInClass = Test().funWithDefaultArgsInClass() + enclosing = defaultArgsInClass.javaClass.enclosingMethod!! + if (enclosing.name != "funWithDefaultArgsInClass\$default") return "fail 6: ${enclosing.name}" + if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}" + if (enclosing.getDeclaringClass().simpleName != "Test") return "fail 8: ${enclosing.getDeclaringClass().simpleName}" + + val nested = Z.Nested::class.java + val enclosingClass = nested.enclosingClass!! + if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt new file mode 100644 index 00000000000..8bf1ff75098 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import java.util.HashMap + +interface R { + fun result(): String +} + +val a by lazy { + with(HashMap()) { + put("result", object : R { + override fun result(): String = "OK" + }) + this + } +} + +fun box(): String { + val r = a["result"]!! + + // Check that reflection won't fail + r.javaClass.getEnclosingMethod().toString() + + return r.result() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt new file mode 100644 index 00000000000..9be072952c5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +var lambda = {} + +class A { + val prop = Runnable { + lambda = { println("") } + } +} + +fun box(): String { + A().prop.run() + + val javaClass = lambda.javaClass + + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "run") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "A\$prop\$1") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt new file mode 100644 index 00000000000..45a65f1c08f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class O { + companion object { + // Currently we consider in class O as the enclosing method of this lambda, + // so we write outer class = O and enclosing method = null + val f = {} + } +} + +fun box(): String { + val javaClass = O.f.javaClass + + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod != null) return "method: $enclosingMethod" + + val enclosingConstructor = javaClass.getEnclosingConstructor() + if (enclosingConstructor != null) return "constructor: $enclosingConstructor" + + val enclosingClass = javaClass.getEnclosingClass() + if (enclosingClass?.getName() != "O") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt new file mode 100644 index 00000000000..509a098c7ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class C { + val l: Any = {} +} + +fun box(): String { + val javaClass = C().l.javaClass + val enclosingConstructor = javaClass.getEnclosingConstructor() + if (enclosingConstructor?.getDeclaringClass()?.getName() != "C") return "ctor: $enclosingConstructor" + + val enclosingClass = javaClass.getEnclosingClass() + if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt new file mode 100644 index 00000000000..4c5c1d9d73c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + val l: Any = {} + + val javaClass = l.javaClass + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "box") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInFunctionKt") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt new file mode 100644 index 00000000000..2a459cd7720 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + val l = { + {} + } + + val javaClass = l().javaClass + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInLambdaKt\$box\$l\$1") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt new file mode 100644 index 00000000000..e28bc3c45b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +open class C + +fun box(): String { + class L : C() { + val a: Any + + init { + a = {} + } + } + val l = L() + + val javaClass = l.a.javaClass + val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() + if (enclosingMethod != "LambdaInLocalClassConstructorKt\$box\$L") return "ctor: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInLocalClassConstructorKt\$box\$L") return "enclosing class: $enclosingClass" + + if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt new file mode 100644 index 00000000000..f4c4c0c3039 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +open class C(val a: Any) + +fun box(): String { + class L : C({}) { + } + val l = L() + + val javaClass = l.a.javaClass + val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() + if (enclosingMethod != "LambdaInLocalClassSuperCallKt\$box\$L") return "ctor: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInLocalClassSuperCallKt\$box\$L") return "enclosing class: $enclosingClass" + + if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt new file mode 100644 index 00000000000..586ecced0fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + fun foo(): Any { + return {} + } + + val javaClass = foo().javaClass + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInLocalFunctionKt\$box$1") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt new file mode 100644 index 00000000000..192c1feed1c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class C { + fun foo(): Any { + return {} + } +} + + +fun box(): String { + val javaClass = C().foo().javaClass + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass() + if (enclosingClass?.getName() != "C") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt new file mode 100644 index 00000000000..acfbc2d5594 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + class C { + fun foo(): Any { + return {} + } + } + + val javaClass = C().foo().javaClass + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInMemberFunctionInLocalClassKt\$box\$C") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt new file mode 100644 index 00000000000..49eb272c040 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class C { + class D { + fun foo(): Any { + return {} + } + } +} + +fun box(): String { + val javaClass = C.D().foo().javaClass + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass() + if (enclosingClass?.getSimpleName() != "D") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt new file mode 100644 index 00000000000..3aa459e32b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +object O { + val f = {} +} + +fun box(): String { + val javaClass = O.f.javaClass + + val enclosingMethod = javaClass.getEnclosingMethod() + if (enclosingMethod != null) return "method: $enclosingMethod" + + val enclosingConstructor = javaClass.getEnclosingConstructor() + if (enclosingConstructor == null) return "no enclosing constructor" + + val enclosingClass = javaClass.getEnclosingClass() + if (enclosingClass?.getName() != "O") return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt new file mode 100644 index 00000000000..87c3aa5e21c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +interface C { + val a: Any +} + +fun box(): String { + val l = object : C { + override val a: Any + + init { + a = {} + } + } + + val javaClass = l.a.javaClass + val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() + if (enclosingMethod != "LambdaInObjectExpressionKt\$box\$l\$1") return "ctor: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInObjectExpressionKt\$box\$l\$1") return "enclosing class: $enclosingClass" + + if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt new file mode 100644 index 00000000000..bdced626e98 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +open class C(val a: Any) + +fun box(): String { + val l = object : C({}) { + } + + val javaClass = l.a.javaClass + if (javaClass.getEnclosingConstructor() != null) return "ctor should be null" + + val enclosingMethod = javaClass.getEnclosingMethod()!!.getName() + if (enclosingMethod != "box") return "method: $enclosingMethod" + + val enclosingClass = javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInObjectLiteralSuperCallKt" || enclosingClass != l.javaClass.getEnclosingClass()!!.getName()) + return "enclosing class: $enclosingClass" + + val declaringClass = javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt new file mode 100644 index 00000000000..745933c44a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +val l: Any = {} + +fun box(): String { + val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInPackageKt") return "enclosing class: $enclosingClass" + + val enclosingConstructor = l.javaClass.getEnclosingConstructor() + if (enclosingConstructor != null) return "enclosing constructor found: $enclosingConstructor" + + val enclosingMethod = l.javaClass.getEnclosingMethod() + if (enclosingMethod != null) return "enclosing method found: $enclosingMethod" + + val declaringClass = l.javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt new file mode 100644 index 00000000000..e4f9262ebb4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +val l: Any + get() = {} + +fun box(): String { + + val enclosingMethod = l.javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "getL") return "method: $enclosingMethod" + + val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInPropertyGetterKt") return "enclosing class: $enclosingClass" + + val declaringClass = l.javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt new file mode 100644 index 00000000000..622ebcddba1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +var _l: Any = "" + +var l: Any + get() = _l + set(v) { + _l = {} + } + +fun box(): String { + l = "" // to invoke the setter + + val enclosingMethod = l.javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "setL") return "method: $enclosingMethod" + + val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "LambdaInPropertySetterKt") return "enclosing class: $enclosingClass" + + val declaringClass = l.javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt new file mode 100644 index 00000000000..7930d5151b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// KT-4234 + +fun box(): String { + class C + + val name = C::class.java.getSimpleName() + if (name != "box\$C") return "Fail: $name" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt new file mode 100644 index 00000000000..98c8628f230 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun box(): String { + + val objectInLambda = { + object : Any () {} + }() + + val enclosingMethod = objectInLambda.javaClass.getEnclosingMethod() + if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" + + val enclosingClass = objectInLambda.javaClass.getEnclosingClass()!!.getName() + if (enclosingClass != "ObjectInLambdaKt\$box\$objectInLambda\$1") return "enclosing class: $enclosingClass" + + val declaringClass = objectInLambda.javaClass.getDeclaringClass() + if (declaringClass != null) return "anonymous object has a declaring class" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt new file mode 100644 index 00000000000..f0ab70f6490 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt @@ -0,0 +1,80 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public void publicMemberJ() {} + private void privateMemberJ() {} + public static void publicStaticJ() {} + private static void privateStaticJ() {} +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.test.assertEquals + +open class K : J() { + public fun publicMemberK() {} + private fun privateMemberK() {} + public fun Any.publicMemberExtensionK() {} + private fun Any.privateMemberExtensionK() {} +} + +class L : K() + +fun Collection>.names(): Set = + this.map { it.name }.toSet() + +fun check(c: Collection>, names: Set) { + assertEquals(names, c.names()) +} + +fun box(): String { + val any = setOf("equals", "hashCode", "toString") + + val j = J::class + + check(j.staticFunctions, + setOf("publicStaticJ", "privateStaticJ")) + check(j.declaredFunctions, + setOf("publicMemberJ", "privateMemberJ", "publicStaticJ", "privateStaticJ")) + check(j.declaredMemberFunctions, + setOf("publicMemberJ", "privateMemberJ")) + check(j.declaredMemberExtensionFunctions, + emptySet()) + + check(j.functions, any + j.declaredFunctions.names()) + check(j.memberFunctions, any + j.declaredMemberFunctions.names()) + check(j.memberExtensionFunctions, emptySet()) + + val k = K::class + + check(k.staticFunctions, + emptySet()) + check(k.declaredFunctions, + setOf("publicMemberK", "privateMemberK", "publicMemberExtensionK", "privateMemberExtensionK")) + check(k.declaredMemberFunctions, + setOf("publicMemberK", "privateMemberK")) + check(k.declaredMemberExtensionFunctions, + setOf("publicMemberExtensionK", "privateMemberExtensionK")) + + check(k.memberFunctions, any + setOf("publicMemberJ") + k.declaredMemberFunctions.names()) + check(k.memberExtensionFunctions, k.declaredMemberExtensionFunctions.names()) + check(k.functions, any + (k.memberFunctions + k.memberExtensionFunctions).names()) + + + val l = L::class + + check(l.staticFunctions, emptySet()) + check(l.declaredFunctions, emptySet()) + check(l.declaredMemberFunctions, emptySet()) + check(l.declaredMemberExtensionFunctions, emptySet()) + check(l.memberFunctions, any + setOf("publicMemberJ", "publicMemberK")) + check(l.memberExtensionFunctions, setOf("publicMemberExtensionK")) + check(l.functions, any + (l.memberFunctions + l.memberExtensionFunctions).names()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt new file mode 100644 index 00000000000..a6200e2c7ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt @@ -0,0 +1,10 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +fun doStuff(fn: String.() -> String) = "ok".fn() + +fun box(): String { + return doStuff(String::toUpperCase) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt new file mode 100644 index 00000000000..152bc0ee53a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +import kotlin.jvm.functions.Function2; +import kotlin.reflect.KFunction; + +public class J { + public static String go() { + KFunction fun = K.Companion.getRef(); + Object result = ((Function2) fun).invoke(new K(), "KO"); + return (String) result; + } +} + +// FILE: K.kt + +class K { + fun reverse(s: String): String { + return s.reversed() + } + + companion object { + fun getRef() = K::reverse + } +} + +fun box(): String { + return J.go() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt new file mode 100644 index 00000000000..60cdd3f2b01 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +interface H { + fun foo(): T? +} + +interface A : H + +fun box(): String { + assertEquals("A?", A::foo.returnType.toString()) + assertEquals("T?", H::foo.returnType.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt new file mode 100644 index 00000000000..8743a8d55f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: FromJava.java + +import kotlin.reflect.KCallable; +import kotlin.jvm.functions.Function1; +import kotlin.jvm.functions.Function2; +import kotlin.jvm.functions.Function3; + +public class FromJava { + public static String test(KCallable x) { + if (!(x instanceof Function1)) return "Fail 6"; + if (!(x instanceof Function2)) return "Fail 7"; + if (!(x instanceof Function3)) return "Fail 8"; + return "OK"; + } +} + +// FILE: test.kt + +class Foo { + fun bar(x: Int): Int = x + 1 +} + +fun box(): String { + val bar = Foo::class.members.single { it.name == "bar" } + + if (bar is Function1<*, *>) return "Fail 1" + if (bar !is Function2<*, *, *>) return "Fail 2" + if (bar is Function3<*, *, *, *>) return "Fail 3" + + bar as? Function2 ?: return "Fail 4" + + if (bar(Foo(), 42) != 43) return "Fail 5" + + return FromJava.test(bar) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt new file mode 100644 index 00000000000..28537bf438e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public J() { + } + + public void member(String s) { + } + + public static void staticMethod(int x) { + } +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(listOf("equals", "hashCode", "member", "staticMethod", "toString"), J::class.members.map { it.name }.sorted()) + assertEquals(listOf("equals", "hashCode", "member", "staticMethod", "toString"), J::class.functions.map { it.name }.sorted()) + assertEquals(listOf("member", "staticMethod"), J::class.declaredFunctions.map { it.name }.sorted()) + + assertEquals(1, J::class.constructors.size) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/javaMethodsSmokeTest.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/javaMethodsSmokeTest.kt new file mode 100644 index 00000000000..513242ff191 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/javaMethodsSmokeTest.kt @@ -0,0 +1,50 @@ +// TARGET_BACKEND: JVM + +// WITH_REFLECT +// FILE: J.java + +import java.util.List; + +public class J { + void simple() {} + + void objectTypes( + Object o, String s, Object[] oo, String[] ss + ) {} + + void primitives( + boolean z, char c, byte b, short s, int i, float f, long j, double d + ) {} + + void primitiveArrays( + boolean[] z, char[] c, byte[] b, short[] s, int[] i, float[] f, long[] j, double[] d + ) {} + + void multiDimensionalArrays( + int[][][] i, Cloneable[][][][] c + ) {} + + void wildcards( + List l, List m + ) {} +} + +// FILE: K.kt + +import kotlin.reflect.KFunction + +// Initiate descriptor computation in reflection to ensure that nothing fails +fun test(f: KFunction<*>) { + f.parameters +} + +fun box(): String { + test(J::simple) + test(J::objectTypes) + test(J::primitives) + test(J::primitiveArrays) + test(J::multiDimensionalArrays) + test(J::wildcards) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt new file mode 100644 index 00000000000..5179459a719 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt @@ -0,0 +1,9 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +@JvmName("Fail") +fun OK() {} + +fun box() = ::OK.name diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt new file mode 100644 index 00000000000..0bdd870b48d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +class A { + private fun foo() = "A" +} + +fun box(): String { + val f = A::class.declaredFunctions.single() as KFunction + + try { + f.call(A()) + return "Fail: no exception was thrown" + } catch (e: IllegalCallableAccessException) {} + + f.isAccessible = true + + assertEquals("A", f.call(A())) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt new file mode 100644 index 00000000000..840481d7613 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +open class A { + fun mem() {} + fun Int.memExt() {} +} + +class B : A() + +fun box(): String { + val all = A::class.functions.map { it.name }.sorted() + assert(all == listOf("equals", "hashCode", "mem", "memExt", "toString")) { "Fail A functions: ${A::class.functions}" } + + val declared = A::class.declaredFunctions.map { it.name }.sorted() + assert(declared == listOf("mem", "memExt")) { "Fail A declaredFunctions: ${A::class.declaredFunctions}" } + + val declaredSubclass = B::class.declaredFunctions.map { it.name }.sorted() + assert(declaredSubclass.isEmpty()) { "Fail B declaredFunctions: ${B::class.declaredFunctions}" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt new file mode 100644 index 00000000000..46ce3d981ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun foo() {} + +class A { + fun bar() = "" +} + +fun Int.baz() = this + +fun box(): String { + assertEquals("foo", ::foo.name) + assertEquals("bar", A::bar.name) + assertEquals("baz", Int::baz.name) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt new file mode 100644 index 00000000000..e42d6a4e71f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +interface A { + fun foo(): Collection +} + +abstract class B : A { + override fun foo(): Collection = null!! +} + +fun box(): String { + val clazz = B::class.java + if (clazz.declaredMethods.first().genericReturnType.toString() != "java.util.Collection") return "fail 1" + + if (clazz.methods.filter { it.name == "foo" }.size != 1) return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt new file mode 100644 index 00000000000..38b8c0a9cf9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J { + + public static int test1() { + A> x = new X>("O", new B("K")); + return A.DefaultImpls.test1(x, 1, 1.0); + } + + + public static A> test2(){ + X> x = new X>("O", new B("K")); + return A.DefaultImpls.test2(x, 1); + } +} + +// FILE: K.kt + +class B(val value: T) + +interface A> { + + fun test1(p: T, z: L): T { + return p + } + + fun test2(p: L): A { + return this + } +} + + +class X>(val p1: T, val p2: Y) : A { + +} + +fun box(): String { + val test1 = J.test1() + if (test1 != 1) return "fail 1: $test1 != 1" + + val test2: X> = J.test2() as X> + + return test2.p1 + test2.p2.value +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt new file mode 100644 index 00000000000..ff3039e4658 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.util.Date + +fun assertGenericSuper(expected: String, function: Any?) { + val clazz = (function as java.lang.Object).getClass()!! + val genericSuper = clazz.getGenericInterfaces()[0]!! + if ("$genericSuper" != expected) + throw AssertionError("Fail, expected: $expected, actual: $genericSuper") +} + + +val unitFun = { } +val intFun = { 42 } +val stringParamFun = { x: String -> } +val listFun = { l: List -> l } +val mutableListFun = fun (l: MutableList): MutableList = null!! +val funWithIn = fun (x: Comparable) {} + +val extensionFun = fun Any.() {} +val extensionWithArgFun = fun Long.(x: Any): Date = Date() + +fun box(): String { + assertGenericSuper("kotlin.jvm.functions.Function0", unitFun) + assertGenericSuper("kotlin.jvm.functions.Function0", intFun) + assertGenericSuper("kotlin.jvm.functions.Function1", stringParamFun) + assertGenericSuper("kotlin.jvm.functions.Function1, java.util.List>", listFun) + assertGenericSuper("kotlin.jvm.functions.Function1, java.util.List>", mutableListFun) + assertGenericSuper("kotlin.jvm.functions.Function1, kotlin.Unit>", funWithIn) + + assertGenericSuper("kotlin.jvm.functions.Function1", extensionFun) + assertGenericSuper("kotlin.jvm.functions.Function2", extensionWithArgFun) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt new file mode 100644 index 00000000000..2ad596b297f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt @@ -0,0 +1,86 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +//test for KT-3722 Write correct generic type information for generated fields +import kotlin.properties.Delegates + +class Z { + +} + +class TParam { + +} + +class Zout { + +} + +class Zin { + +} + + +class Test(val constructorProperty: T) { + + val classField1 : Z? = null + + val classField2 : Z? = null + + val classField3 : Zout? = null + + val classField4 : Zin? = null + + val delegateLazy: Z? by lazy {Z()} + + val delegateNotNull: Z? by Delegates.notNull() + + +} + +fun box(): String { + val clz = Test::class.java + + val constructorProperty = clz.getDeclaredField("constructorProperty"); + + if (constructorProperty.getGenericType().toString() != "T") + return "fail0: " + constructorProperty.getGenericType(); + + + val classField = clz.getDeclaredField("classField1"); + + if (classField.getGenericType().toString() != "Z") + return "fail1: " + classField.getGenericType(); + + + val classField2 = clz.getDeclaredField("classField2"); + + if (classField2.getGenericType().toString() != "Z") + return "fail2: " + classField2.getGenericType(); + + + val classField3 = clz.getDeclaredField("classField3"); + + if (classField3.getGenericType().toString() != "Zout") + return "fail3: " + classField3.getGenericType(); + + + val classField4 = clz.getDeclaredField("classField4"); + + if (classField4.getGenericType().toString() != "Zin") + return "fail4: " + classField4.getGenericType(); + + val classField5 = clz.getDeclaredField("delegateLazy\$delegate"); + + if (classField5.getGenericType().toString() != "interface kotlin.Lazy") + return "fail5: " + classField5.getGenericType(); + + val classField6 = clz.getDeclaredField("delegateNotNull\$delegate"); + + if (classField6.getGenericType().toString() != "interface kotlin.properties.ReadWriteProperty") + return "fail6: " + classField6.getGenericType(); + + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt new file mode 100644 index 00000000000..8cda6593651 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt @@ -0,0 +1,65 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class Z {} + +class TParam {} + +class Zout {} + +class Zin {} + +class Params(val methodIndex: Int, val paramClass: Class<*>, val expectedReturnType: String, val expecedParamType: String) + +class Test() { + + fun test1(p: T): T? = null + + fun test2(p: Z): Z? = null + + fun test3(p: Z): Z? = null + + fun test4(p: X): Zout? = null + + fun test5(p: Y): Zin? = null +} + +fun box(): String { + val clz = Test::class.java + + val params = listOf( + Params(1, Any::class.java, "T", "T"), + Params(2, Z::class.java, "Z", "Z"), + Params(3, Z::class.java, "Z", "Z"), + Params(4, Any::class.java, "Zout", "X"), + Params(5, Any::class.java, "Zin", "Y") + ) + + + var result: String = "" + for(p in params) { + val fail = test(clz, p.methodIndex, p.paramClass, p.expectedReturnType, p.expecedParamType) + if (fail != "OK") { + result += fail + "\n"; + } + } + + return if (result.isEmpty()) "OK" else result; + +} + +fun test(clazz: Class<*>, methodIndex: Int, paramClass: Class<*>, expectedReturn : String, expectedParam : String): String { + val method = clazz.getDeclaredMethod("test$methodIndex", paramClass)!!; + + if (method.getGenericReturnType().toString() != expectedReturn) + return "fail$methodIndex: " + method.getGenericReturnType(); + + val test1Param = method.getGenericParameterTypes()!![0]; + + if (test1Param.toString() != expectedParam) + return "fail${methodIndex}_param: " + test1Param; + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt new file mode 100644 index 00000000000..679c4a054b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class B + +interface A> { + + fun p(p: T): T { + return p + } + + val T.z : T? + get() = null +} + + +fun box(): String { + val defaultImpls = Class.forName("A\$DefaultImpls") + val declaredMethod = defaultImpls.getDeclaredMethod("p", A::class.java, Any::class.java) + if (declaredMethod.toGenericString() != "public static T A\$DefaultImpls.p(A,T)") return "fail 1: ${declaredMethod.toGenericString()}" + + val declaredProperty = defaultImpls.getDeclaredMethod("getZ", A::class.java, Any::class.java) + if (declaredProperty.toGenericString() != "public static T A\$DefaultImpls.getZ(A,T)") return "fail 2: ${declaredProperty.toGenericString()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt new file mode 100644 index 00000000000..50c4b168122 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package test + +class G(val s: T) { + +} + +public interface ErrorsJvmTrait { + companion object { + public val param : G = G("STRING") + } +} + +public class ErrorsJvmClass { + companion object { + @JvmField public val param : G = G("STRING") + } +} + +fun box(): String { + val genericTypeInClassObject = ErrorsJvmTrait.javaClass.getDeclaredField("param").getGenericType() + if (genericTypeInClassObject.toString() != "test.G") return "fail1: $genericTypeInClassObject" + + val genericTypeInClass = ErrorsJvmClass::class.java.getField("param").getGenericType() + if (genericTypeInClass.toString() != "test.G") return "fail1: genericTypeInClass" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt new file mode 100644 index 00000000000..da05fc1b2fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package test + +open class B + +class A { + + companion object { + @JvmStatic + fun a(s: T) : T { + return s + } + } +} + +fun box(): String { + val method = A::class.java.getDeclaredMethod("a", B::class.java) + val genericParameterTypes = method.getGenericParameterTypes() + + if (genericParameterTypes.size != 1) return "Wrong number of generic parameters" + + if (genericParameterTypes[0].toString() != "T") return "Wrong parameter type ${genericParameterTypes[0].toString()}" + + if (method.getGenericReturnType().toString() != "T") return "Wrong return type ${method.getGenericReturnType()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt new file mode 100644 index 00000000000..0692b7d19e0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt @@ -0,0 +1,61 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.reflect.full.cast +import kotlin.reflect.full.safeCast +import kotlin.test.* + +fun testInstance(value: Any?, klass: KClass<*>) { + assertTrue(klass.isInstance(value)) + assertEquals(value, klass.safeCast(value)) + assertEquals(value, klass.cast(value)) +} + +fun testNotInstance(value: Any?, klass: KClass<*>) { + assertFalse(klass.isInstance(value)) + assertNull(klass.safeCast(value)) + try { + klass.cast(value) + fail("Value should not be an instance of $klass: $value") + } + catch (e: Exception) { /* OK */ } +} + +fun box(): String { + testInstance(Any(), Any::class) + testInstance("", String::class) + testInstance("", Any::class) + testNotInstance(Any(), String::class) + testNotInstance(null, Any::class) + testNotInstance(null, String::class) + + testInstance(arrayOf(""), Array::class) + testInstance(arrayOf(""), Array::class) + testNotInstance(arrayOf(Any()), Array::class) + + testInstance(listOf(""), List::class) + testInstance(listOf(""), Collection::class) + // TODO: support MutableList::class (KT-11754) + // testNotInstance(listOf(""), MutableList::class) + + testInstance(42, Int::class) + testInstance(42, Int::class.javaPrimitiveType!!.kotlin) + testInstance(42, Int::class.javaObjectType!!.kotlin) + + testNotInstance(3.14, Int::class) + + // Function types + + testInstance(fun() {}, Function0::class) + testNotInstance(fun() {}, Function1::class) + testNotInstance(fun() {}, Function2::class) + + testNotInstance(::testInstance, Function0::class) + testNotInstance(::testInstance, Function1::class) + testInstance(::testInstance, Function2::class) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt new file mode 100644 index 00000000000..029e8ddf66a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val args: Array>) + +class O +class K + +@Ann(arrayOf(O::class, K::class)) class MyClass + +fun box(): String { + val args = MyClass::class.java.getAnnotation(Ann::class.java).args + val argName1 = args[0].simpleName ?: "fail 1" + val argName2 = args[1].simpleName ?: "fail 2" + return argName1 + argName2 +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt new file mode 100644 index 00000000000..c9fbb1df645 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class O {} +class K {} + +@Ann(args={O.class, K.class}) +class Test { +} + +// FILE: array.kt + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val args: Array>) + +fun box(): String { + val args = Test::class.java.getAnnotation(Ann::class.java).args + val argName1 = args[0].java.simpleName ?: "fail 1" + val argName2 = args[1].java.simpleName ?: "fail 2" + return argName1 + argName2 +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt new file mode 100644 index 00000000000..e62730f62d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val arg: KClass<*>) + +class OK + +@Ann(OK::class) class MyClass + +fun box(): String { + val argName = MyClass::class.java.getAnnotation(Ann::class.java).arg.simpleName ?: "fail 1" + return argName +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt new file mode 100644 index 00000000000..22cf93d2986 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class OK {} + +@Ann(arg=OK.class) +class Test { +} + +// FILE: basic.kt + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val arg: KClass<*>) + +fun box(): String { + val argName = Test::class.java.getAnnotation(Ann::class.java).arg.java.simpleName ?: "fail 1" + return argName +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt new file mode 100644 index 00000000000..55b869ca26c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass + +fun box(): String { + try { + String::class.java as KClass + } catch (e: Exception) { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt new file mode 100644 index 00000000000..5db5781f6c1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(vararg val args: KClass<*>) + +class O +class K + +@Ann(O::class, K::class) class MyClass + +fun box(): String { + val args = MyClass::class.java.getAnnotation(Ann::class.java).args + val argName1 = args[0].simpleName ?: "fail 1" + val argName2 = args[1].simpleName ?: "fail 2" + return argName1 + argName2 +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt new file mode 100644 index 00000000000..d5f37707737 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: Test.java + +class O {} +class K {} + +@Ann(args={O.class, K.class}) +class Test { +} + +// FILE: vararg.kt + +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(vararg val args: KClass<*>) + +fun box(): String { + val args = Test::class.java.getAnnotation(Ann::class.java).args + val argName1 = args[0].java.simpleName ?: "fail 1" + val argName2 = args[1].java.simpleName ?: "fail 2" + return argName1 + argName2 +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt new file mode 100644 index 00000000000..86e39ed8e72 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals +import kotlin.test.assertNull + +fun lambda() { + val f = { x: Int, y: String? -> } + + val g = f.reflect()!! + + // TODO: maybe change this name + assertEquals("", g.name) + assertEquals(listOf("x", "y"), g.parameters.map { it.name }) + assertEquals(listOf(false, true), g.parameters.map { it.type.isMarkedNullable }) +} + +fun funExpr() { + val f = fun(x: Int, y: String?) {} + + val g = f.reflect()!! + + // TODO: maybe change this name + assertEquals("", g.name) + assertEquals(listOf("x", "y"), g.parameters.map { it.name }) + assertEquals(listOf(false, true), g.parameters.map { it.type.isMarkedNullable }) +} + +fun extensionFunExpr() { + val f = fun String.(): String = this + + val g = f.reflect()!! + + assertEquals(KParameter.Kind.EXTENSION_RECEIVER, g.parameters.single().kind) + assertEquals(null, g.parameters.single().name) +} + +fun box(): String { + lambda() + funExpr() + extensionFunExpr() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt new file mode 100644 index 00000000000..4d918da5108 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +class K { + class Nested + inner class Inner +} + +class Secondary { + constructor(x: Int) {} +} + +fun check(f: KFunction) { + assert(f.javaMethod == null) { "Fail f method" } + assert(f.javaConstructor != null) { "Fail f constructor" } + val c = f.javaConstructor!! + + assert(c.kotlinFunction != null) { "Fail m function" } + val ff = c.kotlinFunction!! + + assert(f == ff) { "Fail f != ff" } +} + +fun box(): String { + check(::K) + + // Workaround KT-8596 + val nested = K::Nested + check(nested) + + check(K::Inner) + check(::Secondary) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt new file mode 100644 index 00000000000..9a6abd37294 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +class K(var value: Long) + +var K.ext: Double + get() = value.toDouble() + set(value) { + this.value = value.toLong() + } + +fun box(): String { + val p = K::ext + + val getter = p.javaGetter!! + val setter = p.javaSetter!! + + assertEquals(getter, Class.forName("ExtensionPropertyKt").getMethod("getExt", K::class.java)) + assertEquals(setter, Class.forName("ExtensionPropertyKt").getMethod("setExt", K::class.java, Double::class.java)) + + val k = K(42L) + assert(getter.invoke(null, k) == 42.0) { "Fail k getter" } + setter.invoke(null, k, -239.0) + assert(getter.invoke(null, k) == -239.0) { "Fail k setter" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt new file mode 100644 index 00000000000..2f6137a493e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// KT-8131 Cannot find backing field in ancestor class via reflection + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +open class TestBase { + var id = 0L +} + +class TestChild : TestBase() + +fun box(): String { + val property = TestChild::class.memberProperties.first { it.name == "id" } as KMutableProperty<*> + if (property.javaField == null) + return "Fail: no field" + if (property.javaGetter == null) + return "Fail: no getter" + if (property.javaSetter == null) + return "Fail: no setter" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt new file mode 100644 index 00000000000..eeeb80dab83 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +open class TestBase { + fun id() = 0L +} + +class TestChild : TestBase() + +fun box(): String { + if (TestChild::class.memberFunctions.first { it.name == "id" }.javaMethod == null) + return "No method for TestChild.id()" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt new file mode 100644 index 00000000000..9a556b2c19f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +class K { + fun foo(s: String): Int = s.length +} +fun bar(s: String): Int = s.length +fun String.baz(): Int = this.length + +fun check(f: KFunction) { + assert(f.javaConstructor == null) { "Fail f constructor" } + assert(f.javaMethod != null) { "Fail f method" } + val m = f.javaMethod!! + + assert(m.kotlinFunction != null) { "Fail m function" } + val ff = m.kotlinFunction!! + + assert(f == ff) { "Fail f != ff" } +} + +fun box(): String { + check(K::foo) + check(::bar) + check(String::baz) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt new file mode 100644 index 00000000000..b1ca36b546e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt @@ -0,0 +1,23 @@ +// IGNORE_BACKEND: JS +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +inline fun f() = 1 + +fun g() {} + +class Foo { + inline fun h(t: T) = 1 +} + +fun box(): String { + assertEquals(::g, ::g.javaMethod!!.kotlinFunction) + + val h = Foo::class.members.single { it.name == "h" } as KFunction<*> + assertEquals(h, h.javaMethod!!.kotlinFunction) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt new file mode 100644 index 00000000000..f3711f43b47 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt @@ -0,0 +1,38 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KFunction +import kotlin.reflect.jvm.* +import kotlin.test.* + +class C { + companion object { + @JvmStatic + fun foo(s: String): Int = s.length + } +} + +fun box(): String { + val foo = C.Companion::class.members.single { it.name == "foo" } as KFunction<*> + + val j = foo.javaMethod ?: return "Fail: no Java method found for C::foo" + assertEquals(3, j.invoke(C, "abc")) + + val k = j.kotlinFunction ?: return "Fail: no Kotlin function found for Java method C::foo" + assertEquals(3, k.call(C, "def")) + + + val staticMethod = C::class.java.getDeclaredMethod("foo", String::class.java) + val k2 = staticMethod.kotlinFunction ?: + return "Fail: no Kotlin function found for static bridge for @JvmStatic method in companion object C::foo" + assertEquals(3, k2.call(C, "ghi")) + + assertFailsWith(NullPointerException::class) { k2.call(null, "")!! } + + val j2 = k2.javaMethod + assertEquals(j, j2) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt new file mode 100644 index 00000000000..db97b6b6af4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KFunction +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +object O { + @JvmStatic + fun foo(s: String): Int = s.length +} + +fun box(): String { + val foo = O::class.members.single { it.name == "foo" } as KFunction<*> + + val j = foo.javaMethod ?: return "Fail: no Java method found for O::foo" + assertEquals(3, j.invoke(null, "abc")) + + val k = j.kotlinFunction ?: return "Fail: no Kotlin function found for Java method O::foo" + assertEquals(3, k.call(O, "def")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt new file mode 100644 index 00000000000..4bd2ad46c9c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +class A + +fun box(): String { + val a1 = A::class.java.kotlin + val a2 = A::class + + if (a1 != a2) return "Fail equals" + if (a1.hashCode() != a2.hashCode()) return "Fail hashCode" + if (a1.toString() != a2.toString()) return "Fail toString" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt new file mode 100644 index 00000000000..a1f3b810225 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +class K(var value: Long) + +fun box(): String { + val p = K::value + + assert(p.javaField != null) { "Fail p field" } + + val getter = p.javaGetter!! + val setter = p.javaSetter!! + + assertEquals(getter, K::class.java.getMethod("getValue")) + assertEquals(setter, K::class.java.getMethod("setValue", Long::class.java)) + + val k = K(42L) + assert(getter.invoke(k) == 42L) { "Fail k getter" } + setter.invoke(k, -239L) + assert(getter.invoke(k) == -239L) { "Fail k setter" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt new file mode 100644 index 00000000000..d4d245b0c98 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.* + +var foo = "foo" + +class A { + var bar = "bar" +} + +fun box(): String { + val fooGetter = ::foo.getter.javaMethod ?: return "Fail fooGetter" + assertEquals("foo", fooGetter.invoke(null)) + + val fooSetter = ::foo.setter.javaMethod ?: return "Fail fooSetter" + fooSetter.invoke(null, "foof") + assertEquals("foof", foo) + + assertNull(::foo.getter.javaConstructor) + assertNull(::foo.setter.javaConstructor) + + + val a = A() + val barGetter = A::bar.getter.javaMethod ?: return "Fail barGetter" + assertEquals("bar", barGetter.invoke(a)) + + val barSetter = A::bar.setter.javaMethod ?: return "Fail barSetter" + barSetter.invoke(a, "barb") + assertEquals("barb", a.bar) + + assertNull(A::bar.getter.javaConstructor) + assertNull(A::bar.setter.javaConstructor) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt new file mode 100644 index 00000000000..75aa220c791 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* + +var state: String = "value" + @JvmName("getter") + get + @JvmName("setter") + set + +fun box(): String { + val p = ::state + + if (p.name != "state") return "Fail name: ${p.name}" + if (p.get() != "value") return "Fail get: ${p.get()}" + p.set("OK") + + val getterName = p.javaGetter!!.getName() + if (getterName != "getter") return "Fail getter name: $getterName" + + val setterName = p.javaSetter!!.getName() + if (setterName != "setter") return "Fail setter name: $setterName" + + return p.get() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt new file mode 100644 index 00000000000..953ce19205b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.kotlinProperty + +enum class A { + // There's a synthetic field "$VALUES" here +} + +fun box(): String { + for (field in A::class.java.getDeclaredFields()) { + val prop = field.kotlinProperty + if (prop != null) return "Fail, property found: $prop" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt new file mode 100644 index 00000000000..8eba3712688 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: test.kt + +fun test2() { +} + +// FILE: main.kt +// See KT-10690 Exception in kotlin.reflect when trying to get kotlinFunction from javaMethod + +import kotlin.reflect.jvm.javaMethod +import kotlin.reflect.jvm.kotlinFunction + +fun box(): String { + if (::box.javaMethod?.kotlinFunction == null) + return "Fail box" + if (::test1.javaMethod?.kotlinFunction == null) + return "Fail test1" + if (::test2.javaMethod?.kotlinFunction == null) + return "Fail test2" + + return "OK" +} + +fun test1() { +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt new file mode 100644 index 00000000000..053e1c0d413 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +var topLevel = "123" + +fun box(): String { + val p = ::topLevel + + assert(p.javaField != null) { "Fail p field" } + val field = p.javaField!! + val className = field.getDeclaringClass().getName() + assertEquals("TopLevelPropertyKt", className) + + val getter = p.javaGetter!! + val setter = p.javaSetter!! + + assertEquals(getter, Class.forName("TopLevelPropertyKt").getMethod("getTopLevel")) + assertEquals(setter, Class.forName("TopLevelPropertyKt").getMethod("setTopLevel", String::class.java)) + + assert(getter.invoke(null) == "123") { "Fail k getter" } + setter.invoke(null, "456") + assert(getter.invoke(null) == "456") { "Fail k setter" } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt new file mode 100644 index 00000000000..7df0d3bfd6f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt @@ -0,0 +1,51 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.GenericArrayType +import java.lang.reflect.ParameterizedType +import kotlin.reflect.KClass +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +annotation class Z +enum class E + +annotation class Anno( + val b: Byte, + val s: String, + val ss: Array, + val z: Z, + val zs: Array, + val e: E, + val es: Array, + val k: KClass<*>, + val ka: Array> +) + +fun tmp(): Array> = null!! + +fun box(): String { + val t = Anno::class.constructors.single().parameters.map { it.type.javaType } + + assertEquals(Byte::class.java, t[0]) + assertEquals(String::class.java, t[1]) + assertEquals(Array::class.java, t[2]) + assertEquals(Z::class.java, t[3]) + assertEquals(Array::class.java, t[4]) + assertEquals(E::class.java, t[5]) + assertEquals(Array::class.java, t[6]) + + assertTrue(t[7] is ParameterizedType) + assertEquals(Class::class.java, (t[7] as ParameterizedType).rawType) + + assertTrue(t[8] is GenericArrayType) + val e = (t[8] as GenericArrayType).genericComponentType + assertTrue(e is ParameterizedType) + assertEquals(Class::class.java, (e as ParameterizedType).rawType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt new file mode 100644 index 00000000000..9baa4f9a039 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.GenericArrayType +import java.lang.reflect.TypeVariable +import java.lang.reflect.ParameterizedType +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun foo(strings: Array, integers: Array, objectArrays: Array>) {} + +fun bar(): Array> = null!! +class A { + fun baz(): Array = null!! +} + +fun box(): String { + assertEquals(Array::class.java, ::foo.parameters[0].type.javaType) + assertEquals(Array::class.java, ::foo.parameters[1].type.javaType) + assertEquals(Array>::class.java, ::foo.parameters[2].type.javaType) + + val g = ::bar.returnType.javaType + if (g !is GenericArrayType || g.genericComponentType !is ParameterizedType) + return "Fail: should be array of parameterized type, but was $g (${g.javaClass})" + + val h = A::baz.returnType.javaType + if (h !is GenericArrayType || h.genericComponentType !is TypeVariable<*>) + return "Fail: should be array of type variable, but was $h (${h.javaClass})" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt new file mode 100644 index 00000000000..80edeaf5228 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +class A(d: Double, s: String, parent: A?) { + class Nested(a: A) + inner class Inner(nested: Nested) +} + +fun box(): String { + assertEquals(listOf(java.lang.Double.TYPE, String::class.java, A::class.java), ::A.parameters.map { it.type.javaType }) + assertEquals(listOf(A::class.java), A::Nested.parameters.map { it.type.javaType }) + assertEquals(listOf(A::class.java, A.Nested::class.java), A::Inner.parameters.map { it.type.javaType }) + + assertEquals(A::class.java, ::A.returnType.javaType) + assertEquals(A.Nested::class.java, A::Nested.returnType.javaType) + assertEquals(A.Inner::class.java, A::Inner.returnType.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt new file mode 100644 index 00000000000..90302aa85a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.ParameterizedType +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class Bar +fun arrayOfInvBar(): Array = null!! +fun arrayOfInBar(): Array = null!! +fun arrayOfOutBar(): Array = null!! + +fun arrayOfInvList(): Array> = null!! +fun arrayOfInList(): Array> = null!! +fun arrayOfOutList(): Array> = null!! + +fun box(): String { + // NB: in "Array", Java type of X is always Any::class.java because this is the JVM signature generated by the compiler + + assertEquals(Bar::class.java, ::arrayOfInvBar.returnType.arguments.single().type!!.javaType) + assertEquals(Any::class.java, ::arrayOfInBar.returnType.arguments.single().type!!.javaType) + assertEquals(Bar::class.java, ::arrayOfOutBar.returnType.arguments.single().type!!.javaType) + + val invList = ::arrayOfInvList.returnType.arguments.single().type!!.javaType + assertTrue(invList is ParameterizedType && invList.rawType == List::class.java, invList.toString()) + + assertEquals(Any::class.java, ::arrayOfInList.returnType.arguments.single().type!!.javaType) + + val outList = ::arrayOfOutList.returnType.arguments.single().type!!.javaType + assertTrue(outList is ParameterizedType && outList.rawType == List::class.java, outList.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt new file mode 100644 index 00000000000..169af37d333 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +class Outer { + inner class Inner { + inner class Innermost + } +} + +fun foo(): Outer.Inner.Innermost = null!! + +fun box(): String { + assertEquals( + listOf( + Any::class.java, + Any::class.java, + String::class.java, + Float::class.javaObjectType, + Int::class.javaObjectType, + Number::class.java + ), + ::foo.returnType.arguments.map { it.type!!.javaType } + ) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt new file mode 100644 index 00000000000..ff249f0eeee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +class A { + fun foo(t: Long?): Long = t!! +} + +object O { + @JvmStatic + fun bar(a: A): String = "" +} + +fun box(): String { + val foo = A::foo + assertEquals(listOf(A::class.java, java.lang.Long::class.java), foo.parameters.map { it.type.javaType }) + assertEquals(java.lang.Long.TYPE, foo.returnType.javaType) + + val bar = O::class.members.single { it.name == "bar" } + assertEquals(listOf(O::class.java, A::class.java), bar.parameters.map { it.type.javaType }) + assertEquals(String::class.java, bar.returnType.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt new file mode 100644 index 00000000000..ebf7691bdd6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.* + +interface I { + fun foo(): Any +} + +class A : I { + override fun foo(): Int = 0 + fun bar(x: Long): Int = x.toInt() +} + +fun box(): String { + assertEquals(Integer::class.java, A::foo.returnType.javaType) + assertNotEquals(Integer.TYPE, A::foo.returnType.javaType) + + assertNotEquals(Integer::class.java, A::bar.returnType.javaType) + assertEquals(Integer.TYPE, A::bar.returnType.javaType) + + assertEquals(java.lang.Long.TYPE, A::bar.parameters.last().type.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt new file mode 100644 index 00000000000..2027af5bc87 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +fun listOfStrings(): List = null!! + +class Foo +class Bar +fun fooOfInvBar(): Foo = null!! +fun fooOfInBar(): Foo = null!! +fun fooOfOutBar(): Foo = null!! + +fun box(): String { + assertEquals(String::class.java, ::listOfStrings.returnType.arguments.single().type!!.javaType) + + assertEquals(Bar::class.java, ::fooOfInvBar.returnType.arguments.single().type!!.javaType) + assertEquals(Bar::class.java, ::fooOfInBar.returnType.arguments.single().type!!.javaType) + assertEquals(Bar::class.java, ::fooOfOutBar.returnType.arguments.single().type!!.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt new file mode 100644 index 00000000000..615ee14bd04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt @@ -0,0 +1,45 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.ParameterizedType +import kotlin.reflect.* +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +class A(private var foo: List) + +object O { + @JvmStatic + private var bar: List = listOf() +} + +fun topLevel(): List = listOf() +fun Any.extension(): List = listOf() + +fun assertGenericType(type: KType) { + val javaType = type.javaType + if (javaType !is ParameterizedType) { + throw AssertionError("Type should be a parameterized type, but was $javaType (${javaType.javaClass})") + } +} + +fun box(): String { + val foo = A::class.members.single { it.name == "foo" } as KMutableProperty<*> + assertGenericType(foo.returnType) + assertGenericType(foo.getter.returnType) + assertGenericType(foo.setter.parameters.last().type) + + val bar = O::class.members.single { it.name == "bar" } as KMutableProperty<*> + assertGenericType(bar.returnType) + assertGenericType(bar.getter.returnType) + assertGenericType(bar.setter.parameters.last().type) + + assertGenericType(::topLevel.returnType) + assertGenericType(Any::extension.returnType) + assertGenericType(::A.parameters.single().type) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt new file mode 100644 index 00000000000..2eae6cf6466 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KMutableProperty +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +class A(private var foo: String) + +object O { + @JvmStatic + private var bar: String = "" +} + +fun box(): String { + val foo = A::class.members.single { it.name == "foo" } as KMutableProperty<*> + assertEquals(listOf(A::class.java), foo.parameters.map { it.type.javaType }) + assertEquals(listOf(A::class.java), foo.getter.parameters.map { it.type.javaType }) + assertEquals(listOf(A::class.java, String::class.java), foo.setter.parameters.map { it.type.javaType }) + + val bar = O::class.members.single { it.name == "bar" } as KMutableProperty<*> + assertEquals(listOf(O::class.java), bar.parameters.map { it.type.javaType }) + assertEquals(listOf(O::class.java), bar.getter.parameters.map { it.type.javaType }) + assertEquals(listOf(O::class.java, String::class.java), bar.setter.parameters.map { it.type.javaType }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/rawTypeArgument.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/rawTypeArgument.kt new file mode 100644 index 00000000000..dff36ee7e4e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/rawTypeArgument.kt @@ -0,0 +1,21 @@ +// TARGET_BACKEND: JVM + +// WITH_REFLECT +// FILE: J.java + +import java.util.List; + +public interface J { + List foo(); +} + +// FILE: K.kt + +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(Any::class.java, J::foo.returnType.arguments.single().type!!.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt new file mode 100644 index 00000000000..f4b75b3615c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.ParameterizedType +import java.lang.reflect.TypeVariable +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals +import kotlin.test.assertTrue +import kotlin.test.fail + +open class Klass +interface Interface +interface Interface2 + +class A : Interface, Klass(), Interface2 + +fun box(): String { + val (i, k, i2) = A::class.supertypes.map { it.javaType } + + i as? ParameterizedType ?: fail("Not a parameterized type: $i") + assertEquals(Interface::class.java, i.rawType) + val args = i.actualTypeArguments + assertEquals(String::class.java, args[0], "Not String: ${args[0]}") + assertTrue(args[1].let { it is TypeVariable<*> && it.name == "Z" && it.genericDeclaration == A::class.java }, "Not Z: ${args[1]}") + + assertEquals(Klass::class.java, k) + + assertEquals(Interface2::class.java, i2) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt new file mode 100644 index 00000000000..6ceaa62c0f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun free(s: String): Int = s.length + +fun Any.extension() {} + +fun box(): String { + assertEquals(java.lang.Integer.TYPE, ::free.returnType.javaType) + assertEquals(String::class.java, ::free.parameters.single().type.javaType) + + assertEquals(Any::class.java, Any::extension.parameters.single().type.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt new file mode 100644 index 00000000000..9998a169b46 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK + +import java.lang.reflect.TypeVariable +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +class A { + fun foo(t: T) {} +} + +fun box(): String { + val f = A::foo + val t = f.parameters.last().type.javaType + if (t !is TypeVariable<*>) return "Fail, t should be a type variable: $t" + + assertEquals("T", t.name) + assertEquals("A", (t.genericDeclaration as Class<*>).name) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt new file mode 100644 index 00000000000..2585d8d7c1a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun foo(unitParam: Unit, nullableUnitParam: Unit?): Unit {} + +var bar: Unit = Unit + +fun box(): String { + assert(Unit::class.java != java.lang.Void.TYPE) + + assertEquals(Unit::class.java, ::foo.parameters[0].type.javaType) + assertEquals(Unit::class.java, ::foo.parameters[1].type.javaType) + assertEquals(java.lang.Void.TYPE, ::foo.returnType.javaType) + + assertEquals(Unit::class.java, ::bar.returnType.javaType) + assertEquals(Unit::class.java, ::bar.getter.returnType.javaType) + assertEquals(Unit::class.java, ::bar.setter.parameters.single().type.javaType) + assertEquals(java.lang.Void.TYPE, ::bar.setter.returnType.javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt new file mode 100644 index 00000000000..4cac34036ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.withNullability +import kotlin.reflect.jvm.javaType +import kotlin.test.assertEquals + +fun nonNull(): String = "" +fun nullable(): String? = "" + +fun box(): String { + val nonNull = ::nonNull.returnType + val nullable = ::nullable.returnType + + assertEquals(nullable.javaType, nullable.withNullability(false).javaType) + assertEquals(nullable.javaType, nullable.withNullability(true).javaType) + assertEquals(nonNull.javaType, nonNull.withNullability(false).javaType) + assertEquals(nullable.javaType, nonNull.withNullability(true).javaType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt new file mode 100644 index 00000000000..134d4f4bcee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +class A { + fun foo() = "foo" + val bar = "bar" +} + +fun checkEqual(x: Any, y: Any) { + assertEquals(x, y) + assertEquals(y, x) + assertEquals(x.hashCode(), y.hashCode()) +} + +fun box(): String { + checkEqual(A::foo, A::class.members.single { it.name == "foo" }) + checkEqual(A::bar, A::class.members.single { it.name == "bar" }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt new file mode 100644 index 00000000000..2fa12531a70 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +class A { + class Nested + + companion object +} + +fun box(): String { + assertEquals("class A", "${A::class}") + assertEquals("class A\$Nested", "${A.Nested::class}") + assertEquals("class A\$Companion", "${A.Companion::class}") + + assertEquals("class kotlin.Any", "${Any::class}") + assertEquals("class kotlin.Int", "${Int::class}") + assertEquals("class kotlin.Int\$Companion", "${Int.Companion::class}") + assertEquals("class kotlin.IntArray", "${IntArray::class}") + assertEquals("class kotlin.String", "${String::class}") + assertEquals("class kotlin.String", "${java.lang.String::class}") + + assertEquals("class kotlin.Array", "${Array::class}") + assertEquals("class kotlin.Array", "${Array::class}") + assertEquals("class kotlin.Array", "${Array>::class}") + + assertEquals("class java.lang.Runnable", "${Runnable::class}") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt new file mode 100644 index 00000000000..0e1aaec84c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt @@ -0,0 +1,91 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KProperty1 +import kotlin.test.assertEquals + +fun check(expected: String, p: KProperty1<*, *>) { + var s = p.toString() + + // Strip "val" or "var" + assert(s.startsWith("val ") || s.startsWith("var ")) { "Fail val/var: $s" } + s = s.substring(4) + + // Strip property type + s = s.substringBeforeLast(':') + + // Strip property name, leave only receiver class + s = s.substringBeforeLast('.') + + assertEquals(expected, s) +} + +val Boolean.x: Any get() = this +val Char.x: Any get() = this +val Byte.x: Any get() = this +val Short.x: Any get() = this +val Int.x: Any get() = this +val Float.x: Any get() = this +val Long.x: Any get() = this +val Double.x: Any get() = this + +val BooleanArray.x: Any get() = this +val CharArray.x: Any get() = this +val ByteArray.x: Any get() = this +val ShortArray.x: Any get() = this +val IntArray.x: Any get() = this +val FloatArray.x: Any get() = this +val LongArray.x: Any get() = this +val DoubleArray.x: Any get() = this + +val Array.a1: Any get() = this +val Array.a2: Any get() = this +val Array>.a3: Any get() = this +val Array.a4: Any get() = this + +val Any?.n1: Any get() = Any() +val Int?.n2: Any get() = Any() +val Array?.n3: Any get() = Any() +val Array.n4: Any get() = Any() +val Array?.n5: Any get() = Any() + +val Map.m: Any get() = this +val List>>.l: Any get() = this + +fun box(): String { + check("kotlin.Boolean", Boolean::x) + check("kotlin.Char", Char::x) + check("kotlin.Byte", Byte::x) + check("kotlin.Short", Short::x) + check("kotlin.Int", Int::x) + check("kotlin.Float", Float::x) + check("kotlin.Long", Long::x) + check("kotlin.Double", Double::x) + + check("kotlin.BooleanArray", BooleanArray::x) + check("kotlin.CharArray", CharArray::x) + check("kotlin.ByteArray", ByteArray::x) + check("kotlin.ShortArray", ShortArray::x) + check("kotlin.IntArray", IntArray::x) + check("kotlin.FloatArray", FloatArray::x) + check("kotlin.LongArray", LongArray::x) + check("kotlin.DoubleArray", DoubleArray::x) + + check("kotlin.Any?", Any?::n1) + check("kotlin.Int?", Int?::n2) + check("kotlin.Array?", Array?::n3) + check("kotlin.Array", Array::n4) + check("kotlin.Array?", Array?::n5) + + check("kotlin.Array", Array::a1) + check("kotlin.Array", Array::a2) + check("kotlin.Array>", Array>::a3) + check("kotlin.Array", Array::a4) + + check("kotlin.collections.Map", Map::m) + check("kotlin.collections.List>>", List>>::l) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt new file mode 100644 index 00000000000..1879444874b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +fun top() = 42 + +fun Int.intExt(): Int = this + +class A { + fun mem() {} +} + +class B { + fun mem() {} +} + + +fun checkEqual(x: Any, y: Any) { + assertEquals(x, y) + assertEquals(x.hashCode(), y.hashCode(), "Elements are equal but their hash codes are not: ${x.hashCode()} != ${y.hashCode()}") +} + +fun box(): String { + checkEqual(::top, ::top) + checkEqual(Int::intExt, Int::intExt) + checkEqual(A::mem, A::mem) + + assertFalse(::top == Int::intExt) + assertFalse(::top == A::mem) + assertFalse(A::mem == B::mem) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt new file mode 100644 index 00000000000..cb18362790f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package test + +import kotlin.test.assertEquals + +fun top() = 42 + +fun String.ext(): Int = 0 +fun IntRange?.ext2(): Array = arrayOfNulls(0) + +class A { + fun mem(): String = "" +} + +fun assertToString(s: String, x: Any) { + assertEquals(s, x.toString()) +} + +fun box(): String { + assertToString("fun top(): kotlin.Int", ::top) + assertToString("fun kotlin.String.ext(): kotlin.Int", String::ext) + assertToString("fun kotlin.ranges.IntRange?.ext2(): kotlin.Array", IntRange::ext2) + assertToString("fun test.A.mem(): kotlin.String", A::mem) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt new file mode 100644 index 00000000000..560d3098d45 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class A { + var String.id: String + get() = this + set(value) {} + + fun Int.foo(): Double = toDouble() +} + +fun box(): String { + val p = A::class.java.kotlin.memberExtensionProperties.single() + return if ("$p" == "var A.(kotlin.String.)id: kotlin.String") "OK" else "Fail $p" + + val q = A::class.java.kotlin.declaredFunctions.single() + if ("$q" != "fun A.(kotlin.Int.)foo(): kotlin.Double") return "Fail q $q" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt new file mode 100644 index 00000000000..30f80286b93 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +class A { + fun foo(s: String, x: Int) {} + fun bar(x: Int) {} + val baz = 42 +} + +fun box(): String { + // Dispatch receiver parameters of different callables are not equal + assertNotEquals(A::foo.parameters[0], A::bar.parameters[0]) + assertNotEquals(A::foo.parameters[0], A::baz.parameters[0]) + + assertNotEquals(A::foo.parameters[1], A::bar.parameters[1]) + assertNotEquals(A::foo.parameters[1], A::foo.parameters[2]) + assertNotEquals(A::bar.parameters[1], A::foo.parameters[2]) + + assertEquals(A::foo.parameters[0], A::foo.parameters[0]) + assertEquals(A::foo.parameters[0].hashCode(), A::foo.parameters[0].hashCode()) + assertEquals(A::foo.parameters[1], A::foo.parameters[1]) + assertEquals(A::foo.parameters[1].hashCode(), A::foo.parameters[1].hashCode()) + assertEquals(A::bar.parameters[0], A::bar.parameters[0]) + assertEquals(A::bar.parameters[0].hashCode(), A::bar.parameters[0].hashCode()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt new file mode 100644 index 00000000000..e184ff0f948 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +fun Int.foo(s: String) {} + +class A { + fun bar() {} +} + +fun baz(name: String) {} + +fun box(): String { + assertEquals( + listOf("extension receiver of ${Int::foo}", "parameter #1 s of ${Int::foo}"), + Int::foo.parameters.map(Any::toString) + ) + + assertEquals( + listOf("instance of ${A::bar}"), + A::bar.parameters.map(Any::toString) + ) + + assertEquals( + listOf("parameter #0 name of ${::baz}"), + ::baz.parameters.map(Any::toString) + ) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt new file mode 100644 index 00000000000..4a7f72c882b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +val top = 42 +var top2 = -23 + +val Int.intExt: Int get() = this +val Char.charExt: Int get() = this.toInt() + +class A(var mem: String) +class B(var mem: String) + + +fun checkEqual(x: Any, y: Any) { + assertEquals(x, y) + assertEquals(x.hashCode(), y.hashCode(), "Elements are equal but their hash codes are not: ${x.hashCode()} != ${y.hashCode()}") +} + +fun box(): String { + checkEqual(::top, ::top) + checkEqual(::top2, ::top2) + checkEqual(Int::intExt, Int::intExt) + checkEqual(A::mem, A::mem) + + assertFalse(::top == ::top2) + assertFalse(Int::intExt == Char::charExt) + assertFalse(A::mem == B::mem) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt new file mode 100644 index 00000000000..2db5df8c71a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +package test + +import kotlin.test.assertEquals + +val top = 42 +var top2 = -23 + +val String.ext: Int get() = 0 +var IntRange?.ext2: Int get() = 0; set(value) {} + +class A(val mem: String) +class B(var mem: String) + +fun assertToString(s: String, x: Any) { + assertEquals(s, x.toString()) +} + +fun box(): String { + assertToString("val top: kotlin.Int", ::top) + assertToString("var top2: kotlin.Int", ::top2) + assertToString("val kotlin.String.ext: kotlin.Int", String::ext) + assertToString("var kotlin.ranges.IntRange?.ext2: kotlin.Int", IntRange::ext2) + assertToString("val test.A.mem: kotlin.String", A::mem) + assertToString("var test.B.mem: kotlin.String", B::mem) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt new file mode 100644 index 00000000000..04f1bea016c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KType +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +fun unit(p: Unit): Unit {} + +fun nullable(s: String): String? = s + +class A { + fun typeParam(t: T): T = t +} + + +fun box(): String { + fun check(t1: KType, t2: KType) { + assertEquals(t1, t2) + assertEquals(t1.hashCode(), t2.hashCode()) + } + + check(::unit.parameters.single().type, ::unit.returnType) + + assertNotEquals(::nullable.parameters.single().type, ::nullable.returnType) + + val typeParam = A::class.members.single { it.name == "typeParam" } + check(typeParam.parameters.last().type, typeParam.returnType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt new file mode 100644 index 00000000000..240a36fcf7c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt @@ -0,0 +1,42 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +class A +class B + +class Fun { + fun foo(): T = null!! +} + +class Fourple + +fun box(): String { + assertEquals(A::class.typeParameters, A::class.typeParameters) + assertEquals(A::class.typeParameters.single().hashCode(), A::class.typeParameters.single().hashCode()) + + fun getFoo() = Fun::class.members.single { it.name == "foo" } + assertEquals(getFoo().typeParameters, getFoo().typeParameters) + assertEquals(getFoo().typeParameters.single().hashCode(), getFoo().typeParameters.single().hashCode()) + + assertNotEquals(A::class.typeParameters.single(), B::class.typeParameters.single()) + + val fi = Fourple::class.typeParameters + val fj = Fourple::class.typeParameters + for (i in 0..fi.size - 1) { + for (j in 0..fj.size - 1) { + if (i == j) { + assertEquals(fi[i], fj[j]) + assertEquals(fi[i].hashCode(), fj[j].hashCode()) + } else { + assertNotEquals(fi[i], fj[j]) + } + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt new file mode 100644 index 00000000000..8cfb7d03a3f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +interface Variance +class OneBound> +class SeveralBounds where T : Enum, T : Variance + +fun box(): String { + assertEquals("[A, in B, out C, D]", Variance::class.typeParameters.toString()) + assertEquals("[T]", OneBound::class.typeParameters.toString()) + assertEquals("[T]", SeveralBounds::class.typeParameters.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt new file mode 100644 index 00000000000..b41a7dcbeda --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +fun String?.foo(x: Int, y: Array, z: IntArray, w: List>>) {} + +class A { + fun bar(t: T, u: U): T? = null +} + +fun baz(inProjection: A, outProjection: A) {} + +fun box(): String { + assertEquals( + listOf( + "kotlin.String?", + "kotlin.Int", + "kotlin.Array", + "kotlin.IntArray", + "kotlin.collections.List>>" + ), + String?::foo.parameters.map { it.type.toString() } + ) + + assertEquals("kotlin.Unit", String?::foo.returnType.toString()) + + val bar = A::class.members.single { it.name == "bar" } + assertEquals(listOf("A", "T", "U"), bar.parameters.map { it.type.toString() }) + assertEquals("T?", bar.returnType.toString()) + + assertEquals( + listOf("A", "A"), + ::baz.parameters.map { it.type.toString() } + ) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt new file mode 100644 index 00000000000..a0b1a002084 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class A { + inner class B { + inner class C + } +} + +fun foo(): A.B.C = null!! + +fun box(): String { + assertEquals("A.B.C", ::foo.returnType.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt new file mode 100644 index 00000000000..36293408282 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt @@ -0,0 +1,54 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +interface Interface { + open fun openFun() {} + abstract fun abstractFun() +} + +abstract class AbstractClass { + final val finalVal = Unit + open val openVal = Unit + abstract var abstractVar: Unit +} + +fun box(): String { + assertFalse(Interface::openFun.isFinal) + assertTrue(Interface::openFun.isOpen) + assertFalse(Interface::openFun.isAbstract) + + assertFalse(Interface::abstractFun.isFinal) + assertFalse(Interface::abstractFun.isOpen) + assertTrue(Interface::abstractFun.isAbstract) + + assertTrue(AbstractClass::finalVal.isFinal) + assertFalse(AbstractClass::finalVal.isOpen) + assertFalse(AbstractClass::finalVal.isAbstract) + assertTrue(AbstractClass::finalVal.getter.isFinal) + assertFalse(AbstractClass::finalVal.getter.isOpen) + assertFalse(AbstractClass::finalVal.getter.isAbstract) + + assertFalse(AbstractClass::openVal.isFinal) + assertTrue(AbstractClass::openVal.isOpen) + assertFalse(AbstractClass::openVal.isAbstract) + assertFalse(AbstractClass::openVal.getter.isFinal) + assertTrue(AbstractClass::openVal.getter.isOpen) + assertFalse(AbstractClass::openVal.getter.isAbstract) + + assertFalse(AbstractClass::abstractVar.isFinal) + assertFalse(AbstractClass::abstractVar.isOpen) + assertTrue(AbstractClass::abstractVar.isAbstract) + assertFalse(AbstractClass::abstractVar.getter.isFinal) + assertFalse(AbstractClass::abstractVar.getter.isOpen) + assertTrue(AbstractClass::abstractVar.getter.isAbstract) + assertFalse(AbstractClass::abstractVar.setter.isFinal) + assertFalse(AbstractClass::abstractVar.setter.isOpen) + assertTrue(AbstractClass::abstractVar.setter.isAbstract) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt new file mode 100644 index 00000000000..a122b6031c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt @@ -0,0 +1,58 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KFunction +import kotlin.reflect.KProperty +import kotlin.reflect.KVisibility +import kotlin.test.assertEquals + +open class Foo { + public fun publicFun() {} + protected fun protectedFun() {} + internal fun internalFun() {} + private fun privateFun() {} + private fun privateToThisFun(): T = null!! + + fun getProtectedFun() = this::protectedFun + fun getPrivateFun() = this::privateFun + fun getPrivateToThisFun(): KFunction<*> = this::privateToThisFun + + public val publicVal = Unit + protected val protectedVar = Unit + internal val internalVal = Unit + private val privateVal = Unit + private val privateToThisVal: T? = null + + fun getProtectedVar() = this::protectedVar + fun getPrivateVal() = this::privateVal + fun getPrivateToThisVal(): KProperty<*> = this::privateToThisVal + + public var publicVarPrivateSetter = Unit + private set + + fun getPublicVarPrivateSetter() = this::publicVarPrivateSetter +} + +fun box(): String { + val f = Foo() + + assertEquals(KVisibility.PUBLIC, f::publicFun.visibility) + assertEquals(KVisibility.PROTECTED, f.getProtectedFun().visibility) + assertEquals(KVisibility.INTERNAL, f::internalFun.visibility) + assertEquals(KVisibility.PRIVATE, f.getPrivateFun().visibility) + assertEquals(KVisibility.PRIVATE, f.getPrivateToThisFun().visibility) + + assertEquals(KVisibility.PUBLIC, f::publicVal.visibility) + assertEquals(KVisibility.PROTECTED, f.getProtectedVar().visibility) + assertEquals(KVisibility.INTERNAL, f::internalVal.visibility) + assertEquals(KVisibility.PRIVATE, f.getPrivateVal().visibility) + assertEquals(KVisibility.PRIVATE, f.getPrivateToThisVal().visibility) + + assertEquals(KVisibility.PUBLIC, f.getPublicVarPrivateSetter().visibility) + assertEquals(KVisibility.PUBLIC, f.getPublicVarPrivateSetter().getter.visibility) + assertEquals(KVisibility.PRIVATE, f.getPublicVarPrivateSetter().setter.visibility) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt new file mode 100644 index 00000000000..5e25940cb26 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt @@ -0,0 +1,59 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +class FinalClass { + companion object Companion +} +open class OpenClass +abstract class AbstractClass +interface Interface +enum class EnumClass +enum class EnumClassWithAbstractMember { ; abstract fun foo() } +annotation class AnnotationClass +object Object + +fun box(): String { + assertTrue(FinalClass::class.isFinal) + assertFalse(FinalClass::class.isOpen) + assertFalse(FinalClass::class.isAbstract) + + assertTrue(FinalClass.Companion::class.isFinal) + assertFalse(FinalClass.Companion::class.isOpen) + assertFalse(FinalClass.Companion::class.isAbstract) + + assertFalse(OpenClass::class.isFinal) + assertTrue(OpenClass::class.isOpen) + assertFalse(OpenClass::class.isAbstract) + + assertFalse(AbstractClass::class.isFinal) + assertFalse(AbstractClass::class.isOpen) + assertTrue(AbstractClass::class.isAbstract) + + assertFalse(Interface::class.isFinal) + assertFalse(Interface::class.isOpen) + assertTrue(Interface::class.isAbstract) + + assertTrue(EnumClass::class.isFinal) + assertFalse(EnumClass::class.isOpen) + assertFalse(EnumClass::class.isAbstract) + + assertTrue(EnumClassWithAbstractMember::class.isFinal) + assertFalse(EnumClassWithAbstractMember::class.isOpen) + assertFalse(EnumClassWithAbstractMember::class.isAbstract) + + // Note that unlike in JVM, annotation classes are final in Kotlin + assertTrue(AnnotationClass::class.isFinal) + assertFalse(AnnotationClass::class.isOpen) + assertFalse(AnnotationClass::class.isAbstract) + + assertTrue(Object::class.isFinal) + assertFalse(Object::class.isOpen) + assertFalse(Object::class.isAbstract) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt new file mode 100644 index 00000000000..4999e740d0e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.reflect.KVisibility +import kotlin.test.assertEquals + +class DefaultVisibilityClass +public class PublicClass { + protected class ProtectedClass + fun getProtectedClass(): KClass<*> = ProtectedClass::class +} +internal class InternalClass +private class PrivateClass + +fun box(): String { + assertEquals(KVisibility.PUBLIC, DefaultVisibilityClass::class.visibility) + assertEquals(KVisibility.PUBLIC, PublicClass::class.visibility) + assertEquals(KVisibility.PROTECTED, PublicClass().getProtectedClass().visibility) + assertEquals(KVisibility.INTERNAL, InternalClass::class.visibility) + assertEquals(KVisibility.PRIVATE, PrivateClass::class.visibility) + + class Local + assertEquals(null, Local::class.visibility) + + val anonymous = object {} + assertEquals(null, anonymous::class.visibility) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt new file mode 100644 index 00000000000..9fb67afb44d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt @@ -0,0 +1,46 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +sealed class S { + data class DataClass(val x: Int) : S() + inner class InnerClass + companion object + object NonCompanionObject +} + +fun box(): String { + assertTrue(S::class.isSealed) + assertFalse(S::class.isFinal) + assertFalse(S::class.isOpen) + assertFalse(S::class.isAbstract) + assertFalse(S::class.isData) + assertFalse(S::class.isInner) + assertFalse(S::class.isCompanion) + + assertFalse(S.DataClass::class.isSealed) + assertTrue(S.DataClass::class.isData) + assertFalse(S.DataClass::class.isInner) + assertFalse(S.DataClass::class.isCompanion) + + assertFalse(S.InnerClass::class.isSealed) + assertFalse(S.InnerClass::class.isData) + assertTrue(S.InnerClass::class.isInner) + assertFalse(S.InnerClass::class.isCompanion) + + assertFalse(S.Companion::class.isSealed) + assertFalse(S.Companion::class.isData) + assertFalse(S.Companion::class.isInner) + assertTrue(S.Companion::class.isCompanion) + + assertFalse(S.NonCompanionObject::class.isSealed) + assertFalse(S.NonCompanionObject::class.isData) + assertFalse(S.NonCompanionObject::class.isInner) + assertFalse(S.NonCompanionObject::class.isCompanion) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt new file mode 100644 index 00000000000..b6e3c43a230 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt @@ -0,0 +1,62 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +inline fun inline() {} +class External { external fun external() } +operator fun Unit.invoke() {} +infix fun Unit.infix(unit: Unit) {} +// TODO: support or prohibit references to suspend functions +// class Suspend { suspend fun suspend(c: Continuation) {} } + +val externalGetter = Unit + external get + +inline var inlineProperty: Unit + get() = Unit + set(value) {} + +fun box(): String { + assertTrue(::inline.isInline) + assertFalse(::inline.isExternal) + assertFalse(::inline.isOperator) + assertFalse(::inline.isInfix) + assertFalse(::inline.isSuspend) + + assertFalse(External::external.isInline) + assertTrue(External::external.isExternal) + assertFalse(External::external.isOperator) + assertFalse(External::external.isInfix) + assertFalse(External::external.isSuspend) + + assertFalse(Unit::invoke.isInline) + assertFalse(Unit::invoke.isExternal) + assertTrue(Unit::invoke.isOperator) + assertFalse(Unit::invoke.isInfix) + assertFalse(Unit::invoke.isSuspend) + + assertFalse(Unit::infix.isInline) + assertFalse(Unit::infix.isExternal) + assertFalse(Unit::infix.isOperator) + assertTrue(Unit::infix.isInfix) + assertFalse(Unit::infix.isSuspend) + +// assertFalse(Suspend::suspend.isInline) +// assertFalse(Suspend::suspend.isExternal) +// assertFalse(Suspend::suspend.isOperator) +// assertFalse(Suspend::suspend.isInfix) +// assertTrue(Suspend::suspend.isSuspend) + + assertTrue(::externalGetter.getter.isExternal) + assertFalse(::externalGetter.getter.isInline) + + assertFalse(::inlineProperty.getter.isExternal) + assertTrue(::inlineProperty.getter.isInline) + assertTrue(::inlineProperty.setter.isInline) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt new file mode 100644 index 00000000000..3376fd86266 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +class J { + protected class C {} + protected static class D {} + + void foo() {} + protected void bar() {} + protected static void baz() {} +} + +// FILE: K.kt + +import kotlin.test.assertEquals + +fun box(): String { + // Package-private class + assertEquals(null, J::class.visibility) + // Protected+package class + assertEquals(null, J.C::class.visibility) + // Protected static class + assertEquals(null, J.D::class.visibility) + + // Package-private method + assertEquals(null, J::foo.visibility) + // Protected+package method + assertEquals(null, J::bar.visibility) + // Protected static method + assertEquals(null, J::baz.visibility) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt new file mode 100644 index 00000000000..f571ca2eabd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +const val const = "const" +val nonConst = "nonConst" + +class A { + lateinit var lateinit: Unit + var nonLateinit = Unit +} + +fun box(): String { + assertTrue(::const.isConst) + assertFalse(::nonConst.isConst) + + assertTrue(A::lateinit.isLateinit) + assertFalse(A::nonLateinit.isLateinit) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt new file mode 100644 index 00000000000..1e9003f822a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +class A { + fun nonReified(): T = null!! + inline fun reified(): U = null!! +} + +fun box(): String { + assertFalse(A::class.members.single { it.name == "nonReified" }.typeParameters.single().isReified) + assertTrue(A::class.members.single { it.name == "reified" }.typeParameters.single().isReified) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt new file mode 100644 index 00000000000..a3f57e30b09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: Test1.kt + +@file:kotlin.jvm.JvmName("Test") +@file:kotlin.jvm.JvmMultifileClass +package test + +import kotlin.test.assertEquals + +fun getX() = 1 + +fun box(): String { + assertEquals("getX", ::getX.name) + assertEquals("getY", ::getY.name) + assertEquals("getZ", ::getZ.name) + + assertEquals(1, ::getX.call()) + assertEquals(239, ::getY.call()) + assertEquals(42, ::getZ.callBy(emptyMap())) + + return "OK" +} + +// FILE: Test2.kt + +@file:kotlin.jvm.JvmName("Test") +@file:kotlin.jvm.JvmMultifileClass +package test + +fun getY() = 239 + +fun getZ(value: Int = 42) = value diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt new file mode 100644 index 00000000000..8939a169de1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt @@ -0,0 +1,45 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// KT-11447 Multifile declaration causes IAE: Method can not access a member of class +// WITH_REFLECT +// FILE: Test1.kt + +@file:kotlin.jvm.JvmName("Test") +@file:kotlin.jvm.JvmMultifileClass +package test + +import kotlin.test.assertEquals + +var x = 1 + +fun box(): String { + assertEquals("x", ::x.name) + assertEquals("y", ::y.name) + assertEquals("MAGIC_NUMBER", ::MAGIC_NUMBER.name) + + assertEquals(1, ::x.call()) + assertEquals(1, ::x.getter.call()) + + assertEquals(239, ::y.call()) + assertEquals(239, ::y.getter.call()) + + assertEquals(42, ::MAGIC_NUMBER.call()) + assertEquals(42, ::MAGIC_NUMBER.getter.call()) + + assertEquals(Unit, ::x.setter.call(2)) + assertEquals(2, ::x.call()) + assertEquals(2, ::x.getter.call()) + + return "OK" +} + +// FILE: Test2.kt + +@file:kotlin.jvm.JvmName("Test") +@file:kotlin.jvm.JvmMultifileClass +package test + +val y = 239 + +const val MAGIC_NUMBER = 42 diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt new file mode 100644 index 00000000000..81d5b406ced --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt @@ -0,0 +1,75 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK +// FILE: 1.kt + +@file:kotlin.jvm.JvmName("Test") +@file:kotlin.jvm.JvmMultifileClass +package test + +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +fun testX() { + val field = ::x.javaField ?: throw AssertionError("No java field for ${::x.name}") + + try { + field.get(null) + throw AssertionError("Fail: field.get should fail because the field is private") + } + catch (e: IllegalAccessException) { + // OK + } + + field.setAccessible(true) + assertEquals("I am x", field.get(null)) + field.set(null, "OK") +} + +fun testY() { + val field = ::y.javaField ?: throw AssertionError("No java field for ${::y.name}") + + assertEquals("I am const y", field.get(null)) + + // Accessible = false should have no effect because the field is public + field.setAccessible(false) + + assertEquals("I am const y", field.get(null)) +} + +fun testZ() { + val field = refZ.javaField ?: throw AssertionError("No java field for ${refZ.name}") + + + try { + field.get(null) + throw AssertionError("IllegalAccessError expected") + } + catch (e: IllegalAccessException) { + // OK + } + + field.setAccessible(true) + assertEquals("I am private const val Z", field.get(null)) +} + +fun box(): String { + testX() + testY() + testZ() + return x +} + +// FILE: 2.kt + +@file:kotlin.jvm.JvmName("Test") +@file:kotlin.jvm.JvmMultifileClass +package test + +var x = "I am x" +const val y = "I am const y" +private const val z = "I am private const val Z" + +val refZ = ::z \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt new file mode 100644 index 00000000000..456830c2cd9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.* + +class Klass + +fun box(): String { + val kClass = Klass::class + val jClass = kClass.java + val kjClass = Klass::class.java + val kkClass = jClass.kotlin + val jjClass = kkClass.java + + assertEquals("Klass", jClass.getSimpleName()) + assertEquals("Klass", kjClass.getSimpleName()) + assertEquals("Klass", kkClass.java.simpleName) + assertEquals(kjClass, jjClass) + + try { kClass.simpleName; return "Fail 1" } catch (e: Error) {} + try { kClass.qualifiedName; return "Fail 2" } catch (e: Error) {} + try { kClass.members; return "Fail 3" } catch (e: Error) {} + + val jlError = Error::class.java + val kljError = Error::class + val jljError = kljError.java + val jlkError = jlError.kotlin + + assertEquals("Error", jlError.getSimpleName()) + assertEquals("Error", jljError.getSimpleName()) + assertEquals("Error", jlkError.java.simpleName) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt new file mode 100644 index 00000000000..83fb877637c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KCallable +import kotlin.test.* + +class M { + fun foo() {} + val bar = 1 +} + +fun checkEquals(x: KCallable<*>, y: KCallable<*>) { + assertEquals(x, y) + assertEquals(y, x) + assertEquals(x.hashCode(), y.hashCode()) +} + +fun checkToString(x: KCallable<*>, expected: String) { + assertEquals(expected + " (Kotlin reflection is not available)", x.toString()) +} + +fun box(): String { + checkEquals(M::foo, M::foo) + checkEquals(M::bar, M::bar) + checkEquals(::M, ::M) + + checkToString(M::foo, "function foo") + checkToString(M::bar, "property bar") + checkToString(::M, "constructor") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt new file mode 100644 index 00000000000..b6a963f9ab9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.reflect.KClass +import kotlin.test.* + +class M + +fun check(x: KClass<*>) { + assertEquals(x, x.java.kotlin) + assertEquals(x.hashCode(), x.java.kotlin.hashCode()) + assertEquals(x.java.toString() + " (Kotlin reflection is not available)", x.toString()) +} + +fun box(): String { + check(M::class) + check(String::class) + check(Error::class) + check(Int::class) + check(java.lang.Integer::class) + check(MutableList::class) + check(Array::class) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt new file mode 100644 index 00000000000..e65c322986e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun check(name: String, c: Class<*>) { + assertEquals(name, c.simpleName) +} + +fun box(): String { + check("boolean", Boolean::class.java) + check("byte", Byte::class.java) + check("char", Char::class.java) + check("short", Short::class.java) + check("int", Int::class.java) + check("float", Float::class.java) + check("long", Long::class.java) + check("double", Double::class.java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyGetSetName.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyGetSetName.kt new file mode 100644 index 00000000000..f485e0554fe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyGetSetName.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.reflect.* + +data class Box(val value: String) + +var pr = Box("first") + +fun box(): String { + val p = ::pr + if (p.get().value != "first") return "Fail value 1: ${p.get()}" + if (p.name != "pr") return "Fail name: ${p.name}" + p.set(Box("second")) + if (p.get().value != "second") return "Fail value 2: ${p.get()}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyInstanceof.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyInstanceof.kt new file mode 100644 index 00000000000..bbd34af42b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/propertyInstanceof.kt @@ -0,0 +1,37 @@ +// WITH_RUNTIME + +import kotlin.reflect.* +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +class A { + val readonly: String = "" + var mutable: String = "" +} + +val readonly: String = "" +var mutable: String = "" + +fun box(): String { + assertTrue(::readonly is KProperty0<*>) + assertFalse(::readonly is KMutableProperty0<*>) + assertFalse(::readonly is KProperty1<*, *>) + assertFalse(::readonly is KProperty2<*, *, *>) + + assertTrue(::mutable is KProperty0<*>) + assertTrue(::mutable is KMutableProperty0<*>) + assertFalse(::mutable is KProperty1<*, *>) + assertFalse(::mutable is KProperty2<*, *, *>) + + assertFalse(A::readonly is KProperty0<*>) + assertTrue(A::readonly is KProperty1<*, *>) + assertFalse(A::readonly is KMutableProperty1<*, *>) + assertFalse(A::readonly is KProperty2<*, *, *>) + + assertFalse(A::mutable is KProperty0<*>) + assertTrue(A::mutable is KProperty1<*, *>) + assertTrue(A::mutable is KMutableProperty1<*, *>) + assertFalse(A::mutable is KProperty2<*, *, *>) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt new file mode 100644 index 00000000000..f8c7514c81f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +class Klass + +inline fun simpleName(): String = + T::class.java.getSimpleName() + +inline fun simpleName2(): String { + val kClass = T::class // Intrinsic for T::class.java is not used + return kClass.java.getSimpleName() +} + + +fun box(): String { + assertEquals("Integer", simpleName()) + assertEquals("Integer", simpleName2()) + assertEquals("Klass", simpleName()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt new file mode 100644 index 00000000000..202059e4942 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertNotNull + +class Klass + +fun box(): String { + assertNotNull(Int::class) + assertNotNull(String::class) + assertNotNull(Klass::class) + assertNotNull(Error::class) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt new file mode 100644 index 00000000000..69aea956d07 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +import kotlin.reflect.KParameter +import kotlin.test.assertEquals + +class Outer(val s1: String) { + inner class Inner(val s2: String, val s3: String = "K") { + val result = s1 + s2 + s3 + } +} + +fun KParameter.check(name: String) { + assertEquals(name, this.name!!) + assertEquals(KParameter.Kind.VALUE, this.kind) +} + +fun box(): String { + val ctor = Outer("O")::Inner + val ctorPararms = ctor.parameters + + ctorPararms[0].check("s2") + ctorPararms[1].check("s3") + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt new file mode 100644 index 00000000000..646eed1de73 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt @@ -0,0 +1,26 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.assertEquals + +object Host { + fun foo(i: Int, s: String) {} +} + +fun box(): String { + val fooParams = Host::foo.parameters + + assertEquals(2, fooParams.size) + + assertEquals("i", fooParams[0].name) + assertEquals(Int::class.java, fooParams[0].type.javaType) + + assertEquals("s", fooParams[1].name) + assertEquals(String::class.java, fooParams[1].type.javaType) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt new file mode 100644 index 00000000000..0b47967fd42 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt @@ -0,0 +1,35 @@ +// TODO: investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.* + +class C { + fun foo() {} + var bar = "OK" +} + +fun C.extFun(i: Int) {} + +fun KParameter.check(name: String) { + assertEquals(name, this.name!!) + assertEquals(KParameter.Kind.VALUE, this.kind) +} + +fun box(): String { + val cFoo = C()::foo + val cBar = C()::bar + val cExtFun = C()::extFun + + assertEquals(0, cFoo.parameters.size) + assertEquals(0, cBar.getter.parameters.size) + assertEquals(1, cBar.setter.parameters.size) + + assertEquals(1, cExtFun.parameters.size) + cExtFun.parameters[0].check("i") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt new file mode 100644 index 00000000000..808f3dc072b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public void bar(int x) {} +} + +// FILE: K.kt + +import kotlin.reflect.full.findParameterByName +import kotlin.test.assertEquals +import kotlin.test.assertNull + +fun foo(x: Int) = x + +fun box(): String { + assertEquals(::foo.parameters.single(), ::foo.findParameterByName("x")) + assertNull(::foo.findParameterByName("y")) + + assertNull(J::bar.findParameterByName("x")) + assertNull(J::bar.findParameterByName("y")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt new file mode 100644 index 00000000000..853b6d017c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +fun foo(bar: String): Int = bar.length + +class A(val c: String) { + fun foz(baz: Int) {} + + fun Double.mext(mez: Long) {} +} + +fun Int.qux(zux: String) {} + +fun checkParameters(f: KFunction<*>, names: List) { + val params = f.parameters + assertEquals(names, params.map { it.name }) + assertEquals(params.indices.toList(), params.map { it.index }) +} + +fun box(): String { + checkParameters(::box, listOf()) + checkParameters(::foo, listOf("bar")) + checkParameters(A::foz, listOf(null, "baz")) + checkParameters(Int::qux, listOf(null, "zux")) + + checkParameters(A::class.functions.single { it.name == "mext" }, listOf(null, null, "mez")) + + checkParameters(::A, listOf("c")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt new file mode 100644 index 00000000000..c44fd9c4b66 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.* +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class A { + fun String.memExt(param: Int) {} +} + +fun topLevel() {} + +fun Int.ext(vararg o: Any) {} + +fun box(): String { + A::class.members.single { it.name == "memExt" }.let { + assertNotNull(it.instanceParameter) + assertNotNull(it.extensionReceiverParameter) + assertEquals(1, it.valueParameters.size) + } + + ::topLevel.let { + assertNull(it.instanceParameter) + assertNull(it.extensionReceiverParameter) + assertEquals(0, it.valueParameters.size) + } + + Int::ext.let { + assertNull(it.instanceParameter) + assertNotNull(it.extensionReceiverParameter) + assertEquals(1, it.valueParameters.size) + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt new file mode 100644 index 00000000000..e44112a1410 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class A { + fun foo(p1: String, p2: String?, p3: T, p4: U, p5: U?) { } +} + +fun Any?.ext() {} + +fun box(): String { + val ps = A::class.declaredFunctions.single().parameters.map { it.type.isMarkedNullable } + assertEquals(listOf(false, false, true, false, false, true), ps) + + assertTrue(Any?::ext.parameters.single().type.isMarkedNullable) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt new file mode 100644 index 00000000000..faf6aedb1a6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +open class A { + open fun foo(x: Int, y: Int = 1) {} +} + +class B : A() { + override fun foo(x: Int, y: Int) {} +} + +class C : A() + + +fun Int.extFun() {} + +fun box(): String { + assertEquals(listOf(false, false, true), A::foo.parameters.map { it.isOptional }) + assertEquals(listOf(false, false, true), B::foo.parameters.map { it.isOptional }) + assertEquals(listOf(false, false, true), C::foo.parameters.map { it.isOptional }) + + assertFalse(Int::extFun.parameters.single().isOptional) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt new file mode 100644 index 00000000000..69e4078006d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public @interface J { + short s(); + long j(); + boolean z(); + int i(); + float f(); + char c(); + double d(); +} + +// FILE: K.kt + +import kotlin.reflect.KParameter +import kotlin.test.assertEquals + +fun box(): String { + val ctor = J::class.constructors.single() + + // We sort parameters by name for consistency + assertEquals(listOf("c", "d", "f", "i", "j", "s", "z"), ctor.parameters.map { it.name }) + assert(ctor.parameters.all { it.kind == KParameter.Kind.VALUE }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt new file mode 100644 index 00000000000..81c55e79d58 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + void foo(String s, int i) {} + + static void bar(J j) {} +} + +// FILE: K.kt + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(listOf(null, null, null), J::foo.parameters.map { it.name }) + assertEquals(listOf(null), J::bar.parameters.map { it.name }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt new file mode 100644 index 00000000000..31311ea8beb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.KParameter.Kind.* +import kotlin.test.assertEquals + +class A { + fun Int.foo(x: String) {} + + inner class Inner(s: String) {} +} + +fun box(): String { + val foo = A::class.memberExtensionFunctions.single() + + assertEquals(listOf(INSTANCE, EXTENSION_RECEIVER, VALUE), foo.parameters.map { it.kind }) + assertEquals(listOf(INSTANCE, VALUE), A::Inner.parameters.map { it.kind }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt new file mode 100644 index 00000000000..b3aa00ed4e1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +var default: Int = 0 + +var defaultAnnotated: Int = 0 + public set + +var custom: Int = 0 + set(myName: Int) {} + +fun checkPropertySetterParam(property: KMutableProperty<*>, name: String?) { + val parameter = property.setter.parameters.single() + assertEquals(0, parameter.index) + assertEquals(name, parameter.name) +} + +fun box(): String { + checkPropertySetterParam(::default, null) + checkPropertySetterParam(::defaultAnnotated, null) + checkPropertySetterParam(::custom, "myName") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt new file mode 100644 index 00000000000..234964d8f6e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +var foo = "" +var String.bar: String + get() = this + set(value) {} + +class A(var baz: Int) { + var String.quux: String + get() = this + set(value) {} +} + +fun box(): String { + assertEquals("", ::foo.getter.name) + assertEquals("", ::foo.setter.name) + + assertEquals("", String::bar.getter.name) + assertEquals("", String::bar.setter.name) + + assertEquals("", A::baz.getter.name) + assertEquals("", A::baz.setter.name) + + val me = A::class.memberExtensionProperties.single() as KMutableProperty2 + assertEquals("", me.getter.name) + assertEquals("", me.setter.name) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt new file mode 100644 index 00000000000..1640522f1af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +var state: String = "" + +var String.prop: String + get() = length.toString() + set(value) { state = this + value } + +fun box(): String { + val prop = String::prop + + assertEquals("3", prop.getter.invoke("abc")) + assertEquals("5", prop.getter("defgh")) + + prop.setter("O", "K") + + return state +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt new file mode 100644 index 00000000000..7d5020c49f8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.assertEquals + +class C(var state: String) { + var String.prop: String + get() = length.toString() + set(value) { state = this + value } +} + +fun box(): String { + val prop = C::class.memberExtensionProperties.single() as KMutableProperty2 + + val c = C("") + assertEquals("3", prop.getter.invoke(c, "abc")) + assertEquals("1", prop.getter(c, "d")) + + prop.setter(c, "O", "K") + + return c.state +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt new file mode 100644 index 00000000000..c96895ab6fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class C(var state: String) + +fun box(): String { + val prop = C::state + + val c = C("1") + assertEquals("1", prop.getter.invoke(c)) + assertEquals("1", prop.getter(c)) + + prop.setter(c, "OK") + + return prop.get(c) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt new file mode 100644 index 00000000000..73d72347c5b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +var state: String = "" + +fun box(): String { + val prop = ::state + + assertEquals("", prop.getter.invoke()) + assertEquals("", prop.getter()) + + prop.setter("OK") + + return prop.get() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt new file mode 100644 index 00000000000..df4ec4fb96a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.* + +open class Super { + val a: Int = 1 + val String.b: String get() = this +} + +class Sub : Super() { + val c: Double = 1.0 + val Char.d: Char get() = this +} + +fun box(): String { + val sub = Sub::class + + assertEquals(listOf("a", "c"), sub.memberProperties.map { it.name }.sorted()) + assertEquals(listOf("b", "d"), sub.memberExtensionProperties.map { it.name }.sorted()) + assertEquals(listOf("c"), sub.declaredMemberProperties.map { it.name }) + assertEquals(listOf("d"), sub.declaredMemberExtensionProperties.map { it.name }) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt new file mode 100644 index 00000000000..e0c673ace25 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +class K(private val value: String) + +fun box(): String { + val p = K::class.java.kotlin.memberProperties.single() as KProperty1 + + try { + return p.get(K("Fail: private property should not be accessible by default")) + } + catch (e: IllegalCallableAccessException) { + // OK + } + + p.isAccessible = true + + return p.get(K("OK")) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt new file mode 100644 index 00000000000..cbcf79d07cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt @@ -0,0 +1,70 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public String publicMemberJ; + private String privateMemberJ; + public static String publicStaticJ; + private static String privateStaticJ; +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.test.assertEquals + +open class K : J() { + public val publicMemberK: String = "" + private val privateMemberK: String = "" + public val Any.publicMemberExtensionK: String get() = "" + private val Any.privateMemberExtensionK: String get() = "" +} + +class L : K() + +fun Collection>.names(): Set = + this.map { it.name }.toSet() + +fun check(c: Collection>, names: Set) { + assertEquals(names, c.names()) +} + +fun box(): String { + val j = J::class + + check(j.staticProperties, + setOf("publicStaticJ", "privateStaticJ")) + check(j.declaredMemberProperties, + setOf("publicMemberJ", "privateMemberJ")) + check(j.declaredMemberExtensionProperties, + emptySet()) + + check(j.memberProperties, j.declaredMemberProperties.names()) + check(j.memberExtensionProperties, emptySet()) + + val k = K::class + + check(k.staticProperties, + emptySet()) + check(k.declaredMemberProperties, + setOf("publicMemberK", "privateMemberK")) + check(k.declaredMemberExtensionProperties, + setOf("publicMemberExtensionK", "privateMemberExtensionK")) + + check(k.memberProperties, setOf("publicMemberJ") + k.declaredMemberProperties.names()) + check(k.memberExtensionProperties, k.declaredMemberExtensionProperties.names()) + + + val l = L::class + + check(l.staticProperties, emptySet()) + check(l.declaredMemberProperties, emptySet()) + check(l.declaredMemberExtensionProperties, emptySet()) + check(l.memberProperties, setOf("publicMemberJ", "publicMemberK")) + check(l.memberExtensionProperties, setOf("publicMemberExtensionK")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt new file mode 100644 index 00000000000..277f3d15473 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.test.* + +open class Super(val r: String) + +class Sub(r: String) : Super(r) + +fun box(): String { + val props = Sub::class.java.kotlin.declaredMemberProperties + if (!props.isEmpty()) return "Fail $props" + + val allProps = Sub::class.java.kotlin.memberProperties + assertEquals(listOf("r"), allProps.map { it.name }) + return allProps.single().get(Sub("OK")) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt new file mode 100644 index 00000000000..72746db555e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class A { + val result = "OK" +} + +fun box(): String { + val k: KProperty1, *> = A::class.memberProperties.single() + return k.get(A()) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt new file mode 100644 index 00000000000..e5f16577086 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// KT-13700 Exception obtaining descriptor for property reference + +import kotlin.test.assertEquals + +interface H { + val parent : T? +} + +interface A : H + +fun box(): String { + assertEquals("A?", A::parent.returnType.toString()) + assertEquals("T?", H::parent.returnType.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt new file mode 100644 index 00000000000..d4f14856955 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt @@ -0,0 +1,14 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +data class Box(val element: T) + +fun box(): String { + val p = Box::element + assertEquals("val Box.element: T", p.toString()) + return p.call(Box("OK")) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt new file mode 100644 index 00000000000..50c9df2be44 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt @@ -0,0 +1,31 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +var storage = "before" + +class A { + val String.readonly: String + get() = this + + var String.mutable: String + get() = storage + set(value) { storage = value } +} + +fun box(): String { + val props = A::class.java.kotlin.memberExtensionProperties + val readonly = props.single { it.name == "readonly" } + assert(readonly !is KMutableProperty2) { "Fail 1: $readonly" } + val mutable = props.single { it.name == "mutable" } + assert(mutable is KMutableProperty2) { "Fail 2: $mutable" } + + val a = A() + mutable as KMutableProperty2 + assert(mutable.get(a, "") == "before") { "Fail 3: ${mutable.get(a, "")}" } + mutable.set(a, "", "OK") + return mutable.get(a, "") +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt new file mode 100644 index 00000000000..e87e566dec5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class A(val readonly: String) { + var mutable: String = "before" +} + +fun box(): String { + val props = A::class.java.kotlin.memberProperties + val readonly = props.single { it.name == "readonly" } + assert(readonly !is KMutableProperty1) { "Fail 1: $readonly" } + val mutable = props.single { it.name == "mutable" } + assert(mutable is KMutableProperty1) { "Fail 2: $mutable" } + + val a = A("") + mutable as KMutableProperty1 + assert(mutable.get(a) == "before") { "Fail 3: ${mutable.get(a)}" } + mutable.set(a, "OK") + return mutable.get(a) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt new file mode 100644 index 00000000000..5f5904536c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.declaredMemberProperties + +class A(val foo: String) + +fun box(): String { + return (A::class.declaredMemberProperties.single()).invoke(A("OK")) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt new file mode 100644 index 00000000000..aee681049dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J { + public String result = null; +} + +// FILE: K.kt + +class K : J() + +fun box(): String { + val k = K() + val p = K::result + if (p.get(k) != null) return "Fail" + p.set(k, "OK") + return p.get(k) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt new file mode 100644 index 00000000000..c4a7e21464d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public static String x; + + static String packageLocalField; +} + +// FILE: K.kt + +import kotlin.test.assertEquals + +fun box(): String { + val f = J::x + assertEquals("x", f.name) + + assertEquals(f, J::class.members.single { it.name == "x" }) + + f.set("OK") + assertEquals("OK", J.x) + assertEquals("OK", f.getter()) + + val pl = J::packageLocalField.getter + try { + pl() + return "Fail: package local field must be inaccessible" + } catch (e: Exception) { + // OK + } + + return f.get() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt new file mode 100644 index 00000000000..c1e4cb4f6f5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J extends K { +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +public open class K { + var prop: String = ":(" + + val Int.ext: Int get() = this +} + +fun box(): String { + val j = J() + + val prop = J::prop + if (prop !is KMutableProperty1<*, *>) return "Fail instanceof" + if (prop.name != "prop") return "Fail name: ${prop.name}" + if (prop.get(j) != ":(") return "Fail get before: ${prop.get(j)}" + prop.set(j, ":)") + if (prop.get(j) != ":)") return "Fail get after: ${prop.get(j)}" + + + if (prop == K::prop) return "Fail J::prop == K::prop (these are different properties)" + + + val klass = J::class.java.kotlin + if (klass.declaredMemberProperties.isNotEmpty()) return "Fail: declaredMemberProperties should be empty" + if (klass.declaredMemberExtensionProperties.isNotEmpty()) return "Fail: declaredMemberExtensionProperties should be empty" + + val prop2 = klass.memberProperties.firstOrNull { it.name == "prop" } ?: "Fail: no 'prop' property in memberProperties" + if (prop != prop2) return "Fail: property references from :: and from properties differ: $prop != $prop2" + if (prop2 !is KMutableProperty1<*, *>) return "Fail instanceof 2" + (prop2 as KMutableProperty1).set(j, "::)") + if (prop.get(j) != "::)") return "Fail get after 2: ${prop.get(j)}" + + + val ext = klass.memberExtensionProperties.firstOrNull { it.name == "ext" } ?: "Fail: no 'ext' property in memberExtensionProperties" + ext as KProperty2 + val fortyTwo = ext.get(j, 42) + if (fortyTwo != 42) return "Fail ext get: $fortyTwo" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt new file mode 100644 index 00000000000..c8542b602fb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class A { + val foo: String = "member" + val Unit.foo: String get() = "extension" +} + +fun box(): String { + run { + val foo: KProperty1 = A::class.java.kotlin.memberProperties.single() + assert(foo.name == "foo") { "Fail name: $foo (${foo.name})" } + assert(foo.get(A()) == "member") { "Fail value: ${foo.get(A())}" } + } + + run { + val foo: KProperty2 = A::class.java.kotlin.memberExtensionProperties.single() + assert(foo.name == "foo") { "Fail name: $foo (${foo.name})" } + foo as KProperty2 + assert(foo.get(A(), Unit) == "extension") { "Fail value: ${foo.get(A(), Unit)}" } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt new file mode 100644 index 00000000000..38e4da13923 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + private String result = "Fail"; +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +fun box(): String { + val a = J() + val p = J::class.members.single { it.name == "result" } as KMutableProperty1 + p.isAccessible = true + p.set(a, "OK") + return p.get(a) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt new file mode 100644 index 00000000000..720556a2d19 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + private static String result = "Fail"; +} + +// FILE: K.kt + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +fun box(): String { + val a = J() + val p = J::class.members.single { it.name == "result" } as KMutableProperty0 + p.isAccessible = true + p.set("OK") + return p.get() +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt new file mode 100644 index 00000000000..2780e258503 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public String foo = ""; +} + +// FILE: K.kt + +import kotlin.test.* + +class K : J() { + fun getFoo(): String = "K" +} + +fun box(): String { + val j = J() + val x = J::foo + x.set(j, "J") + assertEquals("J", x.get(j)) + + val k = K() + val y = K::foo + y.set(k, "K") + assertEquals("K", y.get(k)) + assertEquals("K", x.get(k)) + + val z = K::getFoo + assertEquals("K", z.invoke(k)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt new file mode 100644 index 00000000000..a876ff69c9e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt @@ -0,0 +1,42 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J implements K { + private String foo; + + @Override + public String getFoo() { + return foo; + } + + @Override + public void setFoo(String s) { + foo = s; + } +} + +// FILE: K.kt + +import kotlin.test.assertEquals +import kotlin.reflect.KParameter + +interface K { + var foo: String +} + +fun box(): String { + val p = J::foo + assertEquals("foo", p.name) + + if (p.parameters.size != 1) return "Should have only 1 parameter" + if (p.parameters.single().kind != KParameter.Kind.INSTANCE) return "Should have an instance parameter" + + if (J::class.members.none { it == p }) return "No foo in members" + + val j = J() + p.setter.call(j, "OK") + return p.getter.call(j) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt new file mode 100644 index 00000000000..c580f4aef8d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.isAccessible + +class Result { + private val value = "OK" + + fun ref() = Result::class.memberProperties.single() as KProperty1 +} + +fun box(): String { + val p = Result().ref() + try { + p.get(Result()) + return "Fail: private property is accessible by default" + } catch(e: IllegalCallableAccessException) { } + + p.isAccessible = true + + val r = p.get(Result()) + + p.isAccessible = false + try { + p.get(Result()) + return "Fail: setAccessible(false) had no effect" + } catch(e: IllegalCallableAccessException) { } + + return r +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt new file mode 100644 index 00000000000..75c5ca55e4e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.isAccessible + +class A { + private var value = 0 + + fun ref() = A::class.memberProperties.single() as KMutableProperty1 +} + +fun box(): String { + val a = A() + val p = a.ref() + try { + p.set(a, 1) + return "Fail: private property is accessible by default" + } catch(e: IllegalCallableAccessException) { } + + p.isAccessible = true + + p.set(a, 2) + p.get(a) + + p.isAccessible = false + try { + p.set(a, 3) + return "Fail: setAccessible(false) had no effect" + } catch(e: IllegalCallableAccessException) { } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt new file mode 100644 index 00000000000..f88544b28c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +open class A(private val p: Int) +class B : A(42) + +fun box() = + if (B::class.memberProperties.isEmpty()) "OK" + else "Fail: invisible fake overrides should not appear in KClass.memberProperties" diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt new file mode 100644 index 00000000000..398d7666db1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +object Obj { + @JvmStatic + private var result: String = "Fail" +} + +fun box(): String { + val p = Obj::class.members.single { it.name == "result" } as KMutableProperty1 + p.isAccessible = true + + try { + p.set(null, "OK") + return "Fail: set should check that first argument is Obj" + } catch (e: IllegalArgumentException) {} + + try { + p.get(null) + return "Fail: get should check that first argument is Obj" + } catch (e: IllegalArgumentException) {} + + p.set(Obj, "OK") + return p.get(Obj) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt new file mode 100644 index 00000000000..c97d2dcddac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt @@ -0,0 +1,46 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* +import kotlin.test.* + +class A(private var foo: String) + +fun box(): String { + val a = A("") + val foo = A::class.memberProperties.single() as KMutableProperty1 + + assertTrue(!foo.isAccessible) + assertTrue(!foo.getter.isAccessible) + assertTrue(!foo.setter.isAccessible) + + val setter = foo.setter + setter.isAccessible = true + assertTrue(setter.isAccessible) + assertTrue(foo.setter.isAccessible) + + // After we invoked isAccessible on a setter, the underlying field and thus the getter are also accessible + assertTrue(foo.isAccessible) + assertTrue(foo.getter.isAccessible) + setter.call(a, "A") + assertEquals("A", foo.getter.call(a)) + + setter.isAccessible = false + assertFalse(setter.isAccessible) + assertFalse(foo.setter.isAccessible) + assertFalse(foo.getter.isAccessible) + assertFalse(foo.isAccessible) + + val getter = foo.getter + getter.isAccessible = true + assertTrue(setter.isAccessible) + assertTrue(foo.setter.isAccessible) + assertTrue(foo.isAccessible) + assertTrue(foo.getter.isAccessible) + assertTrue(getter.isAccessible) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt new file mode 100644 index 00000000000..d2ee9281c69 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.* + +class K { + private var t: T + get() = "OK" as T + set(value) {} + + fun run(): String { + val p = K::class.memberProperties.single() as KMutableProperty1, String> + p.isAccessible = true + p.set(this as K, "") + return p.get(this) as String + } +} + +fun box() = K().run() diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt new file mode 100644 index 00000000000..4755576f096 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KMutableProperty1 + +class A { + class B(val result: String) + + var p: A.B? = null + var q: Array>? = null +} + +fun box(): String { + val a = A() + + val aq = A::class.members.single { it.name == "q" } as KMutableProperty1>> + aq.set(a, arrayOf(arrayOf(A.B("array")))) + if (a.q!![0][0].result != "array") return "Fail array" + + val ap = A::class.members.single { it.name == "p" } as KMutableProperty1 + ap.set(a, A.B("OK")) + return a.p!!.result +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt new file mode 100644 index 00000000000..783c69dd6d4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.isAccessible + +class A(param: String) { + protected var v: String = param + + fun ref() = A::class.memberProperties.single() as KMutableProperty1 +} + +fun box(): String { + val a = A(":(") + val f = a.ref() + + try { + f.get(a) + return "Fail: protected property getter is accessible by default" + } catch (e: IllegalCallableAccessException) { } + + try { + f.set(a, ":D") + return "Fail: protected property setter is accessible by default" + } catch (e: IllegalCallableAccessException) { } + + f.isAccessible = true + + f.set(a, ":)") + + return if (f.get(a) != ":)") "Fail: ${f.get(a)}" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt new file mode 100644 index 00000000000..4be1ab8df8c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.isAccessible + +class Result { + public val value: String = "OK" +} + +fun box(): String { + val p = Result::value + p.isAccessible = false + // setAccessible(false) should have no effect on the accessibility of a public reflection object + return p.get(Result()) +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt new file mode 100644 index 00000000000..3762436a664 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J extends K { + public final int value = 42; +} + +// FILE: K.kt + +open class K + +fun box(): String { + val f = J::value + val a = J() + return if (f.get(a) == 42) "OK" else "Fail: ${f.get(a)}" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt new file mode 100644 index 00000000000..bb19ac504ac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.* + +class A(param: String) { + val int: Int get() = 42 + val string: String = param + var anyVar: Any? = null + + val List.extensionToList: Unit get() {} + + fun notAProperty() {} +} + +fun box(): String { + val klass = A::class.java.kotlin + + val props = klass.memberProperties + + val names = props.map { it.name }.sorted() + assert(names == listOf("anyVar", "int", "string")) { "Fail names: $props" } + + val stringProp = props.firstOrNull { it.name == "string" } ?: return "Fail, string not found: $props" + return stringProp.get(A("OK")) as String +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt new file mode 100644 index 00000000000..ceb08f00bd1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FULL_JDK +// See KT-11258 Incorrect resolution sequence for Java field + +import java.util.* + +fun box(): String { + listOf( + ArrayList::class, + LinkedList::class, + AbstractList::class, + HashSet::class, + TreeSet::class, + HashMap::class, + TreeMap::class, + AbstractMap::class, + AbstractMap.SimpleEntry::class + ).map { + it.members.map(Any::toString) + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt new file mode 100644 index 00000000000..0aed2bbd5d4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import java.io.Serializable +import kotlin.reflect.KClass +import kotlin.reflect.KCallable +import kotlin.reflect.full.* +import kotlin.test.assertEquals + +inline fun check(vararg callables: KCallable<*>) { + val types = callables.map { it.returnType } + assertEquals(types, T::class.supertypes) + assertEquals(types.map { it.classifier as KClass<*> }, T::class.superclasses) +} + +inline fun checkAll(vararg callables: KCallable<*>) { + val types = callables.map { it.returnType } + // Calling toSet because the order of returned types/classes is not specified + assertEquals(types.toSet(), T::class.allSupertypes.toSet()) + assertEquals(types.map { it.classifier as KClass<*> }.toSet(), T::class.allSuperclasses.toSet()) +} + +fun comparableOfString(): Comparable = null!! +fun charSequence(): CharSequence = null!! +fun serializable(): Serializable = null!! +fun any(): Any = null!! +fun number(): Number = null!! +fun comparableOfInt(): Comparable = null!! +fun cloneable(): Cloneable = null!! + +fun box(): String { + check() + checkAll() + + check(::comparableOfString, ::charSequence, ::serializable) + checkAll(::comparableOfString, ::charSequence, ::serializable, ::any) + + check(::number, ::comparableOfInt, ::serializable) + checkAll(::number, ::comparableOfInt, ::serializable, ::any) + + check>(::any, ::cloneable, ::serializable) + checkAll>(::any, ::cloneable, ::serializable) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt new file mode 100644 index 00000000000..d3f609e4bb0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.allSupertypes +import kotlin.test.assertEquals + +interface A +interface B : A +interface C : B +interface D : C + +interface StringList : List + +fun box(): String { + assertEquals( + listOf(String::class, Int::class), + D::class.allSupertypes.single { it.classifier == A::class }.arguments.map { it.type!!.classifier } + ) + + val collectionType = StringList::class.allSupertypes.single { it.classifier == Collection::class } + val arg = collectionType.arguments.single().type!! + // TODO: this does not work currently because for some reason two different instances of TypeParameterDescriptor are created for List + // assertEquals(String::class, arg.classifier) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt new file mode 100644 index 00000000000..fec97be73d4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.reflect.full.* +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +open class Klass +interface Interface +class Bar : Interface, Klass() + +fun check(subclass: KClass<*>, superclass: KClass<*>, shouldBeSubclass: Boolean) { + if (shouldBeSubclass) { + assertTrue(subclass.isSubclassOf(superclass)) + assertTrue(superclass.isSuperclassOf(subclass)) + } else { + assertFalse(subclass.isSubclassOf(superclass)) + assertFalse(superclass.isSuperclassOf(subclass)) + } +} + +fun box(): String { + check(Any::class, Any::class, true) + check(String::class, Any::class, true) + check(Any::class, String::class, false) + check(String::class, String::class, true) + + check(Int::class, Int::class, true) + check(Int::class, Any::class, true) + + check(List::class, Collection::class, true) + check(List::class, Iterable::class, true) + check(Collection::class, Iterable::class, true) + check(Set::class, List::class, false) + + check(Array::class, Array::class, false) + check(Array::class, Array::class, false) + + check(Function3::class, Function4::class, false) + check(Function4::class, Function3::class, false) + + check(Bar::class, Klass::class, true) + check(Bar::class, Interface::class, true) + check(Klass::class, Bar::class, false) + check(Interface::class, Bar::class, false) + check(Klass::class, Interface::class, false) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt new file mode 100644 index 00000000000..ccbafb2e66e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.isSubclassOf +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +fun box(): String { + // KClass instances for primitive int and wrapper java.lang.Integer are different + val primitiveInt = Int::class.javaPrimitiveType!!.kotlin + val wrapperInt = Int::class.javaObjectType.kotlin + assertTrue(primitiveInt.isSubclassOf(primitiveInt)) + assertTrue(wrapperInt.isSubclassOf(wrapperInt)) + + // KClass for int equals KClass for java.lang.Integer, so they are also a subclass of each other + assertTrue(primitiveInt.isSubclassOf(wrapperInt)) + assertTrue(wrapperInt.isSubclassOf(primitiveInt)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt new file mode 100644 index 00000000000..d9189c68722 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.* +import kotlin.test.assertEquals + +open class Simple +class OneClass : Simple() + +interface Interface +interface Interface2 +class ClassAndTwoInterfaces : Interface, Simple(), Interface2 + +fun any(): Any = null!! +fun simple(): Simple = null!! +fun interface_(): Interface = null!! +fun interface2(): Interface2 = null!! + +fun box(): String { + with(Simple::class) { + assertEquals(listOf(::any.returnType), supertypes) + assertEquals(listOf(Any::class), superclasses) + // Calling toSet because the order of returned types/classes is not specified + assertEquals(setOf(::any.returnType), allSupertypes.toSet()) + assertEquals(setOf(Any::class), allSuperclasses.toSet()) + } + + with (OneClass::class) { + assertEquals(listOf(::simple.returnType), supertypes) + assertEquals(listOf(Simple::class), superclasses) + assertEquals(setOf(::simple.returnType, ::any.returnType), allSupertypes.toSet()) + assertEquals(setOf(Simple::class, Any::class), allSuperclasses.toSet()) + } + + with (Interface::class) { + assertEquals(listOf(::any.returnType), supertypes) + assertEquals(listOf(Any::class), superclasses) + assertEquals(setOf(::any.returnType), allSupertypes.toSet()) + assertEquals(setOf(Any::class), allSuperclasses.toSet()) + } + + with (ClassAndTwoInterfaces::class) { + assertEquals(listOf(::interface_.returnType, ::simple.returnType, ::interface2.returnType), supertypes) + assertEquals(listOf(Interface::class, Simple::class, Interface2::class), superclasses) + assertEquals(setOf(::interface_.returnType, ::simple.returnType, ::interface2.returnType, ::any.returnType), allSupertypes.toSet()) + assertEquals(setOf(Interface::class, Simple::class, Interface2::class, Any::class), allSuperclasses.toSet()) + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt new file mode 100644 index 00000000000..d91f297aab5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KVariance +import kotlin.test.assertEquals + +class Triple { + fun foo(): T = null!! +} + +fun box(): String { + assertEquals( + listOf( + KVariance.IN, + KVariance.INVARIANT, + KVariance.OUT + ), + Triple::class.typeParameters.map { it.variance } + ) + + assertEquals(KVariance.INVARIANT, Triple::class.members.single { it.name == "foo" }.typeParameters.single().variance) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt new file mode 100644 index 00000000000..d864a4bce9a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +class F { + fun foo() {} + val B.bar: B get() = this +} + +class C { + fun baz() {} + fun quux() {} +} + +fun get(klass: KClass<*>, memberName: String? = null): List = + (if (memberName != null) + klass.members.single { it.name == memberName }.typeParameters + else + klass.typeParameters) + .map { it.name } + +fun box(): String { + assertEquals(listOf(), get(F::class)) + assertEquals(listOf("A"), get(F::class, "foo")) + assertEquals(listOf("B"), get(F::class, "bar")) + + assertEquals(listOf("D"), get(C::class)) + assertEquals(listOf(), get(C::class, "baz")) + assertEquals(listOf("E", "G"), get(C::class, "quux")) + + assertEquals(listOf("T"), get(Comparable::class)) + assertEquals(listOf(), get(String::class)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt new file mode 100644 index 00000000000..2cd803757e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt @@ -0,0 +1,62 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KTypeProjection +import kotlin.reflect.KVariance +import kotlin.test.assertEquals + +class DefaultBound +class NullableAnyBound +class NotNullAnyBound +class TwoBounds where T : Comparable + +class OtherParameterBound + +class RecursiveGeneric> + +class FunctionTypeParameter { + fun foo(): Cloneable = null!! +} + +// helper functions to obtain KType instances +fun nullableAny(): Any? = null +fun notNullAny(): Any = null!! + +fun box(): String { + assertEquals(listOf(::nullableAny.returnType), DefaultBound::class.typeParameters.single().upperBounds) + assertEquals(listOf(::nullableAny.returnType), NullableAnyBound::class.typeParameters.single().upperBounds) + assertEquals(listOf(::notNullAny.returnType), NotNullAnyBound::class.typeParameters.single().upperBounds) + + TwoBounds::class.typeParameters.single().let { + val (cl, cm) = it.upperBounds + assertEquals(Cloneable::class, cl.classifier) + assertEquals(listOf(), cl.arguments) + + assertEquals(Comparable::class, cm.classifier) + val cmt = cm.arguments.single() + assertEquals(KVariance.INVARIANT, cmt.variance) + assertEquals(it, cmt.type!!.classifier) + } + + OtherParameterBound::class.typeParameters.let { + val (t, u) = it + assertEquals(u, t.upperBounds.single().classifier) + assertEquals(Number::class, u.upperBounds.single().classifier) + } + + FunctionTypeParameter::class.members.single { it.name == "foo" }.let { foo -> + assertEquals(foo.returnType, foo.typeParameters.single().upperBounds.single()) + } + + val recursiveGenericTypeParameter = RecursiveGeneric::class.typeParameters.single() + val recursiveGenericBound = recursiveGenericTypeParameter.upperBounds.single() + assertEquals(Enum::class, recursiveGenericBound.classifier) + recursiveGenericBound.arguments.single().let { projection -> + assertEquals(KVariance.INVARIANT, projection.variance) + assertEquals(recursiveGenericTypeParameter, projection.type!!.classifier) + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt new file mode 100644 index 00000000000..5423e934e13 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.assertEquals + +class Outer { + class Nested + + inner class Inner +} + +fun outer(): Outer = null!! +fun nested(): Outer.Nested = null!! +fun inner(): Outer.Inner = null!! + +fun array(): Array = null!! + +fun box(): String { + assertEquals(Outer::class, ::outer.returnType.classifier) + assertEquals(Outer.Nested::class, ::nested.returnType.classifier) + assertEquals(Outer.Inner::class, ::inner.returnType.classifier) + + assertEquals(Array::class, ::array.returnType.classifier) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt new file mode 100644 index 00000000000..b92b6f82870 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KTypeParameter +import kotlin.test.* + +class A { + fun foo(): T = null!! + fun bar(): Array? = null!! +} + +fun box(): String { + val t = A::class.members.single { it.name == "foo" }.returnType + assertFalse(t.isMarkedNullable) + val tc = t.classifier + if (tc !is KTypeParameter) fail(tc.toString()) + assertEquals("T", tc.name) + + val u = A::class.members.single { it.name == "bar" }.returnType + assertTrue(u.isMarkedNullable) + assertEquals(Array::class, u.classifier) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt new file mode 100644 index 00000000000..27df7ab2269 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt @@ -0,0 +1,115 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KClass +import kotlin.reflect.KFunction +import kotlin.test.assertEquals + +fun primitives( + p01: Boolean, + p02: Byte, + p03: Char, + p04: Double, + p05: Float, + p06: Int, + p07: Long, + p08: Short +) {} + +fun nullablePrimitives( + p01: Boolean?, + p02: Byte?, + p03: Char?, + p04: Double?, + p05: Float?, + p06: Int?, + p07: Long?, + p08: Short? +) {} + +fun primitiveArrays( + p01: BooleanArray, + p02: ByteArray, + p03: CharArray, + p04: DoubleArray, + p05: FloatArray, + p06: IntArray, + p07: LongArray, + p08: ShortArray +) {} + +fun others( + p1: Array<*>, + p2: Array, + p3: Array?>, + p4: List<*>, + p5: List?, + p6: Map.Entry, + p7: Unit?, + p8: String, + p9: Nothing +) {} + +inline fun wrapper(): KClass = T::class + +fun check(f: KFunction<*>, vararg expected: KClass<*>) { + val actual = f.parameters.map { it.type.classifier as KClass<*> } + for ((e, a) in expected.toList().zip(actual)) { + assertEquals(e, a, "$e (${e.java}) != $a (${a.java})") + } +} + +fun box(): String { + check( + ::primitives, + Boolean::class, + Byte::class, + Char::class, + Double::class, + Float::class, + Int::class, + Long::class, + Short::class + ) + + check( + ::nullablePrimitives, + wrapper(), + wrapper(), + wrapper(), + wrapper(), + wrapper(), + wrapper(), + wrapper(), + wrapper() + ) + + check( + ::primitiveArrays, + BooleanArray::class, + ByteArray::class, + CharArray::class, + DoubleArray::class, + FloatArray::class, + IntArray::class, + LongArray::class, + ShortArray::class + ) + + check( + ::others, + Array::class, + Array::class, + Array?>::class, + List::class, + List::class, + Map.Entry::class, + Unit::class, + String::class, + Nothing::class + ) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt new file mode 100644 index 00000000000..b164b459a24 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt @@ -0,0 +1,43 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.createType +import kotlin.reflect.KTypeProjection +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +class Foo + +fun box(): String { + assertEquals(String::class.createType(), String::class.createType()) + + assertEquals( + Foo::class.createType(listOf(KTypeProjection.STAR)), + Foo::class.createType(listOf(KTypeProjection.STAR)) + ) + + val i = Int::class.createType() + assertEquals( + Foo::class.createType(listOf(KTypeProjection.invariant(i))), + Foo::class.createType(listOf(KTypeProjection.invariant(i))) + ) + + assertNotEquals( + Foo::class.createType(listOf(KTypeProjection.contravariant(i))), + Foo::class.createType(listOf(KTypeProjection.covariant(i))) + ) + + assertNotEquals( + Foo::class.createType(listOf(KTypeProjection.covariant(Any::class.createType(nullable = true)))), + Foo::class.createType(listOf(KTypeProjection.STAR)) + ) + + assertNotEquals( + Foo::class.createType(listOf(KTypeProjection.STAR), nullable = false), + Foo::class.createType(listOf(KTypeProjection.STAR), nullable = true) + ) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt new file mode 100644 index 00000000000..a1e75cb8349 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.createType +import kotlin.reflect.KClass +import kotlin.reflect.KTypeProjection +import kotlin.test.assertEquals + +class A { + inner class B { + inner class C + } + class D +} + +fun foo(): A.B.C = null!! + +fun box(): String { + fun KClass<*>.inv() = KTypeProjection.invariant(this.createType()) + + val type = A.B.C::class.createType(listOf(Long::class.inv(), Double::class.inv(), Float::class.inv(), Int::class.inv())) + assertEquals("A.B.C", type.toString()) + + assertEquals("A.D", A.D::class.createType().toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt new file mode 100644 index 00000000000..fb1189f49d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.createType +import kotlin.reflect.KTypeProjection +import kotlin.test.assertEquals + +class Foo +class Bar + +fun box(): String { + assertEquals("Foo", Foo::class.createType().toString()) + assertEquals("Foo?", Foo::class.createType(nullable = true).toString()) + + assertEquals("Bar", Bar::class.createType(listOf(KTypeProjection.invariant(String::class.createType()))).toString()) + assertEquals("Bar?", Bar::class.createType(listOf(KTypeProjection.invariant(Int::class.createType())), nullable = true).toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt new file mode 100644 index 00000000000..25e837694a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.createType +import kotlin.test.assertEquals + +class Foo { + fun nonNull(): T = null!! + fun nullable(): T? = null +} + +fun box(): String { + val tp = Foo::class.typeParameters.single() + assertEquals( + Foo::class.members.single { it.name == "nonNull" }.returnType, + tp.createType() + ) + assertEquals( + Foo::class.members.single { it.name == "nullable" }.returnType, + tp.createType(nullable = true) + ) + + assertEquals(tp.createType(), tp.createType()) + assertEquals(tp.createType(nullable = true), tp.createType(nullable = true)) + + assertEquals("T", tp.createType().toString()) + assertEquals("T?", tp.createType(nullable = true).toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt new file mode 100644 index 00000000000..73c044da3ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt @@ -0,0 +1,52 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.createType +import kotlin.reflect.KClassifier +import kotlin.reflect.KTypeProjection + +fun test(classifier: KClassifier, arguments: List) { + try { + classifier.createType(arguments) + throw AssertionError("createType should have thrown IllegalArgumentException") + } + catch (e: IllegalArgumentException) { + // OK + } +} + +class Outer { + inner class Inner + class Nested +} + +fun box(): String { + val p = KTypeProjection.STAR + + test(String::class, listOf(p)) + test(String::class, listOf(p, p)) + test(List::class, listOf()) + test(List::class, listOf(p, p)) + test(Map::class, listOf()) + test(Map::class, listOf(p)) + test(Map::class, listOf(p, p, p)) + test(Array::class, listOf()) + + test(Outer::class, listOf()) + test(Outer::class, listOf(p, p)) + + // Outer.Inner takes two arguments: first for O, second for I + test(Outer.Inner::class, listOf()) + test(Outer.Inner::class, listOf(p)) + test(Outer.Inner::class, listOf(p, p, p)) + + // Outer.Nested takes one argument for N + test(Outer.Nested::class, listOf()) + test(Outer.Nested::class, listOf(p, p)) + + test(Outer::class.typeParameters.single(), listOf(p)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt new file mode 100644 index 00000000000..11a6e3d3f71 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.test.* + +class Outer { + inner class Inner { + inner class Innermost + } +} + +fun foo(): Outer.Inner.Innermost = null!! + +fun box(): String { + val types = ::foo.returnType.arguments.map { it.type!! } + + assertEquals( + listOf( + Any::class, + Any::class, + String::class, + Float::class, + Int::class, + Number::class + ), + types.map { it.classifier } + ) + + assertFalse(types[0].isMarkedNullable) + assertTrue(types[1].isMarkedNullable) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt new file mode 100644 index 00000000000..8c3acb125a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.jvmErasure +import kotlin.test.assertEquals + +fun string(): String = null!! +fun array(): Array = null!! + +fun collection(): Collection = null!! +fun mutableCollection(): MutableCollection = null!! + +fun box(): String { + assertEquals(String::class, ::string.returnType.jvmErasure) + assertEquals(Array::class, ::array.returnType.jvmErasure) + + assertEquals(Collection::class, ::collection.returnType.jvmErasure) + assertEquals(MutableCollection::class, ::mutableCollection.returnType.jvmErasure) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt new file mode 100644 index 00000000000..5b3f4f4daa2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt @@ -0,0 +1,48 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.jvm.jvmErasure +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +open class O + +class A { + fun simple(): T = null!! + fun string(): T = null!! + fun nullableString(): T = null!! + fun otherTypeParameter(): T = null!! + fun > otherTypeParameterWithBound(): T = null!! + + fun twoInterfaces1(): T where T : Comparable<*> = null!! + fun > twoInterfaces2(): T where T : Cloneable = null!! + fun interfaceAndClass1(): T where T : O = null!! + fun interfaceAndClass2(): T where T : Cloneable = null!! + + fun arrayOfAny(): Array = null!! + fun arrayOfNumber(): Array = null!! + fun arrayOfArrayOfCloneable(): Array> where T : Cloneable, T : Comparable<*> = null!! +} + +fun get(name: String): KClass<*> = A::class.members.single { it.name == name }.returnType.jvmErasure + +fun box(): String { + assertEquals(Any::class, get("simple")) + assertEquals(String::class, get("string")) + assertEquals(String::class, get("nullableString")) + assertEquals(Any::class, get("otherTypeParameter")) + assertEquals(List::class, get("otherTypeParameterWithBound")) + + assertEquals(Cloneable::class, get("twoInterfaces1")) + assertEquals(Comparable::class, get("twoInterfaces2")) + assertEquals(O::class, get("interfaceAndClass1")) + assertEquals(O::class, get("interfaceAndClass2")) + + assertEquals(Array::class, get("arrayOfAny")) + assertEquals(Array::class, get("arrayOfNumber")) + assertEquals(Array>::class, get("arrayOfArrayOfCloneable")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeClassifier.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeClassifier.kt new file mode 100644 index 00000000000..8487647d634 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeClassifier.kt @@ -0,0 +1,39 @@ +// TARGET_BACKEND: JVM + +// WITH_REFLECT +// FILE: J.java + +import java.util.List; + +public class J { + public static String string() { + return ""; + } + + public static List list() { + return null; + } + + public static int primitiveInt() { + return 0; + } + + public static Integer wrapperInt() { + return 0; + } +} + +// FILE: K.kt + +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(String::class, J::string.returnType.classifier) + assertEquals(List::class, J::list.returnType.classifier) + + assertEquals(Int::class.javaPrimitiveType!!, (J::primitiveInt.returnType.classifier as KClass<*>).java) + assertEquals(Int::class.javaObjectType, (J::wrapperInt.returnType.classifier as KClass<*>).java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt new file mode 100644 index 00000000000..f7ac0e77e93 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public class J { + public static String foo() { + return ""; + } +} + +// FILE: K.kt + +import kotlin.test.assertNotEquals + +fun nonNullString(): String = "" +fun nullableString(): String? = "" + +fun box(): String { + assertNotEquals(J::foo.returnType, ::nonNullString.returnType) + assertNotEquals(J::foo.returnType, ::nullableString.returnType) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeToString.kt new file mode 100644 index 00000000000..e339364b397 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeToString.kt @@ -0,0 +1,27 @@ +// TARGET_BACKEND: JVM + +// WITH_REFLECT +// FILE: J.java + +import java.util.List; + +public class J { + public static String string() { + return ""; + } + + public static List list() { + return null; + } +} + +// FILE: K.kt + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals("kotlin.String!", J::string.returnType.toString()) + assertEquals("kotlin.collections.(Mutable)List!", J::list.returnType.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt new file mode 100644 index 00000000000..0901242ee2a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public interface J { + String platformString(); +} + +// FILE: K.kt + +import kotlin.reflect.KCallable +import kotlin.reflect.full.* +import kotlin.test.assertTrue + +fun string(): String = null!! +fun nullableString(): String? = null!! + +fun check(subCallable: KCallable<*>, superCallable: KCallable<*>) { + val subtype = subCallable.returnType + val supertype = superCallable.returnType + assertTrue(subtype.isSubtypeOf(supertype)) + assertTrue(supertype.isSupertypeOf(subtype)) +} + +fun box(): String { + check(::string, J::platformString) + check(J::platformString, ::string) + check(::nullableString, J::platformString) + check(J::platformString, ::nullableString) + check(J::platformString, J::platformString) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt new file mode 100644 index 00000000000..0a9f07aa0a1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.* +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +open class G +class A : G() + +fun gOfString(): G = null!! +fun gOfInt(): G = null!! + +fun box(): String { + val gs = ::gOfString.returnType + val gi = ::gOfInt.returnType + val a = ::A.returnType + + assertTrue(a.isSubtypeOf(gs)) + assertTrue(gs.isSupertypeOf(a)) + + assertFalse(a.isSubtypeOf(gi)) + assertFalse(gi.isSupertypeOf(a)) + + assertFalse(gs.isSubtypeOf(gi)) + assertFalse(gs.isSupertypeOf(gi)) + assertFalse(gi.isSubtypeOf(gs)) + assertFalse(gi.isSupertypeOf(gs)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt new file mode 100644 index 00000000000..3b2032ddccc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt @@ -0,0 +1,68 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KCallable +import kotlin.reflect.full.* +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +fun check(subCallable: KCallable<*>, superCallable: KCallable<*>, shouldBeSubtype: Boolean) { + val subtype = subCallable.returnType + val supertype = superCallable.returnType + if (shouldBeSubtype) { + assertTrue(subtype.isSubtypeOf(supertype)) + assertTrue(supertype.isSupertypeOf(subtype)) + } else { + assertFalse(subtype.isSubtypeOf(supertype)) + assertFalse(supertype.isSupertypeOf(subtype)) + } +} + +open class O +class X : O() + +fun any(): Any = null!! +fun string(): String = null!! +fun nullableString(): String? = null!! +fun int(): Int = null!! +fun nothing(): Nothing = null!! +fun nullableNothing(): Nothing? = null!! +fun function2(): (Any, Any) -> Any = null!! +fun function3(): (Any, Any, Any) -> Any = null!! + +fun box(): String { + check(::any, ::any, true) + check(::int, ::int, true) + check(::nothing, ::nothing, true) + check(::nullableNothing, ::nullableNothing, true) + + check(::string, ::any, true) + check(::nullableString, ::any, false) + check(::int, ::any, true) + check(::O, ::any, true) + check(::X, ::any, true) + + check(::nothing, ::any, true) + check(::nothing, ::string, true) + check(::nothing, ::nullableString, true) + check(::nullableNothing, ::nullableString, true) + check(::nullableNothing, ::string, false) + + check(::string, ::nullableString, true) + check(::nullableString, ::string, false) + + check(::X, ::O, true) + check(::O, ::X, false) + + check(::int, ::string, false) + check(::string, ::int, false) + check(::any, ::string, false) + check(::any, ::nullableString, false) + + check(::function2, ::function3, false) + check(::function3, ::function2, false) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt new file mode 100644 index 00000000000..4cae206d8d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.full.isSubtypeOf +import kotlin.test.assertTrue +import kotlin.test.assertFalse + +class G + +fun number(): G = null!! +fun outNumber(): G = null!! +fun inNumber(): G = null!! +fun star(): G<*> = null!! + +fun box(): String { + val n = ::number.returnType + val o = ::outNumber.returnType + val i = ::inNumber.returnType + val st = ::star.returnType + + // G <: G + assertTrue(n.isSubtypeOf(o)) + assertFalse(o.isSubtypeOf(n)) + + // G <: G + assertTrue(n.isSubtypeOf(i)) + assertFalse(i.isSubtypeOf(n)) + + // G <: G<*> + assertTrue(n.isSubtypeOf(st)) + assertFalse(st.isSubtypeOf(n)) + + // G <: G<*> + assertTrue(o.isSubtypeOf(st)) + assertFalse(st.isSubtypeOf(o)) + + // G <: G<*> + assertTrue(i.isSubtypeOf(st)) + assertFalse(st.isSubtypeOf(i)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt new file mode 100644 index 00000000000..2f5507f331a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt @@ -0,0 +1,45 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KTypeProjection +import kotlin.reflect.KVariance +import kotlin.test.assertEquals + +fun string(): String = null!! + +class Fourple +fun projections(): Fourple = null!! + +fun array(): Array = null!! + +fun list(): List = null!! + +fun box(): String { + val string = ::string.returnType + assertEquals(listOf(), string.arguments) + + assertEquals( + listOf( + KTypeProjection.invariant(string), + KTypeProjection.contravariant(string), + KTypeProjection.covariant(string), + KTypeProjection.STAR + ), + ::projections.returnType.arguments + ) + assertEquals( + listOf(string, string, string, null), + ::projections.returnType.arguments.map(KTypeProjection::type) + ) + + val outNumber = ::array.returnType.arguments.single() + assertEquals(KVariance.OUT, outNumber.variance) + assertEquals(Number::class, outNumber.type?.classifier) + + // There should be no use-site variance, despite the fact that the corresponding parameter has 'out' variance + assertEquals(KVariance.INVARIANT, ::list.returnType.arguments.single().variance) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt new file mode 100644 index 00000000000..6be21fb92c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT + +import kotlin.reflect.KVariance +import kotlin.test.assertEquals + +class Fourple +fun foo(): Fourple = null!! + +fun listOfStrings(): List = null!! + +fun box(): String { + assertEquals( + listOf( + KVariance.INVARIANT, + KVariance.IN, + KVariance.OUT, + null + ), + ::foo.returnType.arguments.map { it.variance } + ) + + // Declaration-site variance should have no effect on the variance of the type projection: + assertEquals(KVariance.INVARIANT, ::listOfStrings.returnType.arguments.first().variance) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt new file mode 100644 index 00000000000..2bf550e7aa9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_REFLECT +// FILE: J.java + +public interface J { + String platform(); +} + +// FILE: K.kt + +import kotlin.reflect.full.withNullability +import kotlin.test.assertEquals + +fun nonNull(): String = "" +fun nullable(): String? = "" + +fun box(): String { + val nonNull = ::nonNull.returnType + val nullable = ::nullable.returnType + val platform = J::platform.returnType + + assertEquals(nonNull, nullable.withNullability(false)) + assertEquals(nullable, nullable.withNullability(true)) + assertEquals(nonNull, nonNull.withNullability(false)) + assertEquals(nullable, nonNull.withNullability(true)) + + assertEquals(nonNull, platform.withNullability(false)) + assertEquals(nullable, platform.withNullability(true)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/Kt1149.kt b/backend.native/tests/external/codegen/blackbox/regressions/Kt1149.kt new file mode 100644 index 00000000000..f1581c61cf7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/Kt1149.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +package test.regressions.kt1149 + +public interface SomeTrait { + fun foo() +} + +fun box(): String { + val list = ArrayList() + var res = ArrayList() + list.add(object : SomeTrait { + override fun foo() { + res.add("anonymous.foo()") + } + }) + list.forEach{ it.foo() } + return if ("anonymous.foo()" == res[0]) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/Kt1619Test.kt b/backend.native/tests/external/codegen/blackbox/regressions/Kt1619Test.kt new file mode 100644 index 00000000000..d8f38f37765 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/Kt1619Test.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +package regressions + +class Kt1619Test { + + fun doSomething(list: List): Int { + return list.size + } + + fun testCollectionNotNullCanBeUsedForNullables(): Int { + val list: List = arrayListOf("foo", "bar") + return doSomething(list) + } +} + +fun box(): String { + return if (Kt1619Test().testCollectionNotNullCanBeUsedForNullables() == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/Kt2495Test.kt b/backend.native/tests/external/codegen/blackbox/regressions/Kt2495Test.kt new file mode 100644 index 00000000000..072eba9a2f8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/Kt2495Test.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +package regressions + +fun f(xs: Iterator): Int { + var answer = 0 + for (x in xs) { + answer += x + } + return answer +} + +fun box(): String { + val list = arrayListOf(1, 2, 3) + val result = f(list.iterator()) + return if (6 == result) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/arrayLengthNPE.kt b/backend.native/tests/external/codegen/blackbox/regressions/arrayLengthNPE.kt new file mode 100644 index 00000000000..e3c91e64aaf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/arrayLengthNPE.kt @@ -0,0 +1,13 @@ +// See KT-14242 +var x = 1 +fun box(): String { + val testArray: Array? = when (1) { + x -> null + else -> arrayOfNulls(0) + } + + // Must not be NPE here + val size = testArray?.size + + return size?.toString() ?: "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/collections.kt b/backend.native/tests/external/codegen/blackbox/regressions/collections.kt new file mode 100644 index 00000000000..aef72483d91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/collections.kt @@ -0,0 +1,154 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +package collections + +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue +import java.security.KeyPair + + +fun testCollectionSize(c: Collection) = assertEquals(0, c.size) +fun testCollectionIsEmpty(c: Collection) = assertTrue(c.isEmpty()) +fun testCollectionContains(c: Collection) = assertTrue(c.contains(1 as Any?)) +fun testCollectionIterator(c: Collection) { + val it = c.iterator() + while (it.hasNext()) { + assertEquals(1, it.next() as Any?) + } +} +fun testCollectionContainsAll(c: Collection) = assertTrue(c.containsAll(c)) +fun testMutableCollectionAdd(c: MutableCollection, t: T) { + c.add(t) + assertEquals(1, c.size) + assertTrue(c.contains(t)) +} +fun testMutableCollectionRemove(c: MutableCollection, t: T) { + c.remove(t) + assertEquals(0, c.size) + assertFalse(c.contains(t)) +} +fun testMutableCollectionIterator(c: MutableCollection, t: T) { + c.add(t) + val it = c.iterator() + while (it.hasNext()) { + it.next() + it.remove() + } + assertEquals(0, c.size) +} +fun testMutableCollectionAddAll(c: MutableCollection, t1: T, t2: T) { + c.addAll(arrayListOf(t1, t2)) + assertEquals(arrayListOf(t1, t2), c) +} +fun testMutableCollectionRemoveAll(c: MutableCollection, t1: T, t2: T) { + c.addAll(arrayListOf(t1, t2)) + c.removeAll(arrayListOf(t1)) + assertEquals(arrayListOf(t2), c) +} +fun testMutableCollectionRetainAll(c: MutableCollection, t1: T, t2: T) { + c.addAll(arrayListOf(t1, t2)) + c.retainAll(arrayListOf(t1)) + assertEquals(arrayListOf(t1), c) +} +fun testMutableCollectionClear(c: MutableCollection) { + c.clear() + assertTrue(c.isEmpty()) +} + +fun testCollection() { + testCollectionSize(arrayListOf()) + testCollectionIsEmpty(arrayListOf()) + testCollectionContains(arrayListOf(1)) + testCollectionIterator(arrayListOf(1)) + testCollectionContainsAll(arrayListOf("a", "b")) + + testMutableCollectionAdd(arrayListOf(), "") + testMutableCollectionRemove(arrayListOf("a"), "a") + testMutableCollectionIterator(arrayListOf(), 1) + testMutableCollectionAddAll(arrayListOf(), 1, 2) + testMutableCollectionRemoveAll(arrayListOf(), 1, 2) + testMutableCollectionRetainAll(arrayListOf(), 1, 2) + testMutableCollectionClear(arrayListOf(1, 2)) +} + + +fun testListGet(l: List, t: T) = assertEquals(t, l.get(0)) +fun testListIndexOf(l: List, t: T) = assertEquals(0, l.indexOf(t)) +fun testListIterator(l: List, t1 : T, t2 : T) { + val indexes = arrayListOf() + val result = arrayListOf() + val it = l.listIterator() + while (it.hasNext()) { + indexes.add(it.nextIndex()) + result.add(it.next()) + } + while (it.hasPrevious()) { + indexes.add(it.previousIndex()) + result.add(it.previous()) + } + assertEquals(arrayListOf(0, 1, 1, 0), indexes) + assertEquals(arrayListOf(t1, t2, t2, t1), result) +} +fun testListSublist(l: List, t: T) = assertEquals(arrayListOf(t), l.subList(0, 1)) + +fun testMutableListSet(l: MutableList, t: T) { + l.set(0, t) + assertEquals(arrayListOf(t), l) +} +fun testMutableListIterator(l: MutableList, t1: T, t2: T, t3: T) { + val it = l.listIterator() + while (it.hasNext()) { + it.next() + it.add(t3) + } + assertEquals(arrayListOf(t1, t3, t2, t3), l) +} + +fun testList() { + testListGet(arrayListOf(1), 1) + testListIndexOf(arrayListOf(1), 1) + testListIterator(arrayListOf("a", "b"), "a", "b") + testListSublist(arrayListOf(1, 2), 1) + + testMutableListSet(arrayListOf(2), 4) + testMutableListIterator(arrayListOf(1, 2), 1, 2, 3) +} + +fun testMapContainsKey(map: Map, k: K) = assertTrue(map.containsKey(k)) +fun testMapKeys(map: Map, k1: K, k2: K) = assertEqualCollections(hashSetOf(k1, k2), map.keys) +fun testMapValues(map: Map, v1: V, v2: V) = assertEqualCollections(hashSetOf(v1, v2), map.values) +fun testMapEntrySet(map: Map, k : K, v: V) { + for (entry in map.entries) { + assertEquals(k, entry.key) + assertEquals(v, entry.value) + } +} +fun testMutableMapEntry(map: MutableMap, k1 : K, v: V) { + for (entry in map.entries) { + entry.setValue(v) + } + assertEquals(hashMapOf(k1 to v), map) +} + + +fun testMap() { + testMapContainsKey(hashMapOf(1 to 'a', 2 to 'b'), 2) + testMapKeys(hashMapOf(1 to 'a', 2 to 'b'), 1, 2) + testMapValues(hashMapOf(1 to 'a', 2 to 'b'), 'a', 'b') + testMapEntrySet(hashMapOf(1 to 'a'), 1, 'a') + testMutableMapEntry(hashMapOf(1 to 'a'), 1, 'b') +} + +fun box() : String { + testCollection() + testList() + testMap() + return "OK" +} + +fun assertEqualCollections(c1: Collection, c2: Collection) = assertEquals(c1.toCollection(hashSetOf()), c2.toCollection(hashSetOf())) diff --git a/backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant.kt b/backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant.kt new file mode 100644 index 00000000000..8fb7e750367 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant.kt @@ -0,0 +1,11 @@ +interface In + +class En : In +class A : In +fun select(x: T, y: T): T = x ?: y + +// This test just checks that no internal error happens in backend +// Return type should be In<*> nor In +fun foobar(e: En<*>) = select(A(), e) + +fun box() = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant2.kt b/backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant2.kt new file mode 100644 index 00000000000..959eaf527aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/commonSupertypeContravariant2.kt @@ -0,0 +1,9 @@ +interface In +class A : In +class B : In +fun select(x: T, y: T) = x ?: y + +// This test just checks that no internal error happens in backend +fun foobar(a: A, b: B) = select(a, b) + +fun box() = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/doubleMerge.kt b/backend.native/tests/external/codegen/blackbox/regressions/doubleMerge.kt new file mode 100644 index 00000000000..92e282fab33 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/doubleMerge.kt @@ -0,0 +1,10 @@ +fun foo(): Double { + var d = 2.0 + if (d > 0.0) { + d++ + } + d++ + return d +} + +fun box() = if (foo() > 3.5) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/floatMerge.kt b/backend.native/tests/external/codegen/blackbox/regressions/floatMerge.kt new file mode 100644 index 00000000000..22033fa3950 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/floatMerge.kt @@ -0,0 +1,10 @@ +fun foo(): Float { + var f = 2.0f + if (f > 0.0f) { + f++ + } + f++ + return f +} + +fun box() = if (foo() > 3.5f) "OK" else "Fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/regressions/generic.kt b/backend.native/tests/external/codegen/blackbox/regressions/generic.kt new file mode 100644 index 00000000000..c5cf2b2efff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/generic.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME + +fun ArrayList.findAll(predicate: (T) -> Boolean): ArrayList { + val result = ArrayList() + for(t in this) { + if (predicate(t)) result.add(t) + } + return result +} + + +fun box(): String { + val list: ArrayList = ArrayList() + list.add("Prague") + list.add("St.Petersburg") + list.add("Moscow") + list.add("Munich") + + val m: ArrayList = list.findAll({ name: String -> name.startsWith("M")}) + return if (m.size == 2) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt b/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt new file mode 100644 index 00000000000..964220090d8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes + +class SimpleClass + +class ClassWithNonGenericSuperInterface: Cloneable + +class ClassWithGenericSuperInterface: java.util.Comparator { + override fun compare(a: String, b: String): Int = 0 +} + +fun check(klass: Class<*>) { + val interfaces = klass.getInterfaces().toList() + val genericInterfaces = klass.getGenericInterfaces().toList() + if (interfaces.size != genericInterfaces.size) { + throw AssertionError("interfaces=$interfaces, genericInterfaces=$genericInterfaces") + } +} + +fun box(): String { + check(SimpleClass::class.java) + check(ClassWithNonGenericSuperInterface::class.java) + check(ClassWithGenericSuperInterface::class.java) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/hashCodeNPE.kt b/backend.native/tests/external/codegen/blackbox/regressions/hashCodeNPE.kt new file mode 100644 index 00000000000..d362db21e77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/hashCodeNPE.kt @@ -0,0 +1,13 @@ +// See KT-14242 +var x = 1 +fun box(): String { + val any: Any? = when (1) { + x -> null + else -> Any() + } + + // Must not be NPE here + val hashCode = any?.hashCode() + + return hashCode?.toString() ?: "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/internalTopLevelOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/regressions/internalTopLevelOtherPackage.kt new file mode 100644 index 00000000000..8c51a9a2cf9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/internalTopLevelOtherPackage.kt @@ -0,0 +1,9 @@ +// FILE: 1.kt + +fun box() = a.x + +// FILE: 2.kt + +package a + +internal val x: String = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt10143.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt10143.kt new file mode 100644 index 00000000000..33a0cbbce16 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt10143.kt @@ -0,0 +1,33 @@ +// FILE: Outer.kt + +package another +open class Outer { + protected class Stage(val run: () -> Unit) + protected class My(var stage: Stage? = null) { + fun initStage(f: () -> Unit): Stage { + stage = Stage(f) + return stage!! + } + } + protected fun my(init: My.() -> Unit): My { + val result = My() + result.init() + return result + } +} + +// FILE: Main.kt + +package other +class Derived : another.Outer() { + init { + my { + initStage { } + } + } +} + +fun box(): String { + Derived() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt10934.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt10934.kt new file mode 100644 index 00000000000..bbc549b99c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt10934.kt @@ -0,0 +1,38 @@ +//KT-10934 compiler throws UninferredParameterTypeConstructor in when block that covers all types + +class Parser(val f: (TInput) -> Result) { + + operator fun invoke(input: TInput): Result = f(input) + + fun mapJoin( + selector: (TValue) -> Parser, + projector: (TValue, TIntermediate) -> TValue2 + ): Parser { + return Parser({ input -> + val res = this(input) + when (res) { + is Result.ParseError -> Result.ParseError(res.productionLabel, res.child, res.rest) + is Result.Value -> { + val v = res.value + val res2 = selector(v)(res.rest) + when (res2) { + is Result.ParseError -> Result.ParseError(res2.productionLabel, res2.child, res2.rest) + is Result.Value -> Result.Value(projector(v, res2.value), res2.rest) + } + } + } + }) + } +} + +/** A parser can return one of two Results */ +sealed class Result { + + class Value(val value: TValue, val rest: TInput) : Result() {} + + class ParseError(val productionLabel: String, + val child: ParseError?, + val rest: TInput) : Result() {} +} + +fun box() = "OK" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt new file mode 100644 index 00000000000..b4fa90465a2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS +// not sure if it's ok to change Object to Any + +// WITH_RUNTIME + +package test.regressions.kt1172 + +public fun scheduleRefresh(vararg files : Object) { + ArrayList(files.map { it }) +} + +fun box(): String { + scheduleRefresh() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1202.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1202.kt new file mode 100644 index 00000000000..139bfc770bf --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1202.kt @@ -0,0 +1,122 @@ +// TARGET_BACKEND: JVM + +// WITH_RUNTIME +// FULL_JDK + +package testeval + +import java.util.LinkedList +import java.util.Deque + +interface Expression +class Num(val value : Int) : Expression +class Sum(val left : Expression, val right : Expression) : Expression +class Mult(val left : Expression, val right : Expression) : Expression + +fun eval(e : Expression) : Int { + return when (e) { + is Num -> e.value + is Sum -> eval(e.left) + eval (e.right) + is Mult -> eval(e.left) * eval (e.right) + else -> throw AssertionError("Unknown expression") + } +} + +interface ParseResult { + val success : Boolean + val value : T +} + +class Success(override val value : T) : ParseResult { + public override val success : Boolean = true +} + +class Failure(val message : String) : ParseResult { + override val success = false + override val value : Nothing = throw UnsupportedOperationException("Don't call value on a Failure") +} + +open class Token(val text : String) { + override fun toString() = text +} +object LPAR : Token("(") +object RPAR : Token(")") +object PLUS : Token("+") +object TIMES : Token("*") +object EOF : Token("EOF") +class Number(text : String) : Token(text) +class Error(text : String) : Token("[Error: $text]") + + +fun tokenize(text : String) : Deque { + val result = LinkedList() + for (c in text) { + result.add(when (c) { + '(' -> LPAR + ')' -> RPAR + '+' -> PLUS + '*' -> TIMES + in '0'..'9' -> Number(c.toString()) + else -> Error(c.toString()) + }) + } + result.add(EOF) + return result +} + +fun parseSum(tokens : Deque) : ParseResult { + val left = parseMult(tokens) + if (!left.success) return left + + if (tokens.peek() == PLUS) { + tokens.pop() + val right = parseSum(tokens) + if (!right.success) return right + return Success(Sum(left.value, right.value)) + } + + return left +} + +fun parseMult(tokens : Deque) : ParseResult { + val left = parseAtomic(tokens) + if (!left.success) return left + + if (tokens.peek() == PLUS) { + tokens.pop() + val right = parseMult(tokens) + if (!right.success) return right + return Success(Mult(left.value, right.value)) + } + + return left +} + +fun parseAtomic(tokens : Deque) : ParseResult { + val token = tokens.poll() + return when (token) { + LPAR -> { + val result = parseSum(tokens) + val rpar = tokens.poll() + if (rpar == RPAR) + result + else + Failure("Expecting ')'") + } + is Number -> Success(Num(Integer.parseInt((token as Token).text))) + else -> Failure("Unexpected EOF") + } +} + +fun parse(text : String) : ParseResult = parseSum(tokenize(text)) + +fun box(): String { + if (1 != eval(Num(1))) return "fail 1" + if (2 != eval(Sum(Num(1), Num(1)))) return "fail 2" + if (3 != eval(Mult(Num(3), Num(1)))) return "fail 3" + if (6 != eval(Mult(Num(3), Sum(Num(1), Num(1))))) return "fail 4" + + if (1 != eval(parse("1").value)) return "fail 5" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt13381.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt13381.kt new file mode 100644 index 00000000000..b424d596455 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt13381.kt @@ -0,0 +1,12 @@ +interface A { + // There must be no delegation methods for 'log' and 'bar' in C as they are private + private val log: String get() = "O" + private fun bar() = "K" + + fun foo() = log + bar() +} + +interface B : A +class C : B + +fun box() = C().foo() diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1406.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1406.kt new file mode 100644 index 00000000000..171a734bec8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1406.kt @@ -0,0 +1,29 @@ +// TARGET_BACKEND: JVM + +// WITH_RUNTIME +// FULL_JDK + +package pack + +import java.util.regex.Pattern + +class C{ + public fun foo(){ + val items : Collection = listOf(Item()) + val result = ArrayList() + val pattern: Pattern? = Pattern.compile("...") + items.filterTo(result) { + pattern!!.matcher(it.name())!!.matches() + } + } + + private fun Item.name() : String = "" +} + +class Item{ +} + +fun box() : String { + C().foo() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt14447.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt14447.kt new file mode 100644 index 00000000000..7aab4c5003b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt14447.kt @@ -0,0 +1,22 @@ +class ImpulsMigration +{ + fun migrate(oldVersion: Long) + { + var _oldVersion = oldVersion + + if (4 > 3) + { + _oldVersion = 1 + } + + if (1 > 3) + { + _oldVersion++ + } + } +} + +fun box(): String { + ImpulsMigration().migrate(1L) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt new file mode 100644 index 00000000000..38e00ad6b56 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1.kt + +package thispackage + +import otherpackage.* + +fun box(): String { + if (!localUse()) { + return "local use failed" + } + if (!fromOtherPackage()) { + return "use from other package failed" + } + return "OK" +} + +fun localUse(): Boolean { + val c = Runnable::class.java + return (c.getName()!! == "java.lang.Runnable") +} + +// FILE: 2.kt + +package otherpackage + +fun fromOtherPackage(): Boolean { + val c = Runnable::class.java + return (c.getName()!! == "java.lang.Runnable") +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1528.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1528.kt new file mode 100644 index 00000000000..99352a01acb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1528.kt @@ -0,0 +1,10 @@ +// FILE: 1.kt + +fun box() = foo() + +// FILE: 2.kt + +private val a = "OK" +fun foo() : String { + return "${a}" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt new file mode 100644 index 00000000000..fb6770e9da0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt @@ -0,0 +1,9 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box() : String { + val i = 1 + return if(i.javaClass.getSimpleName() == "int") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1779.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1779.kt new file mode 100644 index 00000000000..ffcb7d79844 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1779.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +import kotlin.collections.AbstractIterator + +class MyIterator : AbstractIterator() { + var i = 0 + public override fun computeNext() { + if(i < 5) + setNext((i++).toString()) + } + +} + +fun box() : String { + var k = "" + for (x in MyIterator()) { + k+=x + } + return if(k=="01234") "OK" else k +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1800.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1800.kt new file mode 100644 index 00000000000..85b88bbac74 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1800.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME +//KT-1800 error/NonExistentClass generated on runtime +package i + +public class User(val firstName: String, + val lastName: String, + val age: Int) { + override fun toString() = "$firstName $lastName, age $age" +} + +public fun > Collection.testMin(): T? { + var minValue: T? = null + for(value in this) { + if (minValue == null || value.compareTo(minValue!!) < 0) { + minValue = value + } + } + return minValue +} + +fun box() : String { + val users = arrayListOf( + User("John", "Doe", 30), + User("Jane", "Doe", 27)) + + val ages = users.map { it.age } + + val minAge = ages.testMin() + return if (minAge == 27) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1845.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1845.kt new file mode 100644 index 00000000000..1451484226a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1845.kt @@ -0,0 +1,12 @@ +// FILE: 1.kt + +public var v1: String = "V1" + +fun box(): String { + val s = "v1: $v1, v2: $v2" + return "OK" +} + +// FILE: 2.kt + +public var v2: String = "V2" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt new file mode 100644 index 00000000000..df7e3fe3fa0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import java.lang.annotation.Annotation + +@Retention(AnnotationRetention.RUNTIME) +annotation class foo(val name : String) + +class Test() { + @foo("OK") fun hello(input : String) { + } +} + +fun box(): String { + val test = Test() + for (method in Test::class.java.getMethods()!!) { + val anns = method?.getAnnotations() as Array + if (!anns.isEmpty()) { + for (ann in anns) { + val fooAnn = ann as foo + return fooAnn.name + } + } + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2017.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2017.kt new file mode 100644 index 00000000000..3b1b64b5dc1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2017.kt @@ -0,0 +1,6 @@ +// WITH_RUNTIME + +fun box(): String { + val sorted = arrayListOf("1", "3", "2").sorted() + return if (sorted != arrayListOf("1", "2", "3")) "$sorted" else "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2060.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2060.kt new file mode 100644 index 00000000000..374e73111fb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2060.kt @@ -0,0 +1,28 @@ +// FILE: 1.kt + +import testing.ClassWithInternals + +public class HelloServer() : ClassWithInternals() { + public override fun start() { + val test = foo() + someGetter //+ some + } +} + +fun box() : String { + HelloServer().start() + return "OK" +} + +// FILE: 2.kt + +package testing; // There is no error if both files are in default package + +public abstract class ClassWithInternals { + protected var some: Int = 0; + protected var someGetter: Int = 0 + get() = 5 + + protected fun foo() : Int = 0 + + public abstract fun start() : Unit; +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2210.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2210.kt new file mode 100644 index 00000000000..95f4d64882a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2210.kt @@ -0,0 +1,8 @@ +class A(t: Array>) { + val a:Array> = t +} + +fun box(): String { + A(arrayOf()) // <- java.lang.VerifyError: (class: A, method: getA signature: ()[[Ljava/lang/Object;) Wrong return type in function + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt new file mode 100644 index 00000000000..28bbc2321b2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt @@ -0,0 +1,9 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + kotlin.assert(true) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt new file mode 100644 index 00000000000..a124aa15eb6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + Boolean::class.java + Byte::class.java + Short::class.java + Char::class.java + Int::class.java + Long::class.java + Float::class.java + Double::class.java + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2509.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2509.kt new file mode 100644 index 00000000000..10529d6d497 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2509.kt @@ -0,0 +1,12 @@ +fun box(): String { + A() + return "OK" +} + +class A: B() { + override var foo = arrayOf(12, 13) +} + +abstract class B { + abstract var foo: Array +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt new file mode 100644 index 00000000000..093a1d01116 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun foo() { + if (1==1) { + 1.javaClass + } else { + } +} + +fun box() = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt new file mode 100644 index 00000000000..d49c14e826a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +fun box() : String { + val vector = java.util.Vector() + vector.add(1) + vector.add(2) + vector.add(3) + + var sum = 0 + for(e in vector.elements()) { + sum += e + } + return if(sum == 6) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt new file mode 100644 index 00000000000..1b71da1475c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val bool = true + if (bool.javaClass != Boolean::class.java) return "javaClass function on boolean fails" + val b = 1.toByte() + if (b.javaClass != Byte::class.java) return "javaClass function on byte fails" + val s = 1.toShort() + if (s.javaClass != Short::class.java) return "javaClass function on short fails" + val c = 'c' + if (c.javaClass != Char::class.java) return "javaClass function on char fails" + val i = 1 + if (i.javaClass != Int::class.java) return "javaClass function on int fails" + val l = 1.toLong() + if (l.javaClass != Long::class.java) return "javaClass function on long fails" + val f = 1.toFloat() + if (f.javaClass != Float::class.java) return "javaClass function on float fails" + val d = 1.0 + if (d.javaClass != Double::class.java) return "javaClass function on double fails" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3107.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3107.kt new file mode 100644 index 00000000000..851d6931058 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3107.kt @@ -0,0 +1,17 @@ +fun foo(): String { + val s = try { + "OK" + } catch (e: Exception) { + try { + "" + } catch (ee: Exception) { + "" + } + } + + return s +} + +fun box(): String { + return foo() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3421.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3421.kt new file mode 100644 index 00000000000..a3f0590d621 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3421.kt @@ -0,0 +1,9 @@ +public object Globals{ + operator fun get(key: String, remove: Boolean = true): String { + return "OK" + } +} + +fun box(): String { + return Globals["test"] +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt new file mode 100644 index 00000000000..948f5d26daa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt @@ -0,0 +1,200 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun s0() : Boolean { + val y = "222" + val foo = { + val bar = { y } + bar () + } + return foo() == "222" +} + +fun s1() : Boolean { + var x = "222" + val foo = { + val bar = { + x = "aaa" + } + bar () + } + foo() + return x == "aaa" +} + +fun t1() : Boolean { + var x = "111" + + val y = x + "22" + val foo = { + x = x + "45" + y + x = x.substring(3) + x += "aaa" + Unit + } + foo() + + x += "bbb" + System.out?.println(x) + return x == "4511122aaabbb" +} + +fun t2() : Boolean { + var x = 111 + val y = x + 22 + val foo = { + x = x + 5 + y + x += 5 + x++ + Unit + } + foo() + x -= 55 + System.out?.println(x) + return x == 200 +} + +fun t3() : Boolean { + var x = true + val foo = { + x = false + Unit + } + foo() + return !x +} + +fun t4() : Boolean { + var x = 100.toFloat() + val y = x + 22 + val foo = { + x = x + 200.toFloat() + y + x += 18 + Unit + } + foo() + System.out?.println(x) + return x == 440.toFloat() +} + +fun t5() : Boolean { + var x = 100.toDouble() + val y = x + 22 + val foo = { + x = x + 200.toDouble() + y + x -= 22 + Unit + } + foo() + System.out?.println(x) + return x == 400.toDouble() +} + +fun t6() : Boolean { + var x = 20.toByte() + val y = x + 22 + val foo = { + x = (x + 20.toByte() + y).toByte() + x = (x + 2).toByte() + x-- + Unit + } + foo() + System.out?.println(x) + return x == 83.toByte() +} + +fun t7() : Boolean { + var x : Char = 'a' + val foo = { + x = 'b' + Unit + } + foo() + System.out?.println(x) + return x == 'b' +} + +fun t8() : Boolean { + var x = 20.toShort() + val foo = { + val bar = { + x = 30.toShort() + Unit + } + bar() + Unit + } + foo() + return x == 30.toShort() +} + +fun t9(x0: Int) : Boolean { + var x = x0 + while(x < 100) { + x++ + } + return x == 100 +} + +fun t10() : Boolean { + var y = 1 + val foo = { + val bar = { + y = y + 1 + } + bar() + } + foo() + return y == 2 +} + +fun t11(x0: Int) : Int { + var x = x0 + val foo = { + x = x + 1 + val bar = { + x = x + 1 + x += 3 + } + bar() + } + while(x < 100) { + foo() + } + return x +} + +fun t12(x: Int) : Int { + var y = x + val runnable = object : Runnable { + override fun run () { + y = y + 1 + } + } + while(y < 100) { + runnable.run() + } + return y +} + +fun box(): String { + if (!s0()) return "s0 fail" + if (!s1()) return "s1 fail" + if (!t1()) return "t1 fail" + if (!t2()) return "t2 fail" + if (!t3()) return "t3 fail" + if (!t4()) return "t4 fail" + if (!t5()) return "t5 fail" + if (!t6()) return "t6 fail" + if (!t7()) return "t7 fail" + if (!t8()) return "t8 fail" + if (!t9(0)) return "t9 fail" + if (!t10()) return "t10 fail" + if (t11(1) != 101) return "t11 fail" + if (t12(0) != 100) return "t12 fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3442.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3442.kt new file mode 100644 index 00000000000..0a28219ff5f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3442.kt @@ -0,0 +1,8 @@ +// WITH_RUNTIME + +fun box(): String { + val m = hashMapOf() + m.put("b", null) + val oldValue = m.getOrPut("b", { "Foo" }) + return if (oldValue == "Foo") "OK" else "fail: $oldValue" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3587.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3587.kt new file mode 100644 index 00000000000..3e1d47b1cd9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3587.kt @@ -0,0 +1,10 @@ +open class Variable { + val lightVar: LightVariable = if (this is LightVariable) this else LightVariable() +} + +class LightVariable() : Variable() + +fun box(): String { + Variable() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3850.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3850.kt new file mode 100644 index 00000000000..03acfce7df7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3850.kt @@ -0,0 +1,7 @@ +private class One { + val a1 = arrayOf( + object { val fy = "text"} + ) +} + +fun box() = if (One().a1[0].fy == "text") "OK" else "fail" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3903.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3903.kt new file mode 100644 index 00000000000..1d08051cded --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3903.kt @@ -0,0 +1,11 @@ +class Foo { + fun bar(): String { + fun foo(t:() -> T) : T = t() + foo { } + return "OK" + } +} + +fun box(): String { + return Foo().bar() +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt4142.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt4142.kt new file mode 100644 index 00000000000..d7fe122fda7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt4142.kt @@ -0,0 +1,16 @@ +open class B { + val name: String + get() = "OK" +} + +interface A { + val name: String +} + +class C : B(), A { + +} + +fun box(): String { + return C().name +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt new file mode 100644 index 00000000000..3803247c36d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val s: String? = "a" + val o: Char? = s?.get(0) + val c: Any? = o?.javaClass + return if (c != null) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt new file mode 100644 index 00000000000..c34c88f35e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun > Byte.toEnum(clazz : Class) : E = + (clazz.getMethod("values").invoke(null) as Array)[this.toInt()] + +enum class Letters { A, B, C } + +fun box(): String { + val clazz = Letters::class.java + val r = 1.toByte().toEnum(clazz) + return if (r == Letters.B) "OK" else "Fail: $r" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt4281.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt4281.kt new file mode 100644 index 00000000000..a1e84ddff49 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt4281.kt @@ -0,0 +1,16 @@ +abstract class C { + fun test(x: Int) { + if (x == 0) return + if (this is D) { + val d: D = this + d.test(x - 1) + } + } +} + +class D: C() + +fun box(): String { + D().test(10) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5056.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5056.kt new file mode 100644 index 00000000000..eb6855473ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5056.kt @@ -0,0 +1,6 @@ +// WITH_RUNTIME + +fun box(): String { + val list = arrayOf("a", "c", "b").sorted() + return if (list.toString() == "[a, b, c]") "OK" else "Fail: $list" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt new file mode 100644 index 00000000000..60c5361a14a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt @@ -0,0 +1,132 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +package mask + +import java.io.* +import java.util.* + +fun box() : String { + val input = StringReader("/aaa/bbb/ccc/ddd") + + val luhny = Luhny() + input.forEachChar { + luhny.charIn(it) + } + luhny.printAll() + return "OK" +} + +class Luhny() { + val buffer = LinkedList() + val digits = LinkedList() + + var toBeMasked = 0 + + fun charIn(it : Char) { + buffer.addLast(it) + + // Commented for KT-621 + // when (it) { + // .isDigit() => digits.addLast(it.toInt() - '0'.toInt()) + // ' ', '-' => {} + // else => { + // printAll() + // digits.clear() + // } + // } + + if (it.isDigit()) { + digits.addLast(it - '0') + } else if (it == ' ' || it == '-') { + } else { + printAll() + digits.clear() + } + + if (digits.size > 16) + printOneDigit() + check() + } + + fun check() { + if (digits.size < 14) return + print("check") + val sum = digits.sum { i, d -> +// println("$i -> $d") + if (i % 2 == digits.size) { + val f = d * 2 / 10 + val s = d * 2 % 10 +// println("$d: f = $f, s = $s") + (f + s).pr { +// println("to be doubled: $i -> $d : $it") + } + } else d + } +// println(sum) + if (sum % 10 == 0) {print("s"); toBeMasked = digits.size} + } + + fun printOneDigit() { + while (!buffer.isEmpty()) { + val c = buffer.removeFirst() + out(c) + if (c.isDigit()) { + digits.removeFirst() + return + } + } + } + + fun printAll() { + while (!buffer.isEmpty()) + out(buffer.removeFirst()) + } + + fun out(c : Char) { + if (toBeMasked > 0) { + print('X') + toBeMasked-- + } + else { + // print(c) + } + } +} + +fun T.pr(f : (T) -> Unit) : T { + f(this) + return this +} + +fun LinkedList.sum(f : (Int, Int )-> Int): Int { + var sum = 0 + for (i in 1..size) { + val j = size - i + sum += f(j, get(j)) + } + return sum +} + +//fun List.backwards() : Itl = object : Itl { +// override fun iterator() : It = +// object : It { +// var current = size() +// override fun next() : T = get(--current) +// override fun hasNext() : Boolean = current > 0 +// override fun remove() {throw UnsupportedOperationException()} +// } +//} + +// fun Char.isDigit() = Character.isDigit(this) + +fun Reader.forEachChar(body : (Char) -> Unit) { + do { + var i = read(); + if (i == -1) break + body(i.toChar()) + } while(true) +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt new file mode 100644 index 00000000000..b22b0ab3edb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt @@ -0,0 +1,113 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +package mask + +import java.io.* +import java.util.* + +fun box() : String { + val input = StringReader("/aaa/bbb/ccc/ddd") + + val luhny = Luhny() + input.forEachChar { + luhny.process(it) + } + luhny.printAll() + return "OK" +} + +class Luhny() { + private val buffer = ArrayDeque() + private val digits = ArrayDeque(16) + + private var toBeMasked = 0 + + fun process(it : Char) { + buffer.addLast(it) + + // Commented for KT-621 + // when (it) { + // .isDigit() => digits.addLast(it.toInt() - '0'.toInt()) + // ' ', '-' => {} + // else => printAll() + // } + + if (it.isDigit()) { + digits.addLast(it - '0') + } else if (it == ' ' || it == '-') { + } else { + printAll() + } + + if (digits.size > 16) + printOneDigit() + check() + } + + private fun check() { + val size = digits.size + if (size < 14) return + val sum = digits.sum {i, d -> + if (i % 2 == size % 2) double(d) else d + } +// var sum = 0 +// var i = 0 +// for (d in digits) { +// sum += if (i % 2 == size % 2) double(d) else d +// i++ +// } + if (sum % 10 == 0) toBeMasked = digits.size + } + + private fun double(d : Int) = d * 2 / 10 + d * 2 % 10 + + private fun printOneDigit() { + while (!buffer.isEmpty()) { + val c = buffer.removeFirst()!! + print(c) + if (c.isDigit()) { + digits.removeFirst() + return + } + } + } + + fun printAll() { + while (!buffer.isEmpty()) + print(buffer.removeFirst()) + digits.clear() + } + + private fun print(c : Char) { + if (c.isDigit() && toBeMasked > 0) { + kotlin.io.print('X') + toBeMasked-- + } else { + // kotlin.io.print(c) + } + } +} + +// fun Char.isDigit() = Character.isDigit(this) + +fun Iterable.sum(f : (index : Int, value : Int) -> Int) : Int { + var sum = 0 + var i = 0 + for (d in this) { + sum += f(i, d) + i++ + } + return sum +} + +fun Reader.forEachChar(body : (Char) -> Unit) { + do { + var i = read(); + if (i == -1) break + body(i.toChar()) + } while(true) +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt new file mode 100644 index 00000000000..6b38479569d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt @@ -0,0 +1,150 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +package mask + +import java.io.* +import java.util.* + +fun box() : String { + val input = StringReader("/aaa/bbb/ccc/ddd") + + val luhny = Luhny() + input.forEachChar { + luhny.charIn(it) + } + luhny.printAll() + return "OK" + +} + +class Luhny() { + val buffer = LinkedList() + val digits = LinkedList() + + var toBeMasked = 0 + + fun charIn(it : Char) { + buffer.push(it) + + // Commented for KT-621 + // when (it) { + // .isDigit() => digits.push(it.toInt() - '0'.toInt()) + // ' ', '-' => {} + // else => { + // printAll() + // digits.clear() + // } + // } + + if (it.isDigit()) { + digits.push(it - '0') + } else if (it == ' ' || it == '-') { + } else { + printAll() + digits.clear() + } + + if (digits.size > 16) + printOneDigit() + check() + } + + fun check() { + if (digits.size < 14) return + val sum = digits.sum { i, d -> + if (i % 2 != 0) + d * 2 / 10 + d * 2 % 10 + else d + } + if (sum % 10 == 0) toBeMasked = digits.size + } + + fun printOneDigit() { + while (!buffer.isEmpty()) { + val c = buffer.pop() + out(c) + if (c.isDigit()) { + digits.pop() + return + } + } + } + + fun printAll() { + while (!buffer.isEmpty()) + out(buffer.pop()) + } + + fun out(c : Char) { + if (toBeMasked > 0) { + print('X') + toBeMasked-- + } + else { + // print(c) + } + } +} + +fun LinkedList.sum(f : (Int, Int) -> Int) : Int { + var sum = 0 + var i = 0 + for (d in backwards()) { + sum += f(i, d) + i++ + } + return sum +} + +fun List.backwards() : Iterable = object : Iterable { + override fun iterator() : Iterator = + object : Iterator { + var current = size + override fun next() : T = get(--current) + override fun hasNext() : Boolean = current > 0 + } +} + +// fun Char.isDigit() = Character.isDigit(this) + +//class Queue(initialBufSize : Int) { +// +// private var bufSize = initialBufSize +// private val buf = Array(initialBufSize) +// private var head = 0 +// private var tail = 0 +// private var size = 0 +// +// val empty : Boolean get() = size == 0 +// +// private fun prev(i : Int) = (bufSize + i - 1) % bufSize +// private fun next(i : Int) = (i + 1) % bufSize +// +// fun push(c : T) { +// buf[tail] = c +// tail = prev(tail) +// size++ +// } +// +// fun pop() : T { +// if (size == 0) throw IllegalStateException() +// size-- +// val result = buf[head] +// head = prev(head) +// return result +// } +// +// fun clear() {} +//} + +fun Reader.forEachChar(body : (Char) -> Unit) { + do { + var i = read(); + if (i == -1) break + body(i.toChar()) + } while(true) +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5395.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5395.kt new file mode 100644 index 00000000000..11bb02ddf09 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5395.kt @@ -0,0 +1,13 @@ +class D { + companion object { + protected val F: String = "OK" + } + + inner class E { + fun foo() = F + } +} + +fun box(): String { + return D().E().foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt new file mode 100644 index 00000000000..87a23405c7d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1.kt + +package test2 + +import test.A + +public fun box(): String { + return B().test(B()) +} + +public class B : A() { + public fun test(other:Any): String { + if (other is B && other.s == 2) { + return "OK" + } + return "fail" + } +} + +// FILE: 2.kt + +package test + +open class A { + @JvmField protected val s = 2; +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt new file mode 100644 index 00000000000..fb0b45ec62f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1.kt + +package test2 + +import test.A + +class C : A() { + fun a(): String { + return this.s + } +} + +public fun box(): String { + return C().a() +} + +// FILE: 2.kt + +package test + +open class A { + @JvmField protected val s = "OK"; +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5786_privateWithDefault.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5786_privateWithDefault.kt new file mode 100644 index 00000000000..916ed482c60 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5786_privateWithDefault.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +fun box(): String { + run { + test("ok") + test("ok", 200) + } + test("ok") + test("ok", 300) + + return "OK" +} + +private fun test(arg1: String, default: Int = 0) = Unit diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5953.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5953.kt new file mode 100644 index 00000000000..3a7cdb1f7e5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5953.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +fun box(): String { + val res = (1..3).map { it -> + if (it == 1) + 2 + }; + + var result = "" + for (i in res) + result += " " + return if (result == " ") "OK" else result +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt6153.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt6153.kt new file mode 100644 index 00000000000..cc21778d197 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt6153.kt @@ -0,0 +1,15 @@ +// KT-6153 java.lang.IllegalStateException while building +object Bug { + fun title(id:Int) = when (id) { + 0 -> "OK" + else -> throw Exception("unsupported $id") + } + + private fun T.header(id: Int) = StringBuilder().append(title(id)) + + fun run() = header(0) +} + +fun box(): String { + return Bug.run().toString() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt new file mode 100644 index 00000000000..8cb94c7a42a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +enum class E { + VALUE, + VALUE2 +} + +class C(val nums: Map) { + val normalizedNums = loadNormalizedNums() + + private fun loadNormalizedNums(): Map { + val vals = nums.values + val min = vals.min()!! + val max = vals.max()!! + val rangeDiff = (max - min).toFloat() + val normalizedNums = nums.map { kvp -> + val (e, num) = kvp + //val e = kvp.key + //val num = kvp.value + val normalized = (num - min) / rangeDiff + Pair(e, normalized) + }.toMap() + return normalizedNums + } +} + +fun box(): String { + val res = C(hashMapOf(E.VALUE to 11, E.VALUE2 to 12)).normalizedNums.values.sorted().joinToString() + return if ("0.0, 1.0" == res) "OK" else "fail $res" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt6434_2.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt6434_2.kt new file mode 100644 index 00000000000..19cd842906a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt6434_2.kt @@ -0,0 +1,9 @@ +// WITH_RUNTIME + +fun box(): String { + val p = 1 to 1 + val (e, num) = p + val a = 1f + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt new file mode 100644 index 00000000000..1e609a5645e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import kotlin.test.assertEquals +import java.lang.reflect.ParameterizedType +import java.lang.reflect.Type + +open class TypeLiteral { + val type: Type + get() = (javaClass.getGenericSuperclass() as ParameterizedType).getActualTypeArguments()[0] +} + +inline fun typeLiteral(): TypeLiteral = object : TypeLiteral() {} + +fun box(): String { + assertEquals("class java.lang.String", typeLiteral().type.toString()) + assertEquals("java.util.List", typeLiteral>().type.toString()) + assertEquals("java.lang.String[]", typeLiteral>().type.toString()) + assertEquals("java.lang.Integer[]", typeLiteral>().type.toString()) + assertEquals("java.lang.String[][]", typeLiteral>>().type.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt new file mode 100644 index 00000000000..86006fdcd54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.* + +@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE") +inline fun javaClass(): Class = T::class.java + +val test = "lala".javaClass + +val test2 = javaClass> () + +fun box(): String { + if(test.getCanonicalName() != "java.lang.String") return "fail" + if(test2.getCanonicalName() != "java.util.Iterator") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt7401.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt7401.kt new file mode 100644 index 00000000000..16294c5031b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt7401.kt @@ -0,0 +1,10 @@ +fun foo(): Long { + var n = 2L + if (n > 0L) { + n++ + } + n++ + return n +} + +fun box() = if (foo() == 4L) "OK" else "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt789.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt789.kt new file mode 100644 index 00000000000..9849559160b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt789.kt @@ -0,0 +1,8 @@ +package foo + +fun box() : String { + val a = ArrayList(); + a.add(1) + a.add(2) + return if((a.size == 2) && (a.get(1) == 2) && (a.get(0) == 1)) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt new file mode 100644 index 00000000000..b6e32417942 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import java.io.* +import java.util.* + +fun sample() : Reader { + return StringReader("""Hello +World"""); + } + + fun box() : String { + // NOTE: Also tested in stdlib: LineIteratorTest.useLines + + // TODO compiler error + // both these expressions causes java.lang.NoClassDefFoundError: collections/CollectionPackage + val list1 = sample().useLines { it.toList() } + val list2 = sample().useLines>{ it.toCollection(arrayListOf()) } + + if(arrayListOf("Hello", "World") != list1) return "fail" + if(arrayListOf("Hello", "World") != list2) return "fail" + return "OK" + } diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt998.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt998.kt new file mode 100644 index 00000000000..7fef173ff74 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt998.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME + +fun findPairless(a : IntArray) : Int { + loop@ for (i in a.indices) { + for (j in a.indices) { + if (i != j && a[i] == a[j]) continue@loop + } + return a[i] + } + return -1 +} + +fun hasDuplicates(a : IntArray) : Boolean { + var duplicate = false + loop@ for (i in a.indices) { + for (j in a.indices) { + if (i != j && a[i] == a[j]) { + duplicate = true + break@loop + } + } + } + return duplicate +} + +fun box() : String { + val a = IntArray(5) + a[0] = 0 + a[1] = 0 + a[2] = 1 + a[3] = 1 + a[4] = 5 + if(findPairless(a) != 5) return "fail" + return if(hasDuplicates(a)) "OK" else "fail" + +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt b/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt new file mode 100644 index 00000000000..9be19247af8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +interface In +open class A : In +open class B : In + +inline fun select(x: T, y: T) = T::class.java.simpleName + +// This test checks mostly that no StackOverflow happens while mapping type argument of select-call (In) +// See KT-10972 +fun foo(): String = select(A(), B()) + +fun box(): String { + if (foo() != "In") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/objectCaptureOuterConstructorProperty.kt b/backend.native/tests/external/codegen/blackbox/regressions/objectCaptureOuterConstructorProperty.kt new file mode 100644 index 00000000000..b9011debfe9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/objectCaptureOuterConstructorProperty.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +interface Stream { + fun iterator(): Iterator +} + +class ZippingStream(val stream1: Stream, val stream2: Stream) : Stream> { + override fun iterator(): Iterator> = object : AbstractIterator>() { + val iterator1 = stream1.iterator() + val iterator2 = stream2.iterator() + override fun computeNext() { + if (iterator1.hasNext() && iterator2.hasNext()) { + setNext(iterator1.next() to iterator2.next()) + } else { + done() + } + } + } +} + + +object EmptyStream : Stream { + override fun iterator() = listOf().iterator() +} + +fun box(): String { + ZippingStream(EmptyStream, EmptyStream).iterator().hasNext() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt b/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt new file mode 100644 index 00000000000..5761d0d00a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// KT-4351 Cannot resolve reference to self in init of class local to function + +fun box(): String { + var accessedFromConstructor: Class<*>? = null + + class MyClass() { + init { + accessedFromConstructor = MyClass::class.java + } + } + + MyClass() + if (accessedFromConstructor!!.getName().endsWith("MyClass")) { + return "OK" + } else { + return accessedFromConstructor.toString() + } +} diff --git a/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt b/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt new file mode 100644 index 00000000000..99500695485 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import java.util.ArrayList + +// KT-2823 TypeCastException has no message +// KT-5121 Better error message in on casting null to non-null type + +fun box(): String { + try { + val a: Any? = null + a as Array + } + catch (e: TypeCastException) { + if (e.message != "null cannot be cast to non-null type kotlin.Array") { + return "Fail 1: $e" + } + } + + try { + val x: String? = null + x as String + } + catch (e: TypeCastException) { + if (e.message != "null cannot be cast to non-null type kotlin.String") { + return "Fail 2: $e" + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt b/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt new file mode 100644 index 00000000000..5b8db46d8b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals +import kotlin.reflect.KProperty + +class Project { + fun getInstance(cls: Class): T = + when (cls.getName()) { + "java.lang.Integer" -> 1 as T + "java.lang.String" -> "OK" as T + else -> null!! + } +} + +inline operator fun Project.getValue(t: Any?, p: KProperty<*>): T = getInstance(T::class.java) + +val project = Project() +val x1: Int by project +val x2: String by project + +fun box(): String { + assertEquals(1, x1) + assertEquals("OK", x2) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt b/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt new file mode 100644 index 00000000000..612ba58f353 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt @@ -0,0 +1,24 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +abstract class A { + abstract fun f(): String +} + +inline fun foo(): A { + return object : A() { + override fun f(): String { + return T::class.java.getName() + } + } +} + +fun box(): String { + val y = foo(); + assertEquals("java.lang.String", y.f()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt new file mode 100644 index 00000000000..06934dfa3f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt @@ -0,0 +1,41 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +interface A { + fun f1(): String + fun f2(): String + fun f3(): String +} + +fun doWork(block: () -> String) = block() +inline fun doWorkInline(block: () -> String) = block() + +fun box(): String { + val x = object { + inline fun bar1(): A = object : A { + override fun f1(): String = T::class.java.getName() + override fun f2(): String = doWork { T::class.java.getName() } + override fun f3(): String = doWorkInline { T::class.java.getName() } + } + + inline fun bar2() = T::class.java.getName() + inline fun bar3() = doWork { T::class.java.getName() } + inline fun bar4() = doWorkInline { T::class.java.getName() } + } + + val y: A = x.bar1() + assertEquals("java.lang.String", y.f1()) + assertEquals("java.lang.String", y.f2()) + assertEquals("java.lang.String", y.f3()) + + + assertEquals("java.lang.Integer", x.bar2()) + assertEquals("java.lang.Double", x.bar3()) + assertEquals("java.lang.Long", x.bar4()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt new file mode 100644 index 00000000000..f26aadf0efd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +abstract class A { + abstract fun f(): String +} + +inline fun foo(): A { + return object : A() { + override fun f(): String { + return "OK" + } + } +} + +fun box(): String { + val y = foo(); + assertEquals("OK", y.f()) + assertEquals("A", y.javaClass.getGenericSuperclass()?.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt b/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt new file mode 100644 index 00000000000..7febb78913a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// Basically this test checks that no captured type used as argument for signature mapping +class SwOperator: Operator, T> + +interface Operator + +open class Inv + +class Obs { + inline fun lift(lift: Operator) = object : Inv() {} +} + +fun box(): String { + val o: Obs = Obs() + + val inv = o.lift(SwOperator()) + val signature = inv.javaClass.genericSuperclass.toString() + + if (signature != "Inv>") return "fail 1: $signature" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt new file mode 100644 index 00000000000..b3db2462a04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun foo(x: Any?) = Pair(x is T, x is T?) + +fun box(): String { + val x1 = foo>(arrayOf("")) + if (x1.toString() != "(true, true)") return "fail 1" + + val x2 = foo?>(arrayOf("")) + if (x2.toString() != "(true, true)") return "fail 2" + + val x3 = foo>(null) + if (x3.toString() != "(false, true)") return "fail 3" + + val x4 = foo?>(null) + if (x4.toString() != "(true, true)") return "fail 4" + + val x5 = foo?>(arrayOf("")) + if (x5.toString() != "(false, false)") return "fail 5" + + val x6 = foo?>(null) + if (x6.toString() != "(true, true)") return "fail 6" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt new file mode 100644 index 00000000000..0557c36171b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun foo(x: Any?) = Pair(x is T, x is T?) +inline fun bar(y: Any?) = foo>(y) +inline fun barNullable(y: Any?) = foo?>(y) + +fun box(): String { + val x1 = bar(arrayOf("")) + if (x1.toString() != "(true, true)") return "fail 1" + + val x3 = bar(null) + if (x3.toString() != "(false, true)") return "fail 3" + + val x4 = bar(null) + if (x4.toString() != "(false, true)") return "fail 4" + + val x5 = bar(arrayOf("")) + if (x5.toString() != "(false, false)") return "fail 5" + + val x6 = bar(null) + if (x6.toString() != "(false, true)") return "fail 6" + + // barNullable + + val x7 = barNullable(arrayOf("")) + if (x7.toString() != "(true, true)") return "fail 7" + + val x9 = barNullable(null) + if (x9.toString() != "(true, true)") return "fail 9" + + val x10 = barNullable(arrayOf("")) + if (x10.toString() != "(false, false)") return "fail 11" + + val x12 = barNullable(null) + if (x12.toString() != "(true, true)") return "fail 12" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt new file mode 100644 index 00000000000..eafc6ba8149 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun jClass() = T::class.java +inline fun jClassArray() = jClass>() + +fun box(): String { + if (jClass>().simpleName != "String[]") return "fail 1" + if (jClass().simpleName != "int[]") return "fail 2" + + if (jClassArray().simpleName != "String[]") return "fail 3" + if (jClassArray>().simpleName != "String[][]") return "fail 4" + if (jClassArray().simpleName != "int[][]") return "fail 5" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArray.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArray.kt new file mode 100644 index 00000000000..1a2bee24db9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArray.kt @@ -0,0 +1,15 @@ +inline fun jaggedArray(x: (Int, Int) -> T): Array> = Array(1) { i -> + Array(1) { j -> x(i, j) } +} + +fun box(): String { + val x1: Array> = jaggedArray() { x, y -> "$x-$y" } + if (x1[0][0] != "0-0") return "fail 1" + + val x2: Array>> = jaggedArray() { x, y -> arrayOf("$x-$y") } + if (x2[0][0][0] != "0-0") return "fail 2" + + val x3: Array> = jaggedArray() { x, y -> intArrayOf(x + y + 1) } + if (x3[0][0][0] != 1) return "fail 3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt new file mode 100644 index 00000000000..8d4bc476108 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun jaggedArrayOfNulls(): Array?> = arrayOfNulls>(1) + +fun box(): String { + val x1 = jaggedArrayOfNulls().javaClass.simpleName + if (x1 != "String[][]") return "fail1: $x1" + + val x2 = jaggedArrayOfNulls>().javaClass.simpleName + if (x2 != "String[][][]") return "fail2: $x2" + + val x3 = jaggedArrayOfNulls().javaClass.simpleName + if (x3 != "int[][][]") return "fail3: $x3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedDeep.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedDeep.kt new file mode 100644 index 00000000000..aa8f36fc23e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedDeep.kt @@ -0,0 +1,17 @@ +inline fun jaggedArray(x: (Int, Int, Int) -> T): Array>> = Array(1) { i -> + Array(1) { + j -> Array(1) { k -> x(i, j, k) } + } +} + +fun box(): String { + val x1: Array>> = jaggedArray() { x, y, z -> "$x-$y-$z" } + if (x1[0][0][0] != "0-0-0") return "fail 1" + + val x2: Array>>> = jaggedArray() { x, y, z -> arrayOf("$x-$y-$z") } + if (x2[0][0][0][0] != "0-0-0") return "fail 2" + + val x3: Array>> = jaggedArray() { x, y, z -> intArrayOf(x + y + z + 1) } + if (x3[0][0][0][0] != 1) return "fail 3" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt b/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt new file mode 100644 index 00000000000..781ca4d0e29 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + + public static String nullString() { + return null; + } + + public static String nonnullString() { + return "OK"; + } + +} + +// FILE: kotlin.kt + +fun box(): String { + val nullStr = JavaClass.nullString() + val nonnullStr = JavaClass.nonnullString() + + if (nullStr.foo() != null) return "fail 1" + if (nonnullStr.foo() != nonnullStr) return "fail 2" + + if (nullStr.fooN() != null) return "fail 3" + if (nonnullStr.fooN() != nonnullStr) return "fail 4" + + return "OK" +} + +inline fun T.foo(): T = this as T + +inline fun T.fooN(): T? = this as T? diff --git a/backend.native/tests/external/codegen/blackbox/reified/checkcast.kt b/backend.native/tests/external/codegen/blackbox/reified/checkcast.kt new file mode 100644 index 00000000000..3b10a4bd5f8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/checkcast.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun checkcast(x: Any?): T { + return x as T +} + +fun box(): String { + val x = checkcast("abc") + assertEquals("abc", x) + val y = checkcast(1) + assertEquals(1, y) + + try { + val z = checkcast("abc") + } catch (e: Exception) { + return "OK" + } + + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/copyToArray.kt b/backend.native/tests/external/codegen/blackbox/reified/copyToArray.kt new file mode 100644 index 00000000000..4cbf10bdec5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/copyToArray.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun copy(c: Collection): Array { + return c.toTypedArray() +} + +fun box(): String { + val a: Array = copy(listOf("a", "b", "c")) + assertEquals("abc", a.joinToString("")) + + val b: Array = copy(listOf(1,2,3)) + assertEquals("123", b.map { it.toString() }.joinToString("")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt b/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt new file mode 100644 index 00000000000..d67c688ccef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(x: Class = T::class.java): String = x.getName() + +inline fun bar(x: R): String = foo() + +fun box(): String { + assertEquals("java.lang.String", foo()) + assertEquals("java.lang.Integer", foo()) + assertEquals("java.lang.Object", foo()) + + assertEquals("java.lang.String", bar("abc")) + assertEquals("java.lang.Integer", bar(1)) + assertEquals("java.lang.Object", bar(Any())) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt b/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt new file mode 100644 index 00000000000..f346e09fb54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun Array.filterIsInstance(): List { + return this.filter { it is T }.map { it as T } +} + +fun box(): String { + val src: Array = arrayOf(1,2,3.toDouble(), "abc", "cde") + + assertEquals(arrayListOf(1,2), src.filterIsInstance()) + assertEquals(arrayListOf(3.0), src.filterIsInstance()) + assertEquals(arrayListOf("abc", "cde"), src.filterIsInstance()) + assertEquals(src.toList(), src.filterIsInstance()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt b/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt new file mode 100644 index 00000000000..c1aa86e0bdc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt @@ -0,0 +1,32 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +abstract class A { + abstract fun f(): String + override fun toString() = f() +} + +abstract class G { + abstract fun bar(): Any +} + +inline fun foo(): G { + return object : G() { + override fun bar(): Any { + return object : A() { + override fun f(): String = "OK" + } + } + } +} + +fun box(): String { + val y = foo().bar(); + assertEquals("OK", y.toString()) + assertEquals("A", y.javaClass.getGenericSuperclass()?.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt b/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt new file mode 100644 index 00000000000..e3b8f5ce6c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun isinstance(x: Any?): Boolean { + return x is T +} + +fun box(): String { + assert(isinstance("abc")) + assert(isinstance(1)) + assert(!isinstance("abc")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt b/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt new file mode 100644 index 00000000000..9145708f32f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + + public static String nullString() { + return null; + } + + public static String nonnullString() { + return "OK"; + } + +} + +// FILE: kotlin.kt + +fun box(): String { + val nullStr = JavaClass.nullString() + val nonnullStr = JavaClass.nonnullString() + + if (nullStr.foo() != true) return "fail 1" + if (nonnullStr.foo() != true) return "fail 2" + + if (nullStr.fooN() != true) return "fail 3" + if (nonnullStr.fooN() != true) return "fail 4" + + return "OK" +} + +inline fun T.foo(): Boolean = this is T + +inline fun T.fooN(): Boolean = this is T? diff --git a/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt b/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt new file mode 100644 index 00000000000..a802437479f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun javaClassName(): String { + return T::class.java.getName() +} + +fun box(): String { + assertEquals("java.lang.String", javaClassName()) + assertEquals("java.lang.Integer", javaClassName()) + assertEquals("java.lang.Object", javaClassName()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt b/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt new file mode 100644 index 00000000000..3541986ec12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt @@ -0,0 +1,47 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun foo(): Array { + val x = object { + inline fun bar(): Array = arrayOf( + T1::class.java.getName(), T::class.java.getName(), R::class.java.getName() + ) + fun f1() = bar() + fun f2() = bar() + fun f3() = bar() + fun f4() = bar() + } + + val x1 = x.f1() + val x2 = x.f2() + val x3 = x.f3() + val x4 = x.f4() + + return arrayOf( + x1[0], x1[1], x1[2], + x2[0], x2[1], x2[2], + x3[0], x3[1], x3[2], + x4[0], x4[1], x4[2] + ) +} + +fun box(): String { + val result = foo() + + val expected = arrayOf( + "java.lang.Double", "java.lang.Integer", "java.lang.Integer", + "java.lang.Integer", "java.lang.Double", "java.lang.Integer", + "java.lang.Boolean", "java.lang.Double", "java.lang.Integer", + "java.lang.Double", "java.lang.Boolean", "java.lang.Integer" + ) + + for (i in expected.indices) { + assertEquals(expected[i], result[i], "$i-th element") + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt b/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt new file mode 100644 index 00000000000..f019235be48 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +open class A + +inline fun foo(): Array> { + val x = object { + inline fun bar(): A<*,*,*> = object : A() {} + fun f1() = bar() + fun f2() = bar() + fun f3() = bar() + fun f4() = bar() + } + + return arrayOf(x.f1(), x.f2(), x.f3(), x.f4()) +} + +fun box(): String { + val result = foo() + + val expected = arrayOf( + Triple("java.lang.Double", "java.lang.Integer", "java.lang.Integer"), + Triple("java.lang.Integer", "java.lang.Double", "java.lang.Integer"), + Triple("java.lang.Boolean", "java.lang.Double", "java.lang.Integer"), + Triple("java.lang.Double", "java.lang.Boolean", "java.lang.Integer") + ).map { "A<${it.first}, ${it.second}, ${it.third}>" } + + for (i in expected.indices) { + assertEquals(expected[i], result[i].javaClass.getGenericSuperclass()?.toString(), "$i-th element") + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt b/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt new file mode 100644 index 00000000000..b1d92cfbef9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun createArray(n: Int, crossinline block: () -> T): Array { + return Array(n) { block() } +} + +fun box(): String { + + val x = createArray(5) { 3 } + + assert(x.all { it == 3 }) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt b/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt new file mode 100644 index 00000000000..d970d16e2a5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(block: () -> String) = block() +inline fun bar1(x: T): String = foo() { + T::class.java.getName() +} +inline fun bar2(x: T, y: String): String = foo() { + T::class.java.getName() + "#" + y +} + +fun box(): String { + + assertEquals("java.lang.Integer", bar1(1)) + assertEquals("java.lang.String#OK", bar2("abc", "OK")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt b/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt new file mode 100644 index 00000000000..c93adf8e1ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt @@ -0,0 +1,40 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +abstract class A { + abstract fun f(): String + override fun toString() = f() +} + +abstract class G { + abstract fun bar(): Any +} + +inline fun baz(): G { + return object : G() { + override fun bar(): Any { + return object : A() { + override fun f(): String = "OK" + } + } + } +} + +inline fun foo(): Pair { + return Pair(baz(), baz()) +} + +fun box(): String { + val res = foo(); + val x1 = res.first.bar() + val x2 = res.second.bar() + assertEquals("OK", x1.toString()) + assertEquals("OK", x2.toString()) + assertEquals("A", x1.javaClass.getGenericSuperclass()?.toString()) + assertEquals("A", x2.javaClass.getGenericSuperclass()?.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt b/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt new file mode 100644 index 00000000000..edd797547fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun createArray(n: Int, crossinline block: () -> T): Array { + return Array(n) { block() } +} + +inline fun recursive( + crossinline block: () -> R +): Array { + return createArray(5) { block() } +} + +fun box(): String { + val x = recursive(){ "abc" } + + assert(x.all { it == "abc" }) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt b/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt new file mode 100644 index 00000000000..93f46742359 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt @@ -0,0 +1,27 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(block: () -> String) = block() + +inline fun bar1(): String = foo() { + T::class.java.getName() +} +inline fun bar2(y: String): String = foo() { + T::class.java.getName() + "#" + y +} + +inline fun bar3(y: String) = + Pair(bar1(), bar2(y)) + +fun box(): String { + val x = bar3("OK") + + assertEquals("java.lang.Integer", x.first) + assertEquals("java.lang.String#OK", x.second) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedChain.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedChain.kt new file mode 100644 index 00000000000..476197c805c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedChain.kt @@ -0,0 +1,36 @@ +inline fun Any?.check(): Boolean { + return this is T +} + +inline fun Any?.check2(): Boolean { + return check() +} + + +var log = "" +fun log(a: Any?) { + log += a.toString() + ";" +} + +fun test(a: Any?) { + log(a.check()) + log(a.check()) +} + +fun test2(a: Any?) { + log(a.check2()) + log(a.check2()) +} + +fun box(): String { + test("") + test(null) + test2("") + test2(null) + + if (log != "true;true;false;true;true;true;false;true;") { + return "fail" + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt new file mode 100644 index 00000000000..effbdc75764 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(block: () -> String) = block() + +interface A { + fun f(): String + fun g(): String +} + +fun box(): String { + val x: A = object : A { + private inline fun localClassName(): String = T::class.java.getName() + override fun f(): String = foo { localClassName() } + override fun g(): String = foo { localClassName() } + } + + assertEquals("java.lang.String", x.f()) + assertEquals("java.lang.Integer", x.g()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt new file mode 100644 index 00000000000..690848b3cbb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(block: () -> String) = block() + +inline fun className(): String = T::class.java.getName() + +inline fun lambdaShouldBeReified(): String = foo { className() } + +interface A { + fun f(): String + fun g(): String +} +inline fun AFactory(): A = object : A { + override fun f(): String = className() + override fun g(): String = foo { className() } +} + +fun box(): String { + assertEquals("java.lang.String", lambdaShouldBeReified()) + assertEquals("java.lang.Integer", lambdaShouldBeReified()) + + val x: A = AFactory() + + assertEquals("java.lang.String", x.f()) + assertEquals("java.lang.Integer", x.g()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt new file mode 100644 index 00000000000..19ca4d92125 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(block: () -> String) = block() + +inline fun className(): String = T::class.java.getName() + +interface A { + fun f(): String + fun g(): String +} + +fun box(): String { + val x = foo() { + className() + } + + assertEquals("java.lang.String", x) + + val y: A = object : A { + override fun f(): String = foo { className() } + override fun g(): String = foo { className() } + } + + assertEquals("java.lang.String", y.f()) + assertEquals("java.lang.Integer", y.g()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/safecast.kt b/backend.native/tests/external/codegen/blackbox/reified/safecast.kt new file mode 100644 index 00000000000..10171dd33fe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/safecast.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun safecast(x: Any?): T? { + return x as? T +} + +fun box(): String { + val x = safecast("abc") + assertEquals("abc", x) + val y = safecast(1) + assertEquals(1, y) + + val z = safecast("abc") + assertEquals(null, z) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt b/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt new file mode 100644 index 00000000000..0b5bde0eaef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +inline fun createArray(n: Int, crossinline block: () -> Pair): Pair, Array> { + return Pair(Array(n) { block().first }, Array(n) { block().second }) +} + +inline fun recursive( + crossinline block: () -> R +): Pair, Array> { + return createArray(5) { Pair(block(), block()) } +} + +fun box(): String { + val y = createArray(5) { Pair(1, "test") } + val x = recursive(){ "abc" } + + assert(y.first.all { it == 1 } ) + assert(y.second.all { it == "test" }) + assert(x.first.all { it == "abc" }) + assert(x.second.all { it == "abc" }) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/spreads.kt b/backend.native/tests/external/codegen/blackbox/reified/spreads.kt new file mode 100644 index 00000000000..d0861109cbb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/spreads.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(vararg a: T) = a.size + +inline fun bar(a: Array, block: () -> T): Array { + assertEquals(4, foo(*a, block(), block())) + + return arrayOf(*a, block(), block()) +} + +inline fun empty() = arrayOf() + +fun box(): String { + + var i = 0 + val a: Array = bar(arrayOf("1", "2")) { i++; i.toString() } + assertEquals("1234", a.joinToString("")) + + i = 0 + val b: Array = bar(arrayOf(0, 1)) { i++ } + assertEquals("0123", b.map { it.toString() }.joinToString("")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/reified/varargs.kt b/backend.native/tests/external/codegen/blackbox/reified/varargs.kt new file mode 100644 index 00000000000..73eaba238dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/varargs.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(vararg a: T) = a.size + +inline fun bar(block: () -> T): Array { + assertEquals(2, foo(block(), block())) + + return arrayOf(block(), block(), block()) +} + +inline fun empty() = arrayOf() + +fun box(): String { + var i = 0 + val a: Array = bar() { i++; i.toString() } + assertEquals("345", a.joinToString("")) + + i = 0 + val b: Array = bar() { i++ } + assertEquals("234", b.map { it.toString() }.joinToString("")) + + val c: Array = empty() + assertEquals(0, c.size) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/genericNull.kt b/backend.native/tests/external/codegen/blackbox/safeCall/genericNull.kt new file mode 100644 index 00000000000..d8ffc413616 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/genericNull.kt @@ -0,0 +1,8 @@ +fun foo(t: T) { + t?.toInt() +} + +fun box(): String { + foo(null) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt1572.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt1572.kt new file mode 100644 index 00000000000..d3b3c52bde1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt1572.kt @@ -0,0 +1,23 @@ +//KT-1572 Frontend doesn't mark all vars included in closure as refs. + +class A(val t : Int) {} + +fun testKt1572() : Boolean { + var a = A(0) + var b = A(3) + val changer = {a = b} + b = A(10) // this change has no effect on changer + changer() + return (a.t == 10) +} + +fun testPrimitives() : Boolean { + var a = 0 + var b = 3 + val changer = {a = b} + b = 10 + changer() + return (a == 10) +} + +fun box() = if (testKt1572() && testPrimitives()) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt new file mode 100644 index 00000000000..49a35fc9975 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A() { + fun foo() { + System.out?.println(1) + } +} + +fun box() : String { + val a : A = A() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt245.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt245.kt new file mode 100644 index 00000000000..0678b947098 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt245.kt @@ -0,0 +1,32 @@ +fun foo() { + val l = ArrayList(2) + l.add(1) + + for (el in l) {} + + //verify error "Expecting to find integer on stack" + val iterator = l.iterator() + + //another verify error "Mismatched stack types" + while (iterator?.hasNext() ?: false) { + val i = iterator?.next() + } + + //the same + if (iterator != null) { + while (iterator.hasNext()) { + val i = iterator?.next() + } + } + + //this way it works + if (iterator != null) { + while (iterator.hasNext()) { + iterator.next() //because of the bug KT-244 i can't write "val i = iterator.next()" + } + } +} + +fun box() : String { + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt247.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt247.kt new file mode 100644 index 00000000000..55a7fbe74f8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt247.kt @@ -0,0 +1,38 @@ +fun t1() : Boolean { + val s1 : String? = "sff" + val s2 : String? = null + return s1?.length == 3 && s2?.length == null +} + +fun t2() : Boolean { + val c1: C? = C(1) + val c2: C? = null + return c1?.x == 1 && c2?.x == null +} + +fun t3() { + val d: D = D("s") + val x = d?.s + if (!(d?.s == "s")) throw AssertionError() +} + +fun t4() { + val e: E? = E() + if (!(e?.bar() == e)) throw AssertionError() + val x = e?.foo() +} + +fun box() : String { + if(!t1 ()) return "fail" + if(!t2 ()) return "fail" + t3() + t4() + return "OK" +} + +class C(val x: Int) +class D(val s: String) +class E() { + fun foo() = 1 + fun bar() = this +} diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt3430.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt3430.kt new file mode 100644 index 00000000000..19620029283 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt3430.kt @@ -0,0 +1,6 @@ +fun f(b : Int.(Int)->Int) = 1?.b(1) + +fun box(): String { + val x = f { this + it } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt4733.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt4733.kt new file mode 100644 index 00000000000..dde6d4af7cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt4733.kt @@ -0,0 +1,27 @@ +class Test { + val Long.foo: Long + get() = this + 1 + + val Int.foo: Int + get() = this + 1 + + fun testLong(): Long? { + var s: Long? = 10; + return s?.foo + } + + fun testInt(): Int? { + var s: Int? = 11; + return s?.foo + } +} + +fun box(): String { + val s = Test() + + if (s.testLong() != 11.toLong()) return "fail 1" + + if (s.testInt() != 12) return "fail 1" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/primitive.kt b/backend.native/tests/external/codegen/blackbox/safeCall/primitive.kt new file mode 100644 index 00000000000..64decc4e76b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/primitive.kt @@ -0,0 +1,8 @@ +fun Int.foo() = 239 +fun Long.bar() = 239.toLong() + +fun box(): String { + 42?.foo() + 42.toLong()?.bar() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/safeCallOnLong.kt b/backend.native/tests/external/codegen/blackbox/safeCall/safeCallOnLong.kt new file mode 100644 index 00000000000..9937adc2991 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/safeCallOnLong.kt @@ -0,0 +1,6 @@ +fun f(b : Long.(Long)->Long) = 1L?.b(2L) + +fun box(): String { + val x = f { this + it } + return if (x == 3L) "OK" else "fail $x" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/comparator.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/comparator.kt new file mode 100644 index 00000000000..894b52dfe03 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/comparator.kt @@ -0,0 +1,8 @@ +// WITH_RUNTIME + +fun box(): String { + val list = mutableListOf(3, 2, 4, 8, 1, 5) + val expected = listOf(8, 5, 4, 3, 2, 1) + list.sortWith(Comparator { a, b -> b - a }) + return if (list == expected) "OK" else list.toString() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt new file mode 100644 index 00000000000..7aa5936902c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.io.* + +fun box(): String { + val ACCEPT_NAME = "test" + val WRONG_NAME = "wrong" + + val filter = FileFilter { file -> ACCEPT_NAME == file?.getName() } + + if (!filter.accept(File(ACCEPT_NAME))) return "Wrong answer for $ACCEPT_NAME" + if (filter.accept(File(WRONG_NAME))) return "Wrong answer for $WRONG_NAME" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralComparator.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralComparator.kt new file mode 100644 index 00000000000..5dfa3b5926f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralComparator.kt @@ -0,0 +1,9 @@ +// WITH_RUNTIME + +fun box(): String { + val list = mutableListOf(3, 2, 4, 8, 1, 5) + val expected = listOf(8, 5, 4, 3, 2, 1) + val comparatorFun: (Int, Int) -> Int = { a, b -> b - a } + list.sortWith(Comparator(comparatorFun)) + return if (list == expected) "OK" else list.toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt new file mode 100644 index 00000000000..1a94108f7c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt @@ -0,0 +1,17 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.io.* + +fun box(): String { + val ACCEPT_NAME = "test" + val WRONG_NAME = "wrong" + + val f : (File?) -> Boolean = { file -> ACCEPT_NAME == file?.getName() } + val filter = FileFilter(f) + + if (!filter.accept(File(ACCEPT_NAME))) return "Wrong answer for $ACCEPT_NAME" + if (filter.accept(File(WRONG_NAME))) return "Wrong answer for $WRONG_NAME" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralRunnable.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralRunnable.kt new file mode 100644 index 00000000000..59818629db0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralRunnable.kt @@ -0,0 +1,9 @@ +// TARGET_BACKEND: JVM + +fun box(): String { + var result = "FAIL" + val f = { result = "OK" } + val r = Runnable(f) + r.run() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/nonTrivialRunnable.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonTrivialRunnable.kt new file mode 100644 index 00000000000..23dd339127c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonTrivialRunnable.kt @@ -0,0 +1,13 @@ +// TARGET_BACKEND: JVM + +var result = "FAIL" + +fun getFun(): () -> Unit { + return { result = "OK" } +} + +fun box(): String { + val r = Runnable(getFun()) + r.run() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/runnable.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/runnable.kt new file mode 100644 index 00000000000..7c4564f0b50 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/runnable.kt @@ -0,0 +1,9 @@ +// TARGET_BACKEND: JVM + +var result = "FAIL" + +fun box(): String { + val r = Runnable { result = "OK" } + r.run() + return result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure1.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure1.kt new file mode 100644 index 00000000000..1381931b9f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure1.kt @@ -0,0 +1,10 @@ +// TARGET_BACKEND: JVM + +fun box(): String { + val o = "O" + var result = "" + + val r = Runnable { result = o + "K" } //capturing local vals and local var + r.run() + return result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure2.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure2.kt new file mode 100644 index 00000000000..15c2ff185e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/runnableAccessingClosure2.kt @@ -0,0 +1,13 @@ +// TARGET_BACKEND: JVM + +class Box(val s: String) { + fun extract(): String { + var result = "" + Runnable { result = s }.run() // capturing this and local var + return result + } +} + +fun box(): String { + return Box("OK").extract() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt new file mode 100644 index 00000000000..fd05985efc8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FILE: 1/wrapped.kt + +fun getWrapped1(): Runnable { + val f = { } + return Runnable(f) +} + +// FILE: 2/wrapped2.kt + +fun getWrapped2(): Runnable { + val f = { } + return Runnable(f) +} + +// FILE: box.kt + +fun box(): String { + val class1 = getWrapped1().javaClass + val class2 = getWrapped2().javaClass + + return if (class1 != class2) "OK" else "Same class: $class1" +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt new file mode 100644 index 00000000000..48eb26fc748 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt @@ -0,0 +1,10 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + val f = { } + val class1 = (Runnable(f) as Object).getClass() + val class2 = (Runnable(f) as Object).getClass() + + return if (class1 == class2) "OK" else "$class1 $class2" +} diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/syntheticVsReal.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/syntheticVsReal.kt new file mode 100644 index 00000000000..70ad7f5b42b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/syntheticVsReal.kt @@ -0,0 +1,14 @@ +// TARGET_BACKEND: JVM + +var global = "" + +fun Runnable(f: () -> Unit) = object : Runnable { + public override fun run() { + global = "OK" + } +} + +fun box(): String { + Runnable { global = "FAIL" } .run() + return global +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/sealed/objects.kt b/backend.native/tests/external/codegen/blackbox/sealed/objects.kt new file mode 100644 index 00000000000..c33a71d498f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sealed/objects.kt @@ -0,0 +1,11 @@ +sealed class Season { + object Warm: Season() + object Cold: Season() +} + +fun foo(): Season = Season.Warm + +fun box() = when(foo()) { + Season.Warm -> "OK" + Season.Cold -> "Fail: Cold, should be Warm" +} diff --git a/backend.native/tests/external/codegen/blackbox/sealed/simple.kt b/backend.native/tests/external/codegen/blackbox/sealed/simple.kt new file mode 100644 index 00000000000..01ae3af2c95 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sealed/simple.kt @@ -0,0 +1,11 @@ +sealed class Season { + class Warm: Season() + class Cold: Season() +} + +fun foo(): Season = Season.Warm() + +fun box() = when(foo()) { + is Season.Warm -> "OK" + is Season.Cold -> "Fail: Cold, should be Warm" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToCompanion.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToCompanion.kt new file mode 100644 index 00000000000..0c9e1d2df2e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToCompanion.kt @@ -0,0 +1,15 @@ +internal class A(val result: Int) { + companion object { + fun foo(): Int = 1 + val prop = 2 + val C = 3 + } + + constructor() : this(foo() + prop + C) +} + +fun box(): String { + val result = A().result + if (result != 6) return "fail: $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToNestedObject.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToNestedObject.kt new file mode 100644 index 00000000000..3093181e4bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/accessToNestedObject.kt @@ -0,0 +1,16 @@ +class A(val result: Int) { + object B { + fun bar(): Int = 4 + val prop = 5 + } + object C { + } + + constructor() : this(B.bar() + B.prop) +} + +fun box(): String { + val result = A().result + if (result != 9) return "fail: $result" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryManySinks.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryManySinks.kt new file mode 100644 index 00000000000..862ed7e242c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryManySinks.kt @@ -0,0 +1,35 @@ +var sideEffects: String = "" + +class A { + var prop: String = "" + init { + sideEffects += prop + "first" + } + + constructor(x: String) { + prop = x + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int) { + prop += "$x#int" + sideEffects += "#fourth" + } +} + +fun box(): String { + val a1 = A("abc") + if (a1.prop != "abc") return "fail1: ${a1.prop}" + if (sideEffects != "first#second#third") return "fail1-sideEffects: ${sideEffects}" + + sideEffects = "" + val a2 = A(123) + if (a2.prop != "123#int") return "fail2: ${a2.prop}" + if (sideEffects != "first#second#fourth") return "fail2-sideEffects: ${sideEffects}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryOneSink.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryOneSink.kt new file mode 100644 index 00000000000..23f796276c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicNoPrimaryOneSink.kt @@ -0,0 +1,41 @@ +internal var sideEffects: String = "" + +internal class A { + var prop: String = "" + init { + sideEffects += prop + "first" + } + + constructor() {} + + constructor(x: String): this() { + prop = x + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int): this(x.toString()) { + prop += "#int" + sideEffects += "#fourth" + } +} + +fun box(): String { + val a1 = A("abc") + if (a1.prop != "abc") return "fail1: ${a1.prop}" + if (sideEffects != "first#second#third") return "fail1-sideEffects: ${sideEffects}" + + sideEffects = "" + val a2 = A(123) + if (a2.prop != "123#int") return "fail2: ${a2.prop}" + if (sideEffects != "first#second#third#fourth") return "fail2-sideEffects: ${sideEffects}" + + sideEffects = "" + val a3 = A() + if (a3.prop != "") return "fail2: ${a3.prop}" + if (sideEffects != "first#second") return "fail3-sideEffects: ${sideEffects}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicPrimary.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicPrimary.kt new file mode 100644 index 00000000000..6195900e1d8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/basicPrimary.kt @@ -0,0 +1,39 @@ +var sideEffects: String = "" + +class A() { + var prop: String = "" + init { + sideEffects += prop + "first" + } + + constructor(x: String): this() { + prop = x + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int): this(x.toString()) { + prop += "#int" + sideEffects += "#fourth" + } +} + +fun box(): String { + val a1 = A("abc") + if (a1.prop != "abc") return "fail1: ${a1.prop}" + if (sideEffects != "first#second#third") return "fail1-sideEffects: ${sideEffects}" + + sideEffects = "" + val a2 = A(123) + if (a2.prop != "123#int") return "fail2: ${a2.prop}" + if (sideEffects != "first#second#third#fourth") return "fail2-sideEffects: ${sideEffects}" + + sideEffects = "" + val a3 = A() + if (a3.prop != "") return "fail2: ${a3.prop}" + if (sideEffects != "first#second") return "fail3-sideEffects: ${sideEffects}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromLocalSubClass.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromLocalSubClass.kt new file mode 100644 index 00000000000..e74d65b029d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromLocalSubClass.kt @@ -0,0 +1,15 @@ +fun box(): String { + val z = "K" + open class A(val x: String) { + constructor() : this("O") + + val y: String + get() = z + } + + class B : A() + + val b = B() + + return b.x + b.y +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithNamedArgs.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithNamedArgs.kt new file mode 100644 index 00000000000..30fc0208f2c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithNamedArgs.kt @@ -0,0 +1,11 @@ +open class A(val result: String) { + constructor(x: Int = 11, y: Int = 22, z: Int = 33) : this("$x$y$z") +} + +class B() : A(y = 44) + +fun box(): String { + val result = B().result + if (result != "114433") return "fail: $result" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt new file mode 100644 index 00000000000..71955e44537 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt @@ -0,0 +1,11 @@ +open class A(val result: String) { + constructor(x: Int, y: Int = 99) : this("$x$y") +} + +class B(x: Int) : A(x) + +fun box(): String { + val result = B(11).result + if (result != "1199") return "fail: $result" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromSubClass.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromSubClass.kt new file mode 100644 index 00000000000..7dd165dbc23 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/callFromSubClass.kt @@ -0,0 +1,12 @@ +open class A(val x: String, val z: String) { + constructor(z: String) : this("O", z) +} + +class B(val y: String) : A("_") + +fun box(): String { + val b = B("K") + val result = b.z + b.x + b.y + if (result != "_OK") return "fail: $result" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/clashingDefaultConstructors.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/clashingDefaultConstructors.kt new file mode 100644 index 00000000000..bad07d0d16b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/clashingDefaultConstructors.kt @@ -0,0 +1,35 @@ +open class A(val x: String = "abc", val y: String = "efg") { + constructor(x: String, y: String, z: Int): this(x, y + "#" + z.toString()) + + override fun toString() = "$x#$y" +} + +class B : A { + constructor(x: String, y: String, z: Int): super(x, y + z.toString()) + constructor(x: String = "xyz", y: String = "123") : super(x, y) + constructor(x: Double): super(x.toString()) +} + +fun box(): String { + val a1 = A().toString() + if (a1 != "abc#efg") return "fail1: $a1" + + val a2 = A("hij", "klm", 1).toString() + if (a2 != "hij#klm#1") return "fail2: $a2" + + val a3 = A(x="xyz").toString() + if (a3 != "xyz#efg") return "fail3: $a3" + + val b1 = B().toString() + if (b1 != "xyz#123") return "fail4: $b1" + + val b2 = B("hij", "klm", 2).toString() + if (b2 != "hij#klm2") return "fail5: $b2" + + val b3 = B(123.1).toString() + if (b3 != "123.1#efg") return "fail6: $b3" + + val b4 = B(x="test").toString() + if (b4 != "test#123") return "fail7: $b4" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/dataClasses.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/dataClasses.kt new file mode 100644 index 00000000000..074508611b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/dataClasses.kt @@ -0,0 +1,53 @@ +internal data class A1(val prop1: String) { + val prop2: String = "const2" + var prop3: String = "" + + constructor(): this("default") { + prop3 = "empty" + } + constructor(x: Int): this(x.toString()) { + prop3 = "int" + } + + fun f(): String = "$prop1#$prop2#$prop3" +} + +internal class A2 private constructor() { + var prop1: String = "" + var prop2: String = "const2" + var prop3: String = "" + + constructor(arg: String): this() { + prop1 = arg + } + constructor(x: Double): this() { + prop1 = "default" + prop3 = "empty" + } + constructor(x: Int): this(x.toString()) { + prop3 = "int" + } + + fun f(): String = "$prop1#$prop2#$prop3" +} + +fun box(): String { + val a1x = A1("asd") + if (a1x.f() != "asd#const2#") return "fail1: ${a1x.f()}" + if (a1x.toString() != "A1(prop1=asd)") return "fail1s: ${a1x.toString()}" + val a1y = A1() + if (a1y.f() != "default#const2#empty") return "fail2: ${a1y.f()}" + if (a1y.toString() != "A1(prop1=default)") return "fail2s: ${a1y.toString()}" + val a1z = A1(5) + if (a1z.f() != "5#const2#int") return "fail3: ${a1z.f()}" + if (a1z.toString() != "A1(prop1=5)") return "fail3s: ${a1z.toString()}" + + val a2x = A2("asd") + if (a2x.f() != "asd#const2#") return "fail4: ${a2x.f()}" + val a2y = A2(123.0) + if (a2y.f() != "default#const2#empty") return "fail5: ${a2y.f()}" + val a2z = A2(5) + if (a2z.f() != "5#const2#int") return "fail6: ${a2z.f()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultArgs.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultArgs.kt new file mode 100644 index 00000000000..3c9d312462e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultArgs.kt @@ -0,0 +1,34 @@ +val global = "OK" +class A { + val prop: String + constructor(arg1: String = global) { + prop = arg1 + } + constructor(arg1: String = global, arg2: Long) { + prop = "$arg1#$arg2" + } + constructor(arg1: String = global, argDouble: Double, arg3: Long = 1L) { + prop = "$arg1#$argDouble#$arg3" + } +} + +fun box(): String { + val a1 = A() + if (a1.prop != "OK") return "fail1: ${a1.prop}" + val a2 = A("A") + if (a2.prop != "A") return "fail2: ${a2.prop}" + + val a3 = A(arg2=123) + if (a3.prop != "OK#123") return "fail3: ${a3.prop}" + val a4 = A("A", arg2=123) + if (a4.prop != "A#123") return "fail4: ${a4.prop}" + + val a5 = A(argDouble=23.1) + if (a5.prop != "OK#23.1#1") return "fail5: ${a5.prop}" + val a6 = A("A", argDouble=23.1) + if (a6.prop != "A#23.1#1") return "fail6: ${a6.prop}" + val a7 = A("A", arg3=2L, argDouble=23.1) + if (a7.prop != "A#23.1#2") return "fail7: ${a7.prop}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultParametersNotDuplicated.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultParametersNotDuplicated.kt new file mode 100644 index 00000000000..409e42f9ec0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/defaultParametersNotDuplicated.kt @@ -0,0 +1,15 @@ +var global = 0 + +fun sideEffect() = global++ + +class A(val x: String) { + constructor(y: Int = sideEffect(), z: (Int) -> Int = { it + sideEffect() }) : this("$y:${z(y)}") {} +} + +fun box(): String { + var a = A() + if (a.x != "0:1") return "failed1: ${a.x}" + if (global != 2) return "failed2: ${global}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegateWithComplexExpression.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegateWithComplexExpression.kt new file mode 100644 index 00000000000..999d944d7f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegateWithComplexExpression.kt @@ -0,0 +1,46 @@ +var log = "" + +open class Base(val s: String) + +class A(s: String) : Base(s) { + constructor(i: Int) : this("O" + if (i == 23) { + log += "logged1;" + "K" + } + else { + "fail" + }) + + constructor(i: Long) : this(if (i == 23L) { + log += "logged2;" + 23 + } + else { + 42 + }) +} + +class B : Base { + constructor(i: Int) : super("O" + if (i == 23) { + log += "logged3;" + "K" + } + else { + "fail" + }) +} + +fun box(): String { + var result = A(23).s + if (result != "OK") return "fail1: $result" + + result = A(23L).s + if (result != "OK") return "fail2: $result" + + result = B(23).s + if (result != "OK") return "fail3: $result" + + if (log != "logged1;logged2;logged1;logged3;") return "fail log: $log" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegatedThisWithLambda.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegatedThisWithLambda.kt new file mode 100644 index 00000000000..b48d1356430 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegatedThisWithLambda.kt @@ -0,0 +1,9 @@ +class A(val f: () -> Int) { + constructor() : this({ 23 }) +} + +fun box(): String { + val result = A().f() + if (result != 23) return "fail: $result" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegationWithPrimary.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegationWithPrimary.kt new file mode 100644 index 00000000000..42690e92b97 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/delegationWithPrimary.kt @@ -0,0 +1,17 @@ +internal interface A { + fun foo(): String +} + +internal class B : A { + override fun foo() = "OK" +} + +internal val global = B() + +internal class C(x: Int) : A by global { + constructor(): this(1) +} + +fun box(): String { + return C().foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/enums.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/enums.kt new file mode 100644 index 00000000000..2d62a075bb9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/enums.kt @@ -0,0 +1,62 @@ +enum class A1(val prop1: String) { + X("asd"), + Y() { + override fun f() = super.f() + "#Y" + }, + Z(5); + + val prop2: String = "const2" + var prop3: String = "" + + constructor(): this("default") { + prop3 = "empty" + } + constructor(x: Int): this(x.toString()) { + prop3 = "int" + } + + open fun f(): String = "$prop1#$prop2#$prop3" +} + +enum class A2 { + X("asd"), + Y() { + override fun f() = super.f() + "#Y" + }, + Z(5); + + val prop1: String + val prop2: String = "const2" + var prop3: String = "" + + constructor(arg: String) { + prop1 = arg + } + constructor() { + prop1 = "default" + prop3 = "empty" + } + constructor(x: Int): this(x.toString()) { + prop3 = "int" + } + + open fun f(): String = "$prop1#$prop2#$prop3" +} + +fun box(): String { + val a1x = A1.X + if (a1x.f() != "asd#const2#") return "fail1: ${a1x.f()}" + val a1y = A1.Y + if (a1y.f() != "default#const2#empty#Y") return "fail2: ${a1y.f()}" + val a1z = A1.Z + if (a1z.f() != "5#const2#int") return "fail3: ${a1z.f()}" + + val a2x = A2.X + if (a2x.f() != "asd#const2#") return "fail4: ${a2x.f()}" + val a2y = A2.Y + if (a2y.f() != "default#const2#empty#Y") return "fail5: ${a2y.f()}" + val a2z = A2.Z + if (a2z.f() != "5#const2#int") return "fail6: ${a2z.f()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/generics.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/generics.kt new file mode 100644 index 00000000000..a025954f6dd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/generics.kt @@ -0,0 +1,23 @@ +internal open class B(val x: T, val y: T) { + constructor(x: T): this(x, x) + override fun toString() = "$x#$y" +} + +internal class A : B { + constructor(): super("default") + constructor(x: String): super(x, "default") +} + +fun box(): String { + val b1 = B("1", "2").toString() + if (b1 != "1#2") return "fail1: $b1" + val b2 = B("abc").toString() + if (b2 != "abc#abc") return "fail2: $b2" + + val a1 = A().toString() + if (a1 != "default#default") return "fail3: $a1" + val a2 = A("xyz").toString() + if (a2 != "xyz#default") return "fail4: $a2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClasses.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClasses.kt new file mode 100644 index 00000000000..9d0851c426b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClasses.kt @@ -0,0 +1,79 @@ +class Outer { + val outerProp: String + constructor(x: String) { + outerProp = x + } + + var sideEffects = "" + + inner class A1() { + var prop: String = "" + init { + sideEffects += outerProp + "#" + prop + "first" + } + + constructor(x: String): this() { + prop = x + "#${outerProp}" + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int): this(x.toString() + "#" + outerProp) { + prop += "#int" + sideEffects += "#fourth" + } + } + + inner class A2 { + var prop: String = "" + init { + sideEffects += outerProp + "#" + prop + "first" + } + + constructor(x: String) { + prop = x + "#$outerProp" + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int) { + prop += "$x#$outerProp#int" + sideEffects += "#fourth" + } + } +} + +fun box(): String { + val outer1 = Outer("propValue1") + val a1 = outer1.A1("abc") + if (a1.prop != "abc#propValue1") return "fail1: ${a1.prop}" + if (outer1.sideEffects != "propValue1#first#second#third") return "fail1-sideEffects: ${outer1.sideEffects}" + + val outer2 = Outer("propValue2") + val a2 = outer2.A1(123) + if (a2.prop != "123#propValue2#propValue2#int") return "fail2: ${a2.prop}" + if (outer2.sideEffects != "propValue2#first#second#third#fourth") return "fail2-sideEffects: ${outer2.sideEffects}" + + val outer3 = Outer("propValue3") + val a3 = outer3.A1() + if (a3.prop != "") return "fail2: ${a3.prop}" + if (outer3.sideEffects != "propValue3#first#second") return "fail3-sideEffects: ${outer3.sideEffects}" + + val outer4 = Outer("propValue4") + val a4 = outer4.A2("abc") + if (a4.prop != "abc#propValue4") return "fail4: ${a4.prop}" + if (outer4.sideEffects != "propValue4#first#second#third") return "fail4-sideEffects: ${outer4.sideEffects}" + + val outer5 = Outer("propValue5") + val a5 = outer5.A2(123) + if (a5.prop != "123#propValue5#int") return "fail5: ${a5.prop}" + if (outer5.sideEffects != "propValue5#first#second#fourth") return "fail5-sideEffects: ${outer5.sideEffects}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClassesInheritance.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClassesInheritance.kt new file mode 100644 index 00000000000..f68b538d5ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/innerClassesInheritance.kt @@ -0,0 +1,66 @@ +class Outer { + val outerProp: String + constructor(x: String) { + outerProp = x + } + + var sideEffects = "" + + abstract inner class A1 { + var parentProp: String = "" + init { + sideEffects += outerProp + "#" + parentProp + "first" + } + + protected constructor(x: String) { + parentProp = x + "#${outerProp}" + sideEffects += "#second#" + } + + init { + sideEffects += parentProp + "#third" + } + + protected constructor(x: Int): this(x.toString() + "#" + outerProp) { + parentProp += "#int" + sideEffects += "fourth#" + } + } + + inner class A2 : A1 { + var prop: String = "" + init { + sideEffects += outerProp + "#" + prop + "fifth" + } + + constructor(x: String): super(x + "#" + outerProp) { + prop = x + "#$outerProp" + sideEffects += "#sixth" + } + + init { + sideEffects += prop + "#seventh" + } + + constructor(x: Int): super(x + 1) { + prop += "$x#$outerProp#int" + sideEffects += "#eighth" + } + } +} + +fun box(): String { + val outer1 = Outer("propValue1") + val a1 = outer1.A2("abc") + if (a1.parentProp != "abc#propValue1#propValue1") return "fail1: ${a1.parentProp}" + if (a1.prop != "abc#propValue1") return "fail2: ${a1.prop}" + if (outer1.sideEffects != "propValue1#first#third#second#propValue1#fifth#seventh#sixth") return "fail1-sideEffects: ${outer1.sideEffects}" + + val outer2 = Outer("propValue2") + val a2 = outer2.A2(123) + if (a2.parentProp != "124#propValue2#propValue2#int") return "fail3: ${a2.parentProp}" + if (a2.prop != "123#propValue2#int") return "fail4: ${a2.prop}" + if (outer2.sideEffects != "propValue2#first#third#second#fourth#propValue2#fifth#seventh#eighth") return "fail2-sideEffects: ${outer2.sideEffects}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/localClasses.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/localClasses.kt new file mode 100644 index 00000000000..fb26a6ba6aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/localClasses.kt @@ -0,0 +1,77 @@ +open class C(val grandParentProp: String) +fun box(): String { + var sideEffects: String = "" + var parentSideEffects: String = "" + val justForUsageInClosure = 7 + val justForUsageInParentClosure = "parentCaptured" + + abstract class B : C { + val parentProp: String + init { + sideEffects += "minus-one#" + parentSideEffects += "1" + } + protected constructor(arg: Int): super(justForUsageInParentClosure) { + parentProp = (arg).toString() + sideEffects += "0.5#" + parentSideEffects += "#" + justForUsageInParentClosure + } + protected constructor(arg1: Int, arg2: Int): super(justForUsageInParentClosure) { + parentProp = (arg1 + arg2).toString() + sideEffects += "0.7#" + parentSideEffects += "#3" + } + init { + sideEffects += "zero#" + parentSideEffects += "#4" + } + } + + class A : B { + var prop: String = "" + init { + sideEffects += prop + "first" + } + + constructor(x1: Int, x2: Int): super(x1, x2) { + prop = x1.toString() + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int): super(justForUsageInClosure + x) { + prop += "${x}#int" + sideEffects += "#fourth" + } + + constructor(): this(justForUsageInClosure) { + sideEffects += "#fifth" + } + + override fun toString() = "$prop#$parentProp#$grandParentProp" + } + + val a1 = A(5, 10).toString() + if (a1 != "5#15#parentCaptured") return "fail1: $a1" + if (sideEffects != "minus-one#zero#0.7#first#second#third") return "fail2: ${sideEffects}" + if (parentSideEffects != "1#4#3") return "fail3: ${parentSideEffects}" + + sideEffects = "" + parentSideEffects = "" + val a2 = A(123).toString() + if (a2 != "123#int#130#parentCaptured") return "fail1: $a2" + if (sideEffects != "minus-one#zero#0.5#first#second#fourth") return "fail4: ${sideEffects}" + if (parentSideEffects != "1#4#parentCaptured") return "fail5: ${parentSideEffects}" + + sideEffects = "" + parentSideEffects = "" + val a3 = A().toString() + if (a3 != "7#int#14#parentCaptured") return "fail6: $a3" + if (sideEffects != "minus-one#zero#0.5#first#second#fourth#fifth") return "fail7: ${sideEffects}" + if (parentSideEffects != "1#4#parentCaptured") return "fail8: ${parentSideEffects}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallPrimary.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallPrimary.kt new file mode 100644 index 00000000000..7225bc1af4f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallPrimary.kt @@ -0,0 +1,53 @@ +var sideEffects: String = "" + +abstract class B protected constructor(val arg: Int) { + val parentProp: String + init { + sideEffects += "zero#" + parentProp = arg.toString() + } +} + +class A(x: Boolean) : B(if (x) 1 else 2) { + var prop: String = "" + init { + sideEffects += prop + "first" + } + + constructor(x: String): this(x == "abc") { + prop = x + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int): this(x < 0) { + prop += "${x}#int" + sideEffects += "#fourth" + } +} + +fun box(): String { + val a1 = A("abc") + if (a1.prop != "abc") return "fail0: ${a1.prop}" + if (a1.parentProp != "1") return "fail1: ${a1.parentProp}" + if (a1.arg != 1) return "fail1': ${a1.arg}" + if (sideEffects != "zero#first#second#third") return "fail2: ${sideEffects}" + + sideEffects = "" + val a2 = A(123) + if (a2.prop != "123#int") return "fail3: ${a2.prop}" + if (a2.parentProp != "2") return "fail4: ${a2.parentProp}" + if (a2.arg != 2) return "fail5': ${a2.arg}" + if (sideEffects != "zero#first#second#fourth") return "fail6: ${sideEffects}" + + sideEffects = "" + val a3 = A(false) + if (a3.prop != "") return "fail7: ${a3.prop}" + if (a3.parentProp != "2") return "fail8: ${a3.parentProp}" + if (a3.arg != 2) return "fail9': ${a3.arg}" + if (sideEffects != "zero#first#second") return "fail10: ${sideEffects}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallSecondary.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallSecondary.kt new file mode 100644 index 00000000000..e5d0064aa01 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/superCallSecondary.kt @@ -0,0 +1,64 @@ +var sideEffects: String = "" + +internal abstract class B { + val parentProp: String + init { + sideEffects += "minus-one#" + } + protected constructor(arg: Int) { + parentProp = (arg).toString() + sideEffects += "0.5#" + } + protected constructor(arg1: Int, arg2: Int) { + parentProp = (arg1 + arg2).toString() + sideEffects += "0.7#" + } + init { + sideEffects += "zero#" + } +} + +internal class A : B { + var prop: String = "" + init { + sideEffects += prop + "first" + } + + constructor(x1: Int, x2: Int): super(x1, x2) { + prop = x1.toString() + sideEffects += "#third" + } + + init { + sideEffects += prop + "#second" + } + + constructor(x: Int): super(3 + x) { + prop += "${x}#int" + sideEffects += "#fourth" + } + + constructor(): this(7) { + sideEffects += "#fifth" + } +} + +fun box(): String { + val a1 = A(5, 10) + if (a1.prop != "5") return "fail0: ${a1.prop}" + if (a1.parentProp != "15") return "fail1: ${a1.parentProp}" + if (sideEffects != "minus-one#zero#0.7#first#second#third") return "fail2: ${sideEffects}" + + sideEffects = "" + val a2 = A(123) + if (a2.prop != "123#int") return "fail3: ${a2.prop}" + if (a2.parentProp != "126") return "fail4: ${a2.parentProp}" + if (sideEffects != "minus-one#zero#0.5#first#second#fourth") return "fail5: ${sideEffects}" + + sideEffects = "" + val a3 = A() + if (a3.prop != "7#int") return "fail6: ${a3.prop}" + if (a3.parentProp != "10") return "fail7: ${a3.parentProp}" + if (sideEffects != "minus-one#zero#0.5#first#second#fourth#fifth") return "fail8: ${sideEffects}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/varargs.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/varargs.kt new file mode 100644 index 00000000000..39bfb8bf7a9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/varargs.kt @@ -0,0 +1,31 @@ +fun join(x: Array): String { + var result = "" + for (i in x) { + result += i + result += "#" + } + + return result +} + +open class B { + val parentProp: String + constructor(vararg x: String) { + parentProp = join(x) + } +} + +class A : B { + val prop: String + constructor(vararg x: String): super("0", *x, "4") { + prop = join(x) + } +} + +fun box(): String { + val a1 = A("1", "2", "3") + if (a1.prop != "1#2#3#") return "fail1: ${a1.prop}" + if (a1.parentProp != "0#1#2#3#4#") return "fail2: ${a1.parentProp}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withGenerics.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withGenerics.kt new file mode 100644 index 00000000000..20cd7ce3da7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withGenerics.kt @@ -0,0 +1,37 @@ +// TARGET_BACKEND: JVM +// FILE: WithGenerics.java + +class WithGenerics { + public static String foo1() { + A x = new A("OK"); + return x.toString(); + } + + public static String foo2() { + A x = new A(123); + return x.toString(); + } +} + +// FILE: WithGenerics.kt + +open class A { + val prop: String + constructor(x: String) { + prop = x + } + constructor(x: T) { + prop = x.toString() + } + + override fun toString() = prop +} + +fun box(): String { + val a1 = WithGenerics.foo1() + if (a1 != "OK") return "fail1: $a1" + val a2 = WithGenerics.foo2() + if (a2 != "123") return "fail2: $a2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt new file mode 100644 index 00000000000..2e56fdc0e88 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt @@ -0,0 +1,24 @@ +// TODO enable for JS backend too when KT-14549 will be fixed +// IGNORE_BACKEND: JS + +inline fun run(block: () -> Unit) = block() + +class A { + val prop: Int + constructor(arg: Boolean) { + if (arg) { + prop = 1 + run { return } + throw RuntimeException("fail 0") + } + prop = 2 + } +} + +fun box(): String { + val a1 = A(true) + if (a1.prop != 1) return "fail1: ${a1.prop}" + val a2 = A(false) + if (a2.prop != 2) return "fail2: ${a2.prop}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withPrimary.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withPrimary.kt new file mode 100644 index 00000000000..28080ec08d1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withPrimary.kt @@ -0,0 +1,41 @@ +// TARGET_BACKEND: JVM +// FILE: WithPrimary.java + +class WithPrimary { + public static A test1() { + return new A("123", "abc"); + } + public static A test2() { + return new A(); + } + public static A test3() { + return new A("123", 456); + } + public static A test4() { + return new A(1.0); + } +} + +// FILE: WithPrimary.kt + +class A(val x: String = "def_x", val y: String = "1") { + constructor(x: String, y: Int): this(x, y.toString()) {} + constructor(x: Double): this(x.toString(), "def_y") {} + override fun toString() = "$x#$y" +} + +fun box(): String { + val test1 = WithPrimary.test1().toString() + if (test1 != "123#abc") return "fail1: $test1" + + val test2 = WithPrimary.test2().toString() + if (test2 != "def_x#1") return "fail2: $test2" + + val test3 = WithPrimary.test3().toString() + if (test3 != "123#456") return "fail3: $test3" + + val test4 = WithPrimary.test4().toString() + if (test4 != "1.0#def_y") return "fail4: $test4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturn.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturn.kt new file mode 100644 index 00000000000..b6cb18cf2af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturn.kt @@ -0,0 +1,18 @@ +class A { + val prop: Int + constructor(arg: Boolean) { + if (arg) { + prop = 1 + return + } + prop = 2 + } +} + +fun box(): String { + val a1 = A(true) + if (a1.prop != 1) return "fail1: ${a1.prop}" + val a2 = A(false) + if (a2.prop != 2) return "fail2: ${a2.prop}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturnUnit.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturnUnit.kt new file mode 100644 index 00000000000..956c6db367e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withReturnUnit.kt @@ -0,0 +1,18 @@ +class A { + val prop: Int + constructor(arg: Boolean) { + if (arg) { + prop = 1 + return Unit + } + prop = 2 + } +} + +fun box(): String { + val a1 = A(true) + if (a1.prop != 1) return "fail1: ${a1.prop}" + val a2 = A(false) + if (a2.prop != 2) return "fail2: ${a2.prop}" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withVarargs.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withVarargs.kt new file mode 100644 index 00000000000..84b0f3feba8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withVarargs.kt @@ -0,0 +1,34 @@ +// TARGET_BACKEND: JVM +// FILE: WithVarargs.java + +public class WithVarargs { + public static String foo() { + return new A("1", "2", "3").getProp(); + } +} + +// FILE: withVarargs.kt + +fun join(x: Array): String { + var result = "" + for (i in x) { + result += i + result += "#" + } + + return result +} + +class A { + val prop: String + constructor(vararg x: String) { + prop = join(x) + } +} + +fun box(): String { + val a1 = WithVarargs.foo() + if (a1 != "1#2#3#") return "fail1: ${a1}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withoutPrimary.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withoutPrimary.kt new file mode 100644 index 00000000000..d455a57dba8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withoutPrimary.kt @@ -0,0 +1,41 @@ +// TARGET_BACKEND: JVM +// FILE: WithoutPrimary.java + +class WithoutPrimary { + public static A test1() { + return new A("123", "abc"); + } + public static A test3() { + return new A("123", 456); + } + public static A test4() { + return new A(1.0); + } +} + +// FILE: WithoutPrimary.kt + +class A { + val x: String + val y: String + constructor(x: String, y: String) { + this.x = x + this.y = y + } + constructor(x: String = "def_x", y: Int = 1): this(x, y.toString()) {} + constructor(x: Double): this(x.toString(), "def_y") {} + override fun toString() = "$x#$y" +} + +fun box(): String { + val test1 = WithoutPrimary.test1().toString() + if (test1 != "123#abc") return "fail1: $test1" + + val test3 = WithoutPrimary.test3().toString() + if (test3 != "123#456") return "fail3: $test3" + + val test4 = WithoutPrimary.test4().toString() + if (test4 != "1.0#def_y") return "fail4: $test4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/smap/chainCalls.kt b/backend.native/tests/external/codegen/blackbox/smap/chainCalls.kt new file mode 100644 index 00000000000..73da8b97720 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smap/chainCalls.kt @@ -0,0 +1,86 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FULL_JDK +package test +fun testProperLineNumber(): String { + var exceptionCount = 0; + try { + test(). + test(). + fail() + + } + catch(e: AssertionError) { + val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1) + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("chainCalls.kt:10" != actual) { + return "fail 1: ${actual}" + } + exceptionCount++ + } + + try { + call(). + test(). + fail() + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("chainCalls.kt:25" != actual) { + return "fail 2: ${actual}" + } + exceptionCount++ + } + + try { + test(). + fail() + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("chainCalls.kt:38" != actual) { + return "fail 3: ${actual}" + } + exceptionCount++ + } + + try { + test().fail() + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("chainCalls.kt:50" != actual) { + return "fail 4: ${actual}" + } + exceptionCount++ + } + + return if (exceptionCount == 4) "OK" else "fail" +} + +fun box(): String { + return testProperLineNumber() +} + +public fun checkEquals(p1: String, p2: String) { + throw AssertionError("fail") +} + +inline fun test(): String { + return "123" +} + +inline fun String.test(): String { + return "123" +} + +fun String.fail(): String { + throw AssertionError("fail") +} + +fun call(): String { + return "xxx" +} diff --git a/backend.native/tests/external/codegen/blackbox/smap/infixCalls.kt b/backend.native/tests/external/codegen/blackbox/smap/infixCalls.kt new file mode 100644 index 00000000000..eeab32d82e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smap/infixCalls.kt @@ -0,0 +1,66 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FULL_JDK +package test +fun testProperLineNumber(): String { + var exceptionCount = 0; + try { + test() fail + call() + } + catch(e: AssertionError) { + val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1) + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("infixCalls.kt:8" != actual) { + return "fail 1: ${actual}" + } + exceptionCount++ + } + + try { + call() fail + test() + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("infixCalls.kt:21" != actual) { + return "fail 1: ${actual}" + } + exceptionCount++ + } + + try { + call() fail test() + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("infixCalls.kt:34" != actual) { + return "fail 1: ${actual}" + } + exceptionCount++ + } + + return if (exceptionCount == 3) "OK" else "fail" +} + +fun box(): String { + return testProperLineNumber() +} + +public fun checkEquals(p1: String, p2: String) { + throw AssertionError("fail") +} + +inline fun test(): String { + return "123" +} + +infix fun String.fail(p: String): String { + throw AssertionError("fail") +} + +fun call(): String { + return "xxx" +} diff --git a/backend.native/tests/external/codegen/blackbox/smap/simpleCallWithParams.kt b/backend.native/tests/external/codegen/blackbox/smap/simpleCallWithParams.kt new file mode 100644 index 00000000000..8c0830bc26e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smap/simpleCallWithParams.kt @@ -0,0 +1,110 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FULL_JDK +package test +fun testProperLineNumberAfterInline(): String { + var exceptionCount = 0; + try { + checkEquals(test(), + "12") + } + catch(e: AssertionError) { + val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1) + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("simpleCallWithParams.kt:8" != actual) { + return "fail 1: ${actual}" + } + exceptionCount++ + } + + try { + checkEquals("12", + test()) + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("simpleCallWithParams.kt:21" != actual) { + return "fail 2: ${actual}" + } + exceptionCount++ + } + + return if (exceptionCount == 2) "OK" else "fail" +} + +fun testProperLineForOtherParameters(): String { + var exceptionCount = 0; + try { + checkEquals(test(), + fail()) + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("simpleCallWithParams.kt:39" != actual) { + return "fail 3: ${actual}" + } + exceptionCount++ + + } + + try { + checkEquals(fail(), + test()) + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("simpleCallWithParams.kt:53" != actual) { + return "fail 4: ${actual}" + } + exceptionCount++ + } + + try { + checkEquals(fail(), test()) + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("simpleCallWithParams.kt:66" != actual) { + return "fail 5: ${actual}" + } + exceptionCount++ + } + + try { + checkEquals(fail(), test()) + } + catch(e: AssertionError) { + val entry = e.stackTrace!![1] + val actual = "${entry.getFileName()}:${entry.getLineNumber()}" + if ("simpleCallWithParams.kt:78" != actual) { + return "fail 6: ${actual}" + } + exceptionCount++ + } + + return if (exceptionCount == 4) "OK" else "fail" +} + + +fun box(): String { + val res = testProperLineNumberAfterInline() + if (res != "OK") return "$res" + + return testProperLineForOtherParameters() +} + +public fun checkEquals(p1: String, p2: String) { + throw AssertionError("fail") +} + +inline fun test(): String { + return "123" +} + +fun fail(): String { + throw AssertionError("fail") +} diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/falseSmartCast.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/falseSmartCast.kt new file mode 100644 index 00000000000..cfdcf7e1e7c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/falseSmartCast.kt @@ -0,0 +1,17 @@ +open class SuperFoo { + public fun bar(): String { + if (this is Foo) { + superFoo() // Smart cast + return baz() // Cannot be cast + } + return baz() + } + + public fun baz() = "OK" +} + +class Foo : SuperFoo() { + public fun superFoo() {} +} + +fun box(): String = Foo().bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/genericIntersection.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/genericIntersection.kt new file mode 100644 index 00000000000..51c34682f0e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/genericIntersection.kt @@ -0,0 +1,9 @@ +// See also KT-7801 +class A + +fun test(v: T): T { + val a: T = if (v !is A) v else v + return a +} + +fun box() = test("OK") diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/genericSet.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/genericSet.kt new file mode 100644 index 00000000000..48350f84309 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/genericSet.kt @@ -0,0 +1,13 @@ +class Wrapper(var x: T) + +inline fun change(w: Wrapper, x: Any?) { + if (x is T) { + w.x = x + } +} + +fun box(): String { + val w = Wrapper("FAIL") + change(w, "OK") + return w.x +} diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/implicitExtensionReceiver.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitExtensionReceiver.kt new file mode 100644 index 00000000000..f315a202bdb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitExtensionReceiver.kt @@ -0,0 +1,7 @@ +class A { + fun foo() = "OK" +} + +fun A?.bar() = if (this != null) foo() else "FAIL" + +fun box() = A().bar() diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/implicitMemberReceiver.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitMemberReceiver.kt new file mode 100644 index 00000000000..f38fa9fd9b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitMemberReceiver.kt @@ -0,0 +1,20 @@ +open class A { + open val a = "OK" +} + +class B : A() { + override val a = "FAIL" + fun foo() = "CRUSH" +} + +class C { + fun A?.complex(): String { + if (this is B) return foo() + else if (this != null) return a + else return "???" + } + + fun bar() = A().complex() +} + +fun box() = C().bar() diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiver.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiver.kt new file mode 100644 index 00000000000..911f53248c5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiver.kt @@ -0,0 +1,13 @@ +open class A { + class B : A() { + val a = "FAIL" + } + + fun foo(): String { + if (this is B) return a + return "OK" + } +} + + +fun box(): String = A().foo() diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiverInWhen.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiverInWhen.kt new file mode 100644 index 00000000000..ce31ad2d9f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitReceiverInWhen.kt @@ -0,0 +1,11 @@ +open class A { + fun f(): String = + when (this) { + is B -> x + else -> "FAIL" + } +} + +class B(val x: String) : A() + +fun box() = B("OK").f() diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/implicitToGrandSon.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitToGrandSon.kt new file mode 100644 index 00000000000..588cc9ff24d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/implicitToGrandSon.kt @@ -0,0 +1,13 @@ +open class A { + open fun foo() = "FAIL" + + fun bar() = if (this is C) foo() else foo() +} + +open class B : A() + +open class C : B() { + override fun foo() = "OK" +} + +fun box() = C().bar() diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt new file mode 100644 index 00000000000..a5e38e427a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class Foo(val s: String) +fun foo(): Foo? = Foo("OK") + +fun run(f: () -> T): T = f() + +val foo: Foo = run { + val x = foo() + if (x == null) throw Exception() + x +} + +fun box() = foo.s diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/nullSmartCast.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/nullSmartCast.kt new file mode 100644 index 00000000000..1b74cbd9ea3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/nullSmartCast.kt @@ -0,0 +1,8 @@ +fun String?.foo() = this ?: "OK" + +fun foo(i: Int?): String { + if (i == null) return i.foo() + return "$i" +} + +fun box() = foo(null) diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/smartCastInsideIf.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/smartCastInsideIf.kt new file mode 100644 index 00000000000..10d4a4c76c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/smartCastInsideIf.kt @@ -0,0 +1,15 @@ +class A(val s: String = "FAIL") + +private fun foo(a: A?, aOther: A?): A { + return if (a == null) { + A() + } + else { + if (aOther == null) { + return A() + } + aOther + } +} + +fun box() = foo(A("???"), A("OK")).s diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/whenSmartCast.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/whenSmartCast.kt new file mode 100644 index 00000000000..8069048ce00 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/whenSmartCast.kt @@ -0,0 +1,9 @@ +fun baz(s: String?): Int { + if (s == null) return 0 + return when(s) { + "abc" -> s + else -> "xyz" + }.length +} + +fun box() = if (baz("abc") == 3 && baz("") == 3 && baz(null) == 0) "OK" else "FAIL" diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt new file mode 100644 index 00000000000..1b1d43a9c20 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt @@ -0,0 +1,37 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +private object NotEmptyMap : MutableMap { + override fun containsKey(key: Any): Boolean = true + override fun containsValue(value: Int): Boolean = true + + // non-special bridges get(Object)Integer -> get(Object)I + override fun get(key: Any): Int = 1 + override fun remove(key: Any): Int = 1 + + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun put(key: Any, value: Int): Int? = throw UnsupportedOperationException() + override fun putAll(from: Map): Unit = throw UnsupportedOperationException() + override fun clear(): Unit = throw UnsupportedOperationException() + override val entries: MutableSet> get() = null!! + override val keys: MutableSet get() = null!! + override val values: MutableCollection get() = null!! +} + + +fun box(): String { + val n = NotEmptyMap as MutableMap + + if (n.get(null) != null) return "fail 1" + if (n.containsKey(null)) return "fail 2" + if (n.containsValue(null)) return "fail 3" + if (n.remove(null) != null) return "fail 4" + + if (n.get(1) == null) return "fail 5" + if (!n.containsKey("")) return "fail 6" + if (!n.containsValue(3)) return "fail 7" + if (n.remove("") == null) return "fail 8" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridges.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridges.kt new file mode 100644 index 00000000000..3b26586b311 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridges.kt @@ -0,0 +1,104 @@ + +interface A0 { + val size: Int get() = 56 +} + +class B0 : Collection, A0 { + override fun isEmpty() = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() + override fun iterator() = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() + override val size: Int + get() = super.size +} + +open class A1 { + val size: Int = 56 +} + +class B1 : Collection, A1() { + override fun isEmpty() = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() + override fun iterator() = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() +} + +interface I2 { + val size: Int +} + +val list = ArrayList() + +class B2 : ArrayList(list), I2 + +interface I3 { + val size: T +} + +class B3 : ArrayList(list), I3 + +interface I4 { + val size: T get() = 56 as T +} + +class B4 : Collection, I4 { + override fun isEmpty() = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() + override fun iterator() = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() + override val size: Int + get() = super.size +} + +interface I5 : Collection { + override val size: Int get() = 56 +} + +class B5 : I5 { + override fun isEmpty() = throw UnsupportedOperationException() + override fun contains(o: String) = throw UnsupportedOperationException() + override fun iterator() = throw UnsupportedOperationException() + override fun containsAll(c: Collection) = throw UnsupportedOperationException() +} + +fun box(): String { + list.add("1") + + val b0 = B0() + if (b0.size != 56) return "fail 0: ${b0.size}" + var x: Collection = B0() + if (x.size != 56) return "fail 00: ${x.size}" + val a0: A0 = b0 + if (a0.size != 56) return "fail 000: ${a0.size}" + + val b1 = B1() + if (b1.size != 56) return "fail 1: ${b1.size}" + x = B1() + if (x.size != 56) return "fail 2: ${x.size}" + + val b2 = B2() + if (b2.size != 1) return "fail 3: ${b2.size}" + x = B2() + if (x.size != 1) return "fail 4: ${x.size}" + val i2: I2 = b2 + if (i2.size != 1) return "fail 5: ${i2.size}" + + val b3 = B3() + if (b3.size != 1) return "fail 6: ${b3.size}" + x = B3() + if (x.size != 1) return "fail 7: ${x.size}" + val i3: I3 = b3 + if (i3.size != 1) return "fail 8: ${i3.size}" + + val b4 = B4() + if (b4.size != 56) return "fail 9: ${b4.size}" + x = B4() + if (x.size != 56) return "fail 10: ${x.size}" + + val b5 = B5() + if (b5.size != 56) return "fail 11: ${b5.size}" + x = B5() + if (x.size != 56) return "fail 12: ${x.size}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt new file mode 100644 index 00000000000..4ab3890681f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt @@ -0,0 +1,97 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A1 : MutableCollection { + override val size: Int + get() = 56 + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun contains(o: String): Boolean { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } + + override fun containsAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun add(e: String): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(o: String): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(c: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } +} + +class A2 : java.util.AbstractCollection() { + override val size: Int + get() = 56 + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } +} + +class A3 : java.util.ArrayList() { + override val size: Int + get() = 56 +} + +interface Sized { + val size: Int +} + +class A4 : java.util.ArrayList(), Sized { + override val size: Int + get() = 56 +} + +fun check56(x: Collection) { + if (x.size != 56) throw java.lang.RuntimeException("fail ${x.size}") +} + +fun box(): String { + val a1 = A1() + if (a1.size != 56) return "fail 1: ${a1.size}" + check56(a1) + + val a2 = A2() + if (a2.size != 56) return "fail 2: ${a2.size}" + check56(a2) + + val a3 = A3() + if (a3.size != 56) return "fail 3: ${a3.size}" + check56(a3) + + val a4 = A4() + if (a4.size != 56) return "fail 4: ${a4.size}" + check56(a4) + + val sized: Sized = a4 + if (sized.size != 56) return "fail 5: ${a4.size}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/commonBridgesTarget.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/commonBridgesTarget.kt new file mode 100644 index 00000000000..c5ffa3b61d9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/commonBridgesTarget.kt @@ -0,0 +1,25 @@ + +open class Base() : HashSet() { + override fun remove(element: Target): Boolean { + return true + } +} + +class Derived : Base() { + // common "synthetic bridge override fun remove(element: DatabaseEntity): Boolean" should call + // `INVOKEVIRTUAL remove(Issue)` + // instead of `INVOKEVIRTUAL remove(OBJECT)` + override fun remove(element: Issue): Boolean { + return super.remove(element) + } +} + +open class DatabaseEntity +class Issue: DatabaseEntity() + +fun box(): String { + val sprintIssues = Derived() + if (!sprintIssues.remove(Issue())) return "Fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt new file mode 100644 index 00000000000..51ff7cd35e7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +private object EmptyList : List { + override fun contains(element: Nothing): Boolean = false + override fun containsAll(elements: Collection): Boolean = elements.isEmpty() + override fun indexOf(element: Nothing): Int = -2 + override fun lastIndexOf(element: Nothing): Int = -2 + + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + + override fun iterator(): Iterator = throw UnsupportedOperationException() + override fun get(index: Int): Nothing = throw UnsupportedOperationException() + override fun listIterator(): ListIterator = throw UnsupportedOperationException() + override fun listIterator(index: Int): ListIterator = throw UnsupportedOperationException() + override fun subList(fromIndex: Int, toIndex: Int): List = throw UnsupportedOperationException() +} + +fun box(): String { + val n = EmptyList as List + + if (n.contains("")) return "fail 1" + if (n.indexOf("") != -1) return "fail 2" + if (n.lastIndexOf("") != -1) return "fail 3" + + val nullAny = EmptyList as List + + if (nullAny.contains(null)) return "fail 4" + if (nullAny.indexOf(null) != -1) return "fail 5" + if (nullAny.lastIndexOf(null) != -1) return "fail 6" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyMap.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyMap.kt new file mode 100644 index 00000000000..c0770bd6b2a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyMap.kt @@ -0,0 +1,22 @@ +private object EmptyMap : Map { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + + override fun containsKey(key: Any): Boolean = false + override fun containsValue(value: Nothing): Boolean = false + override fun get(key: Any): Nothing? = null + override val entries: Set> get() = null!! + override val keys: Set get() = null!! + override val values: Collection get() = null!! +} + + +fun box(): String { + val n = EmptyMap as Map + + if (n.get(null) != null) return "fail 1" + if (n.containsKey(null)) return "fail 2" + if (n.containsValue(null)) return "fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyStringMap.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyStringMap.kt new file mode 100644 index 00000000000..fd4953af8ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyStringMap.kt @@ -0,0 +1,21 @@ +private object EmptyStringMap : Map { + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + + override fun containsKey(key: String): Boolean = false + override fun containsValue(value: Nothing): Boolean = false + override fun get(key: String): Nothing? = null + override val entries: Set> get() = null!! + override val keys: Set get() = null!! + override val values: Collection get() = null!! +} + +fun box(): String { + val n = EmptyStringMap as Map + + if (n.get(null) != null) return "fail 1" + if (n.containsKey(null)) return "fail 2" + if (n.containsValue(null)) return "fail 3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/entrySetSOE.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/entrySetSOE.kt new file mode 100644 index 00000000000..15a676453c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/entrySetSOE.kt @@ -0,0 +1,14 @@ + +open class Map1 : HashMap() +class Map2 : Map1() +fun box(): String { + val m = Map2() + if (m.entries.size != 0) return "fail 1" + + m.put("56", "OK") + val x = m.entries.iterator().next() + + if (x.key != "56" || x.value != "OK") return "fail 2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/enumAsOrdinaled.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/enumAsOrdinaled.kt new file mode 100644 index 00000000000..6b3eda01d77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/enumAsOrdinaled.kt @@ -0,0 +1,16 @@ +interface Ordinaled { + val ordinal: Int +} + +enum class A : Ordinaled { + X +} + + +fun box(): String { + val result = (A.X as Ordinaled).ordinal + + if (result != 0) return "fail 1: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/explicitSuperCall.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/explicitSuperCall.kt new file mode 100644 index 00000000000..334b9521a49 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/explicitSuperCall.kt @@ -0,0 +1,10 @@ +class A : ArrayList() { + override val size: Int get() = super.size + 56 +} + +fun box(): String { + val a = A() + if (a.size != 56) return "fail: ${a.size}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/irrelevantRemoveAtOverride.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/irrelevantRemoveAtOverride.kt new file mode 100644 index 00000000000..0e385c6fc30 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/irrelevantRemoveAtOverride.kt @@ -0,0 +1,104 @@ +interface Container { + fun removeAt(x: Int): String +} + +open class ContainerImpl : Container { + override fun removeAt(x: Int) = "abc" +} + +class A : ContainerImpl(), MutableList { + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override val size: Int + get() = throw UnsupportedOperationException() + + override fun contains(element: String): Boolean { + throw UnsupportedOperationException() + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun get(index: Int): String { + throw UnsupportedOperationException() + } + + override fun indexOf(element: String): Int { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(element: String): Int { + throw UnsupportedOperationException() + } + + override fun add(element: String): Boolean { + throw UnsupportedOperationException() + } + + override fun remove(element: String): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun retainAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: String): String { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: String) { + throw UnsupportedOperationException() + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } +} + +fun box(): String { + val a = A() + if (a.removeAt(0) != "abc") return "fail 1" + + val l: MutableList = a + if (l.removeAt(0) != "abc") return "fail 2" + + val anyList: MutableList = a as MutableList + if (anyList.removeAt(0) != "abc") return "fail 3" + + val container: Container = a + if (container.removeAt(0) != "abc") return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/maps.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/maps.kt new file mode 100644 index 00000000000..d3dedeef878 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/maps.kt @@ -0,0 +1,41 @@ +class A : Map { + override val size: Int get() = 56 + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun containsKey(key: String): Boolean { + throw UnsupportedOperationException() + } + + override fun containsValue(value: String): Boolean { + throw UnsupportedOperationException() + } + + override fun get(key: String): String? { + throw UnsupportedOperationException() + } + + override val keys: Set get() { + throw UnsupportedOperationException() + } + + override val values: Collection get() { + throw UnsupportedOperationException() + } + + override val entries: Set> get() { + throw UnsupportedOperationException() + } +} + +fun box(): String { + val a = A() + if (a.size != 56) return "fail 1: ${a.size}" + + val x: Map = a + if (x.size != 56) return "fail 2: ${x.size}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/noSpecialBridgeInSuperClass.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/noSpecialBridgeInSuperClass.kt new file mode 100644 index 00000000000..df49fe5a5cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/noSpecialBridgeInSuperClass.kt @@ -0,0 +1,59 @@ +var result = "" + +public abstract class AbstractFoo : Map { + override operator fun get(key: K): V? { + result = "AbstractFoo" + return null + } + + override val size: Int + get() = throw UnsupportedOperationException() + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun containsKey(key: K): Boolean { + throw UnsupportedOperationException() + } + + override fun containsValue(value: V): Boolean { + throw UnsupportedOperationException() + } + + override val keys: Set + get() = throw UnsupportedOperationException() + override val values: Collection + get() = throw UnsupportedOperationException() + override val entries: Set> + get() = throw UnsupportedOperationException() +} + +public open class StringFoo : AbstractFoo() { + override operator fun get(key: String): E? { + result = "StringFoo" + return null + } +} + +public class IntFoo : AbstractFoo() { + override operator fun get(key: Int): E? { + result = "IntFoo" + return null + } +} + +public class AnyFoo : AbstractFoo() {} + +fun box(): String { + StringFoo().get("") + if (result != "StringFoo") return "fail 1: $result" + + IntFoo().get(1) + if (result != "IntFoo") return "fail 2: $result" + + AnyFoo().get(null) + if (result != "AbstractFoo") return "fail 3: $result" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt new file mode 100644 index 00000000000..e289d230889 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt @@ -0,0 +1,46 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +private object NotEmptyList : MutableList { + override fun contains(element: Any): Boolean = true + override fun indexOf(element: Any): Int = 0 + override fun lastIndexOf(element: Any): Int = 0 + override fun remove(element: Any): Boolean = true + + override val size: Int + get() = throw UnsupportedOperationException() + + override fun containsAll(elements: Collection): Boolean = elements.isEmpty() + override fun isEmpty(): Boolean = throw UnsupportedOperationException() + override fun get(index: Int): Any = throw UnsupportedOperationException() + override fun add(element: Any): Boolean = throw UnsupportedOperationException() + override fun addAll(elements: Collection): Boolean = throw UnsupportedOperationException() + override fun addAll(index: Int, elements: Collection): Boolean = throw UnsupportedOperationException() + override fun removeAll(elements: Collection): Boolean = throw UnsupportedOperationException() + override fun retainAll(elements: Collection): Boolean = throw UnsupportedOperationException() + override fun clear(): Unit = throw UnsupportedOperationException() + override fun set(index: Int, element: Any): Any = throw UnsupportedOperationException() + override fun add(index: Int, element: Any): Unit = throw UnsupportedOperationException() + override fun removeAt(index: Int): Any = throw UnsupportedOperationException() + override fun listIterator(): MutableListIterator = throw UnsupportedOperationException() + override fun listIterator(index: Int): MutableListIterator = throw UnsupportedOperationException() + override fun subList(fromIndex: Int, toIndex: Int): MutableList = throw UnsupportedOperationException() + override fun iterator(): MutableIterator = throw UnsupportedOperationException() +} + +fun box(): String { + val n = NotEmptyList as MutableList + + if (n.contains(null)) return "fail 1" + if (n.indexOf(null) != -1) return "fail 2" + if (n.lastIndexOf(null) != -1) return "fail 3" + + if (!n.contains("")) return "fail 3" + if (n.indexOf("") != 0) return "fail 4" + if (n.lastIndexOf("") != 0) return "fail 5" + + if (n.remove(null)) return "fail 6" + if (!n.remove("")) return "fail 7" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt new file mode 100644 index 00000000000..3e19df62282 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt @@ -0,0 +1,35 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +private object NotEmptyMap : MutableMap { + override fun containsKey(key: Any): Boolean = true + override fun containsValue(value: Any): Boolean = true + override fun get(key: Any): Any? = Any() + override fun remove(key: Any): Any? = Any() + + override val size: Int get() = 0 + override fun isEmpty(): Boolean = true + override fun put(key: Any, value: Any): Any? = throw UnsupportedOperationException() + override fun putAll(from: Map): Unit = throw UnsupportedOperationException() + override fun clear(): Unit = throw UnsupportedOperationException() + override val entries: MutableSet> get() = null!! + override val keys: MutableSet get() = null!! + override val values: MutableCollection get() = null!! +} + + +fun box(): String { + val n = NotEmptyMap as MutableMap + + if (n.get(null) != null) return "fail 1" + if (n.containsKey(null)) return "fail 2" + if (n.containsValue(null)) return "fail 3" + if (n.remove(null) != null) return "fail 4" + + if (n.get("") == null) return "fail 5" + if (!n.containsKey("")) return "fail 6" + if (!n.containsValue("")) return "fail 7" + if (n.remove("") == null) return "fail 8" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/redundantStubForSize.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/redundantStubForSize.kt new file mode 100644 index 00000000000..df0376cc9cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/redundantStubForSize.kt @@ -0,0 +1,28 @@ +open class A1 { + open val size: Int = 56 +} + +class A2 : A1(), Collection { + // No 'getSize()' method should be generated in A2 + + override fun contains(element: String): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun iterator(): Iterator { + throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. + } +} + +fun box(): String { + if (A2().size != 56) return "fail 1" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/removeAtTwoSpecialBridges.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/removeAtTwoSpecialBridges.kt new file mode 100644 index 00000000000..86f4b09d05c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/removeAtTwoSpecialBridges.kt @@ -0,0 +1,96 @@ +open class A0 : MutableList { + override fun add(element: E): Boolean { + throw UnsupportedOperationException() + } + + override fun add(index: Int, element: E) { + throw UnsupportedOperationException() + } + + override fun addAll(index: Int, elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun addAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun clear() { + throw UnsupportedOperationException() + } + + override fun listIterator(): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun listIterator(index: Int): MutableListIterator { + throw UnsupportedOperationException() + } + + override fun remove(element: E): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun removeAt(index: Int): E = "K" as E + + override fun retainAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun set(index: Int, element: E): E { + throw UnsupportedOperationException() + } + + override fun subList(fromIndex: Int, toIndex: Int): MutableList { + throw UnsupportedOperationException() + } + + override val size: Int + get() = throw UnsupportedOperationException() + + override fun contains(element: E): Boolean { + throw UnsupportedOperationException() + } + + override fun containsAll(elements: Collection): Boolean { + throw UnsupportedOperationException() + } + + override fun get(index: Int): E { + throw UnsupportedOperationException() + } + + override fun indexOf(element: E): Int { + throw UnsupportedOperationException() + } + + override fun isEmpty(): Boolean { + throw UnsupportedOperationException() + } + + override fun lastIndexOf(element: E): Int { + throw UnsupportedOperationException() + } + + override fun iterator(): MutableIterator { + throw UnsupportedOperationException() + } +} + +class A1() : A0() { + override fun removeAt(p0: Int): String = "O" +} + +class A2 : A0() + +// Basically this test checks that no redundant special bridges were generated (i.e. no VerifyError happens) +fun box(): String { + val a1 = A1() + val a2 = A2() + + return a1.removeAt(123) + a2.removeAt(456) +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/throwable.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/throwable.kt new file mode 100644 index 00000000000..e4040a63794 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/throwable.kt @@ -0,0 +1,10 @@ +fun box(): String { + try { + throw Throwable("OK", null) + } catch (t: Throwable) { + if (t.cause != null) return "fail 1" + return t.message!! + } + + return "fail 2" +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/throwableImpl.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/throwableImpl.kt new file mode 100644 index 00000000000..2f6aeaa6b55 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/throwableImpl.kt @@ -0,0 +1,21 @@ +class MyThrowable(message: String? = null, cause: Throwable? = null) : Throwable(message, cause) { + + override val message: String? + get() = "My message: " + super.message + + override val cause: Throwable? + get() = super.cause ?: this + +} + +fun box(): String { + try { + throw MyThrowable("test") + } catch (t: MyThrowable) { + if (t.cause != t) return "fail t.cause" + if (t.message != "My message: test") return "fail t.message" + return "OK" + } + + return "fail: MyThrowable wasn't catched." +} diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/valuesInsideEnum.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/valuesInsideEnum.kt new file mode 100644 index 00000000000..ee008bfcf82 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/valuesInsideEnum.kt @@ -0,0 +1,8 @@ +enum class Variants { + O, K; + companion object { + val valueStr = values()[0].name + Variants.values()[1].name + } +} + +fun box() = Variants.valueStr diff --git a/backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerIObject.kt b/backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerIObject.kt new file mode 100644 index 00000000000..72aa88ec05b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerIObject.kt @@ -0,0 +1,11 @@ +object Foo { + val bar: String + + init { + bar = "OK" + } +} + +fun box(): String { + return Foo.bar +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerInClassObject.kt b/backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerInClassObject.kt new file mode 100644 index 00000000000..3b3559b2895 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/anonymousInitializerInClassObject.kt @@ -0,0 +1,13 @@ +class Foo { + companion object { + val bar: String + + init { + bar = "OK" + } + } +} + +fun box(): String { + return Foo.bar +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/fields.kt b/backend.native/tests/external/codegen/blackbox/statics/fields.kt new file mode 100644 index 00000000000..20cd4ddb815 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/fields.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Child.java + +class Child extends Parent { + public static int b = 3; + public static int c = 4; +} + +// FILE: Parent.java + +class Parent { + public static int a = 1; + public static int b = 2; +} + +// FILE: test.kt + +fun box(): String { + if (Parent.a != 1) return "expected Parent.a == 1" + if (Parent.b != 2) return "expected Parent.b == 2" + if (Child.a != 1) return "expected Child.a == 1" + if (Child.b != 3) return "expected Child.b == 3" + if (Child.c != 4) return "expected Child.c == 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/functions.kt b/backend.native/tests/external/codegen/blackbox/statics/functions.kt new file mode 100644 index 00000000000..f06f8aba581 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/functions.kt @@ -0,0 +1,36 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Child.java + +class Child extends Parent { + public static String bar() { + return "Child.bar"; + } + public static String baz() { + return "Child.baz"; + } +} + +// FILE: Parent.java + +class Parent { + public static String foo() { + return "Parent.foo"; + } + public static String baz() { + return "Parent.baz"; + } +} + +// FILE: test.kt + +fun box(): String { + if (Parent.foo() != "Parent.foo") return "expected: Parent.foo" + if (Parent.baz() != "Parent.baz") return "expected: Parent.baz" + if (Child.foo() != "Parent.foo") return "expected: Child.foo() != Parent.foo" + if (Child.baz() != "Child.baz") return "expected: Child.baz" + if (Child.bar() != "Child.bar") return "expected: Child.bar" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt b/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt new file mode 100644 index 00000000000..ffe8b37d042 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Child.java + +class Child extends Parent { + public static String a = "2"; + public static String foo() { + return "Child.foo()"; + } + public static String foo(int i) { + return "Child.foo(int)"; + } +} + +// FILE: Parent.java + +class Parent { + private static int a = 1; + private static String foo() { + return "Parent.foo"; + } +} + +// FILE: test.kt + +fun box(): String { + if (Child.a != "2") return "Fail #1" + if (Child.foo() != "Child.foo()") return "Fail #2" + if (Child.foo(1) != "Child.foo(int)") return "Fail #3" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/incInClassObject.kt b/backend.native/tests/external/codegen/blackbox/statics/incInClassObject.kt new file mode 100644 index 00000000000..fe763170399 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/incInClassObject.kt @@ -0,0 +1,73 @@ +class A { + companion object { + private var r: Int = 1; + + fun test(): Int { + r++ + ++r + return r + } + + var holder: String = "" + + var r2: Int = 1; + get() { + holder += "getR2" + return field + } + + fun test2() : Int { + r2++ + ++r2 + return r2 + } + + var r3: Int = 1; + set(p: Int) { + holder += "setR3" + field = p + } + + fun test3() : Int { + r3++ + ++r3 + return r3 + } + + var r4: Int = 1; + get() { + holder += "getR4" + return field + } + set(p: Int) { + holder += "setR4" + field = p + } + + fun test4() : Int { + r4++ + holder += ":" + ++r4 + return r4 + } + } +} + +fun box() : String { + val p = A.test() + if (p != 3) return "fail 1: $p" + + val p2 = A.test2() + var holderValue = A.holder + if (p2 != 3 || holderValue != "getR2getR2getR2getR2") return "fail 2: $p2 ${holderValue}" + + A.holder = "" + val p3 = A.test3() + if (p3 != 3 || A.holder != "setR3setR3") return "fail 3: $p3 ${A.holder}" + + A.holder = "" + val p4 = A.test4() + if (p4 != 3 || A.holder != "getR4setR4:getR4setR4getR4getR4") return "fail 4: $p4 ${A.holder}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/incInObject.kt b/backend.native/tests/external/codegen/blackbox/statics/incInObject.kt new file mode 100644 index 00000000000..f35b9bb83f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/incInObject.kt @@ -0,0 +1,71 @@ +object A { + private var r: Int = 1; + + fun test() : Int { + r++ + ++r + return r + } + + var holder: String = "" + + var r2: Int = 1; + get() { + holder += "getR2" + return field + } + + fun test2() : Int { + r2++ + ++r2 + return r2 + } + + var r3: Int = 1; + set(p: Int) { + holder += "setR3" + field = p + } + + fun test3() : Int { + r3++ + ++r3 + return r3 + } + + var r4: Int = 1; + get() { + holder += "getR4" + return field + } + set(p: Int) { + holder += "setR4" + field = p + } + + fun test4() : Int { + r4++ + holder += ":" + ++r4 + return r4 + } +} + +fun box() : String { + val p = A.test() + if (p != 3) return "fail 1: $p" + + val p2 = A.test2() + val holderValue = A.holder + if (p2 != 3 || holderValue != "getR2getR2getR2getR2") return "fail 2: $p2 ${holderValue}" + + A.holder = "" + val p3 = A.test3() + if (p3 != 3 || A.holder != "setR3setR3") return "fail 3: $p3 ${A.holder}" + + A.holder = "" + val p4 = A.test4() + if (p4 != 3 || A.holder != "getR4setR4:getR4setR4getR4getR4") return "fail 4: $p4 ${A.holder}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInClassObject.kt b/backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInClassObject.kt new file mode 100644 index 00000000000..2ab591a3f58 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInClassObject.kt @@ -0,0 +1,13 @@ +open class Bar(val prop: String) +class Foo { + companion object : Bar("OK") { + val p = Foo.prop + val p2 = prop + val p3 = this.prop + } + + val p4 = Foo.prop + val p5 = prop +} + +fun box(): String = Foo.prop \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInObject.kt b/backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInObject.kt new file mode 100644 index 00000000000..4d00f209f61 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/inheritedPropertyInObject.kt @@ -0,0 +1,8 @@ +open class Bar(val prop: String) +object Foo : Bar("OK") { + + val p = Foo.prop + val p2 = prop + val p3 = this.prop +} +fun box(): String = Foo.prop \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt b/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt new file mode 100644 index 00000000000..80224d8ba56 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Test.java + +public class Test { + + protected String data = "O"; + + protected Test() { + + } + + protected static String testStatic() { + return "K"; + } + +} + +// FILE: test.kt + +public inline fun test(): String { + val p = object : Test() {} + return p.data + Test.testStatic(); +} + + +fun box(): String { + return test() +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/kt8089.kt b/backend.native/tests/external/codegen/blackbox/statics/kt8089.kt new file mode 100644 index 00000000000..2fee361d80d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/kt8089.kt @@ -0,0 +1,21 @@ +class C { + companion object { + private val s: String + private var s2: String + + init { + s = "O" + s2 = "O" + } + + fun foo() = s + + fun foo2() = s2 + + fun bar2() { s2 = "K" } + } +} + +fun box(): String { + return C.foo() + {C.bar2(); C.foo2()}() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt new file mode 100644 index 00000000000..7026016840e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: JavaClass.java + +public class JavaClass { + + public String runZ(Z z) { + return z.run("O", "K"); + } + + protected interface Z { + String run(String s1, String s2); + } +} + +// FILE: Kotlin.kt + +package zzz + +import JavaClass +import JavaClass.Z + +class A : JavaClass() { + fun test() = runZ(JavaClass.Z {a, b -> a + b}) +} + +fun box(): String { + return A().test() +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt new file mode 100644 index 00000000000..61f8e3ab8cc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt @@ -0,0 +1,38 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: First.java + +public abstract class First { + protected static String TEST = "OK"; + + protected static String test() { + return TEST; + } +} + +// FILE: First.kt + +package anotherPackage + +import First + +class Second : First() { + val some = { First.TEST } + fun foo() = { First.test() } + + val some2 = { TEST } + fun foo2() = { test() } +} + +fun box(): String { + if (Second().some.invoke() != "OK") return "fail 1" + + if (Second().foo().invoke() != "OK") return "fail 2" + + if (Second().some2.invoke() != "OK") return "fail 3" + + if (Second().foo2().invoke() != "OK") return "fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt new file mode 100644 index 00000000000..a6bbeee7730 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt @@ -0,0 +1,61 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: Base.java + +public class Base { + + protected static String BASE_ONLY = "BASE"; + + protected static String baseOnly() { + return BASE_ONLY; + } + + protected static String TEST = "BASE"; + + protected static String test() { + return TEST; + } + + public static class Derived extends Base { + protected static String TEST = "DERIVED"; + + protected static String test() { + return TEST; + } + } +} + +// FILE: Kotlin.kt + +package anotherPackage + +import Base.Derived +import Base + +class Kotlin : Base.Derived() { + fun doTest(): String { + + if ({ TEST }() != "DERIVED") return "fail 1" + if ({ test() }() != "DERIVED") return "fail 2" + + if ({ Derived.TEST }() != "DERIVED") return "fail 3" + if ({ Derived.test() }() != "DERIVED") return "fail 4" + + if ({ Base.TEST }() != "BASE") return "fail 5" + if ({ Base.test() }() != "BASE") return "fail 6" + + + if ({ Base.BASE_ONLY }() != "BASE") return "fail 7" + if ({ Base.baseOnly() }() != "BASE") return "fail 8" + + if ({ BASE_ONLY }() != "BASE") return "fail 9" + if ({ baseOnly() }() != "BASE") return "fail 10" + + return "OK" + } +} + +fun box(): String { + return Kotlin().doTest() +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt new file mode 100644 index 00000000000..c5b96ca260c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: First.java + +public abstract class First { + protected static String TEST = "O"; + + protected static String test() { + return "K"; + } +} + +// FILE: Kotlin.kt + +package anotherPackage + +import First + +class Test : First() { + + inline fun doTest(): String { + return TEST + test() + } +} + +fun box(): String { + return Test().doTest() +} diff --git a/backend.native/tests/external/codegen/blackbox/statics/syntheticAccessor.kt b/backend.native/tests/external/codegen/blackbox/statics/syntheticAccessor.kt new file mode 100644 index 00000000000..2a390400701 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/syntheticAccessor.kt @@ -0,0 +1,12 @@ +object A { + private val p = "OK"; + + object B { + val z = p; + } + +} + +fun box(): String { + return A.B.z +} diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/differentTypes.kt b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/differentTypes.kt new file mode 100644 index 00000000000..2d38eb00026 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/differentTypes.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun bar(x: Int, y: Long, z: Byte, s: String) = x.toString() + y.toString() + z.toString() + s + +fun foobar(x: Int, y: Long, s: String, z: Byte) = x.toString() + y.toString() + s + z.toString() + +fun foo() : String { + return foobar(1, 2L, bar(3, 4L, 5.toByte(), "6"), 7.toByte()) +} + +fun box() : String { + assertEquals("1234567", foo()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/primitiveMerge.kt b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/primitiveMerge.kt new file mode 100644 index 00000000000..7a0c44138c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/primitiveMerge.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun bar() : Boolean = true + +fun foobar1(x: Boolean, y: String, z: String) = x.toString() + y + z +fun foobar2(x: Any, y: String, z: String) = x.toString() + y + z + +inline fun foo() = "-" + +fun box(): String { + val result1 = foobar1(if (1 == 1) true else bar(), foo(), "OK") + val result2 = foobar2(if (1 == 1) "true" else arrayOf("false"), foo(), "OK") + assertEquals("true-OK", result1) + assertEquals("true-OK", result2) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/simple.kt b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/simple.kt new file mode 100644 index 00000000000..02c77ef3f87 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/simple.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun bar(x: Int) : Int { + return x +} + +fun foobar(x: Int, y: Int, z: Int) = x + y + z + +fun foo() : Int { + return foobar(1, bar(2), 3) +} + +fun box() : String { + assertEquals(6, foo()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/unreachableMarker.kt b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/unreachableMarker.kt new file mode 100644 index 00000000000..303293d3cd8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/unreachableMarker.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun bar(block: () -> String) : String { + return block() +} + +inline fun bar2() : String { + return bar { return "def" } +} + +fun foobar(x: String, y: String, z: String) = x + y + z + +fun foo() : String { + return foobar( + "abc", + bar2(), + "ghi" + ) +} + +fun box() : String { + assertEquals("abcdefghi", foo()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/withLambda.kt b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/withLambda.kt new file mode 100644 index 00000000000..44e64d5a9bc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/withLambda.kt @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +inline fun bar(x: String, block: (String) -> String) = "def" + block(x) +fun foobar(x: String, y: String, z: String) = x + y + z + +fun foo() : String { + return foobar("abc", bar("ghi") { x -> x + "jkl" }, "mno") +} + +fun box() : String { + assertEquals("abcdefghijklmno", foo()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/ea35743.kt b/backend.native/tests/external/codegen/blackbox/strings/ea35743.kt new file mode 100644 index 00000000000..31b59f2dcbb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/ea35743.kt @@ -0,0 +1,6 @@ +val Int.test: String get() = "test" + +fun box(): String { + val x = "a ${1.test}" + return if (x == "a test") "OK" else "Fail $x" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/forInString.kt b/backend.native/tests/external/codegen/blackbox/strings/forInString.kt new file mode 100644 index 00000000000..f5bcbbde7be --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/forInString.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME + +fun foo(): Int { + var sum = 0 + for (c in "239") + sum += (c.toInt() - '0'.toInt()) + return sum +} + +fun box(): String { + val f = foo() + return if (f == 14) "OK" else "Fail $f" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/interpolation.kt b/backend.native/tests/external/codegen/blackbox/strings/interpolation.kt new file mode 100644 index 00000000000..772cb33771a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/interpolation.kt @@ -0,0 +1,9 @@ +fun test(p: String?): String { + return "${p ?: "Default"} test" +} +fun box(): String { + if (test(null) != "Default test") return "fail 1: ${test(null)}" + if (test("Good") != "Good test") return "fail 1: ${test("OK")}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt b/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt new file mode 100644 index 00000000000..32134689f31 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt @@ -0,0 +1,7 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun box(): String { + String() + return String() + "OK" + String() +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt3571.kt b/backend.native/tests/external/codegen/blackbox/strings/kt3571.kt new file mode 100644 index 00000000000..960a37656a0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt3571.kt @@ -0,0 +1,6 @@ +class Thing(delegate: CharSequence) : CharSequence by delegate + +fun box(): String { + val l = Thing("hello there").length + return if (l == 11) "OK" else "Fail $l" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt3652.kt b/backend.native/tests/external/codegen/blackbox/strings/kt3652.kt new file mode 100644 index 00000000000..f9e678089b8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt3652.kt @@ -0,0 +1,9 @@ +fun box(): String { + var a = 'a' + + if ("${a++}x" != "ax") return "fail1" + + if ("${a++}" != "b") return "fail2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt5389_stringBuilderGet.kt b/backend.native/tests/external/codegen/blackbox/strings/kt5389_stringBuilderGet.kt new file mode 100644 index 00000000000..c6547b517a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt5389_stringBuilderGet.kt @@ -0,0 +1,4 @@ +fun box(): String { + val sb = StringBuilder("OK") + return "${sb.get(0)}${sb[1]}" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt5956.kt b/backend.native/tests/external/codegen/blackbox/strings/kt5956.kt new file mode 100644 index 00000000000..037ee9ac1dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt5956.kt @@ -0,0 +1,15 @@ +// KT-5956 java.lang.AbstractMethodError: test.Thing.subSequence(II)Ljava/lang/CharSequence + +class Thing(val delegate: CharSequence) : CharSequence { + override fun get(index: Int): Char { + throw UnsupportedOperationException() + } + override val length: Int get() = 0 + override fun subSequence(start: Int, end: Int) = delegate.subSequence(start, end) +} + +fun box(): String { + val txt = Thing("hello there") + val s = txt.subSequence(0, 1) + return if ("$s" == "h") "OK" else "Fail: $s" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt881.kt b/backend.native/tests/external/codegen/blackbox/strings/kt881.kt new file mode 100644 index 00000000000..ba9911d887e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt881.kt @@ -0,0 +1,6 @@ +fun box() : String { + val b = 1+1 + if ("$b" != "2") return "fail" + if ("${1+1}" != "2") return "fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt889.kt b/backend.native/tests/external/codegen/blackbox/strings/kt889.kt new file mode 100644 index 00000000000..99c32c3fa54 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt889.kt @@ -0,0 +1,12 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +operator fun Int.plus(s: String) : String { + System.out?.println("Int.plus(s: String) called") + return s +} + +fun box() : String { + val s = "${1 + "a"}" + return if(s == "a") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt894.kt b/backend.native/tests/external/codegen/blackbox/strings/kt894.kt new file mode 100644 index 00000000000..d822bcd3456 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/kt894.kt @@ -0,0 +1,11 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun stringConcat(n : Int) : String? { + var string : String? = "" + for (i in 0..(n - 1)) + string += "LOL " + return string +} + +fun box() = if(stringConcat(3) == "LOL LOL LOL ") "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/strings/multilineStringsWithTemplates.kt b/backend.native/tests/external/codegen/blackbox/strings/multilineStringsWithTemplates.kt new file mode 100644 index 00000000000..38e661755cd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/multilineStringsWithTemplates.kt @@ -0,0 +1,31 @@ +fun box() : String { + val s = "abc" + val test1 = """$s""" + if (test1 != "abc") return "Fail 1: $test1" + + val test2 = """${s}""" + if (test2 != "abc") return "Fail 2: $test2" + + val test3 = """ "$s" """ + if (test3 != " \"abc\" ") return "Fail 3: $test3" + + val test4 = """ "${s}" """ + if (test4 != " \"abc\" ") return "Fail 4: $test4" + + val test5 = +""" + ${s.length} +""" + if (test5 != "\n 3\n") return "Fail 5: $test5" + + val test6 = """\n""" + if (test6 != "\\n") return "Fail 6: $test6" + + val test7 = """\${'$'}foo""" + if (test7 != "\\\$foo") return "Fail 7: $test7" + + val test8 = """$ foo""" + if (test8 != "$ foo") return "Fail 8: $test8" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/rawStrings.kt b/backend.native/tests/external/codegen/blackbox/strings/rawStrings.kt new file mode 100644 index 00000000000..caa5b8fc27a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/rawStrings.kt @@ -0,0 +1,6 @@ +fun box() : String { + val s = """ foo \n bar """ + if (s != " foo \\n bar ") return "Fail: '$s'" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/rawStringsWithManyQuotes.kt b/backend.native/tests/external/codegen/blackbox/strings/rawStringsWithManyQuotes.kt new file mode 100644 index 00000000000..1fb97bd718e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/rawStringsWithManyQuotes.kt @@ -0,0 +1,28 @@ +class P(val actual: String, val expected: String) +fun array(vararg s: P) = s + +fun box() : String { + val data = array( + P("""""", ""), + P(""""""", "\""), + P("""""""", "\"\""), + P(""""""""", "\"\"\""), + P("""""""""", "\"\"\"\""), + P("""" """, "\" "), + P(""""" """, "\"\" "), + P(""" """", " \""), + P(""" """"", " \"\""), + P(""" """""", " \"\"\""), + P(""" """"""", " \"\"\"\""), + P(""" """""""", " \"\"\"\"\""), + P("""" """", "\" \""), + P(""""" """"", "\"\" \"\"") + ) + + for (i in 0..data.size-1) { + val p = data[i] + if (p.actual != p.expected) return "Fail at #$i. actual='${p.actual}', expected='${p.expected}'" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt b/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt new file mode 100644 index 00000000000..c994f4c4a0a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +class A() { + + override fun toString(): String { + return "A" + } +} + +fun box() : String { + + val s = "1" + "2" + 3 + 4L + 5.0 + 6F + '7' + A() + + if (s != "12345.06.07A") return "fail $s" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/strings/stringPlusOnlyWorksOnString.kt b/backend.native/tests/external/codegen/blackbox/strings/stringPlusOnlyWorksOnString.kt new file mode 100644 index 00000000000..cf713b647c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/stringPlusOnlyWorksOnString.kt @@ -0,0 +1,7 @@ +// WITH_RUNTIME + +fun box(): String { + var x: MutableCollection = ArrayList() + x + ArrayList() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/basicmethodSuperClass.kt b/backend.native/tests/external/codegen/blackbox/super/basicmethodSuperClass.kt new file mode 100644 index 00000000000..612cee4e58b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/basicmethodSuperClass.kt @@ -0,0 +1,15 @@ +class N() : ArrayList() { + override fun add(el: Any) : Boolean { + if (!super.add(el)) { + throw Exception() + } + return false + } +} + +fun box(): String { + val n = N() + if (n.add("239")) return "fail" + if (n.get(0) == "239") return "OK"; + return "fail"; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/basicmethodSuperTrait.kt b/backend.native/tests/external/codegen/blackbox/super/basicmethodSuperTrait.kt new file mode 100644 index 00000000000..886987cf6f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/basicmethodSuperTrait.kt @@ -0,0 +1,14 @@ + +interface Tr { + fun extra() : String = "_" +} + +class N() : Tr { + override fun extra() : String = super.extra() + super.extra() +} + +fun box(): String { + val n = N() + if (n.extra() == "__") return "OK" + return "fail"; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/basicproperty.kt b/backend.native/tests/external/codegen/blackbox/super/basicproperty.kt new file mode 100644 index 00000000000..f1fab6ffe23 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/basicproperty.kt @@ -0,0 +1,24 @@ +open class M() { + open var b: Int = 0 +} + +class N() : M() { + val a : Int + get() { + super.b = super.b + 1 + return super.b + 1 + } + override var b: Int = a + 1 + + val superb : Int + get() = super.b +} + +fun box(): String { + val n = N() + n.a + n.b + n.superb + if (n.b == 3 && n.a == 4 && n.superb == 3) return "OK"; + return "fail"; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/enclosedFun.kt b/backend.native/tests/external/codegen/blackbox/super/enclosedFun.kt new file mode 100644 index 00000000000..5f317b46f77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/enclosedFun.kt @@ -0,0 +1,31 @@ +interface BK { + fun x() : Int = 50 +} + +interface K : BK { + override fun x() : Int = super.x() * 2 +} + +open class M() { + open fun x() : Int = 10 +} + +open class N() : M(), K { + + override fun x() : Int = 20 + + open inner class C() : K { + fun test1() = x() + fun test2() = super@N.x() + fun test3() = super@N.x() + fun test4() = super.x() + } +} + +fun box(): String { + if (N().C().test1() != 100) return "test1 fail"; + if (N().C().test2() != 10) return "test2 fail"; + if (N().C().test3() != 100) return "test3 fail"; + if (N().C().test4() != 100) return "test4 fail"; + return "OK"; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/enclosedVar.kt b/backend.native/tests/external/codegen/blackbox/super/enclosedVar.kt new file mode 100644 index 00000000000..50477570820 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/enclosedVar.kt @@ -0,0 +1,22 @@ +open class M() { + open var y = 500 +} + +open class N() : M() { + + override var y = 200 + + open inner class C() { + fun test5() = y + fun test6() : Int { + super@N.y += 200 + return super@N.y + } + } +} + +fun box(): String { + if (N().C().test5() != 200) return "test5 fail"; + if (N().C().test6() != 700) return "test6 fail"; + return "OK"; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper.kt b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper.kt new file mode 100644 index 00000000000..cbb0a875df9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper.kt @@ -0,0 +1,38 @@ +interface BK { + fun foo(): String + fun bar(): String +} + +interface K : BK { + override fun foo() = bar() +} + +class A : K { + override fun foo() = "A.foo" + override fun bar() = "A.bar" + + inner class B : K { + override fun foo() = "B.foo" + override fun bar() = "B.bar" + + fun test1() = super@A.foo() + fun test2() = super@B.foo() + fun test3() = super.foo() + fun test4() = super@A.foo() + fun test5() = super@B.foo() + fun test6() = super.foo() + } +} + + +fun box(): String { + val b = A().B() + if (b.test1() != "A.bar") return "test1 ${b.test1()}" + if (b.test2() != "B.bar") return "test2 ${b.test2()}" + if (b.test3() != "B.bar") return "test3 ${b.test3()}" + if (b.test4() != "A.bar") return "test4 ${b.test4()}" + if (b.test5() != "B.bar") return "test5 ${b.test5()}" + if (b.test6() != "B.bar") return "test6 ${b.test6()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper2.kt b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper2.kt new file mode 100644 index 00000000000..1a0bca8c437 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuper2.kt @@ -0,0 +1,44 @@ +//inspired by kt3492 +interface BK { + fun foo(): String + fun bar(): String +} + +interface KTrait: BK { + override fun foo() = bar() +} + +open abstract class K : KTrait { + +} + +class A : K() { + override fun foo() = "A.foo" + override fun bar() = "A.bar" + + inner class B : K() { + override fun foo() = "B.foo" + override fun bar() = "B.bar" + + fun test1() = super@A.foo() + fun test2() = super@B.foo() + fun test3() = super.foo() + fun test4() = super@A.foo() + fun test5() = super@B.foo() + fun test6() = super.foo() + } +} + + +fun box(): String { + val b = A().B() + if (b.test1() != "A.bar") return "test1 ${b.test1()}" + if (b.test2() != "B.bar") return "test2 ${b.test2()}" + if (b.test3() != "B.bar") return "test3 ${b.test3()}" + if (b.test4() != "A.bar") return "test4 ${b.test4()}" + if (b.test5() != "B.bar") return "test5 ${b.test5()}" + if (b.test6() != "B.bar") return "test6 ${b.test6()}" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty.kt b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty.kt new file mode 100644 index 00000000000..bb8098564f6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty.kt @@ -0,0 +1,38 @@ +interface Base { + val foo: String + fun bar(): String +} + +abstract class K : Base { + override val foo = bar() +} + +class A : K() { + override val foo = "A.foo" + override fun bar() = "A.bar" + + inner class B : K() { + override val foo = "B.foo" + override fun bar() = "B.bar" + + fun test1() = super@A.foo + fun test2() = super@B.foo + fun test3() = super.foo + fun test4() = super@A.foo + fun test5() = super@B.foo + fun test6() = super.foo + } +} + + +fun box(): String { + val b = A().B() + if (b.test1() != "A.bar") return "test1 ${b.test1()}" + if (b.test2() != "B.bar") return "test2 ${b.test2()}" + if (b.test3() != "B.bar") return "test3 ${b.test3()}" + if (b.test4() != "A.bar") return "test4 ${b.test4()}" + if (b.test5() != "B.bar") return "test5 ${b.test5()}" + if (b.test6() != "B.bar") return "test6 ${b.test6()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty2.kt b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty2.kt new file mode 100644 index 00000000000..effc71e7925 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/innerClassLabeledSuperProperty2.kt @@ -0,0 +1,43 @@ +//inspired by kt3492 +interface Base { + val foo: String + fun bar(): String +} + +abstract class KWithOverride : Base { + override val foo = bar() +} + +abstract class K : KWithOverride() { + +} + +class A : K() { + override val foo = "A.foo" + override fun bar() = "A.bar" + + inner class B : K() { + override val foo = "B.foo" + override fun bar() = "B.bar" + + fun test1() = super@A.foo + fun test2() = super@B.foo + fun test3() = super.foo + fun test4() = super@A.foo + fun test5() = super@B.foo + fun test6() = super.foo + } +} + + +fun box(): String { + val b = A().B() + if (b.test1() != "A.bar") return "test1 ${b.test1()}" + if (b.test2() != "B.bar") return "test2 ${b.test2()}" + if (b.test3() != "B.bar") return "test3 ${b.test3()}" + if (b.test4() != "A.bar") return "test4 ${b.test4()}" + if (b.test5() != "B.bar") return "test5 ${b.test5()}" + if (b.test6() != "B.bar") return "test6 ${b.test6()}" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedFunctionCall.kt b/backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedFunctionCall.kt new file mode 100644 index 00000000000..557905cedbe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedFunctionCall.kt @@ -0,0 +1,46 @@ +interface T { + open fun baz(): String = "T.baz" +} + +open class A { + open val foo: String = "OK" + open fun bar(): String = "OK" + open fun boo(): String = "OK" +} + +open class B : A(), T { + override fun bar(): String = "B" + override fun baz(): String = "B.baz" + inner class E { + val foo: String = super@B.foo + fun bar() = super@B.bar() + super@B.bar() + super@B.baz() + } +} + +class C : B() { + override fun bar(): String = "C" + override fun boo(): String = "C" + inner class D { + val foo: String = super@C.foo + fun bar() = super@C.bar() + super@C.boo() + } +} + +fun box(): String { + var r = "" + + r = B().E().foo + if (r != "OK") return "fail 1; r = $r" + r = "" + r = B().E().bar() + if (r != "OKOKT.baz") return "fail 2; r = $r" + + r = "" + r = C().D().foo + if (r != "OK") return "fail 3; r = $r" + r = "" + r = C().D().bar() + if (r != "BOK") return "fail 4; r = $r" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedPropertyAccess.kt b/backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedPropertyAccess.kt new file mode 100644 index 00000000000..bdcd70ce962 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/innerClassQualifiedPropertyAccess.kt @@ -0,0 +1,45 @@ +interface T { + open val baz: String + get() = "T.baz" +} + +open class A { + open val bar: String + get() = "OK" + open val boo: String + get() = "OK" +} + +open class B : A(), T { + override val bar: String + get() = "B" + override val baz: String + get() = "B.baz" + inner class E { + val bar: String + get() = super@B.bar + super@B.bar + super@B.baz + } +} + +class C : B() { + override val bar: String + get() = "C" + override val boo: String + get() = "C" + inner class D { + val bar: String + get() = super@C.bar + super@C.boo + } +} + +fun box(): String { + var r = "" + + r = B().E().bar + if (r != "OKOKT.baz") return "fail 1; r = $r" + + r = C().D().bar + if (r != "BOK") return "fail 2; r = $r" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/kt14243.kt b/backend.native/tests/external/codegen/blackbox/super/kt14243.kt new file mode 100644 index 00000000000..75d5fcb7ae7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt14243.kt @@ -0,0 +1,18 @@ +interface Z { + fun test(p: T): T { + return p + } +} + +open class ZImpl : Z + +class ZImpl2 : ZImpl() { + + override fun test(p: String): String { + return super.test(p) + } +} + +fun box(): String { + return ZImpl2().test("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt14243_2.kt b/backend.native/tests/external/codegen/blackbox/super/kt14243_2.kt new file mode 100644 index 00000000000..b72bf3dac7c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt14243_2.kt @@ -0,0 +1,20 @@ +interface Z { + fun test(p: T): T { + return p + } +} + +open class ZImpl : Z + +open class ZImpl2 : Z, ZImpl() + +class ZImpl3 : ZImpl2() { + + override fun test(p: String): String { + return super.test(p) + } +} + +fun box(): String { + return ZImpl3().test("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt14243_class.kt b/backend.native/tests/external/codegen/blackbox/super/kt14243_class.kt new file mode 100644 index 00000000000..c0ec94be493 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt14243_class.kt @@ -0,0 +1,20 @@ + +open class Z { + open fun test(p: T, z: Y): T { + return p + } +} + +open class ZImpl : Z() + +open class ZImpl2 : ZImpl() + +class ZImpl3 : ZImpl2() { + override fun test(p: String, z: String): String { + return super.test(p, z) + } +} + +fun box(): String { + return ZImpl3().test("OK", "fail") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt14243_prop.kt b/backend.native/tests/external/codegen/blackbox/super/kt14243_prop.kt new file mode 100644 index 00000000000..73979c08226 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt14243_prop.kt @@ -0,0 +1,21 @@ +interface Z { + val value: T + + val z: T + get() = value +} + +open class ZImpl : Z { + override val value: String + get() = "OK" +} + +open class ZImpl2 : ZImpl() { + override val z: String + get() = super.z +} + + +fun box(): String { + return ZImpl2().value +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt3492ClassFun.kt b/backend.native/tests/external/codegen/blackbox/super/kt3492ClassFun.kt new file mode 100644 index 00000000000..1dd8d1b2770 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt3492ClassFun.kt @@ -0,0 +1,19 @@ +open class A { + open fun foo2(): String = "OK" +} + +open class B : A() { + +} + +class C : B() { + inner class D { + val foo: String = super@C.foo2() + } +} + +fun box() : String { + val obj = C().D(); + return obj.foo +} + diff --git a/backend.native/tests/external/codegen/blackbox/super/kt3492ClassProperty.kt b/backend.native/tests/external/codegen/blackbox/super/kt3492ClassProperty.kt new file mode 100644 index 00000000000..25feedb525f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt3492ClassProperty.kt @@ -0,0 +1,15 @@ +open class A { + open val foo: String = "OK" +} + +open class B : A() { + +} + +class C : B() { + inner class D { + val foo: String = super@C.foo + } +} + +fun box() = C().D().foo diff --git a/backend.native/tests/external/codegen/blackbox/super/kt3492TraitFun.kt b/backend.native/tests/external/codegen/blackbox/super/kt3492TraitFun.kt new file mode 100644 index 00000000000..144e86036a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt3492TraitFun.kt @@ -0,0 +1,19 @@ +interface ATrait { + open fun foo2(): String = "OK" +} + +open class B : ATrait { + +} + +class C : B() { + inner class D { + val foo: String = super@C.foo2() + } +} + +fun box() : String { + val obj = C().D(); + return obj.foo +} + diff --git a/backend.native/tests/external/codegen/blackbox/super/kt3492TraitProperty.kt b/backend.native/tests/external/codegen/blackbox/super/kt3492TraitProperty.kt new file mode 100644 index 00000000000..c4c3298afcb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt3492TraitProperty.kt @@ -0,0 +1,16 @@ +interface A { + open val foo: String + get() = "OK" +} + +open class B : A { + +} + +class C : B() { + inner class D { + val foo: String = super@C.foo + } +} + +fun box() = C().D().foo diff --git a/backend.native/tests/external/codegen/blackbox/super/kt4173.kt b/backend.native/tests/external/codegen/blackbox/super/kt4173.kt new file mode 100644 index 00000000000..12ca4f5c6ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt4173.kt @@ -0,0 +1,18 @@ +open class C(val f: () -> Unit) { + fun test() { + f() + } +} + +class B(var x: Int) { + fun foo() { + object : C({x = 3}) {}.test() + } +} + + +fun box() : String { + val b = B(1) + b.foo() + return if (b.x != 3) "fail: b.x = ${b.x}" else "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt4173_2.kt b/backend.native/tests/external/codegen/blackbox/super/kt4173_2.kt new file mode 100644 index 00000000000..3bc81264f0c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt4173_2.kt @@ -0,0 +1,20 @@ +open class X(var s: ()-> Unit) + +open class C(val f: X) { + fun test() { + f.s() + } +} + +class B(var x: Int) { + fun foo() { + object : C(object: X({x = 3}) {}) {}.test() + } +} + + +fun box() : String { + val b = B(1) + b.foo() + return if (b.x != 3) "fail: b.x = ${b.x}" else "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt4173_3.kt b/backend.native/tests/external/codegen/blackbox/super/kt4173_3.kt new file mode 100644 index 00000000000..8c23cf83f28 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt4173_3.kt @@ -0,0 +1,27 @@ +open class C(s: Int) { + fun test() { + + } +} + +class B(var x: Int) { + fun foo() { + class A(val a: Int) : C({a}()) { + + } + A(11).test() + + + class B(val a: Int) : C(a) { + } + + B(11).test() + } +} + + +fun box() : String { + val b = B(1) + b.foo() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/kt4982.kt b/backend.native/tests/external/codegen/blackbox/super/kt4982.kt new file mode 100644 index 00000000000..8c01d8f2212 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/kt4982.kt @@ -0,0 +1,21 @@ +abstract class WaitFor { + init { + condition() + } + + abstract fun condition() : Boolean; +} + +fun box(): String { + val local = "" + var result = "fail" + val s = object: WaitFor() { + + override fun condition(): Boolean { + result = "OK" + return result.length== 2 + } + } + + return result; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/multipleSuperTraits.kt b/backend.native/tests/external/codegen/blackbox/super/multipleSuperTraits.kt new file mode 100644 index 00000000000..2ddb25d35b9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/multipleSuperTraits.kt @@ -0,0 +1,13 @@ +interface T1 { + fun foo() = "O" +} + +interface T2 { + fun foo() = "K" +} + +class A : T1, T2 { + override fun foo() = super.foo() + super.foo() +} + +fun box() = A().foo() diff --git a/backend.native/tests/external/codegen/blackbox/super/traitproperty.kt b/backend.native/tests/external/codegen/blackbox/super/traitproperty.kt new file mode 100644 index 00000000000..a5de71c24eb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/traitproperty.kt @@ -0,0 +1,31 @@ +interface M { + var backingB : Int + var b : Int + get() = backingB + set(value: Int) { + backingB = value + } +} + +class N() : M { + public override var backingB : Int = 0 + + val a : Int + get() { + super.b = super.b + 1 + return super.b + 1 + } + override var b: Int = a + 1 + + val superb : Int + get() = super.b +} + +fun box(): String { + val n = N() + n.a + n.b + n.superb + if (n.b == 3 && n.a == 4 && n.superb == 3) return "OK"; + return "fail"; +} diff --git a/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuper.kt b/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuper.kt new file mode 100644 index 00000000000..9863671fa68 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuper.kt @@ -0,0 +1,66 @@ +open class Base() { + open fun baseFun(): String = "Base.baseFun()" + + open fun unambiguous(): String = "Base.unambiguous()" + + open val baseProp: String + get() = "Base.baseProp" +} + +interface Interface { + fun interfaceFun(): String = "Interface.interfaceFun()" + + fun unambiguous(): String // NB abstract +} + +interface AnotherInterface + +interface DerivedInterface: Interface, AnotherInterface { + override fun interfaceFun(): String = "DerivedInterface.interfaceFun()" + + override fun unambiguous(): String = "DerivedInterface.unambiguous()" + + fun callsFunFromSuperInterface(): String = super.interfaceFun() +} + +class Derived : Base(), Interface { + override fun baseFun(): String = "Derived.baseFun()" + + override fun unambiguous(): String = "Derived.unambiguous()" + + override fun interfaceFun(): String = "Derived.interfaceFun()" + + override val baseProp: String + get() = "Derived.baseProp" + + fun callsBaseFun(): String = super.baseFun() + + fun callsUnambiguousFun(): String = super.unambiguous() + + fun getsBaseProp(): String = super.baseProp + + fun callsInterfaceFun(): String = super.interfaceFun() +} + +fun box(): String { + val d = Derived() + + val test1 = d.callsBaseFun() + if (test1 != "Base.baseFun()") return "Failed: d.callsBaseFun()==$test1" + + val test2 = d.callsUnambiguousFun() + if (test2 != "Base.unambiguous()") return "Failed: d.callsUnambiguousFun()==$test2" + + val test3 = d.getsBaseProp() + if (test3 != "Base.baseProp") return "Failed: d.getsBaseProp()==$test3" + + val test4 = d.callsInterfaceFun() + if (test4 != "Interface.interfaceFun()") return "Failed: d.callsInterfaceFun()==$test4" + + val di = object : DerivedInterface {} + + val test5 = di.callsFunFromSuperInterface() + if (test5 != "Interface.interfaceFun()") return "Failed: di.callsFunFromSuperInterface()==$test5" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithDeeperHierarchies.kt b/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithDeeperHierarchies.kt new file mode 100644 index 00000000000..c9ab55a897d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithDeeperHierarchies.kt @@ -0,0 +1,63 @@ +open class DeeperBase { + open fun deeperBaseFun(): String = "DeeperBase.deeperBaseFun()" + + open val deeperBaseProp: String + get() = "DeeperBase.deeperBaseProp" +} + +open class DeepBase : DeeperBase() { +} + +interface DeeperInterface { + fun deeperInterfaceFun(): String = "DeeperInterface.deeperInterfaceFun()" + + val deeperInterfaceProp: String + get() = "DeeperInterface.deeperInterfaceProp" +} + +interface DeepInterface : DeeperInterface { + fun deepInterfaceFun(): String = "DeepInterface.deepInterfaceFun()" +} + +class DeepDerived : DeepBase(), DeepInterface { + override fun deeperBaseFun(): String = "DeepDerived.deeperBaseFun()" + + override val deeperBaseProp: String + get() = "DeepDerived.deeperBaseProp" + + override fun deeperInterfaceFun(): String = "DeepDerived.deeperInterfaceFun()" + + override val deeperInterfaceProp: String + get() = "DeepDerived.deeperInterfaceProp" + + override fun deepInterfaceFun(): String = "DeepDerived.deepInterfaceFun()" + + fun callsSuperDeeperBaseFun(): String = super.deeperBaseFun() + + fun getsSuperDeeperBaseProp(): String = super.deeperBaseProp + + fun callsSuperDeepInterfaceFun(): String = super.deepInterfaceFun() + fun callsSuperDeeperInterfaceFun(): String = super.deeperInterfaceFun() + fun getsSuperDeeperInterfaceProp(): String = super.deeperInterfaceProp +} + +fun box(): String { + val dd = DeepDerived() + + val test1 = dd.callsSuperDeeperBaseFun() + if (test1 != "DeeperBase.deeperBaseFun()") return "Failed: dd.callsSuperDeeperBaseFun()==$test1" + + val test2 = dd.getsSuperDeeperBaseProp() + if (test2 != "DeeperBase.deeperBaseProp") return "Failed: dd.getsSuperDeeperBaseProp()==$test2" + + val test3 = dd.callsSuperDeepInterfaceFun() + if (test3 != "DeepInterface.deepInterfaceFun()") return "Failed: dd.callsSuperDeepInterfaceFun()==$test3" + + val test4 = dd.callsSuperDeeperInterfaceFun() + if (test4 != "DeeperInterface.deeperInterfaceFun()") return "Failed: dd.callsSuperDeeperInterfaceFun()==$test4" + + val test5 = dd.getsSuperDeeperInterfaceProp() + if (test5 != "DeeperInterface.deeperInterfaceProp") return "Failed: dd.getsSuperDeeperInterfaceProp()==$test5" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithMethodsOfAny.kt b/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithMethodsOfAny.kt new file mode 100644 index 00000000000..b0eb1ec0d01 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/unqualifiedSuperWithMethodsOfAny.kt @@ -0,0 +1,25 @@ +interface ISomething + +open class ClassWithToString { + override fun toString(): String = "C" +} + +interface IWithToString { + override fun toString(): String +} + +class C1 : ClassWithToString(), ISomething { + override fun toString(): String = super.toString() +} + +class C2 : ClassWithToString(), IWithToString, ISomething { + override fun toString(): String = super.toString() +} + +fun box(): String { + return when { + C1().toString() != "C" -> "Failed #1" + C2().toString() != "C" -> "Failed #2" + else -> "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt b/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt new file mode 100644 index 00000000000..4db88b8f3f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +fun box(): String { + var obj0 = "0" as java.lang.Object + var obj1 = "1" as java.lang.Object + + var v = obj0 + synchronized (v) { + v = obj1 + } + assertThatThreadDoesNotOwnMonitor(obj0) + + return "OK" +} + +fun assertThatThreadDoesNotOwnMonitor(obj: java.lang.Object) { + try { + obj.wait(1) + throw IllegalStateException("Not owning a monitor!") + } + catch (e: IllegalMonitorStateException) { + // OK + } +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt b/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt new file mode 100644 index 00000000000..5df4f84c98f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt @@ -0,0 +1,20 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val obj = "" as java.lang.Object + val e = IllegalArgumentException() + fun m(): Nothing = throw e + try { + synchronized (m()) { + throw AssertionError("Should not have reached this point") + } + } + catch (caught: Throwable) { + if (caught !== e) return "Fail: $caught" + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt b/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt new file mode 100644 index 00000000000..289040bf9d6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt @@ -0,0 +1,33 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +fun box(): String { + val obj = "" as java.lang.Object + + val e = IllegalArgumentException() + try { + synchronized (obj) { + throw e + } + } + catch (caught: Throwable) { + if (caught !== e) return "Fail: $caught" + // If monitorexit didn't happen (a finally block failed), this assertion would fail + assertThatThreadDoesNotOwnMonitor(obj) + } + + return "OK" +} + +fun assertThatThreadDoesNotOwnMonitor(obj: java.lang.Object) { + try { + obj.wait(1) + throw IllegalStateException("Not owning a monitor!") + } + catch (e: IllegalMonitorStateException) { + // OK + } +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt b/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt new file mode 100644 index 00000000000..107d028ffe6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + var obj = "0" as java.lang.Object + val result = synchronized (obj) { + 239L + } + + if (result != 239L) return "Fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt b/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt new file mode 100644 index 00000000000..ccfa71d2c35 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val obj = "" as java.lang.Object + val obj2 = "1" as java.lang.Object + + synchronized (obj) { + synchronized (obj2) { + obj.wait(1) + obj2.wait(1) + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt b/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt new file mode 100644 index 00000000000..c48210df13f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + val obj = "" as java.lang.Object + + synchronized (obj) { + synchronized (obj) { + obj.wait(1) + } + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt new file mode 100644 index 00000000000..90beb6d7110 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt @@ -0,0 +1,182 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import java.util.concurrent.Executors +import java.util.concurrent.Callable +import java.util.concurrent.Future + +val count: Int = 10; +var index: Int = 0; +val doneSignal = CountDownLatch(count) +val startSignal = CountDownLatch(1); +val mutex: Any = Object() +val results = arrayListOf() +val executorService = Executors.newFixedThreadPool(count) + +class MyException(message: String): Exception(message) + +enum class ExecutionType { + LOCAL, + NON_LOCAL_SIMPLE, + NON_LOCAL_EXCEPTION, + NON_LOCAL_FINALLY, + NON_LOCAL_EXCEPTION_AND_FINALLY, + NON_LOCAL_EXCEPTION_AND_FINALLY_WITH_RETURN, + NON_LOCAL_NESTED +} + +class TestLocal(val name: String, val executionType: ExecutionType) : Callable { + + override fun call(): String { + startSignal.await() + return when (executionType) { + ExecutionType.LOCAL -> local() + ExecutionType.NON_LOCAL_SIMPLE -> nonLocalSimple() + ExecutionType.NON_LOCAL_EXCEPTION -> nonLocalWithException() + ExecutionType.NON_LOCAL_FINALLY -> nonLocalWithFinally() + ExecutionType.NON_LOCAL_EXCEPTION_AND_FINALLY -> nonLocalWithExceptionAndFinally() + ExecutionType.NON_LOCAL_EXCEPTION_AND_FINALLY_WITH_RETURN -> nonLocalWithExceptionAndFinallyWithReturn() + ExecutionType.NON_LOCAL_NESTED -> nonLocalNested() + else -> "fail" + } + } + + private fun underMutexFun() { + results.add(++index); + doneSignal.countDown() + } + + fun local(): String { + synchronized(mutex) { + underMutexFun() + } + return executionType.toString() + } + + + fun nonLocalSimple(): String { + synchronized(mutex) { + underMutexFun() + return executionType.name + } + return "fail" + } + + fun nonLocalWithException(): String { + synchronized(mutex) { + try { + underMutexFun() + throw MyException(executionType.name) + } catch (e: MyException) { + return e.message!! + } + } + return "fail" + } + + fun nonLocalWithFinally(): String { + synchronized(mutex) { + try { + underMutexFun() + return "fail" + } finally { + return executionType.name + } + } + return "fail" + } + + fun nonLocalWithExceptionAndFinally(): String { + synchronized(mutex) { + try { + underMutexFun() + throw MyException(executionType.name) + } catch (e: MyException) { + return e.message!! + } finally { + "123" + } + } + return "fail" + } + + fun nonLocalWithExceptionAndFinallyWithReturn(): String { + synchronized(mutex) { + try { + underMutexFun() + throw MyException(executionType.name) + } catch (e: MyException) { + return "fail1" + } finally { + return executionType.name + } + } + return "fail" + } + + fun nonLocalNested(): String { + synchronized(mutex) { + try { + try { + underMutexFun() + throw MyException(executionType.name) + } catch (e: MyException) { + return "fail1" + } finally { + return executionType.name + } + } finally { + val p = 1 + 1 + } + } + return "fail" + } +} + +fun testTemplate(type: ExecutionType, producer: (Int) -> Callable): String { + + try { + val futures = arrayListOf>() + for (i in 1..count) { + futures.add(executorService.submit (producer(i))) + } + + startSignal.countDown() + val b = doneSignal.await(10, TimeUnit.SECONDS) + if (!b) return "fail: processes not finished" + + for (i in 1..count) { + if (results[i - 1] != i) + return "fail $i != ${results[i]}: synchronization not works : " + results.joinToString() + } + + for (f in futures) { + if (f.get() != type.name) return "failed result ${f.get()} != ${type.name}" + } + } finally { + + } + + return "OK" +} + +fun runTest(type: ExecutionType): String { + return testTemplate (type) { TestLocal(it.toString(), type) } +} + +fun box(): String { + try { + for (type in ExecutionType.values()) { + val result = runTest(type) + if (result != "OK") return "fail on $type execution: $result" + } + } finally { + executorService.shutdown() + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt b/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt new file mode 100644 index 00000000000..e6424739f77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + var obj = "0" as java.lang.Object + val result = synchronized (obj) { + "239" + } + + if (result != "239") return "Fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt b/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt new file mode 100644 index 00000000000..f2462277a80 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt @@ -0,0 +1,39 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +import java.util.concurrent.* +import java.util.concurrent.atomic.* + +fun thread(block: ()->Unit ) { + val thread = object: Thread() { + override fun run() { + block() + } + } + thread.start() +} + +fun box() : String { + val mtref = AtomicInteger() + val cdl = CountDownLatch(11) + for(i in 0..10) { + thread { + var current = 0 + do { + current = synchronized(mtref) { + val v = mtref.get() + 1 + if(v < 100) + mtref.set(v+1) + v + } + } + while(current < 100) + cdl.countDown() + } + } + cdl.await() + return if(mtref.get() == 100) "OK" else mtref.get().toString() +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/value.kt b/backend.native/tests/external/codegen/blackbox/synchronized/value.kt new file mode 100644 index 00000000000..15d2d9cad94 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/value.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun box(): String { + var obj = "0" as java.lang.Object + val result = synchronized (obj) { + 239 + } + + if (result != 239) return "Fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt b/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt new file mode 100644 index 00000000000..3ec5edd2c85 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// FULL_JDK + +fun box(): String { + val obj = "" as java.lang.Object + try { + obj.wait(1) + return "Fail: exception should have been thrown" + } + catch (e: IllegalMonitorStateException) { + // OK + } + + synchronized (obj) { + obj.wait(1) + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtected.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtected.kt new file mode 100644 index 00000000000..6250b18d1ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtected.kt @@ -0,0 +1,38 @@ +// FILE: 1.kt + +import b.B +import a.BSamePackage + +fun box() = if (B().test() == BSamePackage().test()) "OK" else "fail" + +// FILE: 2.kt + +package a + +open class A { + protected fun protectedFun(): String = "OK" +} + +class BSamePackage: A() { + fun test(): String { + val a = { + protectedFun() + } + return a() + } +} + +// FILE: 3.kt + +package b + +import a.A + +class B: A() { + fun test(): String { + val a = { + protectedFun() + } + return a() + } +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtectedInvokeVirtual.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtectedInvokeVirtual.kt new file mode 100644 index 00000000000..f68dda4d4b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/accessorForProtectedInvokeVirtual.kt @@ -0,0 +1,68 @@ +// WITH_RUNTIME +// FILE: 1.kt + +import test.A +import kotlin.test.assertEquals + +open class B : A() { + fun box(): String { + val overriddenMethod: () -> String = { + method() + } + assertEquals("C.method", overriddenMethod()) + + val superMethod: () -> String = { + super.method() + } + assertEquals("A.method", superMethod()) + + val overriddenPropertyGetter: () -> String = { + property + } + assertEquals("C.property", overriddenPropertyGetter()) + + val superPropertyGetter: () -> String = { + super.property + } + assertEquals("A.property", superPropertyGetter()) + + val overriddenPropertySetter: () -> Unit = { + property = "" + } + overriddenPropertySetter() + + val superPropertySetter: () -> Unit = { + super.property = "" + } + superPropertySetter() + + assertEquals("C.property;A.property;", state) + + return "OK" + } +} + +class C : B() { + override fun method() = "C.method" + override var property: String + get() = "C.property" + set(value) { state += "C.property;" } +} + +fun box() = C().box() + +// FILE: 2.kt + +package test + +abstract class A { + public var state = "" + + // These implementations should not be called, because they are overridden in C + + protected open fun method(): String = "A.method" + + protected open var property: String + get() = "A.property" + set(value) { state += "A.property;" } +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt10047.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt10047.kt new file mode 100644 index 00000000000..8317ac0f765 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt10047.kt @@ -0,0 +1,36 @@ +// FILE: a.kt + +package test2 + +import test.Actor +import test.O2dScriptAction + +class CompositeActor : Actor() + +public open class O2dDialog : O2dScriptAction() { + + fun test() = { owner }() + + fun test2() = { calc() }() +} + +fun box(): String { + if (O2dDialog().test() != null) return "fail 1" + if (O2dDialog().test2() != null) return "fail 2" + + return "OK" +} + +// FILE: b.kt + +package test + +open class Actor + +abstract public class O2dScriptAction { + protected var owner: T? = null + private set + + protected fun calc(): T? = null + +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717.kt new file mode 100644 index 00000000000..f2438b5a591 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717.kt @@ -0,0 +1,12 @@ +// FILE: box.kt + +object Test { + val test: String = OK +} + +fun box(): String = Test.test + +// FILE: Vars.kt + +public var OK: String = "OK" + private set diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717DifferentPackages.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717DifferentPackages.kt new file mode 100644 index 00000000000..d201d7c2a39 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9717DifferentPackages.kt @@ -0,0 +1,23 @@ +// FILE: a.kt + +package a + +import b.* + +fun box(): String { + BB().ok() + return BB().OK +} + +// FILE: b.kt + +package b + +public open class B { + public var OK: String = "OK" + protected set +} + +public class BB : B() { + public fun ok(): String = OK +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958.kt new file mode 100644 index 00000000000..d138dc19fe4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958.kt @@ -0,0 +1,30 @@ +// FILE: a.kt + +package a + +import b.* + +class B { + companion object : A() {} + + init { + foo() + } +} + +fun box(): String { + B() + return result +} + +// FILE: b.kt + +package b + +var result = "fail" + +abstract class A { + protected fun foo() { + result = "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958Interface.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958Interface.kt new file mode 100644 index 00000000000..639bf6b35bb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/kt9958Interface.kt @@ -0,0 +1,32 @@ +// FILE: a.kt + +package a + +import b.* + +interface B { + companion object : A() {} + + fun test() { + foo() + } +} + +class C : B + +fun box(): String { + C().test() + return result +} + +// FILE: b.kt + +package b + +var result = "fail" + +abstract class A { + protected fun foo() { + result = "OK" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/protectedFromLambda.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/protectedFromLambda.kt new file mode 100644 index 00000000000..a0cb7165308 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/protectedFromLambda.kt @@ -0,0 +1,28 @@ +// FILE: A.kt + +package first +import second.C + +open class A { + protected open fun test(): String = "FAIL (A)" +} + +fun box() = C().value() + +// FILE: B.kt + +// See also KT-8344: INVOKESPECIAL instead of INVOKEVIRTUAL in accessor + +package second + +import first.A + +public abstract class B(): A() { + val value = { + test() + } +} + +class C: B() { + override fun test() = "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt new file mode 100644 index 00000000000..4e270a36f04 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt @@ -0,0 +1,46 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME +// This test checks that synthetic accessors generated by Kotlin compiler have names starting with "access$" +// This is crucial for some JVM frameworks like Quasar which rely on the bytecode being similar to the one generated by javac +// See https://youtrack.jetbrains.com/issue/KT-6870 + +class PrivatePropertyGet { + private val x = 42 + + inner class Inner { val a = x } +} + +class PrivatePropertySet { + private var x = "a" + + inner class Inner { init { x = "b" } } +} + +class PrivateMethod { + private fun foo() = "" + + inner class Inner { val a = foo() } +} + +fun check(klass: Class<*>) { + for (method in klass.getDeclaredMethods()) { + if (method.isSynthetic() && method.getName().startsWith("access$")) return + } + + throw AssertionError("No synthetic methods starting with 'access$' found in class $klass") +} + +fun box(): String { + check(PrivatePropertyGet::class.java) + check(PrivatePropertySet::class.java) + check(PrivateMethod::class.java) + + // Also check that synthetic accessors really work + PrivatePropertyGet().Inner() + PrivatePropertySet().Inner() + PrivateMethod().Inner() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/toArray/kt3177-toTypedArray.kt b/backend.native/tests/external/codegen/blackbox/toArray/kt3177-toTypedArray.kt new file mode 100644 index 00000000000..6d941babc19 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/kt3177-toTypedArray.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +fun box(): String { + val list = ArrayList>() + list.add(Pair("Sample", "http://cyber.law.harvard.edu/rss/examples/rss2sample.xml")) + list.add(Pair("Scripting", "http://static.scripting.com/rss.xml")) + + val keys = list.map { it.first }.toTypedArray() + + val keysToString = keys.contentToString() + if (keysToString != "[Sample, Scripting]") return keysToString + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/toArray/returnToTypedArray.kt b/backend.native/tests/external/codegen/blackbox/toArray/returnToTypedArray.kt new file mode 100644 index 00000000000..5986dbe5bf4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/returnToTypedArray.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +fun getCopyToArray(): Array = listOf(2, 3, 9).toTypedArray() + +fun box(): String { + val str = getCopyToArray().contentToString() + if (str != "[2, 3, 9]") return str + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/toArray/toArray.kt b/backend.native/tests/external/codegen/blackbox/toArray/toArray.kt new file mode 100644 index 00000000000..0475226a268 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/toArray.kt @@ -0,0 +1,23 @@ +// TARGET_BACKEND: JVM + +// WITH_RUNTIME + +class MyCollection(val delegate: Collection): Collection by delegate + +fun box(): String { + val collection = MyCollection(listOf(2, 3, 9)) as java.util.Collection<*> + + val array1 = collection.toArray() + val array2 = collection.toArray(arrayOfNulls(3) as Array) + + if (!array1.isArrayOf()) return (array1 as Object).getClass().toString() + if (!array2.isArrayOf()) return (array2 as Object).getClass().toString() + + val s1 = array1.contentToString() + val s2 = array2.contentToString() + + if (s1 != "[2, 3, 9]") return "s1 = $s1" + if (s2 != "[2, 3, 9]") return "s2 = $s2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/toArray/toArrayAlreadyPresent.kt b/backend.native/tests/external/codegen/blackbox/toArray/toArrayAlreadyPresent.kt new file mode 100644 index 00000000000..3be85f8dad4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/toArrayAlreadyPresent.kt @@ -0,0 +1,40 @@ +// TARGET_BACKEND: JVM + +// WITH_RUNTIME + +import java.util.Arrays + +class MyCollection(val delegate: Collection): Collection by delegate { + public fun toArray(): Array { + val a = arrayOfNulls(3) + a[0] = 0 + a[1] = 1 + a[2] = 2 + return a + } + public fun toArray(array: Array): Array { + val asIntArray = array as Array + asIntArray[0] = 0 + asIntArray[1] = 1 + asIntArray[2] = 2 + return array + } +} + +fun box(): String { + val collection = MyCollection(Arrays.asList(2, 3, 9)) as java.util.Collection<*> + + val array1 = collection.toArray() + val array2 = collection.toArray(arrayOfNulls(3) as Array) + + if (!array1.isArrayOf()) return (array1 as Object).getClass().toString() + if (!array2.isArrayOf()) return (array2 as Object).getClass().toString() + + val s1 = Arrays.toString(array1) + val s2 = Arrays.toString(array2) + + if (s1 != "[0, 1, 2]") return "s1 = $s1" + if (s2 != "[0, 1, 2]") return "s2 = $s2" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublic.kt b/backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublic.kt new file mode 100644 index 00000000000..3e0d76bede1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublic.kt @@ -0,0 +1,50 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: SingletonCollection.kt +package test + +open class SingletonCollection(val value: T) : AbstractCollection() { + override val size = 1 + override fun iterator(): Iterator = listOf(value).iterator() + + protected fun toArray(): Array = + arrayOf(value) + + protected fun toArray(a: Array): Array { + a[0] = value as E + return a + } +} + +// FILE: DerivedSingletonCollection.kt +package test2 + +import test.* + +class DerivedSingletonCollection(value: T) : SingletonCollection(value) + +// FILE: box.kt +import test.* +import test2.* + +fun box(): String { + val sc = SingletonCollection(42) + + val test1 = (sc as java.util.Collection).toArray() + if (test1[0] != 42) return "Failed #1" + + val test2 = arrayOf(0) + (sc as java.util.Collection).toArray(test2) + if (test2[0] != 42) return "Failed #2" + + val dsc = DerivedSingletonCollection(42) + val test3 = (dsc as java.util.Collection).toArray() + if (test3[0] != 42) return "Failed #3" + + val test4 = arrayOf(0) + (dsc as java.util.Collection).toArray(test4) + if (test4[0] != 42) return "Failed #4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublicWithJava.kt b/backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublicWithJava.kt new file mode 100644 index 00000000000..ff00b887294 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/toArrayShouldBePublicWithJava.kt @@ -0,0 +1,68 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: SingletonCollection.kt +package test + +open class SingletonCollection(val value: T) : AbstractCollection() { + override val size = 1 + override fun iterator(): Iterator = listOf(value).iterator() + + protected open fun toArray(): Array = + arrayOf(value) + + protected open fun toArray(a: Array): Array { + a[0] = value as E + return a + } +} + +// FILE: JavaSingletonCollection.java +import test.*; + +public class JavaSingletonCollection extends SingletonCollection { + public JavaSingletonCollection(T value) { + super(value); + } +} + +// FILE: JavaSingletonCollection2.java +import test.*; + +public class JavaSingletonCollection2 extends SingletonCollection { + public JavaSingletonCollection2(T value) { + super(value); + } + + public Object[] toArray() { + return super.toArray(); + } + + public E[] toArray(E[] arr) { + return super.toArray(arr); + } +} + + +// FILE: box.kt +import test.* + +fun box(): String { + val jsc = JavaSingletonCollection(42) as java.util.Collection + val test3 = jsc.toArray() + if (test3[0] != 42) return "Failed #3" + + val test4 = arrayOf(0) + jsc.toArray(test4) + if (test4[0] != 42) return "Failed #4" + + val jsc2 = JavaSingletonCollection2(42) as java.util.Collection + val test5 = jsc2.toArray() + if (test5[0] != 42) return "Failed #5" + + val test6 = arrayOf(0) + jsc2.toArray(test6) + if (test6[0] != 42) return "Failed #6" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt b/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt new file mode 100644 index 00000000000..694f4905d8b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS +// missing isArrayOf on JS + +// WITH_RUNTIME + +fun box(): String { + val array = listOf(2, 3, 9).toTypedArray() + if (!array.isArrayOf()) return "fail: is not Array" + + val str = array.contentToString() + if (str != "[2, 3, 9]") return str + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt new file mode 100644 index 00000000000..ab8972bd862 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt @@ -0,0 +1,25 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:kotlin.jvm.JvmMultifileClass +@file:kotlin.jvm.JvmName("TestKt") +package test + +import kotlin.test.assertEquals + +private var prop = "O" + +private fun test() = "K" + +fun box(): String { + + val clazz = Class.forName("test.TestKt") + assertEquals(1, clazz.declaredMethods.size, "Facade should have only box and getProp methods") + assertEquals("box", clazz.declaredMethods.first().name, "Facade should have only box method") + + return { + prop + test() + }() +} diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt new file mode 100644 index 00000000000..7376c2e0314 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt @@ -0,0 +1,30 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:kotlin.jvm.JvmMultifileClass +@file:kotlin.jvm.JvmName("TestKt") +package test + +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +public var prop = "fail" + private set + +private fun test() = "K" + +fun box(): String { + + val clazz = Class.forName("test.TestKt") + assertEquals(2, clazz.declaredMethods.size, "Facade should have only box method") + val methods = clazz.declaredMethods.map { it.name } + assertTrue(methods.contains("box"), "Facade should have box method") + assertTrue(methods.contains("getProp"), "Facade should have box method") + + return { + prop = "O" + prop + test() + }() +} diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateInInlineNested.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateInInlineNested.kt new file mode 100644 index 00000000000..2f43f6e7930 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateInInlineNested.kt @@ -0,0 +1,19 @@ +package test + +private val prop = "O" + +private fun test() = "K" + +inline internal fun call(p: () -> String): String = p() + +inline internal fun inlineFun(): String { + return call { + object { + fun run() = prop + test() + }.run() + } +} + +fun box(): String { + return inlineFun(); +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt new file mode 100644 index 00000000000..484cd832104 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt @@ -0,0 +1,21 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FULL_JDK +package test + +import java.lang.reflect.Modifier + +private val prop = "O" + +private fun test() = "K" + +fun box(): String { + val clazz = Class.forName("test.PrivateVisibilityKt") + if (!Modifier.isPrivate(clazz.getDeclaredMethod("test").modifiers)) + return "Private top level function should be private" + if (!Modifier.isPrivate(clazz.getDeclaredField("prop").modifiers)) + return "Backing field for private top level property should be private" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessor.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessor.kt new file mode 100644 index 00000000000..68d402f57bc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessor.kt @@ -0,0 +1,11 @@ +package test + +private val prop = "O" + +private fun test() = "K" + +fun box(): String { + return { + prop + test() + }() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt new file mode 100644 index 00000000000..83f8ffc997d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +@file:kotlin.jvm.JvmMultifileClass +@file:kotlin.jvm.JvmName("TestKt") +package test + +private val prop = "O" + +private fun test() = "K" + +fun box(): String { + return { + prop + test() + }() +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt b/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt new file mode 100644 index 00000000000..7e83b204b77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt @@ -0,0 +1,22 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: ExtendsKCWithT.java + +public class ExtendsKCWithT extends KC { + public static String bar() { + return new ExtendsKCWithT().foo(); + } +} + +// FILE: KC.kt + +// KT-3407 Implementing (in Java) an abstract Kotlin class that implements a trait does not respect trait method definition + +interface T { + fun foo() = "OK" +} + +abstract class KC: T {} + +fun box() = ExtendsKCWithT.bar() diff --git a/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt new file mode 100644 index 00000000000..ce344d9014f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt @@ -0,0 +1,26 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface A { + var bar: Boolean + get() = false + set(value) { throw AssertionError("Fail set") } +} + +interface B : A + +interface C : A { + override var bar: Boolean + get() = true + set(value) {} +} + +interface D : B, C + +class Impl : D + +fun box(): String { + Impl().bar = false + if (!Impl().bar) return "Fail get" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/genericMethod.kt b/backend.native/tests/external/codegen/blackbox/traits/genericMethod.kt new file mode 100644 index 00000000000..e3d47b24181 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/genericMethod.kt @@ -0,0 +1,21 @@ +interface A { + val property : T + + open fun a() : T { + return property + } +} + +open class B : A { + + override val property: Any = "fail" +} + +open class C : B(), A { + + override val property: Any = "OK" +} + +fun box() : String { + return C().a() as String +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/traits/indirectlyInheritPropertyGetter.kt b/backend.native/tests/external/codegen/blackbox/traits/indirectlyInheritPropertyGetter.kt new file mode 100644 index 00000000000..75cde1daa46 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/indirectlyInheritPropertyGetter.kt @@ -0,0 +1,10 @@ +interface A { + val str: String + get() = "OK" +} + +interface B : A + +class Impl : B + +fun box() = Impl().str diff --git a/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt b/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt new file mode 100644 index 00000000000..7efb7336918 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: MyInt.java + +public interface MyInt { + + String test(); +} + +// FILE: test.kt + +interface A : MyInt { + override public fun test(): String? { + return "OK" + } +} + +class B: A + +fun box() : String { + return B().test()!! +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/inheritedFun.kt b/backend.native/tests/external/codegen/blackbox/traits/inheritedFun.kt new file mode 100644 index 00000000000..756aed226c7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/inheritedFun.kt @@ -0,0 +1,10 @@ +//KT-2206 +interface A { + fun f():Int = 239 +} + +class B() : A + +fun box() : String { + return if (B().f() == 239) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/inheritedVar.kt b/backend.native/tests/external/codegen/blackbox/traits/inheritedVar.kt new file mode 100644 index 00000000000..887f33c2178 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/inheritedVar.kt @@ -0,0 +1,14 @@ +//KT-2206 + +interface A { + var a:Int + get() = 239 + set(value) { + } +} + +class B() : A + +fun box() : String { + return if (B().a == 239) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt b/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt new file mode 100644 index 00000000000..cd164825f4f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: B.java + +class B { + static String test(A x) { + return A.DefaultImpls.foo(x); + } +} + +// FILE: main.kt + +interface A { + fun foo() = "OK" +} + +fun box(): String { + val result = B.test(object : A {}) + if (result != "OK") return "fail: $result" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt1936.kt b/backend.native/tests/external/codegen/blackbox/traits/kt1936.kt new file mode 100644 index 00000000000..0764dca3de4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt1936.kt @@ -0,0 +1,23 @@ +var result = "Fail" + +interface MyTrait +{ + var property : String + fun foo() { + result = property + } +} + +open class B(param : String) : MyTrait +{ + override var property : String = param + override fun foo() { + super.foo() + } +} + +fun box(): String { + val b = B("OK") + b.foo() + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt1936_1.kt b/backend.native/tests/external/codegen/blackbox/traits/kt1936_1.kt new file mode 100644 index 00000000000..c3c6ef815f6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt1936_1.kt @@ -0,0 +1,13 @@ +interface MyTrait +{ + var property : String + fun foo() = property +} + +open class B(param : String) : MyTrait +{ + override var property : String = param + override fun foo() = super.foo() +} + +fun box()= B("OK").foo() diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt2260.kt b/backend.native/tests/external/codegen/blackbox/traits/kt2260.kt new file mode 100644 index 00000000000..f63a2220542 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt2260.kt @@ -0,0 +1,9 @@ +interface Flusher { + fun flush() = "OK" +} + +fun myFlusher() = object : Flusher { } + +fun flushIt(flusher: Flusher) = flusher.flush() + +fun box() = flushIt(myFlusher()) diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt b/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt new file mode 100644 index 00000000000..9b59cb8cab1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt @@ -0,0 +1,44 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS +// on JS Parser.parse and MultiParser.parse clash in ProjectInfoJsonParser + +class JsonObject { +} + +class JsonArray { +} + +class ProjectInfo { + override fun toString(): String = "OK" +} + +public interface Parser { + public fun parse(source: IN): OUT +} + +public interface MultiParser { + public fun parse(source: IN): Collection +} + +public interface JsonParser: Parser, MultiParser { + public override fun parse(source: JsonArray): Collection { + return ArrayList() + } +} + +public abstract class ProjectInfoJsonParser(): JsonParser { + public override fun parse(source: JsonObject): ProjectInfo { + return ProjectInfo() + } +} + +class ProjectApiContext { + public val projectInfoJsonParser: ProjectInfoJsonParser = object : ProjectInfoJsonParser(){ + } +} + +fun box(): String { + val context = ProjectApiContext() + val array = context.projectInfoJsonParser.parse(JsonArray()) + return if (array != null) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt2541.kt b/backend.native/tests/external/codegen/blackbox/traits/kt2541.kt new file mode 100644 index 00000000000..5be4abf0272 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt2541.kt @@ -0,0 +1,7 @@ +interface A { + fun foo(t: T, u: U) = "OK" +} + +class B : A + +fun box(): String = B().foo(1, 2) diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt3315.kt b/backend.native/tests/external/codegen/blackbox/traits/kt3315.kt new file mode 100644 index 00000000000..91f7f81a489 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt3315.kt @@ -0,0 +1,10 @@ +interface B { + fun foo(dd: T): T = dd +} + +class A: B + +fun box(): String { + val a = A() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt b/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt new file mode 100644 index 00000000000..92954f58c8d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface BK { + fun foo(): String = 10.toString() +} + +interface KTrait: BK { + override fun foo() = 30.toString() +} + +class A : BK, KTrait { + +} + +fun box(): String { + return if (A().foo() == "30") "OK" else "fail" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt3579.kt b/backend.native/tests/external/codegen/blackbox/traits/kt3579.kt new file mode 100644 index 00000000000..64514c50d9b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt3579.kt @@ -0,0 +1,8 @@ +open class Persistent(val p: String) +interface Hierarchy where T : Hierarchy + +class Location(): Persistent("OK"), Hierarchy + +fun box(): String { + return Location().p +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt3579_2.kt b/backend.native/tests/external/codegen/blackbox/traits/kt3579_2.kt new file mode 100644 index 00000000000..10e9a962302 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt3579_2.kt @@ -0,0 +1,10 @@ +interface First +interface Some where T : Some + +val a: Some<*>? = null + +class MClass(val p: String) : First, Some + +fun box(): String { + return MClass("OK").p +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt5393.kt b/backend.native/tests/external/codegen/blackbox/traits/kt5393.kt new file mode 100644 index 00000000000..2b221df2cb3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt5393.kt @@ -0,0 +1,17 @@ +interface A { + fun foo(): String { + return "OK" + } +} + +interface B : A + +class C : B { + override fun foo(): String { + return super.foo() + } +} + +fun box(): String { + return C().foo() +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt5393_property.kt b/backend.native/tests/external/codegen/blackbox/traits/kt5393_property.kt new file mode 100644 index 00000000000..881fb3ba8ca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/kt5393_property.kt @@ -0,0 +1,20 @@ +var result = "Fail" + +interface A { + var foo: String + get() = result + set(value) { result = value } +} + +interface B : A + +class C : B { + override var foo: String + get() = super.foo + set(value) { super.foo = value } +} + +fun box(): String { + C().foo = "OK" + return C().foo +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/multiple.kt b/backend.native/tests/external/codegen/blackbox/traits/multiple.kt new file mode 100644 index 00000000000..bc6470c0d6b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/multiple.kt @@ -0,0 +1,21 @@ +interface AL { + fun get(index: Int) : Any? = null +} + +interface ALE : AL { + fun getOrNull(index: Int, value: T) : T { + val r = get(index) as? T + return r ?: value + } +} + +open class SmartArrayList() : ALE { +} + +class SmartArrayList2() : SmartArrayList(), AL { +} + +fun box() : String { + val c = SmartArrayList2() + return if("239" == c.getOrNull(0, "239")) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt b/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt new file mode 100644 index 00000000000..7f1dc62d68c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt @@ -0,0 +1,19 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface Z{ + + private fun extension(): String { + return "OK" + } +} + +object Z2 : Z { + +} + +fun box() : String { + val size = Class.forName("Z2").declaredMethods.size + if (size != 0) return "fail: $size" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/traits/syntheticAccessor.kt b/backend.native/tests/external/codegen/blackbox/traits/syntheticAccessor.kt new file mode 100644 index 00000000000..32ce13d9d57 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/syntheticAccessor.kt @@ -0,0 +1,21 @@ +var result = "fail" + +interface B { + + private fun test() { + result = "OK" + } + + class Z { + fun ztest(b: B) { + b.test() + } + } +} + +class C : B + +fun box(): String { + B.Z().ztest(C()) + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitImplDelegationWithCovariantOverride.kt b/backend.native/tests/external/codegen/blackbox/traits/traitImplDelegationWithCovariantOverride.kt new file mode 100644 index 00000000000..2c8af75f5c0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/traitImplDelegationWithCovariantOverride.kt @@ -0,0 +1,18 @@ +interface A { + fun foo(): Number { + return 42 + } +} + +interface B : A + +class C : B { + override fun foo(): Int { + return super.foo() as Int + } +} + +fun box(): String { + val x = C().foo() + return if (x == 42) "OK" else "Fail: $x" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt b/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt new file mode 100644 index 00000000000..7c0a3eaa1ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt @@ -0,0 +1,18 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +interface A { + fun foo() = "Fail" +} + +interface B : A + +interface C : A { + override fun foo() = "OK" +} + +interface D : B, C + +class Impl : D + +fun box(): String = Impl().foo() diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitImplGenericDelegation.kt b/backend.native/tests/external/codegen/blackbox/traits/traitImplGenericDelegation.kt new file mode 100644 index 00000000000..65253011fd9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/traitImplGenericDelegation.kt @@ -0,0 +1,22 @@ +interface A { + fun foo(t: T, u: U): V? { + return null + } +} + +interface B : A + +class C : B { + override fun foo(t: String, u: Int): Runnable? { + return super.foo(t, u) + } +} + +interface Runnable { + fun run(): Unit +} + +fun box(): String { + val x = C().foo("", 0) + return if (x == null) "OK" else "Fail: $x" +} diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateExtension.kt b/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateExtension.kt new file mode 100644 index 00000000000..5dee33c0792 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateExtension.kt @@ -0,0 +1,28 @@ +open class B { + val p = "OK" +} + +class BB : B() + +interface Z { + fun T.getString() : String { + return p + } + + fun test(s: T) : String { + return s.extension() + } + + private fun T.extension(): String { + return getString() + } +} + +object Z2 : Z { + +} + +fun box() : String { + return Z2.test(BB()) +} + diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMember.kt b/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMember.kt new file mode 100644 index 00000000000..50debaa1e26 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMember.kt @@ -0,0 +1,26 @@ +interface Z { + + fun testFun() : String { + return privateFun() + } + + fun testProperty() : String { + return privateProp + } + + private fun privateFun(): String { + return "O" + } + + private val privateProp: String + get() = "K" +} + +object Z2 : Z { + +} + +fun box() : String { + return Z2.testFun() + Z2.testProperty() +} + diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMemberAccessFromLambda.kt b/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMemberAccessFromLambda.kt new file mode 100644 index 00000000000..0b2a16072d3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/traitWithPrivateMemberAccessFromLambda.kt @@ -0,0 +1,26 @@ +interface Z { + + fun testFun(): String { + return { privateFun() } () + } + + fun testProperty(): String { + return { privateProp } () + } + + private fun privateFun(): String { + return "O" + } + + private val privateProp: String + get() = "K" +} + +object Z2 : Z { + +} + +fun box(): String { + return Z2.testFun() + Z2.testProperty() +} + diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt new file mode 100644 index 00000000000..a256df47b85 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt @@ -0,0 +1,13 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +import java.io.* + +fun foo(args: Array) { + val reader = BufferedReader(InputStreamReader(System.`in`)) + while(true) { + val cmd = reader.readLine() as String + } +} + +fun box() = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/ifOrWhenSpecialCall.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/ifOrWhenSpecialCall.kt new file mode 100644 index 00000000000..54ec5152a12 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/ifOrWhenSpecialCall.kt @@ -0,0 +1,26 @@ +interface Option { + val s: String +} +class Some(override val s: String) : Option +class None(override val s: String = "None") : Option + +fun whenTest(a: Int): Option = when (a) { + 239 -> { + if (a == 239) Some("239") else None() + } + else -> if (a != 239) Some("$a") else None() +} + +fun ifTest(a: Int): Option = if (a == 239) { + if (a == 239) Some("239") else None() +} else if (a != 239) Some("$a") else None() + +fun box(): String { + if (whenTest(2).s != "2") return "Fail 1" + if (whenTest(239).s != "239") return "Fail 2" + + if (ifTest(2).s != "2") return "Fail 3" + if (ifTest(239).s != "239") return "Fail 4" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/implicitSmartCastThis.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/implicitSmartCastThis.kt new file mode 100644 index 00000000000..a4587005887 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/implicitSmartCastThis.kt @@ -0,0 +1,13 @@ +open class A + +class B : A() { + fun foo(i: Int) = i +} + +fun A.test() = if (this is B) foo(42) else 0 + +fun box(): String { + if (B().test() != 42) return "fail1" + if (A().test() != 0) return "fail2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/inheritance.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/inheritance.kt new file mode 100644 index 00000000000..f40166007db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/inheritance.kt @@ -0,0 +1,11 @@ +open class A () { + fun plus(e: T) = B (e) +} + +class B (val e: T) : A() { + fun add() = B (e) +} + +fun box() : String { + return if(A().plus("239").add().e == "239" ) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/kt2811.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/kt2811.kt new file mode 100644 index 00000000000..293eb80b20b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/kt2811.kt @@ -0,0 +1,25 @@ +open class Test1 { + fun test1(): String { + if (this is Test2) { + return this.foo() + } + return "fail" + } +} + +class Test2(): Test1() { + fun foo(): String { + return "OK" + } +} + +fun Test1.test2(): String { + if (this is Test2) return this.foo() else return "fail" +} + +fun box(): String { + if ("OK" == Test2().test1() && "OK" == Test2().test2()) { + return "OK" + } + return "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/primitiveTypeInfo.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/primitiveTypeInfo.kt new file mode 100644 index 00000000000..ff67d156b7d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/primitiveTypeInfo.kt @@ -0,0 +1,13 @@ +class Box(t: T) { + var value = t +} + +fun isIntBox(box: Box): Boolean { + return box is Box<*>; +} + + +fun box(): String { + val box = Box(1) + return if (isIntBox(box)) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/smartCastThis.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/smartCastThis.kt new file mode 100644 index 00000000000..6ed06c50328 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/smartCastThis.kt @@ -0,0 +1,11 @@ +package h + +open class A { + fun bar() = if (this is B) this.foo() else "fail" +} + +class B() : A() { + fun foo() = "OK" +} + +fun box() = B().bar() \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt new file mode 100644 index 00000000000..03c6034cde6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt @@ -0,0 +1,16 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: J.java + +public class J { + // This test checks that although type '@org.jetbrains.annotations.NotNull Integer' is perceived as simple Int, + // it's correctly mapped to 'Lj.l.Integer' by JVM backend + public static String test(@org.jetbrains.annotations.NotNull Integer x) { + return "OK"; + } +} + +// FILE: box.kt + +fun box() = J.test(1) diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt new file mode 100644 index 00000000000..a06f6791d6b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt @@ -0,0 +1,86 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +package foo + +import kotlin.reflect.KClass + +class A +class B + +class TestRaw { + val a1: A = A() + val a2: A? = A() + val a3: A = A() + val a4: A? = A() + + var b1: B = B() + var b2: B = B() + + val l: List = listOf() + + fun test1(a: A, b: B>): A? = A() + fun test2(a: A?, b: B): B = B() +} + +class TestNotRaw { + val a1: A = A() + val a2: A>? = A() + val a3: A = A() + val a4: A? = A() + + var b1: B = B() + var b2: B, Int> = B() + + val l: List = listOf() + + fun test1(a: A, b: B>): A? = A() + fun test2(a: A?, b: B>): B = B() +} + +abstract class C { + abstract val foo: A + abstract fun bar(): A? +} + +class C1 : C() { + override val foo = A() + override fun bar() = foo +} +class C2 : C() { + override val foo = A() + override fun bar() = foo +} + +fun testAllDeclaredMembers(klass: KClass<*>, expectedIsRaw: Boolean): String? { + val clazz = klass.java + + for (it in clazz.declaredFields) { + if ((it.type == it.genericType) == expectedIsRaw) return "failed on field '${clazz.simpleName}::${it.name}'" + } + + for (m in clazz.declaredMethods) { + for (i in m.parameterTypes.indices) { + if ((m.parameterTypes[i] == m.genericParameterTypes[i]) == expectedIsRaw) return "failed on type of param#$i of method '${clazz.simpleName}::${m.name}'" + } + if (m.returnType != Void.TYPE && (m.returnType == m.genericReturnType) == expectedIsRaw) return "failed on return type of method '${clazz.simpleName}::${m.name}'" + } + + return null +} + +fun box(): String { + testAllDeclaredMembers(TestRaw::class, expectedIsRaw = true) ?: + testAllDeclaredMembers(TestNotRaw::class, expectedIsRaw = false)?.let { return it } + + if (C1::class.java.superclass != C1::class.java.genericSuperclass) return "failed on C1 superclass" + + if (C2::class.java.superclass == C2::class.java.genericSuperclass) return "failed on C2 superclass" + + testAllDeclaredMembers(C1::class, expectedIsRaw = true) ?: + testAllDeclaredMembers(C2::class, expectedIsRaw = false)?.let { return it } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/kt2831.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/kt2831.kt new file mode 100644 index 00000000000..3ead49d90ad --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/kt2831.kt @@ -0,0 +1,16 @@ +// Exception in thread "main" java.lang.VerifyError: (class: org/jetbrains/kannotator/controlFlowBuilder/GraphBuilderInterpreter, method: binaryOperation signature: (Lorg/objectweb/asm/tree/AbstractInsnNode;Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;)Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;) Wrong return type in function + +fun foo(): Nothing = throw Exception() + +fun bar(x: Any): Int { + return when(x) { + is String -> 0 + is Int -> 1 + else -> foo() + } +} + +fun box(): String { + bar(3) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt new file mode 100644 index 00000000000..3717841f2ed --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt @@ -0,0 +1,15 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +class N { + fun foo() = null +} + +fun box(): String { + val method = N::class.java.getDeclaredMethod("foo") + if (method.returnType.name != "java.lang.Void") return "Fail: Nothing should be mapped to Void" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/kt3286.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/kt3286.kt new file mode 100644 index 00000000000..8d5c36246f9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/kt3286.kt @@ -0,0 +1,13 @@ +fun test(x: Int): String = when(x) { + 0 -> "zero" + 1 -> "one" + 2 -> "two" + else -> blowUpHorribly() + } + +fun blowUpHorribly(): Nothing = throw RuntimeException("Blow up!") + +fun box(): String { + test(1) + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/kt3863.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/kt3863.kt new file mode 100644 index 00000000000..21b6b4acd63 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/kt3863.kt @@ -0,0 +1,19 @@ +import kotlin.reflect.KProperty + +// java.lang.VerifyError: (class: NotImplemented, method: get signature: (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;) Unable to pop operand off an empty stack + +class NotImplemented(){ + operator fun getValue(thisRef: Any?, prop: KProperty<*>): T = notImplemented() + operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: T): Nothing = notImplemented() +} + +fun notImplemented() : Nothing = notImplemented() + +class Test { + val x: Int by NotImplemented() +} + +fun box(): String { + Test() + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/kt3976.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/kt3976.kt new file mode 100644 index 00000000000..47110878e72 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/kt3976.kt @@ -0,0 +1,20 @@ +import kotlin.reflect.KProperty + +// java.lang.ClassNotFoundException: kotlin.Nothing + +var currentAccountId: Int? by SessionAccessor() +class SessionAccessor { + operator fun getValue(o : Nothing?, desc: KProperty<*>): T { + return null as T + } + + operator fun setValue(o : Nothing?, desc: KProperty<*>, value: T) { + + } +} + +fun box(): String { + currentAccountId = 1 + if (currentAccountId != null) return "Fail" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/nothing.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/nothing.kt new file mode 100644 index 00000000000..93cafb65401 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/nothing.kt @@ -0,0 +1,5 @@ +fun box(): String { + // kotlin.Nothing should not be loaded here + val x = "" is Nothing + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/nullableNothing.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/nullableNothing.kt new file mode 100644 index 00000000000..79fd2fa060f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/nullableNothing.kt @@ -0,0 +1,5 @@ +fun box(): String { + // This used to be problematic because of an attempt to load kotlin/Nothing class + val x = "" is Nothing? + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt new file mode 100644 index 00000000000..6c5ba217659 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +interface I1 +interface I2 +open class C + +interface K { + // Erasure of a type parameter with multiple bounds should be the class bound, or the first bound if there's no class bound + + fun c1(t: T) where T : C, T : I1, T : I2 + fun c2(t: T) where T : I1, T : C, T : I2 + fun c3(t: T) where T : I2, T : C, T : I1 + fun c4(t: T) where T : I2, T : I1, T : C + + fun i1(t: T) where T : I1, T : I2 + fun i2(t: T) where T : I2, T : I1 +} + +fun box(): String { + val k = K::class.java + + k.getDeclaredMethod("c1", C::class.java) + k.getDeclaredMethod("c2", C::class.java) + k.getDeclaredMethod("c3", C::class.java) + k.getDeclaredMethod("c4", C::class.java) + + k.getDeclaredMethod("i1", I1::class.java) + k.getDeclaredMethod("i2", I2::class.java) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/typealias/genericTypeAliasConstructor.kt b/backend.native/tests/external/codegen/blackbox/typealias/genericTypeAliasConstructor.kt new file mode 100644 index 00000000000..6dfe839c270 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/genericTypeAliasConstructor.kt @@ -0,0 +1,6 @@ +class Cell(val x: T) + +typealias StringCell = Cell + +fun box(): String = + StringCell("O").x + Cell("K").x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructor.kt b/backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructor.kt new file mode 100644 index 00000000000..6193b148048 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructor.kt @@ -0,0 +1,10 @@ +class Outer(val x: String) { + inner class Inner(val y: String) { + val z = x + y + } +} + +typealias OI = Outer.Inner + +fun box(): String = + Outer("O").OI("K").z \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructorInSupertypes.kt b/backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructorInSupertypes.kt new file mode 100644 index 00000000000..0c1b2ee469f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/innerClassTypeAliasConstructorInSupertypes.kt @@ -0,0 +1,12 @@ +class Outer(val x: String) { + abstract inner class InnerBase + + inner class Inner(val y: String) : OIB() { + val z = x + y + } +} + +typealias OIB = Outer.InnerBase + +fun box(): String = + Outer("O").Inner("K").z \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/simple.kt b/backend.native/tests/external/codegen/blackbox/typealias/simple.kt new file mode 100644 index 00000000000..a5cd67b9ad7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/simple.kt @@ -0,0 +1,7 @@ +typealias S = String + +typealias SF = (T) -> S + +val f: SF = { it } + +fun box(): S = f("OK") diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasAsBareType.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasAsBareType.kt new file mode 100644 index 00000000000..eed82fc0045 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasAsBareType.kt @@ -0,0 +1,11 @@ +// WITH_RUNTIME + +typealias L = List + +fun box(): String { + val test: Collection = listOf(1, 2, 3) + if (test !is L) return "test !is L" + val test2 = test as L + if (test.toList() != test2) return "test.toList() != test2" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasCompanion.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasCompanion.kt new file mode 100644 index 00000000000..07efa97a0f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasCompanion.kt @@ -0,0 +1,9 @@ +class A { + companion object { + val result = "OK" + } +} + +typealias Alias = A.Companion + +fun box(): String = Alias.result diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructor.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructor.kt new file mode 100644 index 00000000000..d466f977248 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructor.kt @@ -0,0 +1,5 @@ +class C(val x: String) + +typealias Alias = C + +fun box(): String = Alias("OK").x diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorAccessor.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorAccessor.kt new file mode 100644 index 00000000000..3b92f4005d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorAccessor.kt @@ -0,0 +1,10 @@ +class Outer private constructor(public val x: String) { + class Nested { + fun foo() = OuterAlias("OK") + } +} + +typealias OuterAlias = Outer + +fun box(): String = + Outer.Nested().foo().x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorInSuperCall.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorInSuperCall.kt new file mode 100644 index 00000000000..95cee2f88ef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasConstructorInSuperCall.kt @@ -0,0 +1,10 @@ +open class Cell(val value: T) + +typealias CT = Cell +typealias CStr = Cell + +class C1 : CT("O") +class C2 : CStr("K") + +fun box(): String = + C1().value + C2().value \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasInAnonymousObjectType.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasInAnonymousObjectType.kt new file mode 100644 index 00000000000..ba3a87abaec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasInAnonymousObjectType.kt @@ -0,0 +1,7 @@ +open class Foo(val x: T) + +typealias FooStr = Foo + +val test = object : FooStr("OK") {} + +fun box() = test.x \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasObject.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasObject.kt new file mode 100644 index 00000000000..203f4e5bd5f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasObject.kt @@ -0,0 +1,15 @@ +object OHolder { + val O = "O" +} + +typealias OHolderAlias = OHolder + +class KHolder { + companion object { + val K = "K" + } +} + +typealias KHolderAlias = KHolder + +fun box(): String = OHolderAlias.O + KHolderAlias.K diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasObjectCallable.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasObjectCallable.kt new file mode 100644 index 00000000000..5a321ecd586 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasObjectCallable.kt @@ -0,0 +1,9 @@ +object O { + val x = "OK" + + operator fun invoke() = x +} + +typealias A = O + +fun box(): String = A() diff --git a/backend.native/tests/external/codegen/blackbox/typealias/typeAliasSecondaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasSecondaryConstructor.kt new file mode 100644 index 00000000000..fd0f2bd66c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/typeAliasSecondaryConstructor.kt @@ -0,0 +1,11 @@ +class C(val x: String) { + constructor(n: Int) : this(n.toString()) +} + +typealias Alias = C + +fun box(): String { + val c = Alias(23) + if (c.x != "23") return "fail: $c" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/call.kt b/backend.native/tests/external/codegen/blackbox/unaryOp/call.kt new file mode 100644 index 00000000000..fe138509d88 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/call.kt @@ -0,0 +1,17 @@ +fun box(): String { + val a1: Byte = 1.unaryMinus() + val a2: Short = 1.unaryMinus() + val a3: Int = 1.unaryMinus() + val a4: Long = 1.unaryMinus() + val a5: Double = 1.0.unaryMinus() + val a6: Float = 1f.unaryMinus() + + if (a1 != (-1).toByte()) return "fail 1" + if (a2 != (-1).toShort()) return "fail -1" + if (a3 != -1) return "fail 3" + if (a4 != -1L) return "fail 4" + if (a5 != -1.0) return "fail 5" + if (a6 != -1f) return "fail 6" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/callNullable.kt b/backend.native/tests/external/codegen/blackbox/unaryOp/callNullable.kt new file mode 100644 index 00000000000..f3ff7db949a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/callNullable.kt @@ -0,0 +1,17 @@ +fun box(): String { + val a1: Byte? = 1.unaryMinus() + val a2: Short? = 1.unaryMinus() + val a3: Int? = 1.unaryMinus() + val a4: Long? = 1.unaryMinus() + val a5: Double? = 1.0.unaryMinus() + val a6: Float? = 1f.unaryMinus() + + if (a1!! != (-1).toByte()) return "fail 1" + if (a2!! != (-1).toShort()) return "fail 2" + if (a3!! != -1) return "fail 3" + if (a4!! != -1L) return "fail 4" + if (a5!! != -1.0) return "fail 5" + if (a6!! != -1f) return "fail 6" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/callWithCommonType.kt b/backend.native/tests/external/codegen/blackbox/unaryOp/callWithCommonType.kt new file mode 100644 index 00000000000..a3fa43dc3c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/callWithCommonType.kt @@ -0,0 +1,8 @@ +fun box(): String { + if (!foo(1.toByte())) return "fail 1" + if (!foo((1.toByte()).inc())) return "fail 2" + + return "OK" +} + +fun foo(p: Any) = p is Byte \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/intrinsic.kt b/backend.native/tests/external/codegen/blackbox/unaryOp/intrinsic.kt new file mode 100644 index 00000000000..30bd7d9d8f0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/intrinsic.kt @@ -0,0 +1,17 @@ +fun box(): String { + val a1: Byte = -1 + val a2: Short = -1 + val a3: Int = -1 + val a4: Long = -1 + val a5: Double = -1.0 + val a6: Float = -1f + + if (a1 != (-1).toByte()) return "fail 1" + if (a2 != (-1).toShort()) return "fail 2" + if (a3 != -1) return "fail 3" + if (a4 != -1L) return "fail 4" + if (a5 != -1.0) return "fail 5" + if (a6 != -1f) return "fail 6" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/intrinsicNullable.kt b/backend.native/tests/external/codegen/blackbox/unaryOp/intrinsicNullable.kt new file mode 100644 index 00000000000..0463bcddba9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/intrinsicNullable.kt @@ -0,0 +1,17 @@ +fun box(): String { + val a1: Byte? = -1 + val a2: Short? = -1 + val a3: Int? = -1 + val a4: Long? = -1 + val a5: Double? = -1.0 + val a6: Float? = -1f + + if (a1!! != (-1).toByte()) return "fail 1" + if (a2!! != (-1).toShort()) return "fail 2" + if (a3!! != -1) return "fail 3" + if (a4!! != -1L) return "fail 4" + if (a5!! != -1.0) return "fail 5" + if (a6!! != -1f) return "fail 6" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/longOverflow.kt b/backend.native/tests/external/codegen/blackbox/unaryOp/longOverflow.kt new file mode 100644 index 00000000000..d3615f071ea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/longOverflow.kt @@ -0,0 +1,5 @@ +fun box(): String { + val a: Long = -(1 shl 31) + if (a != -2147483648L) return "fail: in this case we should add to ints and than cast the result to long - overflow expected" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt b/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt new file mode 100644 index 00000000000..1fef505f0af --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt @@ -0,0 +1,8 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo() {} + +fun box(): String { + return if (foo() == Unit) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/closureReturnsNullableUnit.kt b/backend.native/tests/external/codegen/blackbox/unit/closureReturnsNullableUnit.kt new file mode 100644 index 00000000000..604b35ab71f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/closureReturnsNullableUnit.kt @@ -0,0 +1,8 @@ +fun isNull(x: Unit?) = x == null + +fun box(): String { + val closure: () -> Unit? = { null } + if (!isNull(closure())) return "Fail 1" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/ifElse.kt b/backend.native/tests/external/codegen/blackbox/unit/ifElse.kt new file mode 100644 index 00000000000..171b2b2fdeb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/ifElse.kt @@ -0,0 +1,31 @@ +class A (val p: String, p1: String, p2: String) { + + var cond1: String = "" + + var cond2: String = "" + + val prop1 = if (cond1(p)) p1 else null + + val prop2 = if (cond2(p)) p2 else null; + + + fun cond1(p: String): Boolean { + cond1 = "cond1" + return p == "test" + } + + fun cond2(p: String): Boolean { + cond2 = "cond2" + return p == "test" + } +} + +fun box(): String { + val a = A("test", "OK", "fail") + + if (a.cond1 != "cond1") return "fail 2 : ${a.cond1}" + + if (a.cond2 != "cond2") return "fail 3 : ${a.cond2}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/unit/kt3634.kt b/backend.native/tests/external/codegen/blackbox/unit/kt3634.kt new file mode 100644 index 00000000000..4dcbf3f5bfe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/kt3634.kt @@ -0,0 +1,8 @@ +val c = Unit +val d = c + +fun box(): String { + c + d + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt b/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt new file mode 100644 index 00000000000..e0c04071aca --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt @@ -0,0 +1,23 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +fun foo(): Any? = bar() + +fun bar() {} + +fun baz(): Any? { + return bar() +} + +fun quux(): Unit? = bar() + +fun box(): String { + foo() + + if (foo() != Unit) return "Fail 1" + if (foo() != bar()) return "Fail 2" + if (bar() != baz()) return "Fail 3" + if (baz() != quux()) return "Fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/kt4265.kt b/backend.native/tests/external/codegen/blackbox/unit/kt4265.kt new file mode 100644 index 00000000000..3c1aaf9d462 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/kt4265.kt @@ -0,0 +1,14 @@ +fun T.let(f: (T) -> R): R = f(this) + +fun box(): String { + val o: String? = null + + var state = 0 + + o?.let { + state = 1 + } ?: ({ state = 2 })() + + if (state != 2) return "Fail: $state" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/nullableUnit.kt b/backend.native/tests/external/codegen/blackbox/unit/nullableUnit.kt new file mode 100644 index 00000000000..0289cca09ba --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/nullableUnit.kt @@ -0,0 +1,20 @@ +fun isNull(x: Unit?) = x == null + +fun isNullGeneric(x: T?) = x == null + +fun deepIsNull0(x: Unit?) = isNull(x) +fun deepIsNull(x: Unit?) = deepIsNull0(x) + +fun box(): String { + if (!isNull(null)) return "Fail 1" + + val x: Unit? = null + if (!isNull(x)) return "Fail 2" + + val y = x + if (!isNullGeneric(y)) return "Fail 3" + + if (!deepIsNull(x ?: null)) return "Fail 4" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen1.kt b/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen1.kt new file mode 100644 index 00000000000..2d6768af748 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen1.kt @@ -0,0 +1,12 @@ +fun foo() {} + +fun box(): String { + when ("A") { + "B" -> foo() + else -> null + } + + foo() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen2.kt b/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen2.kt new file mode 100644 index 00000000000..47807e50f19 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen2.kt @@ -0,0 +1,12 @@ +fun foo() {} + +fun box(): String { + when ("A") { + "B" -> null + else -> foo() + } + + foo() + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen3.kt b/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen3.kt new file mode 100644 index 00000000000..b2e2b0ae439 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/nullableUnitInWhen3.kt @@ -0,0 +1,12 @@ +fun foo() {} + +fun box(): String { + val x = when ("A") { + "B" -> foo() + else -> null + } + + foo() + + return if (x == null) "OK" else "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/unit/unitClassObject.kt b/backend.native/tests/external/codegen/blackbox/unit/unitClassObject.kt new file mode 100644 index 00000000000..e4cdbacbe14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/unitClassObject.kt @@ -0,0 +1,11 @@ +fun box(): String { + Unit + + val a = Unit + val b = Unit + if (a != b) return "Fail a != b" + + if (Unit != Unit) return "Fail Unit != Unit" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/kt1978.kt b/backend.native/tests/external/codegen/blackbox/vararg/kt1978.kt new file mode 100644 index 00000000000..6d27ec3a311 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/kt1978.kt @@ -0,0 +1,10 @@ +fun aa(vararg a : String): String = a[0] + +fun box(): String { + var result: String = "" + var i = 1 + while (3 > i++) { + result = aa(if (true) "OK" else "fail") + } + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/kt581.kt b/backend.native/tests/external/codegen/blackbox/vararg/kt581.kt new file mode 100644 index 00000000000..829dc640f1d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/kt581.kt @@ -0,0 +1,17 @@ +package whats.the.difference + +fun iarray(vararg a : Int) = a // BUG +val IntArray.indices: IntRange get() = IntRange(0, lastIndex()) +fun IntArray.lastIndex() = size - 1 + +fun box() : String { + val vals = iarray(789, 678, 567, 456, 345, 234, 123, 12) + val diffs = HashSet() + for (i in vals.indices) + for (j in i..vals.lastIndex()) + diffs.add(vals[i] - vals[j]) + val size = diffs.size + + if (size != 8) return "Fail $size" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/kt6192.kt b/backend.native/tests/external/codegen/blackbox/vararg/kt6192.kt new file mode 100644 index 00000000000..89296cf18c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/kt6192.kt @@ -0,0 +1,93 @@ + +fun barB(vararg args: Byte) = args +fun barC(vararg args: Char) = args +fun barD(vararg args: Double) = args +fun barF(vararg args: Float) = args +fun barI(vararg args: Int) = args +fun barJ(vararg args: Long) = args +fun barS(vararg args: Short) = args +fun barZ(vararg args: Boolean) = args + +fun sumInt(x: Int, vararg args: Int): Int { + var result = x + for(a in args) { + result += a + } + return result +} + +fun sumFunOnParameters(x: Int, vararg args: Int, f: (Int) -> Int): Int { + var result = f(x) + for(a in args) { + result += f(a) + } + return result +} + +fun concatParameters(vararg args: Int): String { + var result = "" + for(a in args) { + result += a.toString() + } + return result +} + +fun box(): String { + + val aB = ByteArray(3) + val aC = CharArray(3) + val aD = DoubleArray(3) + val aF = FloatArray(3) + val aI = IntArray(3) + aI[0] = 1 + aI[1] = 2 + aI[2] = 3 + val bI = IntArray(2) + bI[0] = 4 + bI[1] = 5 + val aJ = LongArray(3) + val aS = ShortArray(3) + val aZ = BooleanArray(3) + + + if (barB(*aB, 23.toByte()).size != 4) return "fail: Byte" + if (barB(11.toByte(), *aB, 23.toByte(), *aB).size != 8) return "fail: Byte" + + if (barC(*aC, 'A').size != 4) return "fail: Char" + if (barC('A', *aC, 'A', *aC).size != 8) return "fail: Char" + + if (barD(*aD, 2.3).size != 4) return "fail: Double" + if (barD(*aD, *aD, 2.3).size != 7) return "fail: Double" + + if (barF(*aF, 2.3f).size != 4) return "fail: Float" + if (barF(*aF, 2.3f, 1.1f).size != 5) return "fail: Float" + + if (barI(*aI, 23).size != 4) return "fail: Int" + if (barI(11, 10, *aI, 23).size != 6) return "fail: Int" + if (barI(100, *aI, *aI).size != 7) return "fail: Int 3" + + if (sumInt(100, *aI) != 106) return "fail: sumInt 1" + if (sumInt(100, *aI, 200) != 306) return "fail: sumInt 2" + if (sumInt(100, *aI, *aI) != 112) return "fail: sumInt 3" + if (sumFunOnParameters(100, *aI, 200) { 2*it } != 612) return "fail: sumFunOnParameters 1" + if (sumFunOnParameters(100, *aI, *aI) { 2*it } != 224) return "fail: sumFunOnParameters 2" + + if (concatParameters(1,2,3) != "123") return "fail: concatParameters 1" + if (concatParameters(*aI) != "123") return "fail: concatParameters 2" + if (concatParameters(4, 5, *aI) != "45123") return "fail: concatParameters 3" + if (concatParameters(*aI, 4, 5) != "12345") return "fail: concatParameters 4" + if (concatParameters(*aI, *bI) != "12345") return "fail: concatParameters 5" + if (concatParameters(*aI, 7, 8, *bI) != "1237845") return "fail: concatParameters 6" + if (concatParameters(*aI, 7, *bI, *aI, 9) != "1237451239") return "fail: concatParameters 7" + + if (barJ(*aJ, 23L).size != 4) return "fail: Long" + if (barJ(*aJ, 23L, *aJ, *aJ).size != 10) return "fail: Long" + + if (barS(*aS, 23.toShort()).size != 4) return "fail: Short" + if (barS(*aS, *aS, 23.toShort(), *aS).size != 10) return "fail: Short" + + if (barZ(*aZ, true).size != 4) return "fail: Boolean" + if (barZ(false, *aZ, true, *aZ).size != 8) return "fail: Boolean" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/kt796_797.kt b/backend.native/tests/external/codegen/blackbox/vararg/kt796_797.kt new file mode 100644 index 00000000000..ebb6be014c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/kt796_797.kt @@ -0,0 +1,8 @@ +operator fun Array?.get(i : Int?) = this!!.get(i!!) +fun array(vararg t : T) : Array = t as Array + +fun box() : String { + val a : Array? = array("Str", "Str2") + val i : Int? = 1 + return if(a[i] == "Str2") "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/spreadCopiesArray.kt b/backend.native/tests/external/codegen/blackbox/vararg/spreadCopiesArray.kt new file mode 100644 index 00000000000..d5b7fc1fe65 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/spreadCopiesArray.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +import kotlin.test.* + +fun copyArray(vararg data: T): Array = data + +inline fun reifiedCopyArray(vararg data: T): Array = data + +fun copyIntArray(vararg data: Int): IntArray = data + +fun box(): String { + val sarr = arrayOf("OK") + val sarr2 = copyArray(*sarr) + sarr[0] = "Array was not copied" + assertEquals(sarr2[0], "OK", "Failed: Array") + + var rsarr = arrayOf("OK") + var rsarr2 = reifiedCopyArray(*rsarr) + rsarr[0] = "Array was not copied" + assertEquals(rsarr2[0], "OK", "Failed: Array, reified copy") + + val iarr = IntArray(1) + iarr[0] = 1 + val iarr2 = copyIntArray(*iarr) + iarr[0] = 42 + assertEquals(iarr2[0], 1, "Failed: IntArray") + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/varargInFunParam.kt b/backend.native/tests/external/codegen/blackbox/vararg/varargInFunParam.kt new file mode 100644 index 00000000000..4f5438618f2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/varargInFunParam.kt @@ -0,0 +1,69 @@ +fun box(): String { + if (test1() != "") return "fail 1" + if (test1(1) != "1") return "fail 2" + if (test1(1, 2) != "12") return "fail 3" + + if (test1(*intArrayOf()) != "") return "fail 4" + if (test1(*intArrayOf(1)) != "1") return "fail 5" + if (test1(*intArrayOf(1, 2)) != "12") return "fail 6" + + if (test1(p = 1) != "1") return "fail 7" + + if (test1(p = *intArrayOf()) != "") return "fail 8" + if (test1(p = *intArrayOf(1)) != "1") return "fail 9" + if (test1(p = *intArrayOf(1, 2)) != "12") return "fail 10" + + if (test2() != "") return "fail 11" + if (test2("1") != "1") return "fail 12" + if (test2("1", "2") != "12") return "fail 13" + + if (test2(*arrayOf()) != "") return "fail 14" + if (test2(*arrayOf("1")) != "1") return "fail 15" + if (test2(*arrayOf("1", "2")) != "12") return "fail 16" + + if (test2(p = "1") != "1") return "fail 17" + + if (test2(p = *arrayOf()) != "") return "fail 18" + if (test2(p = *arrayOf("1")) != "1") return "fail 19" + if (test2(p = *arrayOf("1", "2")) != "12") return "fail 20" + + if (test3() != "") return "fail 21" + if (test3("1") != "1") return "fail 22" + if (test3("1", "2") != "12") return "fail 23" + + if (test3(*arrayOf()) != "") return "fail 24" + if (test3(*arrayOf("1")) != "1") return "fail 25" + if (test3(*arrayOf("1", "2")) != "12") return "fail 26" + + if (test3(p = "1") != "1") return "fail 27" + + if (test3(p = *arrayOf()) != "") return "fail 28" + if (test3(p = *arrayOf("1")) != "1") return "fail 29" + if (test3(p = *arrayOf("1", "2")) != "12") return "fail 30" + + return "OK" +} + +fun test1(vararg p: Int): String { + var result = "" + for (i in p) { + result += i + } + return result +} + +fun test2(vararg p: String): String { + var result = "" + for (i in p) { + result += i + } + return result +} + +fun test3(vararg p: T): String { + var result = "" + for (i in p) { + result += i + } + return result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt b/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt new file mode 100644 index 00000000000..36745b853a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt @@ -0,0 +1,34 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// FILE: A.java + +public class A { + public int foo(int x, String ... args) { + return x + args.length; + } + + public static String[] ar = new String[] { "a", "b"}; +} + +// FILE: test.kt + +fun bar(args: Array?): Int { + var res = 0 + + if (args != null) { + res += A().foo(1, *args) + } + + res += A().foo(1, *A.ar) + + return res +} + +fun box(): String { + if (bar(null) != 3) return "Fail" + + if (bar(A.ar) != 6) return "Fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/vararg/varargsAndFunctionLiterals.kt b/backend.native/tests/external/codegen/blackbox/vararg/varargsAndFunctionLiterals.kt new file mode 100644 index 00000000000..3c7dca68c44 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/varargsAndFunctionLiterals.kt @@ -0,0 +1,16 @@ +fun foo(a: Int, vararg b: Int, f: (IntArray) -> String): String { + return "test" + a + " " + f(b) +} + +fun box(): String { + val test1 = foo(1) {a -> "" + a.size} + if (test1 != "test1 0") return test1 + + val test2 = foo(2, 2) {a -> "" + a.size} + if (test2 != "test2 1") return test2 + + val test3 = foo(3, 2, 3) {a -> "" + a.size} + if (test3 != "test3 2") return test3 + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/callProperty.kt b/backend.native/tests/external/codegen/blackbox/when/callProperty.kt new file mode 100644 index 00000000000..65fc9b7997d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/callProperty.kt @@ -0,0 +1,12 @@ +class C(val p: Boolean) { } + +fun box(): String { + val c = C(true) + + // Commented for KT-621 + // return when(c) { + // .p => "OK" + // else => "fail" + // } + return if (c.p) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/emptyWhen.kt b/backend.native/tests/external/codegen/blackbox/when/emptyWhen.kt new file mode 100644 index 00000000000..62ab58b6bf3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/emptyWhen.kt @@ -0,0 +1,7 @@ +enum class A { X1, X2 } + +fun box(): String { + when {} + when (A.X1) {} + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/bigEnum.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/bigEnum.kt new file mode 100644 index 00000000000..fb76910b59d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/bigEnum.kt @@ -0,0 +1,52 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class BigEnum { + ITEM1, ITEM2, ITEM3, ITEM4, ITEM5, ITEM6, ITEM7, ITEM8, ITEM9, ITEM10, + ITEM11, ITEM12, ITEM13, ITEM14, ITEM15, ITEM16, ITEM17, ITEM18, ITEM19, ITEM20 +} + +fun bar1(x : BigEnum) : String { + when (x) { + BigEnum.ITEM1, BigEnum.ITEM2, BigEnum.ITEM3 -> return "123" + BigEnum.ITEM4, BigEnum.ITEM5, BigEnum.ITEM6 -> return "456" + } + + return "-1"; + +} + +fun bar2(x : BigEnum) : String { + when (x) { + BigEnum.ITEM7, BigEnum.ITEM8, BigEnum.ITEM9 -> return "789" + BigEnum.ITEM10 -> return "10" + BigEnum.ITEM11, BigEnum.ITEM12 -> return "1112" + else -> return "-1" + } +} + +fun box() : String { + //bar1 + assertEquals("123", bar1(BigEnum.ITEM1)) + assertEquals("123", bar1(BigEnum.ITEM2)) + assertEquals("123", bar1(BigEnum.ITEM3)) + + assertEquals("456", bar1(BigEnum.ITEM4)) + assertEquals("456", bar1(BigEnum.ITEM5)) + assertEquals("456", bar1(BigEnum.ITEM6)) + + assertEquals("-1", bar1(BigEnum.ITEM7)) + + //bar2 + assertEquals("789", bar2(BigEnum.ITEM7)) + assertEquals("789", bar2(BigEnum.ITEM8)) + assertEquals("789", bar2(BigEnum.ITEM9)) + + assertEquals("10", bar2(BigEnum.ITEM10)) + + assertEquals("1112", bar2(BigEnum.ITEM11)) + assertEquals("1112", bar2(BigEnum.ITEM12)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/duplicatingItems.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/duplicatingItems.kt new file mode 100644 index 00000000000..2760d6daa88 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/duplicatingItems.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun bar(x : Season) : String { + when (x) { + Season.WINTER, Season.SPRING -> return "winter_spring" + Season.SUMMER, Season.SPRING -> return "summer" + else -> return "autumn" + } +} + +fun box() : String { + assertEquals("winter_spring", bar(Season.WINTER)) + assertEquals("winter_spring", bar(Season.SPRING)) + assertEquals("summer", bar(Season.SUMMER)) + assertEquals("autumn", bar(Season.AUTUMN)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/enumInsideClassObject.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/enumInsideClassObject.kt new file mode 100644 index 00000000000..18131fed078 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/enumInsideClassObject.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +class A { + companion object { + enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN + } + } +} + +fun foo(x : A.Companion.Season) : String { + return when (x) { + A.Companion.Season.WINTER -> "winter" + A.Companion.Season.SPRING -> "spring" + A.Companion.Season.SUMMER -> "summer" + else -> "other" + } +} + +fun box() : String { + assertEquals("winter", foo(A.Companion.Season.WINTER)) + assertEquals("spring", foo(A.Companion.Season.SPRING)) + assertEquals("summer", foo(A.Companion.Season.SUMMER)) + assertEquals("other", foo(A.Companion.Season.AUTUMN)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/expression.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/expression.kt new file mode 100644 index 00000000000..e1774794dea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/expression.kt @@ -0,0 +1,39 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun bar1(x : Season) : String { + return when (x) { + Season.WINTER, Season.SPRING -> "winter_spring" + Season.SUMMER -> "summer" + else -> "autumn" + } +} + +fun bar2(x : Season) : String { + return when (x) { + Season.WINTER, Season.SPRING -> "winter_spring" + Season.SUMMER -> "summer" + Season.AUTUMN -> "autumn" + } +} + +fun box() : String { + assertEquals("winter_spring", bar1(Season.WINTER)) + assertEquals("winter_spring", bar1(Season.SPRING)) + assertEquals("summer", bar1(Season.SUMMER)) + assertEquals("autumn", bar1(Season.AUTUMN)) + + assertEquals("winter_spring", bar2(Season.WINTER)) + assertEquals("winter_spring", bar2(Season.SPRING)) + assertEquals("summer", bar2(Season.SUMMER)) + assertEquals("autumn", bar2(Season.AUTUMN)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/functionLiteralInTopLevel.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/functionLiteralInTopLevel.kt new file mode 100644 index 00000000000..9b97152b2f3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/functionLiteralInTopLevel.kt @@ -0,0 +1,17 @@ +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo(x : Season, block : (Season) -> String) = block(x) + +fun box() : String { + return foo(Season.SPRING) { + x -> when (x) { + Season.SPRING -> "OK" + else -> "fail" + } + } +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/manyWhensWithinClass.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/manyWhensWithinClass.kt new file mode 100644 index 00000000000..3a29f080cb3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/manyWhensWithinClass.kt @@ -0,0 +1,52 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +class A { + public fun bar1(x : Season) : String { + when (x) { + Season.WINTER, Season.SPRING -> return "winter_spring" + Season.SPRING -> return "spring" + Season.SUMMER -> return "summer" + } + + return "autumn"; + } + + public fun bar2(y : Season) : String { + return bar3(y) { x -> + when (x) { + Season.WINTER, Season.SPRING -> "winter_spring" + Season.SPRING -> "spring" + Season.SUMMER -> "summer" + else -> "autumn" + } + } + } + + private fun bar3(x : Season, block : (Season) -> String) = block(x) +} + +fun box() : String { + val a = A() + + assertEquals("winter_spring", a.bar1(Season.WINTER)) + assertEquals("winter_spring", a.bar1(Season.SPRING)) + assertEquals("summer", a.bar1(Season.SUMMER)) + assertEquals("autumn", a.bar1(Season.AUTUMN)) + + assertEquals("winter_spring", a.bar2(Season.WINTER)) + assertEquals("winter_spring", a.bar2(Season.SPRING)) + assertEquals("summer", a.bar2(Season.SUMMER)) + assertEquals("autumn", a.bar2(Season.AUTUMN)) + + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nonConstantEnum.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nonConstantEnum.kt new file mode 100644 index 00000000000..a1440b4712b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nonConstantEnum.kt @@ -0,0 +1,16 @@ +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo(): Season = Season.SPRING +fun bar(): Season = Season.SPRING + +fun box() : String { + when (foo()) { + bar() -> return "OK" + else -> return "fail" + } +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullability.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullability.kt new file mode 100644 index 00000000000..d8734f77526 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullability.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo1(x : Season?) : String { + when(x) { + Season.AUTUMN, Season.SPRING -> return "autumn_or_spring"; + Season.SUMMER, null -> return "summer_or_null" + } + + return "other" +} + +fun foo2(x : Season?) : String { + when(x) { + Season.AUTUMN, Season.SPRING -> return "autumn_or_spring"; + Season.SUMMER -> return "summer" + } + + return "other" +} + +fun box() : String { + assertEquals("autumn_or_spring", foo1(Season.AUTUMN)) + assertEquals("autumn_or_spring", foo1(Season.SPRING)) + assertEquals("summer_or_null", foo1(Season.SUMMER)) + assertEquals("summer_or_null", foo1(null)) + + assertEquals("autumn_or_spring", foo2(Season.AUTUMN)) + assertEquals("autumn_or_spring", foo2(Season.SPRING)) + assertEquals("summer", foo2(Season.SUMMER)) + assertEquals("other", foo2(null)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullableEnum.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullableEnum.kt new file mode 100644 index 00000000000..457f6281e1e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/nullableEnum.kt @@ -0,0 +1,14 @@ +enum class E { + A, + B +} + +fun test(e: E?) = when (e) { + E.A -> "Fail A" + null -> "OK" + E.B -> "Fail B" +} + +fun box(): String { + return test(null) +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/subjectAny.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/subjectAny.kt new file mode 100644 index 00000000000..0f21003c5f6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/subjectAny.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun foo(x : Any) : String { + return when (x) { + Season.WINTER -> "winter" + Season.SPRING -> "spring" + Season.SUMMER -> "summer" + else -> "other" + } +} + +fun box() : String { + assertEquals("winter", foo(Season.WINTER)) + assertEquals("spring", foo(Season.SPRING)) + assertEquals("summer", foo(Season.SUMMER)) + assertEquals("other", foo(Season.AUTUMN)) + assertEquals("other", foo(123)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/withoutElse.kt b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/withoutElse.kt new file mode 100644 index 00000000000..abaea695949 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/withoutElse.kt @@ -0,0 +1,43 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +enum class Season { + WINTER, + SPRING, + SUMMER, + AUTUMN +} + +fun bar1(x : Season) : String { + when (x) { + Season.WINTER, Season.SPRING -> return "winter_spring" + Season.SPRING -> return "spring" + Season.SUMMER -> return "summer" + } + return "autumn" +} + +fun bar2(x : Season) : String { + when (x) { + Season.WINTER, Season.SPRING -> return "winter_spring" + Season.SPRING -> return "spring" + Season.SUMMER -> return "summer" + Season.AUTUMN -> return "autumn" + } + + return "fail unknown" +} + +fun box() : String { + assertEquals("winter_spring", bar1(Season.WINTER)) + assertEquals("winter_spring", bar1(Season.SPRING)) + assertEquals("summer", bar1(Season.SUMMER)) + assertEquals("autumn", bar1(Season.AUTUMN)) + + assertEquals("winter_spring", bar2(Season.WINTER)) + assertEquals("winter_spring", bar2(Season.SPRING)) + assertEquals("summer", bar2(Season.SUMMER)) + assertEquals("autumn", bar2(Season.AUTUMN)) + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/exceptionOnNoMatch.kt b/backend.native/tests/external/codegen/blackbox/when/exceptionOnNoMatch.kt new file mode 100644 index 00000000000..15a1b759082 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/exceptionOnNoMatch.kt @@ -0,0 +1,14 @@ +fun isZero(x: Int) = when(x) { + 0 -> true + else -> throw Exception() +} + +fun box(): String { + try { + isZero(1) + } + catch (e: Exception) { + return "OK" + } + return "Fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/exhaustiveBoolean.kt b/backend.native/tests/external/codegen/blackbox/when/exhaustiveBoolean.kt new file mode 100644 index 00000000000..4ac2633da11 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/exhaustiveBoolean.kt @@ -0,0 +1,4 @@ +fun box() : String = when (true) { + ((true)) -> "OK" + (1 == 2) -> "Not ok" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/exhaustiveBreakContinue.kt b/backend.native/tests/external/codegen/blackbox/when/exhaustiveBreakContinue.kt new file mode 100644 index 00000000000..69c959e13cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/exhaustiveBreakContinue.kt @@ -0,0 +1,14 @@ +enum class Color { RED, GREEN, BLUE } + +fun foo(arr: Array): Color { + loop@ for (color in arr) { + when (color) { + Color.RED -> return color + Color.GREEN -> break@loop + Color.BLUE -> if (arr.size == 1) return color else continue@loop + } + } + return Color.GREEN +} + +fun box() = if (foo(arrayOf(Color.BLUE, Color.GREEN)) == Color.GREEN) "OK" else "FAIL" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenInitialization.kt b/backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenInitialization.kt new file mode 100644 index 00000000000..ccf67614e6c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenInitialization.kt @@ -0,0 +1,10 @@ +enum class A { V } + +fun box(): String { + val a: A = A.V + val b: Boolean + when (a) { + A.V -> b = true + } + return if (b) "OK" else "FAIL" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenReturn.kt b/backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenReturn.kt new file mode 100644 index 00000000000..6b3b7658cc2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/exhaustiveWhenReturn.kt @@ -0,0 +1,8 @@ +enum class A { V } + +fun box(): String { + val a: A = A.V + when (a) { + A.V -> return "OK" + } +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/implicitExhaustiveAndReturn.kt b/backend.native/tests/external/codegen/blackbox/when/implicitExhaustiveAndReturn.kt new file mode 100644 index 00000000000..d28e7064678 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/implicitExhaustiveAndReturn.kt @@ -0,0 +1,9 @@ +fun test(i: Int): String { + when (i) { + 0 -> return "0" + 1 -> return "1" + } + return "OK" +} + +fun box(): String = test(42) \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt b/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt new file mode 100644 index 00000000000..1d07419974a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +fun foo1(x: Int): Boolean { + when(x) { + 2 + 2 -> return true + else -> return false + } +} + +fun foo2(x: Int): Boolean { + when(x) { + Integer.MAX_VALUE -> return true + else -> return false + } +} + +fun box(): String { + assert(foo1(4)) + assert(!foo1(1)) + + assert(foo2(Integer.MAX_VALUE)) + assert(!foo2(1)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/is.kt b/backend.native/tests/external/codegen/blackbox/when/is.kt new file mode 100644 index 00000000000..fa0580b2740 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/is.kt @@ -0,0 +1,11 @@ +fun typeName(a: Any?) : String { + return when(a) { + is ArrayList<*> -> "array list" + else -> "no idea" + } +} + +fun box() : String { + if(typeName(ArrayList()) != "array list") return "array list failed" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/kt2457.kt b/backend.native/tests/external/codegen/blackbox/when/kt2457.kt new file mode 100644 index 00000000000..e6f15becd08 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/kt2457.kt @@ -0,0 +1,8 @@ +fun foo(i: Int) : Int = + when (i) { + 1 -> 1 + null -> 1 + else -> 1 + } + +fun box() : String = if (foo(1) == 1) "OK" else "fail" diff --git a/backend.native/tests/external/codegen/blackbox/when/kt2466.kt b/backend.native/tests/external/codegen/blackbox/when/kt2466.kt new file mode 100644 index 00000000000..ba2e7dd052a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/kt2466.kt @@ -0,0 +1,9 @@ +fun foo(b: Boolean) = + when (b) { + false -> 0 + true -> 1 + else -> 2 + } + +fun box(): String = if (foo(false) == 0 && foo(true) == 1) "OK" else "Fail" + diff --git a/backend.native/tests/external/codegen/blackbox/when/kt5307.kt b/backend.native/tests/external/codegen/blackbox/when/kt5307.kt new file mode 100644 index 00000000000..bbbbc8611c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/kt5307.kt @@ -0,0 +1,11 @@ +fun box(): String { + val value = 1 + when (value) { + 0 -> {} + 1 -> when (value) { + 2 -> false + } + } + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/kt5448.kt b/backend.native/tests/external/codegen/blackbox/when/kt5448.kt new file mode 100644 index 00000000000..e1c81b55ca9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/kt5448.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +class A + +class B(val items: Collection) + +class C { + fun foo(p: Int) { + when (p) { + 1 -> arrayListOf().add(1) + } + } + + fun bar() = B(listOf().map { it }) +} + +fun box(): String { + C().foo(1) + if (C().bar().items.isNotEmpty()) return "fail" + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/longInRange.kt b/backend.native/tests/external/codegen/blackbox/when/longInRange.kt new file mode 100644 index 00000000000..c73169ff600 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/longInRange.kt @@ -0,0 +1,9 @@ +class LongR { + operator fun contains(l : Long): Boolean = l == 5.toLong() +} + +fun box(): String { + if (5 !in LongR()) return "fail 1" + if (6 in LongR()) return "fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/matchNotNullAgainstNullable.kt b/backend.native/tests/external/codegen/blackbox/when/matchNotNullAgainstNullable.kt new file mode 100644 index 00000000000..c0598674113 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/matchNotNullAgainstNullable.kt @@ -0,0 +1,7 @@ +fun foo(i: Int, j: Int?): String = + when (i) { + j -> "OK" + else -> "Fail" + } + +fun box(): String = foo(0, 0) diff --git a/backend.native/tests/external/codegen/blackbox/when/multipleEntries.kt b/backend.native/tests/external/codegen/blackbox/when/multipleEntries.kt new file mode 100644 index 00000000000..65c20b334d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/multipleEntries.kt @@ -0,0 +1,12 @@ +fun foo(x: Any) = + when (x) { + 0, 1 -> "bit" + else -> "something" + } + +fun box(): String { + if (foo(0) != "bit") return "Fail 0" + if (foo(1) != "bit") return "Fail 1" + if (foo(2) != "something") return "Fail 2" + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/noElseExhaustive.kt b/backend.native/tests/external/codegen/blackbox/when/noElseExhaustive.kt new file mode 100644 index 00000000000..e02125f19c8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/noElseExhaustive.kt @@ -0,0 +1,9 @@ +enum class En { + A, + B +} + +fun box(): String = when(En.A) { + En.A -> "OK" + En.B -> "Fail 1" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveStatement.kt b/backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveStatement.kt new file mode 100644 index 00000000000..da79d180335 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveStatement.kt @@ -0,0 +1,12 @@ +enum class En { + A, + B +} + +fun box(): String { + when(En.A) { + En.A -> "s1" + En.B -> "s2" + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveUnitExpected.kt b/backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveUnitExpected.kt new file mode 100644 index 00000000000..2c69069abac --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/noElseExhaustiveUnitExpected.kt @@ -0,0 +1,14 @@ +enum class En { + A, + B +} + +fun box(): String { + + val u: Unit = when(En.A) { + En.A -> {} + En.B -> {} + } + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/noElseInStatement.kt b/backend.native/tests/external/codegen/blackbox/when/noElseInStatement.kt new file mode 100644 index 00000000000..9ab1c3fef63 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/noElseInStatement.kt @@ -0,0 +1,7 @@ +fun box(): String { + val x = 1 + when (x) { + 1 -> return "OK" + } + return "Fail 1" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/noElseNoMatch.kt b/backend.native/tests/external/codegen/blackbox/when/noElseNoMatch.kt new file mode 100644 index 00000000000..2c4e803b07b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/noElseNoMatch.kt @@ -0,0 +1,8 @@ +fun box(): String { + val x = 3 + when (x) { + 1 -> {} + 2 -> {} + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/nullableWhen.kt b/backend.native/tests/external/codegen/blackbox/when/nullableWhen.kt new file mode 100644 index 00000000000..717b6a9c303 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/nullableWhen.kt @@ -0,0 +1,13 @@ +// KT-2148 + + +fun f(p: Int?): Int { + return when(p) { + null -> 3 + else -> p!! + } +} + +fun box(): String { + return if (f(null) == 3) "OK" else "fail" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/range.kt b/backend.native/tests/external/codegen/blackbox/when/range.kt new file mode 100644 index 00000000000..a8d8c41c144 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/range.kt @@ -0,0 +1,29 @@ +fun isDigit(a: Int) : String { + val aa = ArrayList () + aa.add(239) + + return when(a) { + in aa -> "array list" + in 0..9 -> "digit" + !in 0..100 -> "not small" + else -> "something" + } +} + +fun assertDigit(i: Int, expected: String): String { + val result = isDigit(i) + return if (result == expected) "" else "fail: isDigit($i) = \"$result\"" +} + +fun box(): String { + val result = + assertDigit(239, "array list") + + assertDigit(0, "digit") + + assertDigit(9, "digit") + + assertDigit(5, "digit") + + assertDigit(19, "something") + + assertDigit(190, "not small") + + if (result == "") return "OK" + return result +} diff --git a/backend.native/tests/external/codegen/blackbox/when/sealedWhenInitialization.kt b/backend.native/tests/external/codegen/blackbox/when/sealedWhenInitialization.kt new file mode 100644 index 00000000000..5f9db0bde7d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/sealedWhenInitialization.kt @@ -0,0 +1,15 @@ +sealed class A { + object B : A() + + class C : A() +} + +fun box(): String { + val a: A = A.C() + val b: Boolean + when (a) { + A.B -> b = true + is A.C -> b = false + } + return if (!b) "OK" else "FAIL" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItems.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItems.kt new file mode 100644 index 00000000000..d000aa96cfa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItems.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(x : String) : String { + when (x) { + "abc" -> return "abc" + "efg", "ghi", "abc" -> return "efg_ghi" + else -> return "other" + } +} + +fun box() : String { + assertEquals("abc", foo("abc")) + assertEquals("efg_ghi", foo("efg")) + assertEquals("efg_ghi", foo("ghi")) + + assertEquals("other", foo("xyz")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt new file mode 100644 index 00000000000..00ff2e6812e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt @@ -0,0 +1,29 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(x : String) : String { + assert("abz]".hashCode() == "aby|".hashCode()) + + when (x) { + "abz]" -> return "abz" + "ghi" -> return "ghi" + "aby|" -> return "aby" + "abz]" -> return "fail" + } + + return "other" +} + +fun box() : String { + assertEquals("abz", foo("abz]")) + assertEquals("aby", foo("aby|")) + assertEquals("ghi", foo("ghi")) + + assertEquals("other", foo("xyz")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/expression.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/expression.kt new file mode 100644 index 00000000000..bc9759e64ee --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/expression.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(x : String) : String { + return when (x) { + "abc", "cde" -> "abc_cde" + "efg", "ghi" -> "efg_ghi" + else -> "other" + } +} + +fun box() : String { + assertEquals("abc_cde", foo("abc")) + assertEquals("abc_cde", foo("cde")) + assertEquals("efg_ghi", foo("efg")) + assertEquals("efg_ghi", foo("ghi")) + + assertEquals("other", foo("xyz")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/nullability.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/nullability.kt new file mode 100644 index 00000000000..d2d047fb153 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/nullability.kt @@ -0,0 +1,43 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo1(x : String?) : String { + when (x) { + "abc", "cde" -> return "abc_cde" + "efg", "ghi", null -> return "efg_ghi" + } + + return "other" +} + +fun foo2(x : String?) : String { + when (x) { + "abc", "cde" -> return "abc_cde" + "efg", "ghi" -> return "efg_ghi" + else -> return "other" + } +} + +fun box() : String { + //foo1 + assertEquals("abc_cde", foo1("abc")) + assertEquals("abc_cde", foo1("cde")) + assertEquals("efg_ghi", foo1("efg")) + assertEquals("efg_ghi", foo1("ghi")) + assertEquals("efg_ghi", foo1(null)) + + assertEquals("other", foo1("xyz")) + + //foo2 + assertEquals("abc_cde", foo2("abc")) + assertEquals("abc_cde", foo2("cde")) + assertEquals("efg_ghi", foo2("efg")) + assertEquals("efg_ghi", foo2("ghi")) + + + assertEquals("other", foo2("xyz")) + assertEquals("other", foo2(null)) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt new file mode 100644 index 00000000000..2114ac50d26 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt @@ -0,0 +1,28 @@ +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS + +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo(x : String) : String { + assert("abz]".hashCode() == "aby|".hashCode()) + + when (x) { + "abz]", "cde" -> return "abz_cde" + "aby|", "ghi", "abz]" -> return "aby_ghi" + } + + return "other" +} + +fun box() : String { + assertEquals("abz_cde", foo("abz]")) + assertEquals("abz_cde", foo("cde")) + assertEquals("aby_ghi", foo("aby|")) + assertEquals("aby_ghi", foo("ghi")) + + assertEquals("other", foo("xyz")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/statement.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/statement.kt new file mode 100644 index 00000000000..4f9bdc05158 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/statement.kt @@ -0,0 +1,40 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun foo1(x : String) : String { + when (x) { + "abc", "cde" -> return "abc_cde" + "efg", "ghi" -> return "efg_ghi" + } + + return "other" +} + +fun foo2(x : String) : String { + when (x) { + "abc", "cde" -> return "abc_cde" + "efg", "ghi" -> return "efg_ghi" + else -> return "other" + } +} + +fun box() : String { + //foo1 + assertEquals("abc_cde", foo1("abc")) + assertEquals("abc_cde", foo1("cde")) + assertEquals("efg_ghi", foo1("efg")) + assertEquals("efg_ghi", foo1("ghi")) + + assertEquals("other", foo1("xyz")) + + //foo2 + assertEquals("abc_cde", foo2("abc")) + assertEquals("abc_cde", foo2("cde")) + assertEquals("efg_ghi", foo2("efg")) + assertEquals("efg_ghi", foo2("ghi")) + + assertEquals("other", foo2("xyz")) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/switchOptimizationDense.kt b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationDense.kt new file mode 100644 index 00000000000..3fc11852388 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationDense.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +fun dense(x: Int): Int { + return when (x) { + -4 -> 9 + -1 -> 10 + 0 -> 11 + 1 -> 12 + 4 -> 13 + 5 -> 14 + 6 -> 15 + 7 -> 16 + 8 -> 17 + 9 -> 18 + else -> 19 + } +} + +fun box(): String { + var result = (-5..10).map(::dense).joinToString() + + if (result != "19, 9, 19, 19, 10, 11, 12, 19, 19, 13, 14, 15, 16, 17, 18, 19") return "dense:" + result + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/switchOptimizationMultipleConditions.kt b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationMultipleConditions.kt new file mode 100644 index 00000000000..d9cd6fd5809 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationMultipleConditions.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +fun foo(x: Int): Int { + return when (x) { + 1, 2, 3 -> 1 + 4, 5, 6 -> 2 + 7, 8, 9 -> 3 + else -> 4 + } +} + +fun box(): String { + var result = (0..10).map(::foo).joinToString() + + if (result != "4, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4") return result + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/switchOptimizationSparse.kt b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationSparse.kt new file mode 100644 index 00000000000..35e33e80d73 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationSparse.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +fun sparse(x: Int): Int { + return when ((x % 4) * 100) { + 100 -> 1 + 200 -> 2 + 300 -> 3 + else -> 4 + } +} + +fun box(): String { + var result = (0..3).map(::sparse).joinToString() + + if (result != "4, 1, 2, 3") return "sparse:" + result + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/switchOptimizationStatement.kt b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationStatement.kt new file mode 100644 index 00000000000..2e436ca37f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationStatement.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +fun exhaustive(x: Int): Int { + var r: Int + when (x) { + 1 -> r = 1 + 2 -> r = 2 + 3 -> r = 3 + else -> r = 4 + } + + return r +} + +fun nonExhaustive(x: Int): Int { + var r: Int = 4 + when (x) { + 1 -> r = 1 + 2 -> r = 2 + 3 -> r = 3 + } + + return r +} + +fun box(): String { + var result = (0..3).map(::exhaustive).joinToString() + + if (result != "4, 1, 2, 3") return "exhaustive:" + result + + result = (0..3).map(::nonExhaustive).joinToString() + + if (result != "4, 1, 2, 3") return "non-exhaustive:" + result + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/switchOptimizationTypes.kt b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationTypes.kt new file mode 100644 index 00000000000..75333b05096 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationTypes.kt @@ -0,0 +1,56 @@ +// WITH_RUNTIME + +fun intFoo(x: Int): Int { + return when (x) { + 1 -> 5 + 2 -> 6 + 3 -> 7 + else -> 8 + } +} + +fun shortFoo(x: Short): Int { + return when (x) { + 1.toShort() -> 5 + 2.toShort() -> 6 + 3.toShort() -> 7 + else -> 8 + } +} + +fun byteFoo(x: Byte): Int { + return when (x) { + 1.toByte() -> 5 + 2.toByte() -> 6 + 3.toByte() -> 7 + else -> 8 + } +} + +fun charFoo(x: Char): Int { + return when (x) { + 'a' -> 5 + 'b' -> 6 + 'c' -> 7 + else -> 8 + } +} + +fun box(): String { + var result = (1..4).map(::intFoo).joinToString() + + if (result != "5, 6, 7, 8") return "int:" + result + + result = (listOf(1, 2, 3, 4)).map(::shortFoo).joinToString() + + if (result != "5, 6, 7, 8") return "short:" + result + + result = (listOf(1, 2, 3, 4)).map(::byteFoo).joinToString() + + if (result != "5, 6, 7, 8") return "byte:" + result + + result = ('a'..'d').map(::charFoo).joinToString() + + if (result != "5, 6, 7, 8") return "int:" + result + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/switchOptimizationUnordered.kt b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationUnordered.kt new file mode 100644 index 00000000000..e299845073a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/switchOptimizationUnordered.kt @@ -0,0 +1,17 @@ +// WITH_RUNTIME + +fun foo(x: Int): Int { + return when (x) { + 2 -> 6 + 1 -> 5 + 3 -> 7 + else -> 8 + } +} + +fun box(): String { + var result = (0..3).map(::foo).joinToString() + + if (result != "8, 5, 6, 7") return "unordered:" + result + return "OK" +} diff --git a/backend.native/tests/external/codegen/blackbox/when/typeDisjunction.kt b/backend.native/tests/external/codegen/blackbox/when/typeDisjunction.kt new file mode 100644 index 00000000000..1d2910393b0 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/typeDisjunction.kt @@ -0,0 +1,15 @@ +fun foo(s: Any): String { + val x = when (s) { + is String -> s + is Int -> "$s" + else -> return "" + } + + val y: String = x + return y +} + +fun box() = if (foo("OK") == "OK" && foo(42) == "42" && foo(true) == "") "OK" else "Fail" + + + diff --git a/backend.native/tests/external/codegen/blackbox/when/whenArgumentIsEvaluatedOnlyOnce.kt b/backend.native/tests/external/codegen/blackbox/when/whenArgumentIsEvaluatedOnlyOnce.kt new file mode 100644 index 00000000000..48ebea48731 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/whenArgumentIsEvaluatedOnlyOnce.kt @@ -0,0 +1,13 @@ +var x = 0 +fun inc(): Int { + x++ + return 0 +} +fun box(): String { + val al = ArrayList() + when (inc()) { + in al -> return "fail 1" + else -> {} + } + return if (x == 1) "OK" else "fail 2" +} From fd44baf2c018bccea3fb469484c68daa9f55dc4b Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 13 Jan 2017 18:47:48 +0700 Subject: [PATCH 11/86] backend/tests: Infrastructure for external test running --- .gitignore | 1 + backend.native/tests/build.gradle | 152 ++++++--------- backend.native/tests/external/build.gradle | 0 .../org/jetbrains/kotlin/KonanTest.groovy | 183 ++++++++++++++++++ settings.gradle | 1 + 5 files changed, 246 insertions(+), 91 deletions(-) create mode 100644 backend.native/tests/external/build.gradle create mode 100644 buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy diff --git a/.gitignore b/.gitignore index f29f98b5108..120809d3411 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ kotstd/kotstd.iml *.kt.S *.kt.exe *.log +**/test-result.md # Ignore Gradle GUI config gradle-app.setting diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 00ed3811ce4..676a7272511 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -1,3 +1,10 @@ +import com.google.common.collect.Lists +import groovy.io.FileType +import org.jetbrains.kotlin.* + +import java.nio.file.* +import java.util.regex.Matcher + configurations { cli_bc } @@ -6,101 +13,38 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } +task regenerate_external_tests() { + doLast { + def externalTestsProject = childProjects["external"] + def gradleGenerated = externalTestsProject.file("build.gradle") + def externalTestsDir = externalTestsProject.file("codegen/blackbox") + gradleGenerated.write("import org.jetbrains.kotlin.*\n\n") + gradleGenerated.append("configurations {\n" + + " cli_bc\n" + + "}\n" + + "\n" + + "dependencies {\n" + + " cli_bc project(path: ':backend.native', configuration: 'cli_bc')\n" + + "}\n\n") - -abstract class KonanTest extends DefaultTask { - protected String source - def backendNative = project.project(":backend.native") - def runtimeProject = project.project(":runtime") - def dist = project.parent.parent.file("dist") - def llvmLlc = llvmTool("llc") - def runtimeBc = new File("${dist.canonicalPath}/lib/runtime.bc").absolutePath - def launcherBc = new File("${dist.canonicalPath}/lib/launcher.bc").absolutePath - def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath - def stdlibKtBc = new File("${dist.canonicalPath}/lib/stdlib.kt.bc").absolutePath - def mainC = 'main.c' - String goldValue = null - String testData = null - List arguments = null - - boolean enabled = true - - public void setDisabled(boolean value) { - this.enabled = !value - } - - public KonanTest(){ - // TODO: that's a long reach up the project tree. - // May be we should reorganize a little. - dependsOn(project.parent.parent.tasks['dist']) - } - - abstract void compileTest(String source, String exe) - - protected void runCompiler(String source, String output, List moreArgs) { - project.javaexec { - main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' - classpath = project.configurations.cli_bc - jvmArgs "-ea", - "-Dkonan.home=${dist.canonicalPath}", - "-Djava.library.path=${dist.canonicalPath}/konan/nativelib" - args("-output", output, - source, - *moreArgs, - *project.globalArgs) - } - } - - @TaskAction - void executeTest() { - def sourceKt = project.file(source).absolutePath - def exe = sourceKt.replace(".kt", ".kt.exe") - - compileTest(sourceKt, exe) - println "execution :$exe" - - def out = null - project.exec { - commandLine exe - if (arguments != null) { - args arguments + externalTestsDir.eachDirRecurse { + if (it.name == "build") { + return } - if (testData != null) { - standardInput = new ByteArrayInputStream(testData.bytes) - } - if (goldValue != null) { - out = new ByteArrayOutputStream() - standardOutput = out + + def directoryGradleGenerated = project.file("$it.absolutePath/build-generated.gradle") + directoryGradleGenerated.write("import org.jetbrains.kotlin.*\n\n") + gradleGenerated.append("\napply from: \"${externalTestsProject.relativePath(directoryGradleGenerated)}\"") + + it.eachFile(FileType.FILES) { + if (it.name.endsWith(".kt")) { + def taskSourcePath = externalTestsProject.relativePath(it) + //remove filename extension. TODO make better replacement + def taskName = taskSourcePath.replace('/', '_').replace('-', '_').replaceFirst(~/\.[^\.]+$/, '') + directoryGradleGenerated.append("task $taskName (type: RunExternalTest) {\n source = \"$taskSourcePath\"\n}\n\n") + } } } - if (goldValue != null && goldValue != out.toString()) - throw new RuntimeException("test failed") - } - - private String llvmTool(String tool) { - return "${project.llvmDir}/bin/${tool}" - } - - protected List clangLinkArgs() { - return project.clangLinkArgs - } -} - -class RunKonanTest extends KonanTest { - void compileTest(String source, String exe) { - runCompiler(source, exe, []) - } -} - -class LinkKonanTest extends KonanTest { - protected String lib - - void compileTest(String source, String exe) { - def libDir = project.file(lib).absolutePath - def libBc = "${libDir}.bc" - - runCompiler(lib, libBc, ['-nolink', '-nostdlib']) - runCompiler(source, exe, ['-library', libBc]) } } @@ -109,6 +53,32 @@ task run() { dependsOn(tasks.withType(KonanTest).matching { it.enabled }) } +task run_external () { + doLast { + //TODO make better output / make as dependencies + def externalTestsProject = project.childProjects["external"] + def logFile = externalTestsProject.file("test-result.md") + logFile.write("|Test|Status|Comment|\n|----|------|-------|") + def current = 1 + def passed = 0 + def total = externalTestsProject.tasks.size() + externalTestsProject.tasks.each { + println("TEST: $current/$total (passed: $passed)") + try { + (it as RunExternalTest).executeTest() + logFile.append("\n|$it.name|PASSED||") + println("TEST PASSED") + passed++ + } catch (Exception ex) { + println("TEST FAILED") + logFile.append("\n|$it.name|FAILED|${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}|") + } + current++ + } + logFile.append("\nPASSED: $passed/$total") + } +} + task sum (type:RunKonanTest) { source = "codegen/function/sum.kt" } diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy new file mode 100644 index 00000000000..9e0f8a2f703 --- /dev/null +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -0,0 +1,183 @@ +package org.jetbrains.kotlin + +import org.gradle.api.DefaultTask +import org.gradle.api.tasks.TaskAction + +abstract class KonanTest extends DefaultTask { + protected String source + def backendNative = project.project(":backend.native") + def runtimeProject = project.project(":runtime") + def dist = project.rootProject.file("dist") + def llvmLlc = llvmTool("llc") + def runtimeBc = new File("${dist.canonicalPath}/lib/runtime.bc").absolutePath + def launcherBc = new File("${dist.canonicalPath}/lib/launcher.bc").absolutePath + def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath + def stdlibKtBc = new File("${dist.canonicalPath}/lib/stdlib.kt.bc").absolutePath + def mainC = 'main.c' + String goldValue = null + String testData = null + List arguments = null + + boolean enabled = true + + public void setDisabled(boolean value) { + this.enabled = !value + } + + public KonanTest(){ + // TODO: that's a long reach up the project tree. + // May be we should reorganize a little. + //dependsOn(project.parent.parent.tasks['dist']) + dependsOn(project.rootProject.tasks['dist']) + } + + abstract void compileTest(List filesToCompile, String exe) + + protected void runCompiler(List filesToCompile, String output, List moreArgs) { + project.javaexec { + main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' + classpath = project.configurations.cli_bc + jvmArgs "-ea", + "-Dkonan.home=${dist.canonicalPath}", + "-Djava.library.path=${dist.canonicalPath}/konan/nativelib" + args("-output", output, + *filesToCompile, + *moreArgs, + *project.globalArgs) + } + } + + protected void runCompiler(String source, String output, List moreArgs) { + runCompiler([source], output, moreArgs) + } + + String buildExePath() { + def exeName = project.file(source).name.replace(".kt", ".kt.exe") + def tempDir = temporaryDir.absolutePath + return "$tempDir/$exeName" + } + + List buildCompileList() { + return [project.file(source).absolutePath] + } + + @TaskAction + void executeTest() { + def exe = buildExePath() + + compileTest(buildCompileList(), exe) + println "execution :$exe" + + def out = null + project.exec { + commandLine exe + if (arguments != null) { + args arguments + } + if (testData != null) { + standardInput = new ByteArrayInputStream(testData.bytes) + } + if (goldValue != null) { + out = new ByteArrayOutputStream() + standardOutput = out + } + } + if (goldValue != null && goldValue != out.toString()) + throw new RuntimeException("test failed.") + } + + private String llvmTool(String tool) { + return "${project.llvmDir}/bin/${tool}" + } + + protected List clangLinkArgs() { + return project.clangLinkArgs + } +} + +class RunKonanTest extends KonanTest { + void compileTest(List filesToCompile, String exe) { + runCompiler(filesToCompile, exe, []) + } +} + +class LinkKonanTest extends KonanTest { + protected String lib + + void compileTest(List filesToCompile, String exe) { + def libDir = project.file(lib).absolutePath + def libBc = "${libDir}.bc" + + runCompiler(lib, libBc, ['-nolink', '-nostdlib']) + runCompiler(filesToCompile, exe, ['-library', libBc]) + } +} + +class RunExternalTest extends RunKonanTest { + + String goldValue = "OK" + + String buildExePath() { + def exeName = "${name}.kt.exe" + def tempDir = temporaryDir.absolutePath + return "$tempDir/$exeName" + } + + // TODO refactor + List buildCompileList() { + def result = [] + def filePattern = ~/(?m)\/\/\s*FILE:\s*(.*)$/ + def packagePattern = ~/(?m)package\s*([a-zA-z-][a-zA-Z0-9.-]*)/ //TODO check the regex + def boxPattern = ~/(?m)fun\s*box\s*\(\s*\)/ + def boxPackage = "" + def srcFile = project.file(source) + def srcText = srcFile.text + def matcher = filePattern.matcher(srcText) + def tmpDir = temporaryDir.absolutePath + + if (!matcher.find()) { + // There is only one file in the input + project.copy{ + from srcFile.absolutePath + into tmpDir + } + def newFile ="$tmpDir/${srcFile.name}" + if (srcText =~ boxPattern && srcText =~ packagePattern){ + boxPackage = (srcText =~ packagePattern)[0][1] + boxPackage += '.' + } + result.add(newFile) + } else { + // There are several files + def processedChars = 0 + while (true) { + def filePath = matcher.group(1) + filePath = "$tmpDir/$filePath" + def start = processedChars + def nextFileExists = matcher.find() + def end = nextFileExists ? matcher.start() : srcText.length() + def fileText = srcText.substring(start, end) + processedChars = end; + createFile(filePath, fileText) + if (fileText =~ boxPattern && fileText =~ packagePattern){ + boxPackage = (fileText =~ packagePattern)[0][1] + boxPackage += '.' + } + result.add(filePath) + if (!nextFileExists) break + } + } + createLauncherFile("$tmpDir/_launcher.kt", boxPackage) + result.add("$tmpDir/_launcher.kt") + return result + } + + void createLauncherFile(String file, String pkg) { + createFile(file, "fun main(args : Array) { print(${pkg}box()) }") + } + + void createFile(String file, String text) { + project.file(file).write(text) + } +} + diff --git a/settings.gradle b/settings.gradle index a4cb6759f92..de284fb5fbb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,3 +7,4 @@ include ':backend.native' include ':runtime' include ':common' include ':backend.native:tests' +include ':backend.native:tests:external' From ee58c7ee5f1b4db7a84ef22276c6b08a61c5590e Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 17 Jan 2017 19:01:19 +0300 Subject: [PATCH 12/86] backend/tests: Added autogenerated tasks for external tests --- backend.native/tests/external/build.gradle | 219 +++++++++ .../annotatedLambda/build-generated.gradle | 18 + .../annotations/build-generated.gradle | 74 +++ .../argumentOrder/build-generated.gradle | 46 ++ .../blackbox/arrays/build-generated.gradle | 230 +++++++++ .../arrays/multiDecl/build-generated.gradle | 22 + .../multiDecl/int/build-generated.gradle | 18 + .../multiDecl/long/build-generated.gradle | 18 + .../blackbox/binaryOp/build-generated.gradle | 70 +++ .../boxingOptimization/build-generated.gradle | 66 +++ .../blackbox/bridges/build-generated.gradle | 190 ++++++++ .../build-generated.gradle | 46 ++ .../builtinStubMethods/build-generated.gradle | 94 ++++ .../build-generated.gradle | 30 ++ .../bound/build-generated.gradle | 54 +++ .../bound/equals/build-generated.gradle | 18 + .../bound/inline/build-generated.gradle | 10 + .../callableReference/build-generated.gradle | 2 + .../function/build-generated.gradle | 166 +++++++ .../function/local/build-generated.gradle | 78 +++ .../property/build-generated.gradle | 106 ++++ .../blackbox/casts/build-generated.gradle | 82 ++++ .../casts/functions/build-generated.gradle | 54 +++ .../build-generated.gradle | 30 ++ .../mutableCollections/build-generated.gradle | 34 ++ .../classLiteral/bound/build-generated.gradle | 18 + .../classLiteral/build-generated.gradle | 6 + .../classLiteral/java/build-generated.gradle | 34 ++ .../blackbox/classes/build-generated.gradle | 458 ++++++++++++++++++ .../classes/inner/build-generated.gradle | 26 + .../blackbox/closures/build-generated.gradle | 150 ++++++ .../build-generated.gradle | 34 ++ .../build-generated.gradle | 26 + .../collections/build-generated.gradle | 74 +++ .../compatibility/build-generated.gradle | 6 + .../blackbox/constants/build-generated.gradle | 22 + .../build-generated.gradle | 58 +++ .../controlStructures/build-generated.gradle | 270 +++++++++++ .../returnsNothing/build-generated.gradle | 22 + .../build-generated.gradle | 90 ++++ .../coroutines/build-generated.gradle | 198 ++++++++ .../controlFlow/build-generated.gradle | 46 ++ .../intLikeVarSpilling/build-generated.gradle | 42 ++ .../multiModule/build-generated.gradle | 10 + .../stackUnwinding/build-generated.gradle | 18 + .../build-generated.gradle | 10 + .../unitTypeReturn/build-generated.gradle | 18 + .../dataClasses/build-generated.gradle | 62 +++ .../dataClasses/copy/build-generated.gradle | 30 ++ .../dataClasses/equals/build-generated.gradle | 26 + .../hashCode/build-generated.gradle | 54 +++ .../toString/build-generated.gradle | 30 ++ .../build-generated.gradle | 18 + .../defaultArguments/build-generated.gradle | 18 + .../constructor/build-generated.gradle | 54 +++ .../convention/build-generated.gradle | 14 + .../function/build-generated.gradle | 82 ++++ .../private/build-generated.gradle | 18 + .../signature/build-generated.gradle | 14 + .../delegatedProperty/build-generated.gradle | 150 ++++++ .../local/build-generated.gradle | 50 ++ .../provideDelegate/build-generated.gradle | 62 +++ .../delegation/build-generated.gradle | 10 + .../build-generated.gradle | 34 ++ .../diagnostics/build-generated.gradle | 2 + .../functions/build-generated.gradle | 2 + .../inference/build-generated.gradle | 6 + .../functions/invoke/build-generated.gradle | 2 + .../invoke/onObjects/build-generated.gradle | 42 ++ .../tailRecursion/build-generated.gradle | 150 ++++++ .../diagnostics/vararg/build-generated.gradle | 6 + .../blackbox/elvis/build-generated.gradle | 18 + .../blackbox/enum/build-generated.gradle | 110 +++++ .../blackbox/evaluate/build-generated.gradle | 62 +++ .../blackbox/exclExcl/build-generated.gradle | 10 + .../extensionFunctions/build-generated.gradle | 90 ++++ .../build-generated.gradle | 58 +++ .../blackbox/external/build-generated.gradle | 14 + .../fakeOverride/build-generated.gradle | 18 + .../fieldRename/build-generated.gradle | 14 + .../blackbox/finally/build-generated.gradle | 46 ++ .../blackbox/fullJdk/build-generated.gradle | 26 + .../fullJdk/native/build-generated.gradle | 14 + .../regressions/build-generated.gradle | 6 + .../blackbox/functions/build-generated.gradle | 174 +++++++ .../functionExpression/build-generated.gradle | 18 + .../functions/invoke/build-generated.gradle | 62 +++ .../localFunctions/build-generated.gradle | 66 +++ .../blackbox/hashPMap/build-generated.gradle | 26 + .../blackbox/ieee754/build-generated.gradle | 78 +++ .../blackbox/increment/build-generated.gradle | 90 ++++ .../innerNested/build-generated.gradle | 94 ++++ .../build-generated.gradle | 82 ++++ .../instructions/build-generated.gradle | 2 + .../instructions/swap/build-generated.gradle | 10 + .../intrinsics/build-generated.gradle | 78 +++ .../javaInterop/build-generated.gradle | 6 + .../generics/build-generated.gradle | 14 + .../notNullAssertions/build-generated.gradle | 10 + .../objectMethods/build-generated.gradle | 26 + .../blackbox/jdk/build-generated.gradle | 18 + .../blackbox/jvmField/build-generated.gradle | 58 +++ .../blackbox/jvmName/build-generated.gradle | 46 ++ .../fileFacades/build-generated.gradle | 14 + .../jvmOverloads/build-generated.gradle | 58 +++ .../blackbox/jvmStatic/build-generated.gradle | 94 ++++ .../blackbox/labels/build-generated.gradle | 26 + .../lazyCodegen/build-generated.gradle | 38 ++ .../optimizations/build-generated.gradle | 38 ++ .../localClasses/build-generated.gradle | 110 +++++ .../blackbox/mangling/build-generated.gradle | 30 ++ .../blackbox/multiDecl/build-generated.gradle | 58 +++ .../forIterator/build-generated.gradle | 22 + .../longIterator/build-generated.gradle | 18 + .../multiDecl/forRange/build-generated.gradle | 30 ++ .../explicitRangeTo/build-generated.gradle | 22 + .../int/build-generated.gradle | 18 + .../long/build-generated.gradle | 18 + .../build-generated.gradle | 22 + .../int/build-generated.gradle | 18 + .../long/build-generated.gradle | 18 + .../forRange/int/build-generated.gradle | 18 + .../forRange/long/build-generated.gradle | 18 + .../multifileClasses/build-generated.gradle | 42 ++ .../optimized/build-generated.gradle | 58 +++ .../nonLocalReturns/build-generated.gradle | 18 + .../objectIntrinsics/build-generated.gradle | 6 + .../blackbox/objects/build-generated.gradle | 174 +++++++ .../build-generated.gradle | 58 +++ .../compareTo/build-generated.gradle | 42 ++ .../blackbox/package/build-generated.gradle | 42 ++ .../platformTypes/build-generated.gradle | 2 + .../primitives/build-generated.gradle | 82 ++++ .../primitiveTypes/build-generated.gradle | 210 ++++++++ .../blackbox/private/build-generated.gradle | 10 + .../build-generated.gradle | 54 +++ .../properties/build-generated.gradle | 270 +++++++++++ .../properties/const/build-generated.gradle | 14 + .../lateinit/build-generated.gradle | 42 ++ .../publishedApi/build-generated.gradle | 14 + .../blackbox/ranges/build-generated.gradle | 26 + .../ranges/contains/build-generated.gradle | 50 ++ .../ranges/expression/build-generated.gradle | 114 +++++ .../ranges/forInDownTo/build-generated.gradle | 18 + .../forInIndices/build-generated.gradle | 62 +++ .../ranges/literal/build-generated.gradle | 114 +++++ .../build-generated.gradle | 14 + .../annotations/build-generated.gradle | 46 ++ .../reflection/build-generated.gradle | 2 + .../call/bound/build-generated.gradle | 54 +++ .../reflection/call/build-generated.gradle | 90 ++++ .../reflection/callBy/build-generated.gradle | 74 +++ .../classLiterals/build-generated.gradle | 30 ++ .../reflection/classes/build-generated.gradle | 50 ++ .../constructors/build-generated.gradle | 22 + .../createAnnotation/build-generated.gradle | 50 ++ .../enclosing/build-generated.gradle | 98 ++++ .../functions/build-generated.gradle | 46 ++ .../genericSignature/build-generated.gradle | 34 ++ .../isInstance/build-generated.gradle | 6 + .../kClassInAnnotation/build-generated.gradle | 30 ++ .../lambdaClasses/build-generated.gradle | 6 + .../reflection/mapping/build-generated.gradle | 46 ++ .../fakeOverrides/build-generated.gradle | 10 + .../mapping/jvmStatic/build-generated.gradle | 10 + .../mapping/types/build-generated.gradle | 66 +++ .../methodsFromAny/build-generated.gradle | 62 +++ .../modifiers/build-generated.gradle | 38 ++ .../multifileClasses/build-generated.gradle | 14 + .../noReflectAtRuntime/build-generated.gradle | 26 + .../methodsFromAny/build-generated.gradle | 10 + .../parameters/build-generated.gradle | 50 ++ .../accessors/build-generated.gradle | 22 + .../properties/build-generated.gradle | 118 +++++ .../specialBuiltIns/build-generated.gradle | 6 + .../supertypes/build-generated.gradle | 22 + .../typeParameters/build-generated.gradle | 14 + .../reflection/types/build-generated.gradle | 50 ++ .../types/createType/build-generated.gradle | 22 + .../types/subtyping/build-generated.gradle | 18 + .../regressions/build-generated.gradle | 278 +++++++++++ .../arraysReification/build-generated.gradle | 26 + .../blackbox/reified/build-generated.gradle | 118 +++++ .../blackbox/safeCall/build-generated.gradle | 38 ++ .../blackbox/sam/build-generated.gradle | 2 + .../sam/constructors/build-generated.gradle | 50 ++ .../blackbox/sealed/build-generated.gradle | 10 + .../build-generated.gradle | 126 +++++ .../blackbox/smap/build-generated.gradle | 14 + .../smartCasts/build-generated.gradle | 50 ++ .../specialBuiltins/build-generated.gradle | 82 ++++ .../blackbox/statics/build-generated.gradle | 66 +++ .../build-generated.gradle | 22 + .../blackbox/strings/build-generated.gradle | 66 +++ .../blackbox/super/build-generated.gradle | 114 +++++ .../synchronized/build-generated.gradle | 46 ++ .../syntheticAccessors/build-generated.gradle | 38 ++ .../blackbox/toArray/build-generated.gradle | 30 ++ .../topLevelPrivate/build-generated.gradle | 26 + .../blackbox/traits/build-generated.gradle | 114 +++++ .../blackbox/typeInfo/build-generated.gradle | 30 ++ .../typeMapping/build-generated.gradle | 42 ++ .../blackbox/typealias/build-generated.gradle | 54 +++ .../blackbox/unaryOp/build-generated.gradle | 26 + .../blackbox/unit/build-generated.gradle | 46 ++ .../blackbox/vararg/build-generated.gradle | 34 ++ .../blackbox/when/build-generated.gradle | 134 +++++ .../enumOptimization/build-generated.gradle | 46 ++ .../stringOptimization/build-generated.gradle | 26 + 209 files changed, 11011 insertions(+) create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/external/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/package/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/private/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/super/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/when/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle create mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle index e69de29bb2d..0b601eab88a 100644 --- a/backend.native/tests/external/build.gradle +++ b/backend.native/tests/external/build.gradle @@ -0,0 +1,219 @@ +import org.jetbrains.kotlin.* + +configurations { + cli_bc +} + +dependencies { + cli_bc project(path: ':backend.native', configuration: 'cli_bc') +} + + +apply from: "codegen/blackbox/annotations/build-generated.gradle" +apply from: "codegen/blackbox/annotations/annotatedLambda/build-generated.gradle" +apply from: "codegen/blackbox/argumentOrder/build-generated.gradle" +apply from: "codegen/blackbox/arrays/build-generated.gradle" +apply from: "codegen/blackbox/arrays/multiDecl/build-generated.gradle" +apply from: "codegen/blackbox/arrays/multiDecl/int/build-generated.gradle" +apply from: "codegen/blackbox/arrays/multiDecl/long/build-generated.gradle" +apply from: "codegen/blackbox/binaryOp/build-generated.gradle" +apply from: "codegen/blackbox/boxingOptimization/build-generated.gradle" +apply from: "codegen/blackbox/bridges/build-generated.gradle" +apply from: "codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle" +apply from: "codegen/blackbox/builtinStubMethods/build-generated.gradle" +apply from: "codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/bound/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/bound/equals/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/bound/inline/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/function/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/function/local/build-generated.gradle" +apply from: "codegen/blackbox/callableReference/property/build-generated.gradle" +apply from: "codegen/blackbox/casts/build-generated.gradle" +apply from: "codegen/blackbox/casts/functions/build-generated.gradle" +apply from: "codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle" +apply from: "codegen/blackbox/casts/mutableCollections/build-generated.gradle" +apply from: "codegen/blackbox/classes/build-generated.gradle" +apply from: "codegen/blackbox/classes/inner/build-generated.gradle" +apply from: "codegen/blackbox/classLiteral/build-generated.gradle" +apply from: "codegen/blackbox/classLiteral/bound/build-generated.gradle" +apply from: "codegen/blackbox/classLiteral/java/build-generated.gradle" +apply from: "codegen/blackbox/closures/build-generated.gradle" +apply from: "codegen/blackbox/closures/captureOuterProperty/build-generated.gradle" +apply from: "codegen/blackbox/closures/closureInsideClosure/build-generated.gradle" +apply from: "codegen/blackbox/collections/build-generated.gradle" +apply from: "codegen/blackbox/compatibility/build-generated.gradle" +apply from: "codegen/blackbox/constants/build-generated.gradle" +apply from: "codegen/blackbox/controlStructures/build-generated.gradle" +apply from: "codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle" +apply from: "codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle" +apply from: "codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/controlFlow/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/multiModule/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle" +apply from: "codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle" +apply from: "codegen/blackbox/dataClasses/build-generated.gradle" +apply from: "codegen/blackbox/dataClasses/copy/build-generated.gradle" +apply from: "codegen/blackbox/dataClasses/equals/build-generated.gradle" +apply from: "codegen/blackbox/dataClasses/hashCode/build-generated.gradle" +apply from: "codegen/blackbox/dataClasses/toString/build-generated.gradle" +apply from: "codegen/blackbox/deadCodeElimination/build-generated.gradle" +apply from: "codegen/blackbox/defaultArguments/build-generated.gradle" +apply from: "codegen/blackbox/defaultArguments/constructor/build-generated.gradle" +apply from: "codegen/blackbox/defaultArguments/convention/build-generated.gradle" +apply from: "codegen/blackbox/defaultArguments/function/build-generated.gradle" +apply from: "codegen/blackbox/defaultArguments/private/build-generated.gradle" +apply from: "codegen/blackbox/defaultArguments/signature/build-generated.gradle" +apply from: "codegen/blackbox/delegatedProperty/build-generated.gradle" +apply from: "codegen/blackbox/delegatedProperty/local/build-generated.gradle" +apply from: "codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle" +apply from: "codegen/blackbox/delegation/build-generated.gradle" +apply from: "codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/functions/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/functions/inference/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle" +apply from: "codegen/blackbox/diagnostics/vararg/build-generated.gradle" +apply from: "codegen/blackbox/elvis/build-generated.gradle" +apply from: "codegen/blackbox/enum/build-generated.gradle" +apply from: "codegen/blackbox/evaluate/build-generated.gradle" +apply from: "codegen/blackbox/exclExcl/build-generated.gradle" +apply from: "codegen/blackbox/extensionFunctions/build-generated.gradle" +apply from: "codegen/blackbox/extensionProperties/build-generated.gradle" +apply from: "codegen/blackbox/external/build-generated.gradle" +apply from: "codegen/blackbox/fakeOverride/build-generated.gradle" +apply from: "codegen/blackbox/fieldRename/build-generated.gradle" +apply from: "codegen/blackbox/finally/build-generated.gradle" +apply from: "codegen/blackbox/fullJdk/build-generated.gradle" +apply from: "codegen/blackbox/fullJdk/native/build-generated.gradle" +apply from: "codegen/blackbox/fullJdk/regressions/build-generated.gradle" +apply from: "codegen/blackbox/functions/build-generated.gradle" +apply from: "codegen/blackbox/functions/functionExpression/build-generated.gradle" +apply from: "codegen/blackbox/functions/invoke/build-generated.gradle" +apply from: "codegen/blackbox/functions/localFunctions/build-generated.gradle" +apply from: "codegen/blackbox/hashPMap/build-generated.gradle" +apply from: "codegen/blackbox/ieee754/build-generated.gradle" +apply from: "codegen/blackbox/increment/build-generated.gradle" +apply from: "codegen/blackbox/innerNested/build-generated.gradle" +apply from: "codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle" +apply from: "codegen/blackbox/instructions/build-generated.gradle" +apply from: "codegen/blackbox/instructions/swap/build-generated.gradle" +apply from: "codegen/blackbox/intrinsics/build-generated.gradle" +apply from: "codegen/blackbox/javaInterop/build-generated.gradle" +apply from: "codegen/blackbox/javaInterop/generics/build-generated.gradle" +apply from: "codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle" +apply from: "codegen/blackbox/javaInterop/objectMethods/build-generated.gradle" +apply from: "codegen/blackbox/jdk/build-generated.gradle" +apply from: "codegen/blackbox/jvmField/build-generated.gradle" +apply from: "codegen/blackbox/jvmName/build-generated.gradle" +apply from: "codegen/blackbox/jvmName/fileFacades/build-generated.gradle" +apply from: "codegen/blackbox/jvmOverloads/build-generated.gradle" +apply from: "codegen/blackbox/jvmStatic/build-generated.gradle" +apply from: "codegen/blackbox/labels/build-generated.gradle" +apply from: "codegen/blackbox/lazyCodegen/build-generated.gradle" +apply from: "codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle" +apply from: "codegen/blackbox/localClasses/build-generated.gradle" +apply from: "codegen/blackbox/mangling/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forIterator/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/int/build-generated.gradle" +apply from: "codegen/blackbox/multiDecl/forRange/long/build-generated.gradle" +apply from: "codegen/blackbox/multifileClasses/build-generated.gradle" +apply from: "codegen/blackbox/multifileClasses/optimized/build-generated.gradle" +apply from: "codegen/blackbox/nonLocalReturns/build-generated.gradle" +apply from: "codegen/blackbox/objectIntrinsics/build-generated.gradle" +apply from: "codegen/blackbox/objects/build-generated.gradle" +apply from: "codegen/blackbox/operatorConventions/build-generated.gradle" +apply from: "codegen/blackbox/operatorConventions/compareTo/build-generated.gradle" +apply from: "codegen/blackbox/package/build-generated.gradle" +apply from: "codegen/blackbox/platformTypes/build-generated.gradle" +apply from: "codegen/blackbox/platformTypes/primitives/build-generated.gradle" +apply from: "codegen/blackbox/primitiveTypes/build-generated.gradle" +apply from: "codegen/blackbox/private/build-generated.gradle" +apply from: "codegen/blackbox/privateConstructors/build-generated.gradle" +apply from: "codegen/blackbox/properties/build-generated.gradle" +apply from: "codegen/blackbox/properties/const/build-generated.gradle" +apply from: "codegen/blackbox/properties/lateinit/build-generated.gradle" +apply from: "codegen/blackbox/publishedApi/build-generated.gradle" +apply from: "codegen/blackbox/ranges/build-generated.gradle" +apply from: "codegen/blackbox/ranges/contains/build-generated.gradle" +apply from: "codegen/blackbox/ranges/expression/build-generated.gradle" +apply from: "codegen/blackbox/ranges/forInDownTo/build-generated.gradle" +apply from: "codegen/blackbox/ranges/forInIndices/build-generated.gradle" +apply from: "codegen/blackbox/ranges/literal/build-generated.gradle" +apply from: "codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle" +apply from: "codegen/blackbox/reflection/build-generated.gradle" +apply from: "codegen/blackbox/reflection/annotations/build-generated.gradle" +apply from: "codegen/blackbox/reflection/call/build-generated.gradle" +apply from: "codegen/blackbox/reflection/call/bound/build-generated.gradle" +apply from: "codegen/blackbox/reflection/callBy/build-generated.gradle" +apply from: "codegen/blackbox/reflection/classes/build-generated.gradle" +apply from: "codegen/blackbox/reflection/classLiterals/build-generated.gradle" +apply from: "codegen/blackbox/reflection/constructors/build-generated.gradle" +apply from: "codegen/blackbox/reflection/createAnnotation/build-generated.gradle" +apply from: "codegen/blackbox/reflection/enclosing/build-generated.gradle" +apply from: "codegen/blackbox/reflection/functions/build-generated.gradle" +apply from: "codegen/blackbox/reflection/genericSignature/build-generated.gradle" +apply from: "codegen/blackbox/reflection/isInstance/build-generated.gradle" +apply from: "codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle" +apply from: "codegen/blackbox/reflection/lambdaClasses/build-generated.gradle" +apply from: "codegen/blackbox/reflection/mapping/build-generated.gradle" +apply from: "codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle" +apply from: "codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle" +apply from: "codegen/blackbox/reflection/mapping/types/build-generated.gradle" +apply from: "codegen/blackbox/reflection/methodsFromAny/build-generated.gradle" +apply from: "codegen/blackbox/reflection/modifiers/build-generated.gradle" +apply from: "codegen/blackbox/reflection/multifileClasses/build-generated.gradle" +apply from: "codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle" +apply from: "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle" +apply from: "codegen/blackbox/reflection/parameters/build-generated.gradle" +apply from: "codegen/blackbox/reflection/properties/build-generated.gradle" +apply from: "codegen/blackbox/reflection/properties/accessors/build-generated.gradle" +apply from: "codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle" +apply from: "codegen/blackbox/reflection/supertypes/build-generated.gradle" +apply from: "codegen/blackbox/reflection/typeParameters/build-generated.gradle" +apply from: "codegen/blackbox/reflection/types/build-generated.gradle" +apply from: "codegen/blackbox/reflection/types/createType/build-generated.gradle" +apply from: "codegen/blackbox/reflection/types/subtyping/build-generated.gradle" +apply from: "codegen/blackbox/regressions/build-generated.gradle" +apply from: "codegen/blackbox/reified/build-generated.gradle" +apply from: "codegen/blackbox/reified/arraysReification/build-generated.gradle" +apply from: "codegen/blackbox/safeCall/build-generated.gradle" +apply from: "codegen/blackbox/sam/build-generated.gradle" +apply from: "codegen/blackbox/sam/constructors/build-generated.gradle" +apply from: "codegen/blackbox/sealed/build-generated.gradle" +apply from: "codegen/blackbox/secondaryConstructors/build-generated.gradle" +apply from: "codegen/blackbox/smap/build-generated.gradle" +apply from: "codegen/blackbox/smartCasts/build-generated.gradle" +apply from: "codegen/blackbox/specialBuiltins/build-generated.gradle" +apply from: "codegen/blackbox/statics/build-generated.gradle" +apply from: "codegen/blackbox/storeStackBeforeInline/build-generated.gradle" +apply from: "codegen/blackbox/strings/build-generated.gradle" +apply from: "codegen/blackbox/super/build-generated.gradle" +apply from: "codegen/blackbox/synchronized/build-generated.gradle" +apply from: "codegen/blackbox/syntheticAccessors/build-generated.gradle" +apply from: "codegen/blackbox/toArray/build-generated.gradle" +apply from: "codegen/blackbox/topLevelPrivate/build-generated.gradle" +apply from: "codegen/blackbox/traits/build-generated.gradle" +apply from: "codegen/blackbox/typealias/build-generated.gradle" +apply from: "codegen/blackbox/typeInfo/build-generated.gradle" +apply from: "codegen/blackbox/typeMapping/build-generated.gradle" +apply from: "codegen/blackbox/unaryOp/build-generated.gradle" +apply from: "codegen/blackbox/unit/build-generated.gradle" +apply from: "codegen/blackbox/vararg/build-generated.gradle" +apply from: "codegen/blackbox/when/build-generated.gradle" +apply from: "codegen/blackbox/when/enumOptimization/build-generated.gradle" +apply from: "codegen/blackbox/when/stringOptimization/build-generated.gradle" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle new file mode 100644 index 00000000000..56a21e90c91 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_annotations_annotatedLambda_funExpression (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotatedLambda/funExpression.kt" +} + +task codegen_blackbox_annotations_annotatedLambda_lambda (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotatedLambda/lambda.kt" +} + +task codegen_blackbox_annotations_annotatedLambda_samFunExpression (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt" +} + +task codegen_blackbox_annotations_annotatedLambda_samLambda (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotatedLambda/samLambda.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle new file mode 100644 index 00000000000..eceae97d5c4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle @@ -0,0 +1,74 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_annotations_annotatedEnumEntry (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotatedEnumEntry.kt" +} + +task codegen_blackbox_annotations_annotatedObjectLiteral (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotatedObjectLiteral.kt" +} + +task codegen_blackbox_annotations_annotationsOnDefault (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotationsOnDefault.kt" +} + +task codegen_blackbox_annotations_annotationsOnTypeAliases (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotationsOnTypeAliases.kt" +} + +task codegen_blackbox_annotations_annotationWithKotlinProperty (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotationWithKotlinProperty.kt" +} + +task codegen_blackbox_annotations_annotationWithKotlinPropertyFromInterfaceCompanion (type: RunExternalTest) { + source = "codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt" +} + +task codegen_blackbox_annotations_defaultParameterValues (type: RunExternalTest) { + source = "codegen/blackbox/annotations/defaultParameterValues.kt" +} + +task codegen_blackbox_annotations_delegatedPropertySetter (type: RunExternalTest) { + source = "codegen/blackbox/annotations/delegatedPropertySetter.kt" +} + +task codegen_blackbox_annotations_fileClassWithFileAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/annotations/fileClassWithFileAnnotation.kt" +} + +task codegen_blackbox_annotations_jvmAnnotationFlags (type: RunExternalTest) { + source = "codegen/blackbox/annotations/jvmAnnotationFlags.kt" +} + +task codegen_blackbox_annotations_kotlinPropertyFromClassObjectAsParameter (type: RunExternalTest) { + source = "codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt" +} + +task codegen_blackbox_annotations_kotlinTopLevelPropertyAsParameter (type: RunExternalTest) { + source = "codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt" +} + +task codegen_blackbox_annotations_kt10136 (type: RunExternalTest) { + source = "codegen/blackbox/annotations/kt10136.kt" +} + +task codegen_blackbox_annotations_nestedClassPropertyAsParameter (type: RunExternalTest) { + source = "codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt" +} + +task codegen_blackbox_annotations_parameterWithPrimitiveType (type: RunExternalTest) { + source = "codegen/blackbox/annotations/parameterWithPrimitiveType.kt" +} + +task codegen_blackbox_annotations_propertyWithPropertyInInitializerAsParameter (type: RunExternalTest) { + source = "codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt" +} + +task codegen_blackbox_annotations_resolveWithLowPriorityAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/annotations/resolveWithLowPriorityAnnotation.kt" +} + +task codegen_blackbox_annotations_varargInAnnotationParameter (type: RunExternalTest) { + source = "codegen/blackbox/annotations/varargInAnnotationParameter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle new file mode 100644 index 00000000000..c15f184f81a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_argumentOrder_arguments (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/arguments.kt" +} + +task codegen_blackbox_argumentOrder_captured (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/captured.kt" +} + +task codegen_blackbox_argumentOrder_capturedInExtension (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/capturedInExtension.kt" +} + +task codegen_blackbox_argumentOrder_defaults (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/defaults.kt" +} + +task codegen_blackbox_argumentOrder_extension (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/extension.kt" +} + +task codegen_blackbox_argumentOrder_extensionInClass (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/extensionInClass.kt" +} + +task codegen_blackbox_argumentOrder_kt9277 (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/kt9277.kt" +} + +task codegen_blackbox_argumentOrder_lambdaMigration (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/lambdaMigration.kt" +} + +task codegen_blackbox_argumentOrder_lambdaMigrationInClass (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/lambdaMigrationInClass.kt" +} + +task codegen_blackbox_argumentOrder_simple (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/simple.kt" +} + +task codegen_blackbox_argumentOrder_simpleInClass (type: RunExternalTest) { + source = "codegen/blackbox/argumentOrder/simpleInClass.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle new file mode 100644 index 00000000000..ed92b77b47d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle @@ -0,0 +1,230 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_arrays_arrayConstructorsSimple (type: RunExternalTest) { + source = "codegen/blackbox/arrays/arrayConstructorsSimple.kt" +} + +task codegen_blackbox_arrays_arrayGetAssignMultiIndex (type: RunExternalTest) { + source = "codegen/blackbox/arrays/arrayGetAssignMultiIndex.kt" +} + +task codegen_blackbox_arrays_arrayGetMultiIndex (type: RunExternalTest) { + source = "codegen/blackbox/arrays/arrayGetMultiIndex.kt" +} + +task codegen_blackbox_arrays_arrayInstanceOf (type: RunExternalTest) { + source = "codegen/blackbox/arrays/arrayInstanceOf.kt" +} + +task codegen_blackbox_arrays_arrayPlusAssign (type: RunExternalTest) { + source = "codegen/blackbox/arrays/arrayPlusAssign.kt" +} + +task codegen_blackbox_arrays_arraysAreCloneable (type: RunExternalTest) { + source = "codegen/blackbox/arrays/arraysAreCloneable.kt" +} + +task codegen_blackbox_arrays_cloneArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/cloneArray.kt" +} + +task codegen_blackbox_arrays_clonePrimitiveArrays (type: RunExternalTest) { + source = "codegen/blackbox/arrays/clonePrimitiveArrays.kt" +} + +task codegen_blackbox_arrays_collectionAssignGetMultiIndex (type: RunExternalTest) { + source = "codegen/blackbox/arrays/collectionAssignGetMultiIndex.kt" +} + +task codegen_blackbox_arrays_collectionGetMultiIndex (type: RunExternalTest) { + source = "codegen/blackbox/arrays/collectionGetMultiIndex.kt" +} + +task codegen_blackbox_arrays_forEachBooleanArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachBooleanArray.kt" +} + +task codegen_blackbox_arrays_forEachByteArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachByteArray.kt" +} + +task codegen_blackbox_arrays_forEachCharArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachCharArray.kt" +} + +task codegen_blackbox_arrays_forEachDoubleArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachDoubleArray.kt" +} + +task codegen_blackbox_arrays_forEachFloatArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachFloatArray.kt" +} + +task codegen_blackbox_arrays_forEachIntArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachIntArray.kt" +} + +task codegen_blackbox_arrays_forEachLongArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachLongArray.kt" +} + +task codegen_blackbox_arrays_forEachShortArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/forEachShortArray.kt" +} + +task codegen_blackbox_arrays_hashMap (type: RunExternalTest) { + source = "codegen/blackbox/arrays/hashMap.kt" +} + +task codegen_blackbox_arrays_indices (type: RunExternalTest) { + source = "codegen/blackbox/arrays/indices.kt" +} + +task codegen_blackbox_arrays_indicesChar (type: RunExternalTest) { + source = "codegen/blackbox/arrays/indicesChar.kt" +} + +task codegen_blackbox_arrays_inProjectionAsParameter (type: RunExternalTest) { + source = "codegen/blackbox/arrays/inProjectionAsParameter.kt" +} + +task codegen_blackbox_arrays_inProjectionOfArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/inProjectionOfArray.kt" +} + +task codegen_blackbox_arrays_inProjectionOfList (type: RunExternalTest) { + source = "codegen/blackbox/arrays/inProjectionOfList.kt" +} + +task codegen_blackbox_arrays_iterator (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iterator.kt" +} + +task codegen_blackbox_arrays_iteratorBooleanArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorBooleanArray.kt" +} + +task codegen_blackbox_arrays_iteratorByteArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorByteArray.kt" +} + +task codegen_blackbox_arrays_iteratorByteArrayNextByte (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorByteArrayNextByte.kt" +} + +task codegen_blackbox_arrays_iteratorCharArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorCharArray.kt" +} + +task codegen_blackbox_arrays_iteratorDoubleArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorDoubleArray.kt" +} + +task codegen_blackbox_arrays_iteratorFloatArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorFloatArray.kt" +} + +task codegen_blackbox_arrays_iteratorIntArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorIntArray.kt" +} + +task codegen_blackbox_arrays_iteratorLongArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorLongArray.kt" +} + +task codegen_blackbox_arrays_iteratorLongArrayNextLong (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorLongArrayNextLong.kt" +} + +task codegen_blackbox_arrays_iteratorShortArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/iteratorShortArray.kt" +} + +task codegen_blackbox_arrays_kt1291 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt1291.kt" +} + +task codegen_blackbox_arrays_kt238 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt238.kt" +} + +task codegen_blackbox_arrays_kt2997 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt2997.kt" +} + +task codegen_blackbox_arrays_kt33 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt33.kt" +} + +task codegen_blackbox_arrays_kt3771 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt3771.kt" +} + +task codegen_blackbox_arrays_kt4118 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt4118.kt" +} + +task codegen_blackbox_arrays_kt4348 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt4348.kt" +} + +task codegen_blackbox_arrays_kt4357 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt4357.kt" +} + +task codegen_blackbox_arrays_kt503 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt503.kt" +} + +task codegen_blackbox_arrays_kt594 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt594.kt" +} + +task codegen_blackbox_arrays_kt602 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt602.kt" +} + +task codegen_blackbox_arrays_kt7009 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt7009.kt" +} + +task codegen_blackbox_arrays_kt7288 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt7288.kt" +} + +task codegen_blackbox_arrays_kt7338 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt7338.kt" +} + +task codegen_blackbox_arrays_kt779 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt779.kt" +} + +task codegen_blackbox_arrays_kt945 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt945.kt" +} + +task codegen_blackbox_arrays_kt950 (type: RunExternalTest) { + source = "codegen/blackbox/arrays/kt950.kt" +} + +task codegen_blackbox_arrays_longAsIndex (type: RunExternalTest) { + source = "codegen/blackbox/arrays/longAsIndex.kt" +} + +task codegen_blackbox_arrays_multiArrayConstructors (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiArrayConstructors.kt" +} + +task codegen_blackbox_arrays_nonLocalReturnArrayConstructor (type: RunExternalTest) { + source = "codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt" +} + +task codegen_blackbox_arrays_nonNullArray (type: RunExternalTest) { + source = "codegen/blackbox/arrays/nonNullArray.kt" +} + +task codegen_blackbox_arrays_stdlib (type: RunExternalTest) { + source = "codegen/blackbox/arrays/stdlib.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle new file mode 100644 index 00000000000..97de5253c2a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_arrays_multiDecl_MultiDeclFor (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/MultiDeclFor.kt" +} + +task codegen_blackbox_arrays_multiDecl_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_arrays_multiDecl_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_arrays_multiDecl_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + +task codegen_blackbox_arrays_multiDecl_MultiDeclForValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/MultiDeclForValCaptured.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle new file mode 100644 index 00000000000..2414f8fe4a9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle new file mode 100644 index 00000000000..d5d294ba40e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle new file mode 100644 index 00000000000..c621537b53c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle @@ -0,0 +1,70 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_binaryOp_bitwiseOp (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/bitwiseOp.kt" +} + +task codegen_blackbox_binaryOp_bitwiseOpAny (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/bitwiseOpAny.kt" +} + +task codegen_blackbox_binaryOp_bitwiseOpNullable (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/bitwiseOpNullable.kt" +} + +task codegen_blackbox_binaryOp_call (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/call.kt" +} + +task codegen_blackbox_binaryOp_callAny (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/callAny.kt" +} + +task codegen_blackbox_binaryOp_callNullable (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/callNullable.kt" +} + +task codegen_blackbox_binaryOp_compareWithBoxedDouble (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/compareWithBoxedDouble.kt" +} + +task codegen_blackbox_binaryOp_compareWithBoxedLong (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/compareWithBoxedLong.kt" +} + +task codegen_blackbox_binaryOp_divisionByZero (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/divisionByZero.kt" +} + +task codegen_blackbox_binaryOp_intrinsic (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/intrinsic.kt" +} + +task codegen_blackbox_binaryOp_intrinsicAny (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/intrinsicAny.kt" +} + +task codegen_blackbox_binaryOp_intrinsicNullable (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/intrinsicNullable.kt" +} + +task codegen_blackbox_binaryOp_kt11163 (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/kt11163.kt" +} + +task codegen_blackbox_binaryOp_kt6747_identityEquals (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/kt6747_identityEquals.kt" +} + +task codegen_blackbox_binaryOp_overflowChar (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/overflowChar.kt" +} + +task codegen_blackbox_binaryOp_overflowInt (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/overflowInt.kt" +} + +task codegen_blackbox_binaryOp_overflowLong (type: RunExternalTest) { + source = "codegen/blackbox/binaryOp/overflowLong.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle new file mode 100644 index 00000000000..a9a401714ff --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_boxingOptimization_casts (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/casts.kt" +} + +task codegen_blackbox_boxingOptimization_checkcastAndInstanceOf (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt" +} + +task codegen_blackbox_boxingOptimization_fold (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/fold.kt" +} + +task codegen_blackbox_boxingOptimization_foldRange (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/foldRange.kt" +} + +task codegen_blackbox_boxingOptimization_kt5493 (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/kt5493.kt" +} + +task codegen_blackbox_boxingOptimization_kt5588 (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/kt5588.kt" +} + +task codegen_blackbox_boxingOptimization_kt5844 (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/kt5844.kt" +} + +task codegen_blackbox_boxingOptimization_kt6047 (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/kt6047.kt" +} + +task codegen_blackbox_boxingOptimization_kt6842 (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/kt6842.kt" +} + +task codegen_blackbox_boxingOptimization_nullCheck (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/nullCheck.kt" +} + +task codegen_blackbox_boxingOptimization_progressions (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/progressions.kt" +} + +task codegen_blackbox_boxingOptimization_safeCallWithElvis (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/safeCallWithElvis.kt" +} + +task codegen_blackbox_boxingOptimization_simple (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/simple.kt" +} + +task codegen_blackbox_boxingOptimization_simpleUninitializedMerge (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/simpleUninitializedMerge.kt" +} + +task codegen_blackbox_boxingOptimization_unsafeRemoving (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/unsafeRemoving.kt" +} + +task codegen_blackbox_boxingOptimization_variables (type: RunExternalTest) { + source = "codegen/blackbox/boxingOptimization/variables.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle new file mode 100644 index 00000000000..b6a5918acc5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle @@ -0,0 +1,190 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_bridges_complexMultiInheritance (type: RunExternalTest) { + source = "codegen/blackbox/bridges/complexMultiInheritance.kt" +} + +task codegen_blackbox_bridges_complexTraitImpl (type: RunExternalTest) { + source = "codegen/blackbox/bridges/complexTraitImpl.kt" +} + +task codegen_blackbox_bridges_delegation (type: RunExternalTest) { + source = "codegen/blackbox/bridges/delegation.kt" +} + +task codegen_blackbox_bridges_delegationComplex (type: RunExternalTest) { + source = "codegen/blackbox/bridges/delegationComplex.kt" +} + +task codegen_blackbox_bridges_delegationComplexWithList (type: RunExternalTest) { + source = "codegen/blackbox/bridges/delegationComplexWithList.kt" +} + +task codegen_blackbox_bridges_delegationProperty (type: RunExternalTest) { + source = "codegen/blackbox/bridges/delegationProperty.kt" +} + +task codegen_blackbox_bridges_diamond (type: RunExternalTest) { + source = "codegen/blackbox/bridges/diamond.kt" +} + +task codegen_blackbox_bridges_fakeCovariantOverride (type: RunExternalTest) { + source = "codegen/blackbox/bridges/fakeCovariantOverride.kt" +} + +task codegen_blackbox_bridges_fakeGenericCovariantOverride (type: RunExternalTest) { + source = "codegen/blackbox/bridges/fakeGenericCovariantOverride.kt" +} + +task codegen_blackbox_bridges_fakeGenericCovariantOverrideWithDelegation (type: RunExternalTest) { + source = "codegen/blackbox/bridges/fakeGenericCovariantOverrideWithDelegation.kt" +} + +task codegen_blackbox_bridges_fakeOverrideOfTraitImpl (type: RunExternalTest) { + source = "codegen/blackbox/bridges/fakeOverrideOfTraitImpl.kt" +} + +task codegen_blackbox_bridges_fakeOverrideWithSeveralSuperDeclarations (type: RunExternalTest) { + source = "codegen/blackbox/bridges/fakeOverrideWithSeveralSuperDeclarations.kt" +} + +task codegen_blackbox_bridges_fakeOverrideWithSynthesizedImplementation (type: RunExternalTest) { + source = "codegen/blackbox/bridges/fakeOverrideWithSynthesizedImplementation.kt" +} + +task codegen_blackbox_bridges_genericProperty (type: RunExternalTest) { + source = "codegen/blackbox/bridges/genericProperty.kt" +} + +task codegen_blackbox_bridges_jsName (type: RunExternalTest) { + source = "codegen/blackbox/bridges/jsName.kt" +} + +task codegen_blackbox_bridges_jsNative (type: RunExternalTest) { + source = "codegen/blackbox/bridges/jsNative.kt" +} + +task codegen_blackbox_bridges_kt12416 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt12416.kt" +} + +task codegen_blackbox_bridges_kt1939 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt1939.kt" +} + +task codegen_blackbox_bridges_kt1959 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt1959.kt" +} + +task codegen_blackbox_bridges_kt2498 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt2498.kt" +} + +task codegen_blackbox_bridges_kt2702 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt2702.kt" +} + +task codegen_blackbox_bridges_kt2833 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt2833.kt" +} + +task codegen_blackbox_bridges_kt2920 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt2920.kt" +} + +task codegen_blackbox_bridges_kt318 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/kt318.kt" +} + +task codegen_blackbox_bridges_longChainOneBridge (type: RunExternalTest) { + source = "codegen/blackbox/bridges/longChainOneBridge.kt" +} + +task codegen_blackbox_bridges_manyTypeArgumentsSubstitutedSuccessively (type: RunExternalTest) { + source = "codegen/blackbox/bridges/manyTypeArgumentsSubstitutedSuccessively.kt" +} + +task codegen_blackbox_bridges_methodFromTrait (type: RunExternalTest) { + source = "codegen/blackbox/bridges/methodFromTrait.kt" +} + +task codegen_blackbox_bridges_noBridgeOnMutableCollectionInheritance (type: RunExternalTest) { + source = "codegen/blackbox/bridges/noBridgeOnMutableCollectionInheritance.kt" +} + +task codegen_blackbox_bridges_objectClone (type: RunExternalTest) { + source = "codegen/blackbox/bridges/objectClone.kt" +} + +task codegen_blackbox_bridges_overrideAbstractProperty (type: RunExternalTest) { + source = "codegen/blackbox/bridges/overrideAbstractProperty.kt" +} + +task codegen_blackbox_bridges_overrideReturnType (type: RunExternalTest) { + source = "codegen/blackbox/bridges/overrideReturnType.kt" +} + +task codegen_blackbox_bridges_propertyAccessorsWithoutBody (type: RunExternalTest) { + source = "codegen/blackbox/bridges/propertyAccessorsWithoutBody.kt" +} + +task codegen_blackbox_bridges_propertyDiamond (type: RunExternalTest) { + source = "codegen/blackbox/bridges/propertyDiamond.kt" +} + +task codegen_blackbox_bridges_propertyInConstructor (type: RunExternalTest) { + source = "codegen/blackbox/bridges/propertyInConstructor.kt" +} + +task codegen_blackbox_bridges_propertySetter (type: RunExternalTest) { + source = "codegen/blackbox/bridges/propertySetter.kt" +} + +task codegen_blackbox_bridges_simple (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simple.kt" +} + +task codegen_blackbox_bridges_simpleEnum (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simpleEnum.kt" +} + +task codegen_blackbox_bridges_simpleGenericMethod (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simpleGenericMethod.kt" +} + +task codegen_blackbox_bridges_simpleObject (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simpleObject.kt" +} + +task codegen_blackbox_bridges_simpleReturnType (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simpleReturnType.kt" +} + +task codegen_blackbox_bridges_simpleTraitImpl (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simpleTraitImpl.kt" +} + +task codegen_blackbox_bridges_simpleUpperBound (type: RunExternalTest) { + source = "codegen/blackbox/bridges/simpleUpperBound.kt" +} + +task codegen_blackbox_bridges_strListContains (type: RunExternalTest) { + source = "codegen/blackbox/bridges/strListContains.kt" +} + +task codegen_blackbox_bridges_traitImplInheritsTraitImpl (type: RunExternalTest) { + source = "codegen/blackbox/bridges/traitImplInheritsTraitImpl.kt" +} + +task codegen_blackbox_bridges_twoParentsWithDifferentMethodsTwoBridges (type: RunExternalTest) { + source = "codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges.kt" +} + +task codegen_blackbox_bridges_twoParentsWithDifferentMethodsTwoBridges2 (type: RunExternalTest) { + source = "codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt" +} + +task codegen_blackbox_bridges_twoParentsWithTheSameMethodOneBridge (type: RunExternalTest) { + source = "codegen/blackbox/bridges/twoParentsWithTheSameMethodOneBridge.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle new file mode 100644 index 00000000000..f2d9278cb6a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_bridges_substitutionInSuperClass_abstractFun (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/abstractFun.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_boundedTypeArguments (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/boundedTypeArguments.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_delegation (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/delegation.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_differentErasureInSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_differentErasureInSuperClassComplex (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_enum (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/enum.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_genericMethod (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/genericMethod.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_object (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/object.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_property (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/property.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_simple (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/simple.kt" +} + +task codegen_blackbox_bridges_substitutionInSuperClass_upperBound (type: RunExternalTest) { + source = "codegen/blackbox/bridges/substitutionInSuperClass/upperBound.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle new file mode 100644 index 00000000000..0c90cf468fc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle @@ -0,0 +1,94 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_builtinStubMethods_abstractMember (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/abstractMember.kt" +} + +task codegen_blackbox_builtinStubMethods_Collection (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/Collection.kt" +} + +task codegen_blackbox_builtinStubMethods_customReadOnlyIterator (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/customReadOnlyIterator.kt" +} + +task codegen_blackbox_builtinStubMethods_delegationToArrayList (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/delegationToArrayList.kt" +} + +task codegen_blackbox_builtinStubMethods_immutableRemove (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/immutableRemove.kt" +} + +task codegen_blackbox_builtinStubMethods_implementationInTrait (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/implementationInTrait.kt" +} + +task codegen_blackbox_builtinStubMethods_inheritedImplementations (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/inheritedImplementations.kt" +} + +task codegen_blackbox_builtinStubMethods_Iterator (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/Iterator.kt" +} + +task codegen_blackbox_builtinStubMethods_IteratorWithRemove (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt" +} + +task codegen_blackbox_builtinStubMethods_List (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/List.kt" +} + +task codegen_blackbox_builtinStubMethods_ListIterator (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/ListIterator.kt" +} + +task codegen_blackbox_builtinStubMethods_ListWithAllImplementations (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt" +} + +task codegen_blackbox_builtinStubMethods_ListWithAllInheritedImplementations (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt" +} + +task codegen_blackbox_builtinStubMethods_manyTypeParametersWithUpperBounds (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/manyTypeParametersWithUpperBounds.kt" +} + +task codegen_blackbox_builtinStubMethods_Map (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/Map.kt" +} + +task codegen_blackbox_builtinStubMethods_MapEntry (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/MapEntry.kt" +} + +task codegen_blackbox_builtinStubMethods_MapEntryWithSetValue (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt" +} + +task codegen_blackbox_builtinStubMethods_MapWithAllImplementations (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt" +} + +task codegen_blackbox_builtinStubMethods_nonTrivialSubstitution (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt" +} + +task codegen_blackbox_builtinStubMethods_nonTrivialUpperBound (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt" +} + +task codegen_blackbox_builtinStubMethods_substitutedIterable (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/substitutedIterable.kt" +} + +task codegen_blackbox_builtinStubMethods_SubstitutedList (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/SubstitutedList.kt" +} + +task codegen_blackbox_builtinStubMethods_substitutedListWithExtraSuperInterface (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle new file mode 100644 index 00000000000..a7e14664184 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_abstractList (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractList.kt" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_abstractMap (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractMap.kt" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_abstractSet (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractSet.kt" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_arrayList (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/arrayList.kt" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_hashMap (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/hashMap.kt" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_hashSet (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/hashSet.kt" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections_mapEntry (type: RunExternalTest) { + source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/mapEntry.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle new file mode 100644 index 00000000000..b0efd5dcebe --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_callableReference_bound_array (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/array.kt" +} + +task codegen_blackbox_callableReference_bound_companionObjectReceiver (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/companionObjectReceiver.kt" +} + +task codegen_blackbox_callableReference_bound_enumEntryMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/enumEntryMember.kt" +} + +task codegen_blackbox_callableReference_bound_kCallableNameIntrinsic (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt" +} + +task codegen_blackbox_callableReference_bound_kt12738 (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/kt12738.kt" +} + +task codegen_blackbox_callableReference_bound_kt15446 (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/kt15446.kt" +} + +task codegen_blackbox_callableReference_bound_multiCase (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/multiCase.kt" +} + +task codegen_blackbox_callableReference_bound_nullReceiver (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/nullReceiver.kt" +} + +task codegen_blackbox_callableReference_bound_objectReceiver (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/objectReceiver.kt" +} + +task codegen_blackbox_callableReference_bound_primitiveReceiver (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/primitiveReceiver.kt" +} + +task codegen_blackbox_callableReference_bound_simpleFunction (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/simpleFunction.kt" +} + +task codegen_blackbox_callableReference_bound_simpleProperty (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/simpleProperty.kt" +} + +task codegen_blackbox_callableReference_bound_syntheticExtensionOnLHS (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/syntheticExtensionOnLHS.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle new file mode 100644 index 00000000000..6a87ba1ea9d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_callableReference_bound_equals_nullableReceiverInEquals (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt" +} + +task codegen_blackbox_callableReference_bound_equals_propertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt" +} + +task codegen_blackbox_callableReference_bound_equals_receiverInEquals (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt" +} + +task codegen_blackbox_callableReference_bound_equals_reflectionReference (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/equals/reflectionReference.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle new file mode 100644 index 00000000000..6147b6278e6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_callableReference_bound_inline_simple (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/inline/simple.kt" +} + +task codegen_blackbox_callableReference_bound_inline_simpleVal (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/bound/inline/simpleVal.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle new file mode 100644 index 00000000000..0c69fcd1d21 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle @@ -0,0 +1,166 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_callableReference_function_abstractClassMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/abstractClassMember.kt" +} + +task codegen_blackbox_callableReference_function_booleanNotIntrinsic (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt" +} + +task codegen_blackbox_callableReference_function_classMemberFromClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/classMemberFromClass.kt" +} + +task codegen_blackbox_callableReference_function_classMemberFromExtension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/classMemberFromExtension.kt" +} + +task codegen_blackbox_callableReference_function_classMemberFromTopLevelStringNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelStringNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_classMemberFromTopLevelStringOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_classMemberFromTopLevelUnitNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_classMemberFromTopLevelUnitOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_constructorFromTopLevelNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/constructorFromTopLevelNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_constructorFromTopLevelOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/constructorFromTopLevelOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_enumValueOfMethod (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/enumValueOfMethod.kt" +} + +task codegen_blackbox_callableReference_function_equalsIntrinsic (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/equalsIntrinsic.kt" +} + +task codegen_blackbox_callableReference_function_extensionFromClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/extensionFromClass.kt" +} + +task codegen_blackbox_callableReference_function_extensionFromExtension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/extensionFromExtension.kt" +} + +task codegen_blackbox_callableReference_function_extensionFromTopLevelStringNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/extensionFromTopLevelStringNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_extensionFromTopLevelStringOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/extensionFromTopLevelStringOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_extensionFromTopLevelUnitNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/extensionFromTopLevelUnitNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_extensionFromTopLevelUnitOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_genericMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/genericMember.kt" +} + +task codegen_blackbox_callableReference_function_getArityViaFunctionImpl (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt" +} + +task codegen_blackbox_callableReference_function_innerConstructorFromClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/innerConstructorFromClass.kt" +} + +task codegen_blackbox_callableReference_function_innerConstructorFromExtension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/innerConstructorFromExtension.kt" +} + +task codegen_blackbox_callableReference_function_innerConstructorFromTopLevelNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/innerConstructorFromTopLevelNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_innerConstructorFromTopLevelOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_javaCollectionsStaticMethod (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt" +} + +task codegen_blackbox_callableReference_function_nestedConstructorFromClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/nestedConstructorFromClass.kt" +} + +task codegen_blackbox_callableReference_function_nestedConstructorFromTopLevelNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_nestedConstructorFromTopLevelOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_newArray (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/newArray.kt" +} + +task codegen_blackbox_callableReference_function_overloadedFun (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/overloadedFun.kt" +} + +task codegen_blackbox_callableReference_function_overloadedFunVsVal (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/overloadedFunVsVal.kt" +} + +task codegen_blackbox_callableReference_function_privateClassMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/privateClassMember.kt" +} + +task codegen_blackbox_callableReference_function_sortListOfStrings (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/sortListOfStrings.kt" +} + +task codegen_blackbox_callableReference_function_topLevelFromClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/topLevelFromClass.kt" +} + +task codegen_blackbox_callableReference_function_topLevelFromExtension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/topLevelFromExtension.kt" +} + +task codegen_blackbox_callableReference_function_topLevelFromTopLevelStringNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelStringNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_topLevelFromTopLevelStringOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_topLevelFromTopLevelUnitNoArgs (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt" +} + +task codegen_blackbox_callableReference_function_topLevelFromTopLevelUnitOneStringArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt" +} + +task codegen_blackbox_callableReference_function_traitImplMethodWithClassReceiver (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/traitImplMethodWithClassReceiver.kt" +} + +task codegen_blackbox_callableReference_function_traitMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/traitMember.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle new file mode 100644 index 00000000000..a045b2474a3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle @@ -0,0 +1,78 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_callableReference_function_local_captureOuter (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/captureOuter.kt" +} + +task codegen_blackbox_callableReference_function_local_classMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/classMember.kt" +} + +task codegen_blackbox_callableReference_function_local_closureWithSideEffect (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/closureWithSideEffect.kt" +} + +task codegen_blackbox_callableReference_function_local_constructor (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/constructor.kt" +} + +task codegen_blackbox_callableReference_function_local_constructorWithInitializer (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/constructorWithInitializer.kt" +} + +task codegen_blackbox_callableReference_function_local_enumExtendsTrait (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/enumExtendsTrait.kt" +} + +task codegen_blackbox_callableReference_function_local_extension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/extension.kt" +} + +task codegen_blackbox_callableReference_function_local_extensionToLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/extensionToLocalClass.kt" +} + +task codegen_blackbox_callableReference_function_local_extensionToPrimitive (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/extensionToPrimitive.kt" +} + +task codegen_blackbox_callableReference_function_local_extensionWithClosure (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/extensionWithClosure.kt" +} + +task codegen_blackbox_callableReference_function_local_genericMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/genericMember.kt" +} + +task codegen_blackbox_callableReference_function_local_localClassMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/localClassMember.kt" +} + +task codegen_blackbox_callableReference_function_local_localFunctionName (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/localFunctionName.kt" +} + +task codegen_blackbox_callableReference_function_local_localLocal (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/localLocal.kt" +} + +task codegen_blackbox_callableReference_function_local_recursiveClosure (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/recursiveClosure.kt" +} + +task codegen_blackbox_callableReference_function_local_simple (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/simple.kt" +} + +task codegen_blackbox_callableReference_function_local_simpleClosure (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/simpleClosure.kt" +} + +task codegen_blackbox_callableReference_function_local_simpleWithArg (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/simpleWithArg.kt" +} + +task codegen_blackbox_callableReference_function_local_unitWithSideEffect (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/function/local/unitWithSideEffect.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle new file mode 100644 index 00000000000..8baf8a03b46 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle @@ -0,0 +1,106 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_callableReference_property_accessViaSubclass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/accessViaSubclass.kt" +} + +task codegen_blackbox_callableReference_property_delegated (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/delegated.kt" +} + +task codegen_blackbox_callableReference_property_delegatedMutable (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/delegatedMutable.kt" +} + +task codegen_blackbox_callableReference_property_enumNameOrdinal (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/enumNameOrdinal.kt" +} + +task codegen_blackbox_callableReference_property_extensionToArray (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/extensionToArray.kt" +} + +task codegen_blackbox_callableReference_property_genericProperty (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/genericProperty.kt" +} + +task codegen_blackbox_callableReference_property_invokePropertyReference (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/invokePropertyReference.kt" +} + +task codegen_blackbox_callableReference_property_javaBeanConvention (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/javaBeanConvention.kt" +} + +task codegen_blackbox_callableReference_property_kClassInstanceIsInitializedFirst (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kClassInstanceIsInitializedFirst.kt" +} + +task codegen_blackbox_callableReference_property_kt12044 (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kt12044.kt" +} + +task codegen_blackbox_callableReference_property_kt12982_protectedPropertyReference (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kt12982_protectedPropertyReference.kt" +} + +task codegen_blackbox_callableReference_property_kt14330 (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kt14330.kt" +} + +task codegen_blackbox_callableReference_property_kt14330_2 (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kt14330_2.kt" +} + +task codegen_blackbox_callableReference_property_kt15447 (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kt15447.kt" +} + +task codegen_blackbox_callableReference_property_kt6870_privatePropertyReference (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt" +} + +task codegen_blackbox_callableReference_property_listOfStringsMapLength (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/listOfStringsMapLength.kt" +} + +task codegen_blackbox_callableReference_property_localClassVar (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/localClassVar.kt" +} + +task codegen_blackbox_callableReference_property_overriddenInSubclass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/overriddenInSubclass.kt" +} + +task codegen_blackbox_callableReference_property_privateSetterInsideClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/privateSetterInsideClass.kt" +} + +task codegen_blackbox_callableReference_property_privateSetterOutsideClass (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt" +} + +task codegen_blackbox_callableReference_property_simpleExtension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/simpleExtension.kt" +} + +task codegen_blackbox_callableReference_property_simpleMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/simpleMember.kt" +} + +task codegen_blackbox_callableReference_property_simpleMutableExtension (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/simpleMutableExtension.kt" +} + +task codegen_blackbox_callableReference_property_simpleMutableMember (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/simpleMutableMember.kt" +} + +task codegen_blackbox_callableReference_property_simpleMutableTopLevel (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/simpleMutableTopLevel.kt" +} + +task codegen_blackbox_callableReference_property_simpleTopLevel (type: RunExternalTest) { + source = "codegen/blackbox/callableReference/property/simpleTopLevel.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle new file mode 100644 index 00000000000..dada0f04f76 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle @@ -0,0 +1,82 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_casts_as (type: RunExternalTest) { + source = "codegen/blackbox/casts/as.kt" +} + +task codegen_blackbox_casts_asForConstants (type: RunExternalTest) { + source = "codegen/blackbox/casts/asForConstants.kt" +} + +task codegen_blackbox_casts_asSafe (type: RunExternalTest) { + source = "codegen/blackbox/casts/asSafe.kt" +} + +task codegen_blackbox_casts_asSafeFail (type: RunExternalTest) { + source = "codegen/blackbox/casts/asSafeFail.kt" +} + +task codegen_blackbox_casts_asSafeForConstants (type: RunExternalTest) { + source = "codegen/blackbox/casts/asSafeForConstants.kt" +} + +task codegen_blackbox_casts_asUnit (type: RunExternalTest) { + source = "codegen/blackbox/casts/asUnit.kt" +} + +task codegen_blackbox_casts_asWithGeneric (type: RunExternalTest) { + source = "codegen/blackbox/casts/asWithGeneric.kt" +} + +task codegen_blackbox_casts_castGenericNull (type: RunExternalTest) { + source = "codegen/blackbox/casts/castGenericNull.kt" +} + +task codegen_blackbox_casts_intersectionTypeMultipleBounds (type: RunExternalTest) { + source = "codegen/blackbox/casts/intersectionTypeMultipleBounds.kt" +} + +task codegen_blackbox_casts_intersectionTypeMultipleBoundsImplicitReceiver (type: RunExternalTest) { + source = "codegen/blackbox/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt" +} + +task codegen_blackbox_casts_intersectionTypeSmartcast (type: RunExternalTest) { + source = "codegen/blackbox/casts/intersectionTypeSmartcast.kt" +} + +task codegen_blackbox_casts_intersectionTypeWithMultipleBoundsAsReceiver (type: RunExternalTest) { + source = "codegen/blackbox/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt" +} + +task codegen_blackbox_casts_intersectionTypeWithoutGenericsAsReceiver (type: RunExternalTest) { + source = "codegen/blackbox/casts/intersectionTypeWithoutGenericsAsReceiver.kt" +} + +task codegen_blackbox_casts_is (type: RunExternalTest) { + source = "codegen/blackbox/casts/is.kt" +} + +task codegen_blackbox_casts_lambdaToUnitCast (type: RunExternalTest) { + source = "codegen/blackbox/casts/lambdaToUnitCast.kt" +} + +task codegen_blackbox_casts_notIs (type: RunExternalTest) { + source = "codegen/blackbox/casts/notIs.kt" +} + +task codegen_blackbox_casts_unitAsAny (type: RunExternalTest) { + source = "codegen/blackbox/casts/unitAsAny.kt" +} + +task codegen_blackbox_casts_unitAsInt (type: RunExternalTest) { + source = "codegen/blackbox/casts/unitAsInt.kt" +} + +task codegen_blackbox_casts_unitAsSafeAny (type: RunExternalTest) { + source = "codegen/blackbox/casts/unitAsSafeAny.kt" +} + +task codegen_blackbox_casts_unitNullableCast (type: RunExternalTest) { + source = "codegen/blackbox/casts/unitNullableCast.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle new file mode 100644 index 00000000000..09bae99c38c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_casts_functions_asFunKBig (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/asFunKBig.kt" +} + +task codegen_blackbox_casts_functions_asFunKSmall (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/asFunKSmall.kt" +} + +task codegen_blackbox_casts_functions_isFunKBig (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/isFunKBig.kt" +} + +task codegen_blackbox_casts_functions_isFunKSmall (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/isFunKSmall.kt" +} + +task codegen_blackbox_casts_functions_javaTypeIsFunK (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/javaTypeIsFunK.kt" +} + +task codegen_blackbox_casts_functions_reifiedAsFunKBig (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/reifiedAsFunKBig.kt" +} + +task codegen_blackbox_casts_functions_reifiedAsFunKSmall (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt" +} + +task codegen_blackbox_casts_functions_reifiedIsFunKBig (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/reifiedIsFunKBig.kt" +} + +task codegen_blackbox_casts_functions_reifiedIsFunKSmall (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt" +} + +task codegen_blackbox_casts_functions_reifiedSafeAsFunKBig (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt" +} + +task codegen_blackbox_casts_functions_reifiedSafeAsFunKSmall (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt" +} + +task codegen_blackbox_casts_functions_safeAsFunKBig (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/safeAsFunKBig.kt" +} + +task codegen_blackbox_casts_functions_safeAsFunKSmall (type: RunExternalTest) { + source = "codegen/blackbox/casts/functions/safeAsFunKSmall.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle new file mode 100644 index 00000000000..30ed41e9fc8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_binaryExpressionCast (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_javaBox (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_labeledExpressionCast (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_parenthesizedExpressionCast (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_superConstructor (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/superConstructor.kt" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_unaryExpressionCast (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument_vararg (type: RunExternalTest) { + source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/vararg.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle new file mode 100644 index 00000000000..aa4f4f22706 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle @@ -0,0 +1,34 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_casts_mutableCollections_asWithMutable (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/asWithMutable.kt" +} + +task codegen_blackbox_casts_mutableCollections_isWithMutable (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/isWithMutable.kt" +} + +task codegen_blackbox_casts_mutableCollections_mutabilityMarkerInterfaces (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt" +} + +task codegen_blackbox_casts_mutableCollections_reifiedAsWithMutable (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/reifiedAsWithMutable.kt" +} + +task codegen_blackbox_casts_mutableCollections_reifiedIsWithMutable (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/reifiedIsWithMutable.kt" +} + +task codegen_blackbox_casts_mutableCollections_reifiedSafeAsWithMutable (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/reifiedSafeAsWithMutable.kt" +} + +task codegen_blackbox_casts_mutableCollections_safeAsWithMutable (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/safeAsWithMutable.kt" +} + +task codegen_blackbox_casts_mutableCollections_weirdMutableCasts (type: RunExternalTest) { + source = "codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle new file mode 100644 index 00000000000..258cf6f26d8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_classLiteral_bound_javaIntrinsicWithSideEffect (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt" +} + +task codegen_blackbox_classLiteral_bound_primitives (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/bound/primitives.kt" +} + +task codegen_blackbox_classLiteral_bound_sideEffect (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/bound/sideEffect.kt" +} + +task codegen_blackbox_classLiteral_bound_simple (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/bound/simple.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle new file mode 100644 index 00000000000..c7fc2724961 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_classLiteral_primitiveKClassEquality (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/primitiveKClassEquality.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle new file mode 100644 index 00000000000..114205a30a8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle @@ -0,0 +1,34 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_classLiteral_java_java (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/java.kt" +} + +task codegen_blackbox_classLiteral_java_javaObjectType (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/javaObjectType.kt" +} + +task codegen_blackbox_classLiteral_java_javaObjectTypeReified (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt" +} + +task codegen_blackbox_classLiteral_java_javaPrimitiveType (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/javaPrimitiveType.kt" +} + +task codegen_blackbox_classLiteral_java_javaPrimitiveTypeReified (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt" +} + +task codegen_blackbox_classLiteral_java_javaReified (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/javaReified.kt" +} + +task codegen_blackbox_classLiteral_java_kt11943 (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/kt11943.kt" +} + +task codegen_blackbox_classLiteral_java_objectSuperConstructorCall (type: RunExternalTest) { + source = "codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle new file mode 100644 index 00000000000..8cc9d66117f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle @@ -0,0 +1,458 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_classes_boxPrimitiveTypeInClinitOfClassObject (type: RunExternalTest) { + source = "codegen/blackbox/classes/boxPrimitiveTypeInClinitOfClassObject.kt" +} + +task codegen_blackbox_classes_classCompanionInitializationWithJava (type: RunExternalTest) { + source = "codegen/blackbox/classes/classCompanionInitializationWithJava.kt" +} + +task codegen_blackbox_classes_classNamedAsOldPackageFacade (type: RunExternalTest) { + source = "codegen/blackbox/classes/classNamedAsOldPackageFacade.kt" +} + +task codegen_blackbox_classes_classObject (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObject.kt" +} + +task codegen_blackbox_classes_classObjectAsExtensionReceiver (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectAsExtensionReceiver.kt" +} + +task codegen_blackbox_classes_classObjectAsStaticInitializer (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectAsStaticInitializer.kt" +} + +task codegen_blackbox_classes_classObjectField (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectField.kt" +} + +task codegen_blackbox_classes_classObjectInTrait (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectInTrait.kt" +} + +task codegen_blackbox_classes_classObjectNotOfEnum (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectNotOfEnum.kt" +} + +task codegen_blackbox_classes_classObjectsWithParentClasses (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectsWithParentClasses.kt" +} + +task codegen_blackbox_classes_classObjectToString (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectToString.kt" +} + +task codegen_blackbox_classes_classObjectWithPrivateGenericMember (type: RunExternalTest) { + source = "codegen/blackbox/classes/classObjectWithPrivateGenericMember.kt" +} + +task codegen_blackbox_classes_defaultObjectSameNamesAsInOuter (type: RunExternalTest) { + source = "codegen/blackbox/classes/defaultObjectSameNamesAsInOuter.kt" +} + +task codegen_blackbox_classes_delegation2 (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegation2.kt" +} + +task codegen_blackbox_classes_delegation3 (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegation3.kt" +} + +task codegen_blackbox_classes_delegation4 (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegation4.kt" +} + +task codegen_blackbox_classes_delegationGenericArg (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegationGenericArg.kt" +} + +task codegen_blackbox_classes_delegationGenericArgUpperBound (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegationGenericArgUpperBound.kt" +} + +task codegen_blackbox_classes_delegationGenericLongArg (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegationGenericLongArg.kt" +} + +task codegen_blackbox_classes_delegationJava (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegationJava.kt" +} + +task codegen_blackbox_classes_delegationMethodsWithArgs (type: RunExternalTest) { + source = "codegen/blackbox/classes/delegationMethodsWithArgs.kt" +} + +task codegen_blackbox_classes_exceptionConstructor (type: RunExternalTest) { + source = "codegen/blackbox/classes/exceptionConstructor.kt" +} + +task codegen_blackbox_classes_extensionOnNamedClassObject (type: RunExternalTest) { + source = "codegen/blackbox/classes/extensionOnNamedClassObject.kt" +} + +task codegen_blackbox_classes_funDelegation (type: RunExternalTest) { + source = "codegen/blackbox/classes/funDelegation.kt" +} + +task codegen_blackbox_classes_implementComparableInSubclass (type: RunExternalTest) { + source = "codegen/blackbox/classes/implementComparableInSubclass.kt" +} + +task codegen_blackbox_classes_inheritance (type: RunExternalTest) { + source = "codegen/blackbox/classes/inheritance.kt" +} + +task codegen_blackbox_classes_inheritedInnerClass (type: RunExternalTest) { + source = "codegen/blackbox/classes/inheritedInnerClass.kt" +} + +task codegen_blackbox_classes_inheritedMethod (type: RunExternalTest) { + source = "codegen/blackbox/classes/inheritedMethod.kt" +} + +task codegen_blackbox_classes_inheritSetAndHashSet (type: RunExternalTest) { + source = "codegen/blackbox/classes/inheritSetAndHashSet.kt" +} + +task codegen_blackbox_classes_initializerBlock (type: RunExternalTest) { + source = "codegen/blackbox/classes/initializerBlock.kt" +} + +task codegen_blackbox_classes_initializerBlockDImpl (type: RunExternalTest) { + source = "codegen/blackbox/classes/initializerBlockDImpl.kt" +} + +task codegen_blackbox_classes_innerClass (type: RunExternalTest) { + source = "codegen/blackbox/classes/innerClass.kt" +} + +task codegen_blackbox_classes_interfaceCompanionInitializationWithJava (type: RunExternalTest) { + source = "codegen/blackbox/classes/interfaceCompanionInitializationWithJava.kt" +} + +task codegen_blackbox_classes_kt1018 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1018.kt" +} + +task codegen_blackbox_classes_kt1120 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1120.kt" +} + +task codegen_blackbox_classes_kt1134 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1134.kt" +} + +task codegen_blackbox_classes_kt1157 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1157.kt" +} + +task codegen_blackbox_classes_kt1247 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1247.kt" +} + +task codegen_blackbox_classes_kt1345 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1345.kt" +} + +task codegen_blackbox_classes_kt1439 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1439.kt" +} + +task codegen_blackbox_classes_kt1535 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1535.kt" +} + +task codegen_blackbox_classes_kt1538 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1538.kt" +} + +task codegen_blackbox_classes_kt1578 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1578.kt" +} + +task codegen_blackbox_classes_kt1611 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1611.kt" +} + +task codegen_blackbox_classes_kt1721 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1721.kt" +} + +task codegen_blackbox_classes_kt1726 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1726.kt" +} + +task codegen_blackbox_classes_kt1759 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1759.kt" +} + +task codegen_blackbox_classes_kt1891 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1891.kt" +} + +task codegen_blackbox_classes_kt1918 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1918.kt" +} + +task codegen_blackbox_classes_kt1976 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1976.kt" +} + +task codegen_blackbox_classes_kt1980 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt1980.kt" +} + +task codegen_blackbox_classes_kt2224 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2224.kt" +} + +task codegen_blackbox_classes_kt2288 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2288.kt" +} + +task codegen_blackbox_classes_kt2384 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2384.kt" +} + +task codegen_blackbox_classes_kt2390 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2390.kt" +} + +task codegen_blackbox_classes_kt2391 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2391.kt" +} + +task codegen_blackbox_classes_kt2395 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2395.kt" +} + +task codegen_blackbox_classes_kt2417 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2417.kt" +} + +task codegen_blackbox_classes_kt2477 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2477.kt" +} + +task codegen_blackbox_classes_kt2480 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2480.kt" +} + +task codegen_blackbox_classes_kt2482 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2482.kt" +} + +task codegen_blackbox_classes_kt2485 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2485.kt" +} + +task codegen_blackbox_classes_kt249 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt249.kt" +} + +task codegen_blackbox_classes_kt2532 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2532.kt" +} + +task codegen_blackbox_classes_kt2566 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2566.kt" +} + +task codegen_blackbox_classes_kt2566_2 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2566_2.kt" +} + +task codegen_blackbox_classes_kt2607 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2607.kt" +} + +task codegen_blackbox_classes_kt2626 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2626.kt" +} + +task codegen_blackbox_classes_kt2711 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2711.kt" +} + +task codegen_blackbox_classes_kt2784 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt2784.kt" +} + +task codegen_blackbox_classes_kt285 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt285.kt" +} + +task codegen_blackbox_classes_kt3001 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt3001.kt" +} + +task codegen_blackbox_classes_kt3114 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt3114.kt" +} + +task codegen_blackbox_classes_kt3414 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt3414.kt" +} + +task codegen_blackbox_classes_kt343 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt343.kt" +} + +task codegen_blackbox_classes_kt3546 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt3546.kt" +} + +task codegen_blackbox_classes_kt454 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt454.kt" +} + +task codegen_blackbox_classes_kt471 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt471.kt" +} + +task codegen_blackbox_classes_kt48 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt48.kt" +} + +task codegen_blackbox_classes_kt496 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt496.kt" +} + +task codegen_blackbox_classes_kt500 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt500.kt" +} + +task codegen_blackbox_classes_kt501 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt501.kt" +} + +task codegen_blackbox_classes_kt504 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt504.kt" +} + +task codegen_blackbox_classes_kt508 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt508.kt" +} + +task codegen_blackbox_classes_kt5347 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt5347.kt" +} + +task codegen_blackbox_classes_kt6136 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt6136.kt" +} + +task codegen_blackbox_classes_kt633 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt633.kt" +} + +task codegen_blackbox_classes_kt6816 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt6816.kt" +} + +task codegen_blackbox_classes_kt707 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt707.kt" +} + +task codegen_blackbox_classes_kt723 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt723.kt" +} + +task codegen_blackbox_classes_kt725 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt725.kt" +} + +task codegen_blackbox_classes_kt8011 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt8011.kt" +} + +task codegen_blackbox_classes_kt8011a (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt8011a.kt" +} + +task codegen_blackbox_classes_kt903 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt903.kt" +} + +task codegen_blackbox_classes_kt940 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt940.kt" +} + +task codegen_blackbox_classes_kt9642 (type: RunExternalTest) { + source = "codegen/blackbox/classes/kt9642.kt" +} + +task codegen_blackbox_classes_namedClassObject (type: RunExternalTest) { + source = "codegen/blackbox/classes/namedClassObject.kt" +} + +task codegen_blackbox_classes_outerThis (type: RunExternalTest) { + source = "codegen/blackbox/classes/outerThis.kt" +} + +task codegen_blackbox_classes_overloadBinaryOperator (type: RunExternalTest) { + source = "codegen/blackbox/classes/overloadBinaryOperator.kt" +} + +task codegen_blackbox_classes_overloadPlusAssign (type: RunExternalTest) { + source = "codegen/blackbox/classes/overloadPlusAssign.kt" +} + +task codegen_blackbox_classes_overloadPlusAssignReturn (type: RunExternalTest) { + source = "codegen/blackbox/classes/overloadPlusAssignReturn.kt" +} + +task codegen_blackbox_classes_overloadPlusToPlusAssign (type: RunExternalTest) { + source = "codegen/blackbox/classes/overloadPlusToPlusAssign.kt" +} + +task codegen_blackbox_classes_overloadUnaryOperator (type: RunExternalTest) { + source = "codegen/blackbox/classes/overloadUnaryOperator.kt" +} + +task codegen_blackbox_classes_privateOuterFunctions (type: RunExternalTest) { + source = "codegen/blackbox/classes/privateOuterFunctions.kt" +} + +task codegen_blackbox_classes_privateOuterProperty (type: RunExternalTest) { + source = "codegen/blackbox/classes/privateOuterProperty.kt" +} + +task codegen_blackbox_classes_privateToThis (type: RunExternalTest) { + source = "codegen/blackbox/classes/privateToThis.kt" +} + +task codegen_blackbox_classes_propertyDelegation (type: RunExternalTest) { + source = "codegen/blackbox/classes/propertyDelegation.kt" +} + +task codegen_blackbox_classes_propertyInInitializer (type: RunExternalTest) { + source = "codegen/blackbox/classes/propertyInInitializer.kt" +} + +task codegen_blackbox_classes_rightHandOverride (type: RunExternalTest) { + source = "codegen/blackbox/classes/rightHandOverride.kt" +} + +task codegen_blackbox_classes_sealedInSameFile (type: RunExternalTest) { + source = "codegen/blackbox/classes/sealedInSameFile.kt" +} + +task codegen_blackbox_classes_selfcreate (type: RunExternalTest) { + source = "codegen/blackbox/classes/selfcreate.kt" +} + +task codegen_blackbox_classes_simpleBox (type: RunExternalTest) { + source = "codegen/blackbox/classes/simpleBox.kt" +} + +task codegen_blackbox_classes_superConstructorCallWithComplexArg (type: RunExternalTest) { + source = "codegen/blackbox/classes/superConstructorCallWithComplexArg.kt" +} + +task codegen_blackbox_classes_typedDelegation (type: RunExternalTest) { + source = "codegen/blackbox/classes/typedDelegation.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle new file mode 100644 index 00000000000..0b6b2f86520 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_classes_inner_instantiateInDerived (type: RunExternalTest) { + source = "codegen/blackbox/classes/inner/instantiateInDerived.kt" +} + +task codegen_blackbox_classes_inner_instantiateInDerivedLabeled (type: RunExternalTest) { + source = "codegen/blackbox/classes/inner/instantiateInDerivedLabeled.kt" +} + +task codegen_blackbox_classes_inner_instantiateInSameClass (type: RunExternalTest) { + source = "codegen/blackbox/classes/inner/instantiateInSameClass.kt" +} + +task codegen_blackbox_classes_inner_kt6708 (type: RunExternalTest) { + source = "codegen/blackbox/classes/inner/kt6708.kt" +} + +task codegen_blackbox_classes_inner_properOuter (type: RunExternalTest) { + source = "codegen/blackbox/classes/inner/properOuter.kt" +} + +task codegen_blackbox_classes_inner_properSuperLinking (type: RunExternalTest) { + source = "codegen/blackbox/classes/inner/properSuperLinking.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle new file mode 100644 index 00000000000..337ebd665d3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle @@ -0,0 +1,150 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_closures_capturedLocalGenericFun (type: RunExternalTest) { + source = "codegen/blackbox/closures/capturedLocalGenericFun.kt" +} + +task codegen_blackbox_closures_captureExtensionReceiver (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureExtensionReceiver.kt" +} + +task codegen_blackbox_closures_closureInsideConstrucor (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideConstrucor.kt" +} + +task codegen_blackbox_closures_closureOnTopLevel1 (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureOnTopLevel1.kt" +} + +task codegen_blackbox_closures_closureOnTopLevel2 (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureOnTopLevel2.kt" +} + +task codegen_blackbox_closures_closureWithParameter (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureWithParameter.kt" +} + +task codegen_blackbox_closures_closureWithParameterAndBoxing (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureWithParameterAndBoxing.kt" +} + +task codegen_blackbox_closures_doubleEnclosedLocalVariable (type: RunExternalTest) { + source = "codegen/blackbox/closures/doubleEnclosedLocalVariable.kt" +} + +task codegen_blackbox_closures_enclosingLocalVariable (type: RunExternalTest) { + source = "codegen/blackbox/closures/enclosingLocalVariable.kt" +} + +task codegen_blackbox_closures_enclosingThis (type: RunExternalTest) { + source = "codegen/blackbox/closures/enclosingThis.kt" +} + +task codegen_blackbox_closures_extensionClosure (type: RunExternalTest) { + source = "codegen/blackbox/closures/extensionClosure.kt" +} + +task codegen_blackbox_closures_kt10044 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt10044.kt" +} + +task codegen_blackbox_closures_kt11634 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt11634.kt" +} + +task codegen_blackbox_closures_kt11634_2 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt11634_2.kt" +} + +task codegen_blackbox_closures_kt11634_3 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt11634_3.kt" +} + +task codegen_blackbox_closures_kt11634_4 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt11634_4.kt" +} + +task codegen_blackbox_closures_kt2151 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt2151.kt" +} + +task codegen_blackbox_closures_kt3152 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt3152.kt" +} + +task codegen_blackbox_closures_kt3523 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt3523.kt" +} + +task codegen_blackbox_closures_kt3738 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt3738.kt" +} + +task codegen_blackbox_closures_kt3905 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt3905.kt" +} + +task codegen_blackbox_closures_kt4106 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt4106.kt" +} + +task codegen_blackbox_closures_kt4137 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt4137.kt" +} + +task codegen_blackbox_closures_kt5589 (type: RunExternalTest) { + source = "codegen/blackbox/closures/kt5589.kt" +} + +task codegen_blackbox_closures_localClassFunClosure (type: RunExternalTest) { + source = "codegen/blackbox/closures/localClassFunClosure.kt" +} + +task codegen_blackbox_closures_localClassLambdaClosure (type: RunExternalTest) { + source = "codegen/blackbox/closures/localClassLambdaClosure.kt" +} + +task codegen_blackbox_closures_localFunctionInFunction (type: RunExternalTest) { + source = "codegen/blackbox/closures/localFunctionInFunction.kt" +} + +task codegen_blackbox_closures_localFunctionInInitializer (type: RunExternalTest) { + source = "codegen/blackbox/closures/localFunctionInInitializer.kt" +} + +task codegen_blackbox_closures_localGenericFun (type: RunExternalTest) { + source = "codegen/blackbox/closures/localGenericFun.kt" +} + +task codegen_blackbox_closures_localReturn (type: RunExternalTest) { + source = "codegen/blackbox/closures/localReturn.kt" +} + +task codegen_blackbox_closures_localReturnWithAutolabel (type: RunExternalTest) { + source = "codegen/blackbox/closures/localReturnWithAutolabel.kt" +} + +task codegen_blackbox_closures_noRefToOuter (type: RunExternalTest) { + source = "codegen/blackbox/closures/noRefToOuter.kt" +} + +task codegen_blackbox_closures_recursiveClosure (type: RunExternalTest) { + source = "codegen/blackbox/closures/recursiveClosure.kt" +} + +task codegen_blackbox_closures_simplestClosure (type: RunExternalTest) { + source = "codegen/blackbox/closures/simplestClosure.kt" +} + +task codegen_blackbox_closures_simplestClosureAndBoxing (type: RunExternalTest) { + source = "codegen/blackbox/closures/simplestClosureAndBoxing.kt" +} + +task codegen_blackbox_closures_subclosuresWithinInitializers (type: RunExternalTest) { + source = "codegen/blackbox/closures/subclosuresWithinInitializers.kt" +} + +task codegen_blackbox_closures_underscoreParameters (type: RunExternalTest) { + source = "codegen/blackbox/closures/underscoreParameters.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle new file mode 100644 index 00000000000..552b3079aa2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle @@ -0,0 +1,34 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_closures_captureOuterProperty_captureFunctionInProperty (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/captureFunctionInProperty.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_inFunction (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/inFunction.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_inProperty (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/inProperty.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_inPropertyDeepObjectChain (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/inPropertyDeepObjectChain.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_inPropertyFromSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperClass.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_inPropertyFromSuperSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_kt4176 (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/kt4176.kt" +} + +task codegen_blackbox_closures_captureOuterProperty_kt4656 (type: RunExternalTest) { + source = "codegen/blackbox/closures/captureOuterProperty/kt4656.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle new file mode 100644 index 00000000000..0bd7ff2623a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_closures_closureInsideClosure_localFunInsideLocalFun (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFun.kt" +} + +task codegen_blackbox_closures_closureInsideClosure_localFunInsideLocalFunDifferentSignatures (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt" +} + +task codegen_blackbox_closures_closureInsideClosure_propertyAndFunctionNameClash (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideClosure/propertyAndFunctionNameClash.kt" +} + +task codegen_blackbox_closures_closureInsideClosure_threeLevels (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideClosure/threeLevels.kt" +} + +task codegen_blackbox_closures_closureInsideClosure_threeLevelsDifferentSignatures (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt" +} + +task codegen_blackbox_closures_closureInsideClosure_varAsFunInsideLocalFun (type: RunExternalTest) { + source = "codegen/blackbox/closures/closureInsideClosure/varAsFunInsideLocalFun.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle new file mode 100644 index 00000000000..ac248c2874e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle @@ -0,0 +1,74 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_collections_charSequence (type: RunExternalTest) { + source = "codegen/blackbox/collections/charSequence.kt" +} + +task codegen_blackbox_collections_implementCollectionThroughKotlin (type: RunExternalTest) { + source = "codegen/blackbox/collections/implementCollectionThroughKotlin.kt" +} + +task codegen_blackbox_collections_inSetWithSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/collections/inSetWithSmartCast.kt" +} + +task codegen_blackbox_collections_irrelevantImplCharSequence (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantImplCharSequence.kt" +} + +task codegen_blackbox_collections_irrelevantImplCharSequenceKotlin (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt" +} + +task codegen_blackbox_collections_irrelevantImplMutableList (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantImplMutableList.kt" +} + +task codegen_blackbox_collections_irrelevantImplMutableListKotlin (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt" +} + +task codegen_blackbox_collections_irrelevantImplMutableListSubstitution (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantImplMutableListSubstitution.kt" +} + +task codegen_blackbox_collections_irrelevantRemoveAtOverrideInJava (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantRemoveAtOverrideInJava.kt" +} + +task codegen_blackbox_collections_irrelevantSizeOverrideInJava (type: RunExternalTest) { + source = "codegen/blackbox/collections/irrelevantSizeOverrideInJava.kt" +} + +task codegen_blackbox_collections_mutableList (type: RunExternalTest) { + source = "codegen/blackbox/collections/mutableList.kt" +} + +task codegen_blackbox_collections_noStubsInJavaSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/collections/noStubsInJavaSuperClass.kt" +} + +task codegen_blackbox_collections_platformValueContains (type: RunExternalTest) { + source = "codegen/blackbox/collections/platformValueContains.kt" +} + +task codegen_blackbox_collections_readOnlyList (type: RunExternalTest) { + source = "codegen/blackbox/collections/readOnlyList.kt" +} + +task codegen_blackbox_collections_readOnlyMap (type: RunExternalTest) { + source = "codegen/blackbox/collections/readOnlyMap.kt" +} + +task codegen_blackbox_collections_removeAtInt (type: RunExternalTest) { + source = "codegen/blackbox/collections/removeAtInt.kt" +} + +task codegen_blackbox_collections_strList (type: RunExternalTest) { + source = "codegen/blackbox/collections/strList.kt" +} + +task codegen_blackbox_collections_toArrayInJavaClass (type: RunExternalTest) { + source = "codegen/blackbox/collections/toArrayInJavaClass.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle new file mode 100644 index 00000000000..7f6f3319a0b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_compatibility_dataClassEqualsHashCodeToString (type: RunExternalTest) { + source = "codegen/blackbox/compatibility/dataClassEqualsHashCodeToString.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle new file mode 100644 index 00000000000..9472bc858ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_constants_constantsInWhen (type: RunExternalTest) { + source = "codegen/blackbox/constants/constantsInWhen.kt" +} + +task codegen_blackbox_constants_float (type: RunExternalTest) { + source = "codegen/blackbox/constants/float.kt" +} + +task codegen_blackbox_constants_kt9532 (type: RunExternalTest) { + source = "codegen/blackbox/constants/kt9532.kt" +} + +task codegen_blackbox_constants_long (type: RunExternalTest) { + source = "codegen/blackbox/constants/long.kt" +} + +task codegen_blackbox_constants_privateConst (type: RunExternalTest) { + source = "codegen/blackbox/constants/privateConst.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle new file mode 100644 index 00000000000..a16b2212325 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_controlStructures_breakContinueInExpressions_breakFromOuter (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_breakInDoWhile (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/breakInDoWhile.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_breakInExpr (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/breakInExpr.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_continueInDoWhile (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/continueInDoWhile.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_continueInExpr (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/continueInExpr.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_inlineWithStack (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/inlineWithStack.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_innerLoopWithStack (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_kt14581 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/kt14581.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_kt9022And (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022And.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_kt9022Or (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022Or.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_popSizes (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/popSizes.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_tryFinally1 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally1.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_tryFinally2 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally2.kt" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions_whileTrueBreak (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakContinueInExpressions/whileTrueBreak.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle new file mode 100644 index 00000000000..0cdf521e7aa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle @@ -0,0 +1,270 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_controlStructures_bottles (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/bottles.kt" +} + +task codegen_blackbox_controlStructures_breakInFinally (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/breakInFinally.kt" +} + +task codegen_blackbox_controlStructures_compareBoxedIntegerToZero (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/compareBoxedIntegerToZero.kt" +} + +task codegen_blackbox_controlStructures_conditionOfEmptyIf (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/conditionOfEmptyIf.kt" +} + +task codegen_blackbox_controlStructures_continueInExpr (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/continueInExpr.kt" +} + +task codegen_blackbox_controlStructures_continueInFor (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/continueInFor.kt" +} + +task codegen_blackbox_controlStructures_continueInForCondition (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/continueInForCondition.kt" +} + +task codegen_blackbox_controlStructures_continueInWhile (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/continueInWhile.kt" +} + +task codegen_blackbox_controlStructures_continueToLabelInFor (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/continueToLabelInFor.kt" +} + +task codegen_blackbox_controlStructures_doWhile (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/doWhile.kt" +} + +task codegen_blackbox_controlStructures_doWhileFib (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/doWhileFib.kt" +} + +task codegen_blackbox_controlStructures_doWhileWithContinue (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/doWhileWithContinue.kt" +} + +task codegen_blackbox_controlStructures_emptyDoWhile (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/emptyDoWhile.kt" +} + +task codegen_blackbox_controlStructures_emptyFor (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/emptyFor.kt" +} + +task codegen_blackbox_controlStructures_emptyWhile (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/emptyWhile.kt" +} + +task codegen_blackbox_controlStructures_factorialTest (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/factorialTest.kt" +} + +task codegen_blackbox_controlStructures_finallyOnEmptyReturn (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/finallyOnEmptyReturn.kt" +} + +task codegen_blackbox_controlStructures_forArrayList (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forArrayList.kt" +} + +task codegen_blackbox_controlStructures_forArrayListMultiDecl (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forArrayListMultiDecl.kt" +} + +task codegen_blackbox_controlStructures_forInSmartCastToArray (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forInSmartCastToArray.kt" +} + +task codegen_blackbox_controlStructures_forIntArray (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forIntArray.kt" +} + +task codegen_blackbox_controlStructures_forLoopMemberExtensionAll (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt" +} + +task codegen_blackbox_controlStructures_forLoopMemberExtensionHasNext (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forLoopMemberExtensionHasNext.kt" +} + +task codegen_blackbox_controlStructures_forLoopMemberExtensionNext (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt" +} + +task codegen_blackbox_controlStructures_forNullableIntArray (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forNullableIntArray.kt" +} + +task codegen_blackbox_controlStructures_forPrimitiveIntArray (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forPrimitiveIntArray.kt" +} + +task codegen_blackbox_controlStructures_forUserType (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/forUserType.kt" +} + +task codegen_blackbox_controlStructures_inRangeConditionsInWhen (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/inRangeConditionsInWhen.kt" +} + +task codegen_blackbox_controlStructures_kt12908 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt12908.kt" +} + +task codegen_blackbox_controlStructures_kt12908_2 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt12908_2.kt" +} + +task codegen_blackbox_controlStructures_kt1441 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt1441.kt" +} + +task codegen_blackbox_controlStructures_kt14839 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt14839.kt" +} + +task codegen_blackbox_controlStructures_kt1688 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt1688.kt" +} + +task codegen_blackbox_controlStructures_kt1742 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt1742.kt" +} + +task codegen_blackbox_controlStructures_kt1899 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt1899.kt" +} + +task codegen_blackbox_controlStructures_kt2147 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2147.kt" +} + +task codegen_blackbox_controlStructures_kt2259 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2259.kt" +} + +task codegen_blackbox_controlStructures_kt2291 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2291.kt" +} + +task codegen_blackbox_controlStructures_kt237 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt237.kt" +} + +task codegen_blackbox_controlStructures_kt2416 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2416.kt" +} + +task codegen_blackbox_controlStructures_kt2423 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2423.kt" +} + +task codegen_blackbox_controlStructures_kt2577 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2577.kt" +} + +task codegen_blackbox_controlStructures_kt2597 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt2597.kt" +} + +task codegen_blackbox_controlStructures_kt299 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt299.kt" +} + +task codegen_blackbox_controlStructures_kt3087 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt3087.kt" +} + +task codegen_blackbox_controlStructures_kt3203_1 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt3203_1.kt" +} + +task codegen_blackbox_controlStructures_kt3203_2 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt3203_2.kt" +} + +task codegen_blackbox_controlStructures_kt3273 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt3273.kt" +} + +task codegen_blackbox_controlStructures_kt3280 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt3280.kt" +} + +task codegen_blackbox_controlStructures_kt3574 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt3574.kt" +} + +task codegen_blackbox_controlStructures_kt416 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt416.kt" +} + +task codegen_blackbox_controlStructures_kt513 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt513.kt" +} + +task codegen_blackbox_controlStructures_kt628 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt628.kt" +} + +task codegen_blackbox_controlStructures_kt769 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt769.kt" +} + +task codegen_blackbox_controlStructures_kt772 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt772.kt" +} + +task codegen_blackbox_controlStructures_kt773 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt773.kt" +} + +task codegen_blackbox_controlStructures_kt8148 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt8148.kt" +} + +task codegen_blackbox_controlStructures_kt8148_break (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt8148_break.kt" +} + +task codegen_blackbox_controlStructures_kt8148_continue (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt8148_continue.kt" +} + +task codegen_blackbox_controlStructures_kt870 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt870.kt" +} + +task codegen_blackbox_controlStructures_kt9022Return (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt9022Return.kt" +} + +task codegen_blackbox_controlStructures_kt9022Throw (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt9022Throw.kt" +} + +task codegen_blackbox_controlStructures_kt910 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt910.kt" +} + +task codegen_blackbox_controlStructures_kt958 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/kt958.kt" +} + +task codegen_blackbox_controlStructures_longRange (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/longRange.kt" +} + +task codegen_blackbox_controlStructures_quicksort (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/quicksort.kt" +} + +task codegen_blackbox_controlStructures_tryCatchFinallyChain (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchFinallyChain.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle new file mode 100644 index 00000000000..99785c13a72 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_controlStructures_returnsNothing_ifElse (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/returnsNothing/ifElse.kt" +} + +task codegen_blackbox_controlStructures_returnsNothing_inlineMethod (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/returnsNothing/inlineMethod.kt" +} + +task codegen_blackbox_controlStructures_returnsNothing_propertyGetter (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/returnsNothing/propertyGetter.kt" +} + +task codegen_blackbox_controlStructures_returnsNothing_tryCatch (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/returnsNothing/tryCatch.kt" +} + +task codegen_blackbox_controlStructures_returnsNothing_when (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/returnsNothing/when.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle new file mode 100644 index 00000000000..ec04d74ebbb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle @@ -0,0 +1,90 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_controlStructures_tryCatchInExpressions_catch (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/catch.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_complexChain (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/complexChain.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_deadTryCatch (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/deadTryCatch.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_differentTypes (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_expectException (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/expectException.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_finally (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/finally.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_inlineTryCatch (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryCatch.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_inlineTryExpr (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryExpr.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_inlineTryFinally (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryFinally.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_kt8608 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/kt8608.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_kt9644try (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/kt9644try.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_multipleCatchBlocks (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_splitTry (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/splitTry.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_splitTryCorner1 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner1.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_splitTryCorner2 (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner2.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_try (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/try.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_tryAfterTry (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryAfterTry.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_tryAndBreak (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndBreak.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_tryAndContinue (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndContinue.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_tryInsideCatch (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideCatch.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_tryInsideTry (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideTry.kt" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions_unmatchedInlineMarkers (type: RunExternalTest) { + source = "codegen/blackbox/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle new file mode 100644 index 00000000000..037ff7b0bc8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle @@ -0,0 +1,198 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_asyncIterator (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/asyncIterator.kt" +} + +task codegen_blackbox_coroutines_await (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/await.kt" +} + +task codegen_blackbox_coroutines_beginWithException (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/beginWithException.kt" +} + +task codegen_blackbox_coroutines_beginWithExceptionNoHandleException (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/beginWithExceptionNoHandleException.kt" +} + +task codegen_blackbox_coroutines_coercionToUnit (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/coercionToUnit.kt" +} + +task codegen_blackbox_coroutines_controllerAccessFromInnerLambda (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controllerAccessFromInnerLambda.kt" +} + +task codegen_blackbox_coroutines_defaultParametersInSuspend (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/defaultParametersInSuspend.kt" +} + +task codegen_blackbox_coroutines_dispatchResume (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/dispatchResume.kt" +} + +task codegen_blackbox_coroutines_emptyClosure (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/emptyClosure.kt" +} + +task codegen_blackbox_coroutines_falseUnitCoercion (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/falseUnitCoercion.kt" +} + +task codegen_blackbox_coroutines_generate (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/generate.kt" +} + +task codegen_blackbox_coroutines_handleException (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/handleException.kt" +} + +task codegen_blackbox_coroutines_handleResultCallEmptyBody (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/handleResultCallEmptyBody.kt" +} + +task codegen_blackbox_coroutines_handleResultNonUnitExpression (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/handleResultNonUnitExpression.kt" +} + +task codegen_blackbox_coroutines_handleResultSuspended (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/handleResultSuspended.kt" +} + +task codegen_blackbox_coroutines_illegalState (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/illegalState.kt" +} + +task codegen_blackbox_coroutines_inlinedTryCatchFinally (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/inlinedTryCatchFinally.kt" +} + +task codegen_blackbox_coroutines_inlineSuspendFunction (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/inlineSuspendFunction.kt" +} + +task codegen_blackbox_coroutines_innerSuspensionCalls (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/innerSuspensionCalls.kt" +} + +task codegen_blackbox_coroutines_instanceOfContinuation (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/instanceOfContinuation.kt" +} + +task codegen_blackbox_coroutines_iterateOverArray (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/iterateOverArray.kt" +} + +task codegen_blackbox_coroutines_kt12958 (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/kt12958.kt" +} + +task codegen_blackbox_coroutines_lastExpressionIsLoop (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/lastExpressionIsLoop.kt" +} + +task codegen_blackbox_coroutines_lastStatementInc (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/lastStatementInc.kt" +} + +task codegen_blackbox_coroutines_lastStementAssignment (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/lastStementAssignment.kt" +} + +task codegen_blackbox_coroutines_lastUnitExpression (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/lastUnitExpression.kt" +} + +task codegen_blackbox_coroutines_multipleInvokeCalls (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/multipleInvokeCalls.kt" +} + +task codegen_blackbox_coroutines_multipleInvokeCallsInsideInlineLambda1 (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda1.kt" +} + +task codegen_blackbox_coroutines_multipleInvokeCallsInsideInlineLambda2 (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda2.kt" +} + +task codegen_blackbox_coroutines_multipleInvokeCallsInsideInlineLambda3 (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda3.kt" +} + +task codegen_blackbox_coroutines_nestedTryCatch (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/nestedTryCatch.kt" +} + +task codegen_blackbox_coroutines_nonLocalReturnFromInlineLambda (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/nonLocalReturnFromInlineLambda.kt" +} + +task codegen_blackbox_coroutines_nonLocalReturnFromInlineLambdaDeep (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/nonLocalReturnFromInlineLambdaDeep.kt" +} + +task codegen_blackbox_coroutines_noSuspensionPoints (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/noSuspensionPoints.kt" +} + +task codegen_blackbox_coroutines_returnByLabel (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/returnByLabel.kt" +} + +task codegen_blackbox_coroutines_simple (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/simple.kt" +} + +task codegen_blackbox_coroutines_simpleException (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/simpleException.kt" +} + +task codegen_blackbox_coroutines_simpleWithHandleResult (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/simpleWithHandleResult.kt" +} + +task codegen_blackbox_coroutines_statementLikeLastExpression (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/statementLikeLastExpression.kt" +} + +task codegen_blackbox_coroutines_suspendDelegation (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/suspendDelegation.kt" +} + +task codegen_blackbox_coroutines_suspendFromInlineLambda (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/suspendFromInlineLambda.kt" +} + +task codegen_blackbox_coroutines_suspendInCycle (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/suspendInCycle.kt" +} + +task codegen_blackbox_coroutines_suspendInTheMiddleOfObjectConstruction (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/suspendInTheMiddleOfObjectConstruction.kt" +} + +task codegen_blackbox_coroutines_tryCatchFinallyWithHandleResult (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/tryCatchFinallyWithHandleResult.kt" +} + +task codegen_blackbox_coroutines_tryCatchWithHandleResult (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/tryCatchWithHandleResult.kt" +} + +task codegen_blackbox_coroutines_tryFinallyInsideInlineLambda (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/tryFinallyInsideInlineLambda.kt" +} + +task codegen_blackbox_coroutines_tryFinallyWithHandleResult (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/tryFinallyWithHandleResult.kt" +} + +task codegen_blackbox_coroutines_varValueConflictsWithTable (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/varValueConflictsWithTable.kt" +} + +task codegen_blackbox_coroutines_varValueConflictsWithTableSameSort (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/varValueConflictsWithTableSameSort.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle new file mode 100644 index 00000000000..836c22d4207 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_controlFlow_breakFinally (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/breakFinally.kt" +} + +task codegen_blackbox_coroutines_controlFlow_breakStatement (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/breakStatement.kt" +} + +task codegen_blackbox_coroutines_controlFlow_doWhileStatement (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/doWhileStatement.kt" +} + +task codegen_blackbox_coroutines_controlFlow_forContinue (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/forContinue.kt" +} + +task codegen_blackbox_coroutines_controlFlow_forStatement (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/forStatement.kt" +} + +task codegen_blackbox_coroutines_controlFlow_ifStatement (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/ifStatement.kt" +} + +task codegen_blackbox_coroutines_controlFlow_returnFromFinally (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/returnFromFinally.kt" +} + +task codegen_blackbox_coroutines_controlFlow_switchLikeWhen (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/switchLikeWhen.kt" +} + +task codegen_blackbox_coroutines_controlFlow_throwFromCatch (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/throwFromCatch.kt" +} + +task codegen_blackbox_coroutines_controlFlow_throwInTryWithHandleResult (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/throwInTryWithHandleResult.kt" +} + +task codegen_blackbox_coroutines_controlFlow_whileStatement (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/controlFlow/whileStatement.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle new file mode 100644 index 00000000000..4d33ceb6580 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_intLikeVarSpilling_complicatedMerge (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/complicatedMerge.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_i2bResult (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/i2bResult.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_loadFromBooleanArray (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_loadFromByteArray (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/loadFromByteArray.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_noVariableInTable (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/noVariableInTable.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_sameIconst1ManyVars (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_usedInArrayStore (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInArrayStore.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_usedInMethodCall (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInMethodCall.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_usedInPutfield (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInPutfield.kt" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling_usedInVarStore (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInVarStore.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle new file mode 100644 index 00000000000..4ac7ae13d6b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_multiModule_inlineFunctionWithOptionalParam (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/multiModule/inlineFunctionWithOptionalParam.kt" +} + +task codegen_blackbox_coroutines_multiModule_simple (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/multiModule/simple.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle new file mode 100644 index 00000000000..9acee24c01f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_stackUnwinding_exception (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/stackUnwinding/exception.kt" +} + +task codegen_blackbox_coroutines_stackUnwinding_inlineSuspendFunction (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/stackUnwinding/inlineSuspendFunction.kt" +} + +task codegen_blackbox_coroutines_stackUnwinding_simple (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/stackUnwinding/simple.kt" +} + +task codegen_blackbox_coroutines_stackUnwinding_suspendInCycle (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/stackUnwinding/suspendInCycle.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle new file mode 100644 index 00000000000..102174207e1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_suspendFunctionTypeCall_manyParameters (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/suspendFunctionTypeCall/manyParameters.kt" +} + +task codegen_blackbox_coroutines_suspendFunctionTypeCall_simple (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/suspendFunctionTypeCall/simple.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle new file mode 100644 index 00000000000..91315961617 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_coroutines_unitTypeReturn_coroutineNonLocalReturn (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt" +} + +task codegen_blackbox_coroutines_unitTypeReturn_coroutineReturn (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/unitTypeReturn/coroutineReturn.kt" +} + +task codegen_blackbox_coroutines_unitTypeReturn_suspendNonLocalReturn (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt" +} + +task codegen_blackbox_coroutines_unitTypeReturn_suspendReturn (type: RunExternalTest) { + source = "codegen/blackbox/coroutines/unitTypeReturn/suspendReturn.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle new file mode 100644 index 00000000000..9558c630034 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle @@ -0,0 +1,62 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_dataClasses_arrayParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/arrayParams.kt" +} + +task codegen_blackbox_dataClasses_changingVarParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/changingVarParam.kt" +} + +task codegen_blackbox_dataClasses_doubleParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/doubleParam.kt" +} + +task codegen_blackbox_dataClasses_floatParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/floatParam.kt" +} + +task codegen_blackbox_dataClasses_genericParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/genericParam.kt" +} + +task codegen_blackbox_dataClasses_kt5002 (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/kt5002.kt" +} + +task codegen_blackbox_dataClasses_mixedParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/mixedParams.kt" +} + +task codegen_blackbox_dataClasses_multiDeclaration (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/multiDeclaration.kt" +} + +task codegen_blackbox_dataClasses_multiDeclarationFor (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/multiDeclarationFor.kt" +} + +task codegen_blackbox_dataClasses_nonTrivialFinalMemberInSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/nonTrivialFinalMemberInSuperClass.kt" +} + +task codegen_blackbox_dataClasses_nonTrivialMemberInSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/nonTrivialMemberInSuperClass.kt" +} + +task codegen_blackbox_dataClasses_privateValParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/privateValParams.kt" +} + +task codegen_blackbox_dataClasses_twoValParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/twoValParams.kt" +} + +task codegen_blackbox_dataClasses_twoVarParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/twoVarParams.kt" +} + +task codegen_blackbox_dataClasses_unitComponent (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/unitComponent.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle new file mode 100644 index 00000000000..383e50cdbc8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_dataClasses_copy_constructorWithDefaultParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/constructorWithDefaultParam.kt" +} + +task codegen_blackbox_dataClasses_copy_copyInObjectNestedDataClass (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/copyInObjectNestedDataClass.kt" +} + +task codegen_blackbox_dataClasses_copy_kt12708 (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/kt12708.kt" +} + +task codegen_blackbox_dataClasses_copy_kt3033 (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/kt3033.kt" +} + +task codegen_blackbox_dataClasses_copy_valInConstructorParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/valInConstructorParams.kt" +} + +task codegen_blackbox_dataClasses_copy_varInConstructorParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/varInConstructorParams.kt" +} + +task codegen_blackbox_dataClasses_copy_withGenericParameter (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/copy/withGenericParameter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle new file mode 100644 index 00000000000..b3ce55015fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_dataClasses_equals_alreadyDeclared (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/equals/alreadyDeclared.kt" +} + +task codegen_blackbox_dataClasses_equals_alreadyDeclaredWrongSignature (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt" +} + +task codegen_blackbox_dataClasses_equals_genericarray (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/equals/genericarray.kt" +} + +task codegen_blackbox_dataClasses_equals_intarray (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/equals/intarray.kt" +} + +task codegen_blackbox_dataClasses_equals_nullother (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/equals/nullother.kt" +} + +task codegen_blackbox_dataClasses_equals_sameinstance (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/equals/sameinstance.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle new file mode 100644 index 00000000000..e6a4e26f5e1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_dataClasses_hashCode_alreadyDeclared (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/alreadyDeclared.kt" +} + +task codegen_blackbox_dataClasses_hashCode_alreadyDeclaredWrongSignature (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt" +} + +task codegen_blackbox_dataClasses_hashCode_array (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/array.kt" +} + +task codegen_blackbox_dataClasses_hashCode_boolean (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/boolean.kt" +} + +task codegen_blackbox_dataClasses_hashCode_byte (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/byte.kt" +} + +task codegen_blackbox_dataClasses_hashCode_char (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/char.kt" +} + +task codegen_blackbox_dataClasses_hashCode_double (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/double.kt" +} + +task codegen_blackbox_dataClasses_hashCode_float (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/float.kt" +} + +task codegen_blackbox_dataClasses_hashCode_genericNull (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/genericNull.kt" +} + +task codegen_blackbox_dataClasses_hashCode_int (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/int.kt" +} + +task codegen_blackbox_dataClasses_hashCode_long (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/long.kt" +} + +task codegen_blackbox_dataClasses_hashCode_null (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/null.kt" +} + +task codegen_blackbox_dataClasses_hashCode_short (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/hashCode/short.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle new file mode 100644 index 00000000000..6e10a5157cb --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_dataClasses_toString_alreadyDeclared (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/alreadyDeclared.kt" +} + +task codegen_blackbox_dataClasses_toString_alreadyDeclaredWrongSignature (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt" +} + +task codegen_blackbox_dataClasses_toString_arrayParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/arrayParams.kt" +} + +task codegen_blackbox_dataClasses_toString_changingVarParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/changingVarParam.kt" +} + +task codegen_blackbox_dataClasses_toString_genericParam (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/genericParam.kt" +} + +task codegen_blackbox_dataClasses_toString_mixedParams (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/mixedParams.kt" +} + +task codegen_blackbox_dataClasses_toString_unitComponent (type: RunExternalTest) { + source = "codegen/blackbox/dataClasses/toString/unitComponent.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle new file mode 100644 index 00000000000..61555c67913 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_deadCodeElimination_emptyVariableRange (type: RunExternalTest) { + source = "codegen/blackbox/deadCodeElimination/emptyVariableRange.kt" +} + +task codegen_blackbox_deadCodeElimination_intersectingVariableRange (type: RunExternalTest) { + source = "codegen/blackbox/deadCodeElimination/intersectingVariableRange.kt" +} + +task codegen_blackbox_deadCodeElimination_intersectingVariableRangeInFinally (type: RunExternalTest) { + source = "codegen/blackbox/deadCodeElimination/intersectingVariableRangeInFinally.kt" +} + +task codegen_blackbox_deadCodeElimination_kt14357 (type: RunExternalTest) { + source = "codegen/blackbox/deadCodeElimination/kt14357.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle new file mode 100644 index 00000000000..26267364d16 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_defaultArguments_kt6382 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/kt6382.kt" +} + +task codegen_blackbox_defaultArguments_protected (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/protected.kt" +} + +task codegen_blackbox_defaultArguments_simpleFromOtherFile (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/simpleFromOtherFile.kt" +} + +task codegen_blackbox_defaultArguments_superCallCheck (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/superCallCheck.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle new file mode 100644 index 00000000000..0c3b27ffcae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_defaultArguments_constructor_annotation (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/annotation.kt" +} + +task codegen_blackbox_defaultArguments_constructor_checkIfConstructorIsSynthetic (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt" +} + +task codegen_blackbox_defaultArguments_constructor_defArgs1 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/defArgs1.kt" +} + +task codegen_blackbox_defaultArguments_constructor_defArgs1InnerClass (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/defArgs1InnerClass.kt" +} + +task codegen_blackbox_defaultArguments_constructor_defArgs2 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/defArgs2.kt" +} + +task codegen_blackbox_defaultArguments_constructor_doubleDefArgs1InnerClass (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/doubleDefArgs1InnerClass.kt" +} + +task codegen_blackbox_defaultArguments_constructor_enum (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/enum.kt" +} + +task codegen_blackbox_defaultArguments_constructor_enumWithOneDefArg (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/enumWithOneDefArg.kt" +} + +task codegen_blackbox_defaultArguments_constructor_enumWithTwoDefArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/enumWithTwoDefArgs.kt" +} + +task codegen_blackbox_defaultArguments_constructor_enumWithTwoDoubleDefArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt" +} + +task codegen_blackbox_defaultArguments_constructor_kt2852 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/kt2852.kt" +} + +task codegen_blackbox_defaultArguments_constructor_kt3060 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/kt3060.kt" +} + +task codegen_blackbox_defaultArguments_constructor_manyArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/constructor/manyArgs.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle new file mode 100644 index 00000000000..b1c9a9234b4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_defaultArguments_convention_incWithDefaultInGetter (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/convention/incWithDefaultInGetter.kt" +} + +task codegen_blackbox_defaultArguments_convention_kt9140 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/convention/kt9140.kt" +} + +task codegen_blackbox_defaultArguments_convention_plusAssignWithDefaultInGetter (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/convention/plusAssignWithDefaultInGetter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle new file mode 100644 index 00000000000..99778f909c1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle @@ -0,0 +1,82 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_defaultArguments_function_abstractClass (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/abstractClass.kt" +} + +task codegen_blackbox_defaultArguments_function_covariantOverride (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/covariantOverride.kt" +} + +task codegen_blackbox_defaultArguments_function_covariantOverrideGeneric (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/covariantOverrideGeneric.kt" +} + +task codegen_blackbox_defaultArguments_function_extensionFunctionManyArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extensionFunctionManyArgs.kt" +} + +task codegen_blackbox_defaultArguments_function_extentionFunction (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extentionFunction.kt" +} + +task codegen_blackbox_defaultArguments_function_extentionFunctionDouble (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extentionFunctionDouble.kt" +} + +task codegen_blackbox_defaultArguments_function_extentionFunctionDoubleTwoArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt" +} + +task codegen_blackbox_defaultArguments_function_extentionFunctionInClassObject (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extentionFunctionInClassObject.kt" +} + +task codegen_blackbox_defaultArguments_function_extentionFunctionInObject (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extentionFunctionInObject.kt" +} + +task codegen_blackbox_defaultArguments_function_extentionFunctionWithOneDefArg (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/extentionFunctionWithOneDefArg.kt" +} + +task codegen_blackbox_defaultArguments_function_funInTrait (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/funInTrait.kt" +} + +task codegen_blackbox_defaultArguments_function_innerExtentionFunction (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/innerExtentionFunction.kt" +} + +task codegen_blackbox_defaultArguments_function_innerExtentionFunctionDouble (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/innerExtentionFunctionDouble.kt" +} + +task codegen_blackbox_defaultArguments_function_innerExtentionFunctionDoubleTwoArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt" +} + +task codegen_blackbox_defaultArguments_function_innerExtentionFunctionManyArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/innerExtentionFunctionManyArgs.kt" +} + +task codegen_blackbox_defaultArguments_function_kt5232 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/kt5232.kt" +} + +task codegen_blackbox_defaultArguments_function_memberFunctionManyArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/memberFunctionManyArgs.kt" +} + +task codegen_blackbox_defaultArguments_function_mixingNamedAndPositioned (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/mixingNamedAndPositioned.kt" +} + +task codegen_blackbox_defaultArguments_function_topLevelManyArgs (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/topLevelManyArgs.kt" +} + +task codegen_blackbox_defaultArguments_function_trait (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/function/trait.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle new file mode 100644 index 00000000000..7c464172c7d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_defaultArguments_private_memberExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/private/memberExtensionFunction.kt" +} + +task codegen_blackbox_defaultArguments_private_memberFunction (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/private/memberFunction.kt" +} + +task codegen_blackbox_defaultArguments_private_primaryConstructor (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/private/primaryConstructor.kt" +} + +task codegen_blackbox_defaultArguments_private_secondaryConstructor (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/private/secondaryConstructor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle new file mode 100644 index 00000000000..9d00a16a78f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_defaultArguments_signature_kt2789 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/signature/kt2789.kt" +} + +task codegen_blackbox_defaultArguments_signature_kt9428 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/signature/kt9428.kt" +} + +task codegen_blackbox_defaultArguments_signature_kt9924 (type: RunExternalTest) { + source = "codegen/blackbox/defaultArguments/signature/kt9924.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle new file mode 100644 index 00000000000..64b91cddbd4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle @@ -0,0 +1,150 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_delegatedProperty_accessTopLevelDelegatedPropertyInClinit (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt" +} + +task codegen_blackbox_delegatedProperty_capturePropertyInClosure (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/capturePropertyInClosure.kt" +} + +task codegen_blackbox_delegatedProperty_castGetReturnType (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/castGetReturnType.kt" +} + +task codegen_blackbox_delegatedProperty_castSetParameter (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/castSetParameter.kt" +} + +task codegen_blackbox_delegatedProperty_delegateAsInnerClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateAsInnerClass.kt" +} + +task codegen_blackbox_delegatedProperty_delegateByOtherProperty (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateByOtherProperty.kt" +} + +task codegen_blackbox_delegatedProperty_delegateByTopLevelFun (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateByTopLevelFun.kt" +} + +task codegen_blackbox_delegatedProperty_delegateByTopLevelProperty (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateByTopLevelProperty.kt" +} + +task codegen_blackbox_delegatedProperty_delegateForExtProperty (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateForExtProperty.kt" +} + +task codegen_blackbox_delegatedProperty_delegateForExtPropertyInClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateForExtPropertyInClass.kt" +} + +task codegen_blackbox_delegatedProperty_delegateWithPrivateSet (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/delegateWithPrivateSet.kt" +} + +task codegen_blackbox_delegatedProperty_extensionDelegatesWithSameNames (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/extensionDelegatesWithSameNames.kt" +} + +task codegen_blackbox_delegatedProperty_extensionPropertyAndExtensionGetValue (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/extensionPropertyAndExtensionGetValue.kt" +} + +task codegen_blackbox_delegatedProperty_genericDelegate (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/genericDelegate.kt" +} + +task codegen_blackbox_delegatedProperty_getAsExtensionFun (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/getAsExtensionFun.kt" +} + +task codegen_blackbox_delegatedProperty_getAsExtensionFunInClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/getAsExtensionFunInClass.kt" +} + +task codegen_blackbox_delegatedProperty_inClassVal (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/inClassVal.kt" +} + +task codegen_blackbox_delegatedProperty_inClassVar (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/inClassVar.kt" +} + +task codegen_blackbox_delegatedProperty_inferredPropertyType (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/inferredPropertyType.kt" +} + +task codegen_blackbox_delegatedProperty_inTrait (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/inTrait.kt" +} + +task codegen_blackbox_delegatedProperty_kt4138 (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/kt4138.kt" +} + +task codegen_blackbox_delegatedProperty_kt6722 (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/kt6722.kt" +} + +task codegen_blackbox_delegatedProperty_kt9712 (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/kt9712.kt" +} + +task codegen_blackbox_delegatedProperty_privateSetterKPropertyIsNotMutable (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt" +} + +task codegen_blackbox_delegatedProperty_privateVar (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/privateVar.kt" +} + +task codegen_blackbox_delegatedProperty_propertyMetadataShouldBeCached (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt" +} + +task codegen_blackbox_delegatedProperty_protectedVarWithPrivateSet (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/protectedVarWithPrivateSet.kt" +} + +task codegen_blackbox_delegatedProperty_setAsExtensionFun (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/setAsExtensionFun.kt" +} + +task codegen_blackbox_delegatedProperty_setAsExtensionFunInClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/setAsExtensionFunInClass.kt" +} + +task codegen_blackbox_delegatedProperty_stackOverflowOnCallFromGetValue (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt" +} + +task codegen_blackbox_delegatedProperty_topLevelVal (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/topLevelVal.kt" +} + +task codegen_blackbox_delegatedProperty_topLevelVar (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/topLevelVar.kt" +} + +task codegen_blackbox_delegatedProperty_twoPropByOneDelegete (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/twoPropByOneDelegete.kt" +} + +task codegen_blackbox_delegatedProperty_useKPropertyLater (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/useKPropertyLater.kt" +} + +task codegen_blackbox_delegatedProperty_useReflectionOnKProperty (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt" +} + +task codegen_blackbox_delegatedProperty_valInInnerClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/valInInnerClass.kt" +} + +task codegen_blackbox_delegatedProperty_varInInnerClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/varInInnerClass.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle new file mode 100644 index 00000000000..df09fe9d0b1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_delegatedProperty_local_capturedLocalVal (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/capturedLocalVal.kt" +} + +task codegen_blackbox_delegatedProperty_local_capturedLocalValNoInline (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/capturedLocalValNoInline.kt" +} + +task codegen_blackbox_delegatedProperty_local_capturedLocalVar (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/capturedLocalVar.kt" +} + +task codegen_blackbox_delegatedProperty_local_capturedLocalVarNoInline (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/capturedLocalVarNoInline.kt" +} + +task codegen_blackbox_delegatedProperty_local_inlineGetValue (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/inlineGetValue.kt" +} + +task codegen_blackbox_delegatedProperty_local_inlineOperators (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/inlineOperators.kt" +} + +task codegen_blackbox_delegatedProperty_local_kt12891 (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/kt12891.kt" +} + +task codegen_blackbox_delegatedProperty_local_kt13557 (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/kt13557.kt" +} + +task codegen_blackbox_delegatedProperty_local_localVal (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/localVal.kt" +} + +task codegen_blackbox_delegatedProperty_local_localValNoExplicitType (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/localValNoExplicitType.kt" +} + +task codegen_blackbox_delegatedProperty_local_localVar (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/localVar.kt" +} + +task codegen_blackbox_delegatedProperty_local_localVarNoExplicitType (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/local/localVarNoExplicitType.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle new file mode 100644 index 00000000000..11d0067e096 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle @@ -0,0 +1,62 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_delegatedProperty_provideDelegate_differentReceivers (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/differentReceivers.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_evaluationOrder (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrder.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_evaluationOrderVar (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrderVar.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_extensionDelegated (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/extensionDelegated.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_generic (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/generic.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_hostCheck (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/hostCheck.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_inClass (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/inClass.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_inlineProvideDelegate (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/inlineProvideDelegate.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_jvmStaticInObject (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_kt15437 (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/kt15437.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_local (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/local.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_localCaptured (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/localCaptured.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_localDifferentReceivers (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/localDifferentReceivers.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_memberExtension (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/memberExtension.kt" +} + +task codegen_blackbox_delegatedProperty_provideDelegate_propertyMetadata (type: RunExternalTest) { + source = "codegen/blackbox/delegatedProperty/provideDelegate/propertyMetadata.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle new file mode 100644 index 00000000000..c1d52b9f6f7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_delegation_delegationToVal (type: RunExternalTest) { + source = "codegen/blackbox/delegation/delegationToVal.kt" +} + +task codegen_blackbox_delegation_kt8154 (type: RunExternalTest) { + source = "codegen/blackbox/delegation/kt8154.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle new file mode 100644 index 00000000000..d8fb2071174 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle @@ -0,0 +1,34 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_destructuringDeclInLambdaParam_extensionComponents (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/extensionComponents.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_generic (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/generic.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_inline (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/inline.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_otherParameters (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/otherParameters.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_simple (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/simple.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_stdlibUsages (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/stdlibUsages.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_underscoreNames (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/underscoreNames.kt" +} + +task codegen_blackbox_destructuringDeclInLambdaParam_withIndexed (type: RunExternalTest) { + source = "codegen/blackbox/destructuringDeclInLambdaParam/withIndexed.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle new file mode 100644 index 00000000000..3ac388b8d16 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_diagnostics_functions_inference_kt6176 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/inference/kt6176.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle new file mode 100644 index 00000000000..ebca3df30c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObject1 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObject2 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObjectOfNestedClass1 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObjectOfNestedClass2 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnEnum1 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnEnum2 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnImportedEnum1 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnImportedEnum2 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnObject1 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnObject2 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle new file mode 100644 index 00000000000..c4873bc324f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle @@ -0,0 +1,150 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_diagnostics_functions_tailRecursion_defaultArgs (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_defaultArgsOverridden (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_extensionTailCall (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_functionWithNonTailRecursions (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_functionWithNoTails (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_functionWithoutAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_infixCall (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_infixRecursiveCall (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_insideElvis (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_labeledThisReferences (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_loops (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/loops.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_multilevelBlocks (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_realIteratorFoldl (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_realStringEscape (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_realStringRepeat (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_recursiveCallInLambda (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_recursiveCallInLocalFunction (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_recursiveInnerFunction (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_returnIf (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_returnInCatch (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_returnInFinally (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_returnInIfInFinally (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_returnInParentheses (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_returnInTry (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_simpleBlock (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_simpleReturn (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_simpleReturnWithElse (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_sum (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/sum.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_tailCallInBlockInParentheses (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_tailCallInParentheses (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_tailRecursionInFinally (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_thisReferences (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_unitBlocks (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithCondition (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithInRange (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithIs (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.kt" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithoutCondition (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle new file mode 100644 index 00000000000..4529422e175 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_diagnostics_vararg_kt4172 (type: RunExternalTest) { + source = "codegen/blackbox/diagnostics/vararg/kt4172.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle new file mode 100644 index 00000000000..18494aef99f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_elvis_genericNull (type: RunExternalTest) { + source = "codegen/blackbox/elvis/genericNull.kt" +} + +task codegen_blackbox_elvis_kt6694ExactAnnotationForElvis (type: RunExternalTest) { + source = "codegen/blackbox/elvis/kt6694ExactAnnotationForElvis.kt" +} + +task codegen_blackbox_elvis_nullNullOk (type: RunExternalTest) { + source = "codegen/blackbox/elvis/nullNullOk.kt" +} + +task codegen_blackbox_elvis_primitive (type: RunExternalTest) { + source = "codegen/blackbox/elvis/primitive.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle new file mode 100644 index 00000000000..ca2e41e47ec --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle @@ -0,0 +1,110 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_enum_abstractMethodInEnum (type: RunExternalTest) { + source = "codegen/blackbox/enum/abstractMethodInEnum.kt" +} + +task codegen_blackbox_enum_abstractNestedClass (type: RunExternalTest) { + source = "codegen/blackbox/enum/abstractNestedClass.kt" +} + +task codegen_blackbox_enum_asReturnExpression (type: RunExternalTest) { + source = "codegen/blackbox/enum/asReturnExpression.kt" +} + +task codegen_blackbox_enum_classForEnumEntry (type: RunExternalTest) { + source = "codegen/blackbox/enum/classForEnumEntry.kt" +} + +task codegen_blackbox_enum_companionObjectInEnum (type: RunExternalTest) { + source = "codegen/blackbox/enum/companionObjectInEnum.kt" +} + +task codegen_blackbox_enum_emptyConstructor (type: RunExternalTest) { + source = "codegen/blackbox/enum/emptyConstructor.kt" +} + +task codegen_blackbox_enum_emptyEnumValuesValueOf (type: RunExternalTest) { + source = "codegen/blackbox/enum/emptyEnumValuesValueOf.kt" +} + +task codegen_blackbox_enum_enumInheritedFromTrait (type: RunExternalTest) { + source = "codegen/blackbox/enum/enumInheritedFromTrait.kt" +} + +task codegen_blackbox_enum_enumShort (type: RunExternalTest) { + source = "codegen/blackbox/enum/enumShort.kt" +} + +task codegen_blackbox_enum_enumWithLambdaParameter (type: RunExternalTest) { + source = "codegen/blackbox/enum/enumWithLambdaParameter.kt" +} + +task codegen_blackbox_enum_inclassobj (type: RunExternalTest) { + source = "codegen/blackbox/enum/inclassobj.kt" +} + +task codegen_blackbox_enum_inner (type: RunExternalTest) { + source = "codegen/blackbox/enum/inner.kt" +} + +task codegen_blackbox_enum_innerWithExistingClassObject (type: RunExternalTest) { + source = "codegen/blackbox/enum/innerWithExistingClassObject.kt" +} + +task codegen_blackbox_enum_inPackage (type: RunExternalTest) { + source = "codegen/blackbox/enum/inPackage.kt" +} + +task codegen_blackbox_enum_kt1119 (type: RunExternalTest) { + source = "codegen/blackbox/enum/kt1119.kt" +} + +task codegen_blackbox_enum_kt2350 (type: RunExternalTest) { + source = "codegen/blackbox/enum/kt2350.kt" +} + +task codegen_blackbox_enum_kt9711 (type: RunExternalTest) { + source = "codegen/blackbox/enum/kt9711.kt" +} + +task codegen_blackbox_enum_kt9711_2 (type: RunExternalTest) { + source = "codegen/blackbox/enum/kt9711_2.kt" +} + +task codegen_blackbox_enum_modifierFlags (type: RunExternalTest) { + source = "codegen/blackbox/enum/modifierFlags.kt" +} + +task codegen_blackbox_enum_noClassForSimpleEnum (type: RunExternalTest) { + source = "codegen/blackbox/enum/noClassForSimpleEnum.kt" +} + +task codegen_blackbox_enum_objectInEnum (type: RunExternalTest) { + source = "codegen/blackbox/enum/objectInEnum.kt" +} + +task codegen_blackbox_enum_ordinal (type: RunExternalTest) { + source = "codegen/blackbox/enum/ordinal.kt" +} + +task codegen_blackbox_enum_simple (type: RunExternalTest) { + source = "codegen/blackbox/enum/simple.kt" +} + +task codegen_blackbox_enum_sortEnumEntries (type: RunExternalTest) { + source = "codegen/blackbox/enum/sortEnumEntries.kt" +} + +task codegen_blackbox_enum_superCallInEnumLiteral (type: RunExternalTest) { + source = "codegen/blackbox/enum/superCallInEnumLiteral.kt" +} + +task codegen_blackbox_enum_toString (type: RunExternalTest) { + source = "codegen/blackbox/enum/toString.kt" +} + +task codegen_blackbox_enum_valueof (type: RunExternalTest) { + source = "codegen/blackbox/enum/valueof.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle new file mode 100644 index 00000000000..57455ff0614 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle @@ -0,0 +1,62 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_evaluate_char (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/char.kt" +} + +task codegen_blackbox_evaluate_divide (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/divide.kt" +} + +task codegen_blackbox_evaluate_intrinsics (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/intrinsics.kt" +} + +task codegen_blackbox_evaluate_kt9443 (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/kt9443.kt" +} + +task codegen_blackbox_evaluate_maxValue (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/maxValue.kt" +} + +task codegen_blackbox_evaluate_maxValueByte (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/maxValueByte.kt" +} + +task codegen_blackbox_evaluate_maxValueInt (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/maxValueInt.kt" +} + +task codegen_blackbox_evaluate_minus (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/minus.kt" +} + +task codegen_blackbox_evaluate_mod (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/mod.kt" +} + +task codegen_blackbox_evaluate_multiply (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/multiply.kt" +} + +task codegen_blackbox_evaluate_parenthesized (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/parenthesized.kt" +} + +task codegen_blackbox_evaluate_plus (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/plus.kt" +} + +task codegen_blackbox_evaluate_simpleCallBinary (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/simpleCallBinary.kt" +} + +task codegen_blackbox_evaluate_unaryMinus (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/unaryMinus.kt" +} + +task codegen_blackbox_evaluate_unaryPlus (type: RunExternalTest) { + source = "codegen/blackbox/evaluate/unaryPlus.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle new file mode 100644 index 00000000000..9bb6c4d3165 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_exclExcl_genericNull (type: RunExternalTest) { + source = "codegen/blackbox/exclExcl/genericNull.kt" +} + +task codegen_blackbox_exclExcl_primitive (type: RunExternalTest) { + source = "codegen/blackbox/exclExcl/primitive.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle new file mode 100644 index 00000000000..fe1d57a1532 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle @@ -0,0 +1,90 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_extensionFunctions_executionOrder (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/executionOrder.kt" +} + +task codegen_blackbox_extensionFunctions_kt1061 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt1061.kt" +} + +task codegen_blackbox_extensionFunctions_kt1249 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt1249.kt" +} + +task codegen_blackbox_extensionFunctions_kt1290 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt1290.kt" +} + +task codegen_blackbox_extensionFunctions_kt1776 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt1776.kt" +} + +task codegen_blackbox_extensionFunctions_kt1953 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt1953.kt" +} + +task codegen_blackbox_extensionFunctions_kt1953_class (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt1953_class.kt" +} + +task codegen_blackbox_extensionFunctions_kt3285 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt3285.kt" +} + +task codegen_blackbox_extensionFunctions_kt3298 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt3298.kt" +} + +task codegen_blackbox_extensionFunctions_kt3646 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt3646.kt" +} + +task codegen_blackbox_extensionFunctions_kt3969 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt3969.kt" +} + +task codegen_blackbox_extensionFunctions_kt4228 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt4228.kt" +} + +task codegen_blackbox_extensionFunctions_kt475 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt475.kt" +} + +task codegen_blackbox_extensionFunctions_kt5467 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt5467.kt" +} + +task codegen_blackbox_extensionFunctions_kt606 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt606.kt" +} + +task codegen_blackbox_extensionFunctions_kt865 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/kt865.kt" +} + +task codegen_blackbox_extensionFunctions_nested2 (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/nested2.kt" +} + +task codegen_blackbox_extensionFunctions_shared (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/shared.kt" +} + +task codegen_blackbox_extensionFunctions_simple (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/simple.kt" +} + +task codegen_blackbox_extensionFunctions_thisMethodInObjectLiteral (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/thisMethodInObjectLiteral.kt" +} + +task codegen_blackbox_extensionFunctions_virtual (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/virtual.kt" +} + +task codegen_blackbox_extensionFunctions_whenFail (type: RunExternalTest) { + source = "codegen/blackbox/extensionFunctions/whenFail.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle new file mode 100644 index 00000000000..4e5ae5cb71a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_extensionProperties_accessorForPrivateSetter (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/accessorForPrivateSetter.kt" +} + +task codegen_blackbox_extensionProperties_genericValForPrimitiveType (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/genericValForPrimitiveType.kt" +} + +task codegen_blackbox_extensionProperties_genericValMultipleUpperBounds (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt" +} + +task codegen_blackbox_extensionProperties_genericVarForPrimitiveType (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/genericVarForPrimitiveType.kt" +} + +task codegen_blackbox_extensionProperties_inClass (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/inClass.kt" +} + +task codegen_blackbox_extensionProperties_inClassLongTypeInReceiver (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/inClassLongTypeInReceiver.kt" +} + +task codegen_blackbox_extensionProperties_inClassWithGetter (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/inClassWithGetter.kt" +} + +task codegen_blackbox_extensionProperties_inClassWithPrivateGetter (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/inClassWithPrivateGetter.kt" +} + +task codegen_blackbox_extensionProperties_inClassWithPrivateSetter (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/inClassWithPrivateSetter.kt" +} + +task codegen_blackbox_extensionProperties_inClassWithSetter (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/inClassWithSetter.kt" +} + +task codegen_blackbox_extensionProperties_kt9897 (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/kt9897.kt" +} + +task codegen_blackbox_extensionProperties_kt9897_topLevel (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/kt9897_topLevel.kt" +} + +task codegen_blackbox_extensionProperties_topLevel (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/topLevel.kt" +} + +task codegen_blackbox_extensionProperties_topLevelLongTypeInReceiver (type: RunExternalTest) { + source = "codegen/blackbox/extensionProperties/topLevelLongTypeInReceiver.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/external/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/external/build-generated.gradle new file mode 100644 index 00000000000..0173ebf7211 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/external/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_external_jvmStaticExternal (type: RunExternalTest) { + source = "codegen/blackbox/external/jvmStaticExternal.kt" +} + +task codegen_blackbox_external_jvmStaticExternalPrivate (type: RunExternalTest) { + source = "codegen/blackbox/external/jvmStaticExternalPrivate.kt" +} + +task codegen_blackbox_external_withDefaultArg (type: RunExternalTest) { + source = "codegen/blackbox/external/withDefaultArg.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle new file mode 100644 index 00000000000..5757b912608 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_fakeOverride_diamondFunction (type: RunExternalTest) { + source = "codegen/blackbox/fakeOverride/diamondFunction.kt" +} + +task codegen_blackbox_fakeOverride_function (type: RunExternalTest) { + source = "codegen/blackbox/fakeOverride/function.kt" +} + +task codegen_blackbox_fakeOverride_propertyGetter (type: RunExternalTest) { + source = "codegen/blackbox/fakeOverride/propertyGetter.kt" +} + +task codegen_blackbox_fakeOverride_propertySetter (type: RunExternalTest) { + source = "codegen/blackbox/fakeOverride/propertySetter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle new file mode 100644 index 00000000000..2c65a719a02 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_fieldRename_constructorAndClassObject (type: RunExternalTest) { + source = "codegen/blackbox/fieldRename/constructorAndClassObject.kt" +} + +task codegen_blackbox_fieldRename_delegates (type: RunExternalTest) { + source = "codegen/blackbox/fieldRename/delegates.kt" +} + +task codegen_blackbox_fieldRename_genericPropertyWithItself (type: RunExternalTest) { + source = "codegen/blackbox/fieldRename/genericPropertyWithItself.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle new file mode 100644 index 00000000000..7df5ad718ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_finally_finallyAndFinally (type: RunExternalTest) { + source = "codegen/blackbox/finally/finallyAndFinally.kt" +} + +task codegen_blackbox_finally_kt3549 (type: RunExternalTest) { + source = "codegen/blackbox/finally/kt3549.kt" +} + +task codegen_blackbox_finally_kt3706 (type: RunExternalTest) { + source = "codegen/blackbox/finally/kt3706.kt" +} + +task codegen_blackbox_finally_kt3867 (type: RunExternalTest) { + source = "codegen/blackbox/finally/kt3867.kt" +} + +task codegen_blackbox_finally_kt3874 (type: RunExternalTest) { + source = "codegen/blackbox/finally/kt3874.kt" +} + +task codegen_blackbox_finally_kt3894 (type: RunExternalTest) { + source = "codegen/blackbox/finally/kt3894.kt" +} + +task codegen_blackbox_finally_kt4134 (type: RunExternalTest) { + source = "codegen/blackbox/finally/kt4134.kt" +} + +task codegen_blackbox_finally_loopAndFinally (type: RunExternalTest) { + source = "codegen/blackbox/finally/loopAndFinally.kt" +} + +task codegen_blackbox_finally_notChainCatch (type: RunExternalTest) { + source = "codegen/blackbox/finally/notChainCatch.kt" +} + +task codegen_blackbox_finally_tryFinally (type: RunExternalTest) { + source = "codegen/blackbox/finally/tryFinally.kt" +} + +task codegen_blackbox_finally_tryLoopTry (type: RunExternalTest) { + source = "codegen/blackbox/finally/tryLoopTry.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle new file mode 100644 index 00000000000..9773989905d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_fullJdk_charBuffer (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/charBuffer.kt" +} + +task codegen_blackbox_fullJdk_classpath (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/classpath.kt" +} + +task codegen_blackbox_fullJdk_ifInWhile (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/ifInWhile.kt" +} + +task codegen_blackbox_fullJdk_intCountDownLatchExtension (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/intCountDownLatchExtension.kt" +} + +task codegen_blackbox_fullJdk_kt434 (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/kt434.kt" +} + +task codegen_blackbox_fullJdk_platformTypeAssertionStackTrace (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/platformTypeAssertionStackTrace.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle new file mode 100644 index 00000000000..976aa8bda77 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_fullJdk_native_nativePropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt" +} + +task codegen_blackbox_fullJdk_native_simpleNative (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/native/simpleNative.kt" +} + +task codegen_blackbox_fullJdk_native_topLevel (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/native/topLevel.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle new file mode 100644 index 00000000000..c4dcbd4bfbc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_fullJdk_regressions_kt1770 (type: RunExternalTest) { + source = "codegen/blackbox/fullJdk/regressions/kt1770.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle new file mode 100644 index 00000000000..a8d74d6c87e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle @@ -0,0 +1,174 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_functions_coerceVoidToArray (type: RunExternalTest) { + source = "codegen/blackbox/functions/coerceVoidToArray.kt" +} + +task codegen_blackbox_functions_coerceVoidToObject (type: RunExternalTest) { + source = "codegen/blackbox/functions/coerceVoidToObject.kt" +} + +task codegen_blackbox_functions_dataLocalVariable (type: RunExternalTest) { + source = "codegen/blackbox/functions/dataLocalVariable.kt" +} + +task codegen_blackbox_functions_defaultargs (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs.kt" +} + +task codegen_blackbox_functions_defaultargs1 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs1.kt" +} + +task codegen_blackbox_functions_defaultargs2 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs2.kt" +} + +task codegen_blackbox_functions_defaultargs3 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs3.kt" +} + +task codegen_blackbox_functions_defaultargs4 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs4.kt" +} + +task codegen_blackbox_functions_defaultargs5 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs5.kt" +} + +task codegen_blackbox_functions_defaultargs6 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs6.kt" +} + +task codegen_blackbox_functions_defaultargs7 (type: RunExternalTest) { + source = "codegen/blackbox/functions/defaultargs7.kt" +} + +task codegen_blackbox_functions_ea33909 (type: RunExternalTest) { + source = "codegen/blackbox/functions/ea33909.kt" +} + +task codegen_blackbox_functions_fakeDescriptorWithSeveralOverridenOne (type: RunExternalTest) { + source = "codegen/blackbox/functions/fakeDescriptorWithSeveralOverridenOne.kt" +} + +task codegen_blackbox_functions_functionNtoString (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionNtoString.kt" +} + +task codegen_blackbox_functions_functionNtoStringGeneric (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionNtoStringGeneric.kt" +} + +task codegen_blackbox_functions_functionNtoStringNoReflect (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionNtoStringNoReflect.kt" +} + +task codegen_blackbox_functions_infixRecursiveCall (type: RunExternalTest) { + source = "codegen/blackbox/functions/infixRecursiveCall.kt" +} + +task codegen_blackbox_functions_kt1038 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt1038.kt" +} + +task codegen_blackbox_functions_kt1199 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt1199.kt" +} + +task codegen_blackbox_functions_kt1413 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt1413.kt" +} + +task codegen_blackbox_functions_kt1649_1 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt1649_1.kt" +} + +task codegen_blackbox_functions_kt1649_2 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt1649_2.kt" +} + +task codegen_blackbox_functions_kt1739 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt1739.kt" +} + +task codegen_blackbox_functions_kt2270 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2270.kt" +} + +task codegen_blackbox_functions_kt2271 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2271.kt" +} + +task codegen_blackbox_functions_kt2280 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2280.kt" +} + +task codegen_blackbox_functions_kt2481 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2481.kt" +} + +task codegen_blackbox_functions_kt2716 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2716.kt" +} + +task codegen_blackbox_functions_kt2739 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2739.kt" +} + +task codegen_blackbox_functions_kt2929 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt2929.kt" +} + +task codegen_blackbox_functions_kt3214 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt3214.kt" +} + +task codegen_blackbox_functions_kt3313 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt3313.kt" +} + +task codegen_blackbox_functions_kt3573 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt3573.kt" +} + +task codegen_blackbox_functions_kt3724 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt3724.kt" +} + +task codegen_blackbox_functions_kt395 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt395.kt" +} + +task codegen_blackbox_functions_kt785 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt785.kt" +} + +task codegen_blackbox_functions_kt873 (type: RunExternalTest) { + source = "codegen/blackbox/functions/kt873.kt" +} + +task codegen_blackbox_functions_localFunction (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunction.kt" +} + +task codegen_blackbox_functions_localReturnInsideFunctionExpression (type: RunExternalTest) { + source = "codegen/blackbox/functions/localReturnInsideFunctionExpression.kt" +} + +task codegen_blackbox_functions_nothisnoclosure (type: RunExternalTest) { + source = "codegen/blackbox/functions/nothisnoclosure.kt" +} + +task codegen_blackbox_functions_prefixRecursiveCall (type: RunExternalTest) { + source = "codegen/blackbox/functions/prefixRecursiveCall.kt" +} + +task codegen_blackbox_functions_recursiveCompareTo (type: RunExternalTest) { + source = "codegen/blackbox/functions/recursiveCompareTo.kt" +} + +task codegen_blackbox_functions_recursiveIncrementCall (type: RunExternalTest) { + source = "codegen/blackbox/functions/recursiveIncrementCall.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle new file mode 100644 index 00000000000..445c6cb2aef --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_functions_functionExpression_functionExpression (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionExpression/functionExpression.kt" +} + +task codegen_blackbox_functions_functionExpression_functionExpressionWithThisReference (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionExpression/functionExpressionWithThisReference.kt" +} + +task codegen_blackbox_functions_functionExpression_functionLiteralExpression (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionExpression/functionLiteralExpression.kt" +} + +task codegen_blackbox_functions_functionExpression_underscoreParameters (type: RunExternalTest) { + source = "codegen/blackbox/functions/functionExpression/underscoreParameters.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle new file mode 100644 index 00000000000..f2a55b99390 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle @@ -0,0 +1,62 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_functions_invoke_castFunctionToExtension (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/castFunctionToExtension.kt" +} + +task codegen_blackbox_functions_invoke_extensionInvokeOnExpr (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/extensionInvokeOnExpr.kt" +} + +task codegen_blackbox_functions_invoke_implicitInvokeInCompanionObjectWithFunctionalArgument (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt" +} + +task codegen_blackbox_functions_invoke_implicitInvokeWithFunctionLiteralArgument (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt" +} + +task codegen_blackbox_functions_invoke_invoke (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/invoke.kt" +} + +task codegen_blackbox_functions_invoke_invokeOnExprByConvention (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/invokeOnExprByConvention.kt" +} + +task codegen_blackbox_functions_invoke_invokeOnSyntheticProperty (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt" +} + +task codegen_blackbox_functions_invoke_kt3189 (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3189.kt" +} + +task codegen_blackbox_functions_invoke_kt3190 (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3190.kt" +} + +task codegen_blackbox_functions_invoke_kt3297 (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3297.kt" +} + +task codegen_blackbox_functions_invoke_kt3450getAndInvoke (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3450getAndInvoke.kt" +} + +task codegen_blackbox_functions_invoke_kt3631invokeOnString (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3631invokeOnString.kt" +} + +task codegen_blackbox_functions_invoke_kt3772 (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3772.kt" +} + +task codegen_blackbox_functions_invoke_kt3821invokeOnThis (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3821invokeOnThis.kt" +} + +task codegen_blackbox_functions_invoke_kt3822invokeOnThis (type: RunExternalTest) { + source = "codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle new file mode 100644 index 00000000000..c247feb3eaa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_functions_localFunctions_callInlineLocalInLambda (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/callInlineLocalInLambda.kt" +} + +task codegen_blackbox_functions_localFunctions_definedWithinLambda (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/definedWithinLambda.kt" +} + +task codegen_blackbox_functions_localFunctions_definedWithinLambdaInnerUsage1 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage1.kt" +} + +task codegen_blackbox_functions_localFunctions_definedWithinLambdaInnerUsage2 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage2.kt" +} + +task codegen_blackbox_functions_localFunctions_kt2895 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt2895.kt" +} + +task codegen_blackbox_functions_localFunctions_kt3308 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt3308.kt" +} + +task codegen_blackbox_functions_localFunctions_kt3978 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt3978.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4119 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4119.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4119_2 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4119_2.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4514 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4514.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4777 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4777.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4783 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4783.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4784 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4784.kt" +} + +task codegen_blackbox_functions_localFunctions_kt4989 (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/kt4989.kt" +} + +task codegen_blackbox_functions_localFunctions_localExtensionOnNullableParameter (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/localExtensionOnNullableParameter.kt" +} + +task codegen_blackbox_functions_localFunctions_localFunctionInConstructor (type: RunExternalTest) { + source = "codegen/blackbox/functions/localFunctions/localFunctionInConstructor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle new file mode 100644 index 00000000000..4487ba50080 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_hashPMap_empty (type: RunExternalTest) { + source = "codegen/blackbox/hashPMap/empty.kt" +} + +task codegen_blackbox_hashPMap_manyNumbers (type: RunExternalTest) { + source = "codegen/blackbox/hashPMap/manyNumbers.kt" +} + +task codegen_blackbox_hashPMap_rewriteWithDifferent (type: RunExternalTest) { + source = "codegen/blackbox/hashPMap/rewriteWithDifferent.kt" +} + +task codegen_blackbox_hashPMap_rewriteWithEqual (type: RunExternalTest) { + source = "codegen/blackbox/hashPMap/rewriteWithEqual.kt" +} + +task codegen_blackbox_hashPMap_simplePlusGet (type: RunExternalTest) { + source = "codegen/blackbox/hashPMap/simplePlusGet.kt" +} + +task codegen_blackbox_hashPMap_simplePlusMinus (type: RunExternalTest) { + source = "codegen/blackbox/hashPMap/simplePlusMinus.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle new file mode 100644 index 00000000000..01362d55a40 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle @@ -0,0 +1,78 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ieee754_anyToReal (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/anyToReal.kt" +} + +task codegen_blackbox_ieee754_comparableTypeCast (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/comparableTypeCast.kt" +} + +task codegen_blackbox_ieee754_dataClass (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/dataClass.kt" +} + +task codegen_blackbox_ieee754_equalsDouble (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/equalsDouble.kt" +} + +task codegen_blackbox_ieee754_equalsFloat (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/equalsFloat.kt" +} + +task codegen_blackbox_ieee754_equalsNullableDouble (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/equalsNullableDouble.kt" +} + +task codegen_blackbox_ieee754_explicitCompareCall (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/explicitCompareCall.kt" +} + +task codegen_blackbox_ieee754_explicitEqualsCall (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/explicitEqualsCall.kt" +} + +task codegen_blackbox_ieee754_generic (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/generic.kt" +} + +task codegen_blackbox_ieee754_greaterDouble (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/greaterDouble.kt" +} + +task codegen_blackbox_ieee754_greaterFloat (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/greaterFloat.kt" +} + +task codegen_blackbox_ieee754_inline (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/inline.kt" +} + +task codegen_blackbox_ieee754_lessDouble (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/lessDouble.kt" +} + +task codegen_blackbox_ieee754_lessFloat (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/lessFloat.kt" +} + +task codegen_blackbox_ieee754_nullableAnyToReal (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/nullableAnyToReal.kt" +} + +task codegen_blackbox_ieee754_safeCall (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/safeCall.kt" +} + +task codegen_blackbox_ieee754_smartCastToDifferentTypes (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/smartCastToDifferentTypes.kt" +} + +task codegen_blackbox_ieee754_when (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/when.kt" +} + +task codegen_blackbox_ieee754_whenNoSubject (type: RunExternalTest) { + source = "codegen/blackbox/ieee754/whenNoSubject.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle new file mode 100644 index 00000000000..ac438342187 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle @@ -0,0 +1,90 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_increment_arrayElement (type: RunExternalTest) { + source = "codegen/blackbox/increment/arrayElement.kt" +} + +task codegen_blackbox_increment_assignPlusOnSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/assignPlusOnSmartCast.kt" +} + +task codegen_blackbox_increment_augmentedAssignmentWithComplexRhs (type: RunExternalTest) { + source = "codegen/blackbox/increment/augmentedAssignmentWithComplexRhs.kt" +} + +task codegen_blackbox_increment_classNaryGetSet (type: RunExternalTest) { + source = "codegen/blackbox/increment/classNaryGetSet.kt" +} + +task codegen_blackbox_increment_classWithGetSet (type: RunExternalTest) { + source = "codegen/blackbox/increment/classWithGetSet.kt" +} + +task codegen_blackbox_increment_extOnLong (type: RunExternalTest) { + source = "codegen/blackbox/increment/extOnLong.kt" +} + +task codegen_blackbox_increment_genericClassWithGetSet (type: RunExternalTest) { + source = "codegen/blackbox/increment/genericClassWithGetSet.kt" +} + +task codegen_blackbox_increment_memberExtOnLong (type: RunExternalTest) { + source = "codegen/blackbox/increment/memberExtOnLong.kt" +} + +task codegen_blackbox_increment_mutableListElement (type: RunExternalTest) { + source = "codegen/blackbox/increment/mutableListElement.kt" +} + +task codegen_blackbox_increment_nullable (type: RunExternalTest) { + source = "codegen/blackbox/increment/nullable.kt" +} + +task codegen_blackbox_increment_postfixIncrementDoubleSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixIncrementDoubleSmartCast.kt" +} + +task codegen_blackbox_increment_postfixIncrementOnClass (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixIncrementOnClass.kt" +} + +task codegen_blackbox_increment_postfixIncrementOnClassSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixIncrementOnClassSmartCast.kt" +} + +task codegen_blackbox_increment_postfixIncrementOnShortSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixIncrementOnShortSmartCast.kt" +} + +task codegen_blackbox_increment_postfixIncrementOnSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixIncrementOnSmartCast.kt" +} + +task codegen_blackbox_increment_postfixNullableClassIncrement (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixNullableClassIncrement.kt" +} + +task codegen_blackbox_increment_postfixNullableIncrement (type: RunExternalTest) { + source = "codegen/blackbox/increment/postfixNullableIncrement.kt" +} + +task codegen_blackbox_increment_prefixIncrementOnClass (type: RunExternalTest) { + source = "codegen/blackbox/increment/prefixIncrementOnClass.kt" +} + +task codegen_blackbox_increment_prefixIncrementOnClassSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/prefixIncrementOnClassSmartCast.kt" +} + +task codegen_blackbox_increment_prefixIncrementOnSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/increment/prefixIncrementOnSmartCast.kt" +} + +task codegen_blackbox_increment_prefixNullableClassIncrement (type: RunExternalTest) { + source = "codegen/blackbox/increment/prefixNullableClassIncrement.kt" +} + +task codegen_blackbox_increment_prefixNullableIncrement (type: RunExternalTest) { + source = "codegen/blackbox/increment/prefixNullableIncrement.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle new file mode 100644 index 00000000000..c39b6a0cb4c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle @@ -0,0 +1,94 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_innerNested_createdNestedInOuterMember (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/createdNestedInOuterMember.kt" +} + +task codegen_blackbox_innerNested_createNestedClass (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/createNestedClass.kt" +} + +task codegen_blackbox_innerNested_extensionFun (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/extensionFun.kt" +} + +task codegen_blackbox_innerNested_extensionToNested (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/extensionToNested.kt" +} + +task codegen_blackbox_innerNested_importNestedClass (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/importNestedClass.kt" +} + +task codegen_blackbox_innerNested_innerGeneric (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/innerGeneric.kt" +} + +task codegen_blackbox_innerNested_innerGenericClassFromJava (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/innerGenericClassFromJava.kt" +} + +task codegen_blackbox_innerNested_innerJavaClass (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/innerJavaClass.kt" +} + +task codegen_blackbox_innerNested_innerLabeledThis (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/innerLabeledThis.kt" +} + +task codegen_blackbox_innerNested_innerSimple (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/innerSimple.kt" +} + +task codegen_blackbox_innerNested_kt3132 (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/kt3132.kt" +} + +task codegen_blackbox_innerNested_kt3927 (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/kt3927.kt" +} + +task codegen_blackbox_innerNested_kt5363 (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/kt5363.kt" +} + +task codegen_blackbox_innerNested_kt6804 (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/kt6804.kt" +} + +task codegen_blackbox_innerNested_nestedClassInObject (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedClassInObject.kt" +} + +task codegen_blackbox_innerNested_nestedClassObject (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedClassObject.kt" +} + +task codegen_blackbox_innerNested_nestedEnumConstant (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedEnumConstant.kt" +} + +task codegen_blackbox_innerNested_nestedGeneric (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedGeneric.kt" +} + +task codegen_blackbox_innerNested_nestedInPackage (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedInPackage.kt" +} + +task codegen_blackbox_innerNested_nestedObjects (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedObjects.kt" +} + +task codegen_blackbox_innerNested_nestedSimple (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/nestedSimple.kt" +} + +task codegen_blackbox_innerNested_protectedNestedClass (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/protectedNestedClass.kt" +} + +task codegen_blackbox_innerNested_protectedNestedClassFromJava (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/protectedNestedClassFromJava.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle new file mode 100644 index 00000000000..f8e1f3b4259 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle @@ -0,0 +1,82 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_innerNested_superConstructorCall_deepInnerHierarchy (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/deepInnerHierarchy.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_deepLocalHierarchy (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/deepLocalHierarchy.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_innerExtendsInnerViaSecondaryConstuctor (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_innerExtendsInnerWithProperOuterCapture (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_innerExtendsOuter (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/innerExtendsOuter.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_kt11833_1 (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/kt11833_1.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_kt11833_2 (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/kt11833_2.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_localClassOuterDiffersFromInnerOuter (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_localExtendsInner (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/localExtendsInner.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_localExtendsLocalWithClosure (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_localWithClosureExtendsLocalWithClosure (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsClassDefaultArgument (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsClassVararg (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassVararg.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInner (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInner.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInnerDefaultArgument (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInnerOfLocalVarargAndDefault (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInnerOfLocalWithCapture (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsLocalCaptureInSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectExtendsLocalWithClosure (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt" +} + +task codegen_blackbox_innerNested_superConstructorCall_objectOuterDiffersFromInnerOuter (type: RunExternalTest) { + source = "codegen/blackbox/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle new file mode 100644 index 00000000000..51d5a95b1da --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_instructions_swap_swapRefToSharedVarInt (type: RunExternalTest) { + source = "codegen/blackbox/instructions/swap/swapRefToSharedVarInt.kt" +} + +task codegen_blackbox_instructions_swap_swapRefToSharedVarLong (type: RunExternalTest) { + source = "codegen/blackbox/instructions/swap/swapRefToSharedVarLong.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle new file mode 100644 index 00000000000..9c2d8fdc99a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle @@ -0,0 +1,78 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_intrinsics_charToInt (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/charToInt.kt" +} + +task codegen_blackbox_intrinsics_defaultObjectMapping (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/defaultObjectMapping.kt" +} + +task codegen_blackbox_intrinsics_ea35953 (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/ea35953.kt" +} + +task codegen_blackbox_intrinsics_incWithLabel (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/incWithLabel.kt" +} + +task codegen_blackbox_intrinsics_kt10131 (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt10131.kt" +} + +task codegen_blackbox_intrinsics_kt10131a (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt10131a.kt" +} + +task codegen_blackbox_intrinsics_kt12125 (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt12125.kt" +} + +task codegen_blackbox_intrinsics_kt12125_2 (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt12125_2.kt" +} + +task codegen_blackbox_intrinsics_kt12125_inc (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt12125_inc.kt" +} + +task codegen_blackbox_intrinsics_kt12125_inc_2 (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt12125_inc_2.kt" +} + +task codegen_blackbox_intrinsics_kt5937 (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/kt5937.kt" +} + +task codegen_blackbox_intrinsics_longRangeWithExplicitDot (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/longRangeWithExplicitDot.kt" +} + +task codegen_blackbox_intrinsics_prefixIncDec (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/prefixIncDec.kt" +} + +task codegen_blackbox_intrinsics_rangeFromCollection (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/rangeFromCollection.kt" +} + +task codegen_blackbox_intrinsics_stringFromCollection (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/stringFromCollection.kt" +} + +task codegen_blackbox_intrinsics_throwable (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/throwable.kt" +} + +task codegen_blackbox_intrinsics_throwableCallableReference (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/throwableCallableReference.kt" +} + +task codegen_blackbox_intrinsics_throwableParamOrder (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/throwableParamOrder.kt" +} + +task codegen_blackbox_intrinsics_tostring (type: RunExternalTest) { + source = "codegen/blackbox/intrinsics/tostring.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle new file mode 100644 index 00000000000..60b8692b389 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_javaInterop_lambdaInstanceOf (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/lambdaInstanceOf.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle new file mode 100644 index 00000000000..1d55d886343 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_javaInterop_generics_allWildcardsOnClass (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt" +} + +task codegen_blackbox_javaInterop_generics_covariantOverrideWithDeclarationSiteProjection (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt" +} + +task codegen_blackbox_javaInterop_generics_invariantArgumentsNoWildcard (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle new file mode 100644 index 00000000000..9831abbbc07 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_javaInterop_notNullAssertions_extensionReceiverParameter (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt" +} + +task codegen_blackbox_javaInterop_notNullAssertions_mapPut (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/notNullAssertions/mapPut.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle new file mode 100644 index 00000000000..7c46fe3ca31 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_javaInterop_objectMethods_cloneableClassWithoutClone (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt" +} + +task codegen_blackbox_javaInterop_objectMethods_cloneCallsConstructor (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt" +} + +task codegen_blackbox_javaInterop_objectMethods_cloneCallsSuper (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt" +} + +task codegen_blackbox_javaInterop_objectMethods_cloneCallsSuperAndModifies (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt" +} + +task codegen_blackbox_javaInterop_objectMethods_cloneHashSet (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/objectMethods/cloneHashSet.kt" +} + +task codegen_blackbox_javaInterop_objectMethods_cloneHierarchy (type: RunExternalTest) { + source = "codegen/blackbox/javaInterop/objectMethods/cloneHierarchy.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle new file mode 100644 index 00000000000..4e6bf2d4813 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_jdk_arrayList (type: RunExternalTest) { + source = "codegen/blackbox/jdk/arrayList.kt" +} + +task codegen_blackbox_jdk_hashMap (type: RunExternalTest) { + source = "codegen/blackbox/jdk/hashMap.kt" +} + +task codegen_blackbox_jdk_iteratingOverHashMap (type: RunExternalTest) { + source = "codegen/blackbox/jdk/iteratingOverHashMap.kt" +} + +task codegen_blackbox_jdk_kt1397 (type: RunExternalTest) { + source = "codegen/blackbox/jdk/kt1397.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle new file mode 100644 index 00000000000..dfdfb68fb1c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_jvmField_captureClassFields (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/captureClassFields.kt" +} + +task codegen_blackbox_jvmField_capturePackageFields (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/capturePackageFields.kt" +} + +task codegen_blackbox_jvmField_checkNoAccessors (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/checkNoAccessors.kt" +} + +task codegen_blackbox_jvmField_classFieldReference (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/classFieldReference.kt" +} + +task codegen_blackbox_jvmField_classFieldReflection (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/classFieldReflection.kt" +} + +task codegen_blackbox_jvmField_constructorProperty (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/constructorProperty.kt" +} + +task codegen_blackbox_jvmField_publicField (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/publicField.kt" +} + +task codegen_blackbox_jvmField_simpleMemberProperty (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/simpleMemberProperty.kt" +} + +task codegen_blackbox_jvmField_superCall (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/superCall.kt" +} + +task codegen_blackbox_jvmField_superCall2 (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/superCall2.kt" +} + +task codegen_blackbox_jvmField_topLevelFieldReference (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/topLevelFieldReference.kt" +} + +task codegen_blackbox_jvmField_topLevelFieldReflection (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/topLevelFieldReflection.kt" +} + +task codegen_blackbox_jvmField_visibility (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/visibility.kt" +} + +task codegen_blackbox_jvmField_writeFieldReference (type: RunExternalTest) { + source = "codegen/blackbox/jvmField/writeFieldReference.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle new file mode 100644 index 00000000000..2727eaf4a1c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_jvmName_callableReference (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/callableReference.kt" +} + +task codegen_blackbox_jvmName_clashingErasure (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/clashingErasure.kt" +} + +task codegen_blackbox_jvmName_classMembers (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/classMembers.kt" +} + +task codegen_blackbox_jvmName_fakeJvmNameInJava (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/fakeJvmNameInJava.kt" +} + +task codegen_blackbox_jvmName_functionName (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/functionName.kt" +} + +task codegen_blackbox_jvmName_multifileClass (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/multifileClass.kt" +} + +task codegen_blackbox_jvmName_multifileClassWithLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/multifileClassWithLocalClass.kt" +} + +task codegen_blackbox_jvmName_multifileClassWithLocalGeneric (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt" +} + +task codegen_blackbox_jvmName_propertyAccessorsUseSite (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/propertyAccessorsUseSite.kt" +} + +task codegen_blackbox_jvmName_propertyName (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/propertyName.kt" +} + +task codegen_blackbox_jvmName_renamedFileClass (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/renamedFileClass.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle new file mode 100644 index 00000000000..b4db50d6e8a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_jvmName_fileFacades_differentFiles (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/fileFacades/differentFiles.kt" +} + +task codegen_blackbox_jvmName_fileFacades_javaAnnotationOnFileFacade (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt" +} + +task codegen_blackbox_jvmName_fileFacades_simple (type: RunExternalTest) { + source = "codegen/blackbox/jvmName/fileFacades/simple.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle new file mode 100644 index 00000000000..7ec750346ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_jvmOverloads_companionObject (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/companionObject.kt" +} + +task codegen_blackbox_jvmOverloads_defaultsNotAtEnd (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt" +} + +task codegen_blackbox_jvmOverloads_doubleParameters (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/doubleParameters.kt" +} + +task codegen_blackbox_jvmOverloads_extensionMethod (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/extensionMethod.kt" +} + +task codegen_blackbox_jvmOverloads_generics (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/generics.kt" +} + +task codegen_blackbox_jvmOverloads_innerClass (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/innerClass.kt" +} + +task codegen_blackbox_jvmOverloads_multipleDefaultParameters (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt" +} + +task codegen_blackbox_jvmOverloads_nonDefaultParameter (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/nonDefaultParameter.kt" +} + +task codegen_blackbox_jvmOverloads_primaryConstructor (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/primaryConstructor.kt" +} + +task codegen_blackbox_jvmOverloads_privateClass (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/privateClass.kt" +} + +task codegen_blackbox_jvmOverloads_secondaryConstructor (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/secondaryConstructor.kt" +} + +task codegen_blackbox_jvmOverloads_simple (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/simple.kt" +} + +task codegen_blackbox_jvmOverloads_simpleJavaCall (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/simpleJavaCall.kt" +} + +task codegen_blackbox_jvmOverloads_varargs (type: RunExternalTest) { + source = "codegen/blackbox/jvmOverloads/varargs.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle new file mode 100644 index 00000000000..a87d54bd081 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle @@ -0,0 +1,94 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_jvmStatic_annotations (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/annotations.kt" +} + +task codegen_blackbox_jvmStatic_closure (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/closure.kt" +} + +task codegen_blackbox_jvmStatic_companionObject (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/companionObject.kt" +} + +task codegen_blackbox_jvmStatic_convention (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/convention.kt" +} + +task codegen_blackbox_jvmStatic_default (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/default.kt" +} + +task codegen_blackbox_jvmStatic_enumCompanion (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/enumCompanion.kt" +} + +task codegen_blackbox_jvmStatic_explicitObject (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/explicitObject.kt" +} + +task codegen_blackbox_jvmStatic_funAccess (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/funAccess.kt" +} + +task codegen_blackbox_jvmStatic_importStaticMemberFromObject (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt" +} + +task codegen_blackbox_jvmStatic_inline (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/inline.kt" +} + +task codegen_blackbox_jvmStatic_inlinePropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt" +} + +task codegen_blackbox_jvmStatic_kt9897_static (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/kt9897_static.kt" +} + +task codegen_blackbox_jvmStatic_object (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/object.kt" +} + +task codegen_blackbox_jvmStatic_postfixInc (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/postfixInc.kt" +} + +task codegen_blackbox_jvmStatic_prefixInc (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/prefixInc.kt" +} + +task codegen_blackbox_jvmStatic_privateMethod (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/privateMethod.kt" +} + +task codegen_blackbox_jvmStatic_privateSetter (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/privateSetter.kt" +} + +task codegen_blackbox_jvmStatic_propertyAccess (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/propertyAccess.kt" +} + +task codegen_blackbox_jvmStatic_propertyAccessorsCompanion (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt" +} + +task codegen_blackbox_jvmStatic_propertyAccessorsObject (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/propertyAccessorsObject.kt" +} + +task codegen_blackbox_jvmStatic_propertyAsDefault (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/propertyAsDefault.kt" +} + +task codegen_blackbox_jvmStatic_simple (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/simple.kt" +} + +task codegen_blackbox_jvmStatic_syntheticAccessor (type: RunExternalTest) { + source = "codegen/blackbox/jvmStatic/syntheticAccessor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle new file mode 100644 index 00000000000..92506486612 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_labels_labeledDeclarations (type: RunExternalTest) { + source = "codegen/blackbox/labels/labeledDeclarations.kt" +} + +task codegen_blackbox_labels_propertyAccessor (type: RunExternalTest) { + source = "codegen/blackbox/labels/propertyAccessor.kt" +} + +task codegen_blackbox_labels_propertyAccessorFunctionLiteral (type: RunExternalTest) { + source = "codegen/blackbox/labels/propertyAccessorFunctionLiteral.kt" +} + +task codegen_blackbox_labels_propertyAccessorInnerExtensionFun (type: RunExternalTest) { + source = "codegen/blackbox/labels/propertyAccessorInnerExtensionFun.kt" +} + +task codegen_blackbox_labels_propertyAccessorObject (type: RunExternalTest) { + source = "codegen/blackbox/labels/propertyAccessorObject.kt" +} + +task codegen_blackbox_labels_propertyInClassAccessor (type: RunExternalTest) { + source = "codegen/blackbox/labels/propertyInClassAccessor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle new file mode 100644 index 00000000000..714032e87df --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle @@ -0,0 +1,38 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_lazyCodegen_exceptionInFieldInitializer (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/exceptionInFieldInitializer.kt" +} + +task codegen_blackbox_lazyCodegen_ifElse (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/ifElse.kt" +} + +task codegen_blackbox_lazyCodegen_increment (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/increment.kt" +} + +task codegen_blackbox_lazyCodegen_safeAssign (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/safeAssign.kt" +} + +task codegen_blackbox_lazyCodegen_safeAssignComplex (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/safeAssignComplex.kt" +} + +task codegen_blackbox_lazyCodegen_safeCallAndArray (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/safeCallAndArray.kt" +} + +task codegen_blackbox_lazyCodegen_toString (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/toString.kt" +} + +task codegen_blackbox_lazyCodegen_tryCatchExpression (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/tryCatchExpression.kt" +} + +task codegen_blackbox_lazyCodegen_when (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/when.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle new file mode 100644 index 00000000000..f2114e9737c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle @@ -0,0 +1,38 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_lazyCodegen_optimizations_negateConstantCompare (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateConstantCompare.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateFalse (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateFalse.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateFalseVar (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateFalseVar.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateFalseVarChain (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateFalseVarChain.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateObjectComp (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateObjectComp.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateObjectComp2 (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateObjectComp2.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateTrue (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateTrue.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_negateTrueVar (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/negateTrueVar.kt" +} + +task codegen_blackbox_lazyCodegen_optimizations_noOptimization (type: RunExternalTest) { + source = "codegen/blackbox/lazyCodegen/optimizations/noOptimization.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle new file mode 100644 index 00000000000..999b1c3d607 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle @@ -0,0 +1,110 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_localClasses_anonymousObjectInInitializer (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/anonymousObjectInInitializer.kt" +} + +task codegen_blackbox_localClasses_anonymousObjectInParameterInitializer (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/anonymousObjectInParameterInitializer.kt" +} + +task codegen_blackbox_localClasses_closureOfInnerLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/closureOfInnerLocalClass.kt" +} + +task codegen_blackbox_localClasses_closureOfLambdaInLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/closureOfLambdaInLocalClass.kt" +} + +task codegen_blackbox_localClasses_closureWithSelfInstantiation (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/closureWithSelfInstantiation.kt" +} + +task codegen_blackbox_localClasses_inExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/inExtensionFunction.kt" +} + +task codegen_blackbox_localClasses_inExtensionProperty (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/inExtensionProperty.kt" +} + +task codegen_blackbox_localClasses_inLocalExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/inLocalExtensionFunction.kt" +} + +task codegen_blackbox_localClasses_inLocalExtensionProperty (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/inLocalExtensionProperty.kt" +} + +task codegen_blackbox_localClasses_innerClassInLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/innerClassInLocalClass.kt" +} + +task codegen_blackbox_localClasses_innerOfLocalCaptureExtensionReceiver (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/innerOfLocalCaptureExtensionReceiver.kt" +} + +task codegen_blackbox_localClasses_kt2700 (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/kt2700.kt" +} + +task codegen_blackbox_localClasses_kt2873 (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/kt2873.kt" +} + +task codegen_blackbox_localClasses_kt3210 (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/kt3210.kt" +} + +task codegen_blackbox_localClasses_kt3389 (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/kt3389.kt" +} + +task codegen_blackbox_localClasses_kt3584 (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/kt3584.kt" +} + +task codegen_blackbox_localClasses_kt4174 (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/kt4174.kt" +} + +task codegen_blackbox_localClasses_localClass (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/localClass.kt" +} + +task codegen_blackbox_localClasses_localClassCaptureExtensionReceiver (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/localClassCaptureExtensionReceiver.kt" +} + +task codegen_blackbox_localClasses_localClassInInitializer (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/localClassInInitializer.kt" +} + +task codegen_blackbox_localClasses_localClassInParameterInitializer (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/localClassInParameterInitializer.kt" +} + +task codegen_blackbox_localClasses_localDataClass (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/localDataClass.kt" +} + +task codegen_blackbox_localClasses_localExtendsInnerAndReferencesOuterMember (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/localExtendsInnerAndReferencesOuterMember.kt" +} + +task codegen_blackbox_localClasses_noclosure (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/noclosure.kt" +} + +task codegen_blackbox_localClasses_object (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/object.kt" +} + +task codegen_blackbox_localClasses_ownClosureOfInnerLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/ownClosureOfInnerLocalClass.kt" +} + +task codegen_blackbox_localClasses_withclosure (type: RunExternalTest) { + source = "codegen/blackbox/localClasses/withclosure.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle new file mode 100644 index 00000000000..e6f64c8e593 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_mangling_field (type: RunExternalTest) { + source = "codegen/blackbox/mangling/field.kt" +} + +task codegen_blackbox_mangling_fun (type: RunExternalTest) { + source = "codegen/blackbox/mangling/fun.kt" +} + +task codegen_blackbox_mangling_internalOverride (type: RunExternalTest) { + source = "codegen/blackbox/mangling/internalOverride.kt" +} + +task codegen_blackbox_mangling_internalOverrideSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/mangling/internalOverrideSuperCall.kt" +} + +task codegen_blackbox_mangling_noOverrideWithJava (type: RunExternalTest) { + source = "codegen/blackbox/mangling/noOverrideWithJava.kt" +} + +task codegen_blackbox_mangling_publicOverride (type: RunExternalTest) { + source = "codegen/blackbox/mangling/publicOverride.kt" +} + +task codegen_blackbox_mangling_publicOverrideSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/mangling/publicOverrideSuperCall.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle new file mode 100644 index 00000000000..8c27b2f90c6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_ComplexInitializer (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/ComplexInitializer.kt" +} + +task codegen_blackbox_multiDecl_component (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/component.kt" +} + +task codegen_blackbox_multiDecl_kt9828_hashMap (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/kt9828_hashMap.kt" +} + +task codegen_blackbox_multiDecl_returnInElvis (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/returnInElvis.kt" +} + +task codegen_blackbox_multiDecl_SimpleVals (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/SimpleVals.kt" +} + +task codegen_blackbox_multiDecl_SimpleValsExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/SimpleValsExtensions.kt" +} + +task codegen_blackbox_multiDecl_SimpleVarsExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/SimpleVarsExtensions.kt" +} + +task codegen_blackbox_multiDecl_UnderscoreNames (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/UnderscoreNames.kt" +} + +task codegen_blackbox_multiDecl_ValCapturedInFunctionLiteral (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/ValCapturedInFunctionLiteral.kt" +} + +task codegen_blackbox_multiDecl_ValCapturedInLocalFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/ValCapturedInLocalFunction.kt" +} + +task codegen_blackbox_multiDecl_ValCapturedInObjectLiteral (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/ValCapturedInObjectLiteral.kt" +} + +task codegen_blackbox_multiDecl_VarCapturedInFunctionLiteral (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/VarCapturedInFunctionLiteral.kt" +} + +task codegen_blackbox_multiDecl_VarCapturedInLocalFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/VarCapturedInLocalFunction.kt" +} + +task codegen_blackbox_multiDecl_VarCapturedInObjectLiteral (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/VarCapturedInObjectLiteral.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle new file mode 100644 index 00000000000..16d8c7c97ae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forIterator_MultiDeclFor (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/MultiDeclFor.kt" +} + +task codegen_blackbox_multiDecl_forIterator_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forIterator_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forIterator_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + +task codegen_blackbox_multiDecl_forIterator_MultiDeclForValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForValCaptured.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle new file mode 100644 index 00000000000..3173f0e5afa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle new file mode 100644 index 00000000000..df9a76bdae7 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_MultiDeclFor (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/MultiDeclFor.kt" +} + +task codegen_blackbox_multiDecl_forRange_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + +task codegen_blackbox_multiDecl_forRange_MultiDeclForValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/MultiDeclForValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_UnderscoreNames (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/UnderscoreNames.kt" +} + +task codegen_blackbox_multiDecl_forRange_UnderscoreNamesDontCallComponent (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle new file mode 100644 index 00000000000..38f54a00320 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclFor (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle new file mode 100644 index 00000000000..765d8ef6c59 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle new file mode 100644 index 00000000000..3f61fc445ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle new file mode 100644 index 00000000000..43091265daa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclFor (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle new file mode 100644 index 00000000000..15b88292449 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle new file mode 100644 index 00000000000..cd8778e5ee2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle new file mode 100644 index 00000000000..319e045c3e9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle new file mode 100644 index 00000000000..2e9faa2e850 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt" +} + +task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt" +} + +task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle new file mode 100644 index 00000000000..49f4b309ba3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multifileClasses_callMultifileClassMemberFromOtherPackage (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt" +} + +task codegen_blackbox_multifileClasses_callsToMultifileClassFromOtherPackage (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt" +} + +task codegen_blackbox_multifileClasses_constPropertyReferenceFromMultifileClass (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt" +} + +task codegen_blackbox_multifileClasses_inlineMultifileClassMemberFromOtherPackage (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt" +} + +task codegen_blackbox_multifileClasses_multifileClassPartsInitialization (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt" +} + +task codegen_blackbox_multifileClasses_multifileClassWith2Files (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/multifileClassWith2Files.kt" +} + +task codegen_blackbox_multifileClasses_multifileClassWithCrossCall (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt" +} + +task codegen_blackbox_multifileClasses_multifileClassWithPrivate (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt" +} + +task codegen_blackbox_multifileClasses_privateConstVal (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/privateConstVal.kt" +} + +task codegen_blackbox_multifileClasses_samePartNameDifferentFacades (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle new file mode 100644 index 00000000000..3bd8dee69a4 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_multifileClasses_optimized_callableRefToFun (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt" +} + +task codegen_blackbox_multifileClasses_optimized_callableRefToInternalValInline (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt" +} + +task codegen_blackbox_multifileClasses_optimized_callableRefToPrivateVal (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt" +} + +task codegen_blackbox_multifileClasses_optimized_callableRefToVal (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt" +} + +task codegen_blackbox_multifileClasses_optimized_calls (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/calls.kt" +} + +task codegen_blackbox_multifileClasses_optimized_deferredStaticInitialization (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt" +} + +task codegen_blackbox_multifileClasses_optimized_delegatedVal (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/delegatedVal.kt" +} + +task codegen_blackbox_multifileClasses_optimized_initializePrivateVal (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt" +} + +task codegen_blackbox_multifileClasses_optimized_initializePublicVal (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt" +} + +task codegen_blackbox_multifileClasses_optimized_overlappingFuns (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt" +} + +task codegen_blackbox_multifileClasses_optimized_overlappingVals (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/overlappingVals.kt" +} + +task codegen_blackbox_multifileClasses_optimized_valAccessFromInlinedToDifferentPackage (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt" +} + +task codegen_blackbox_multifileClasses_optimized_valAccessFromInlineFunCalledFromJava (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt" +} + +task codegen_blackbox_multifileClasses_optimized_valWithAccessor (type: RunExternalTest) { + source = "codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle new file mode 100644 index 00000000000..a060b6a165b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_nonLocalReturns_kt6895 (type: RunExternalTest) { + source = "codegen/blackbox/nonLocalReturns/kt6895.kt" +} + +task codegen_blackbox_nonLocalReturns_kt9644let (type: RunExternalTest) { + source = "codegen/blackbox/nonLocalReturns/kt9644let.kt" +} + +task codegen_blackbox_nonLocalReturns_use (type: RunExternalTest) { + source = "codegen/blackbox/nonLocalReturns/use.kt" +} + +task codegen_blackbox_nonLocalReturns_useWithException (type: RunExternalTest) { + source = "codegen/blackbox/nonLocalReturns/useWithException.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle new file mode 100644 index 00000000000..32ce1634a71 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_objectIntrinsics_objects (type: RunExternalTest) { + source = "codegen/blackbox/objectIntrinsics/objects.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle new file mode 100644 index 00000000000..6a6be6f480c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle @@ -0,0 +1,174 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_objects_anonymousObjectPropertyInitialization (type: RunExternalTest) { + source = "codegen/blackbox/objects/anonymousObjectPropertyInitialization.kt" +} + +task codegen_blackbox_objects_classCallsProtectedInheritedByCompanion (type: RunExternalTest) { + source = "codegen/blackbox/objects/classCallsProtectedInheritedByCompanion.kt" +} + +task codegen_blackbox_objects_flist (type: RunExternalTest) { + source = "codegen/blackbox/objects/flist.kt" +} + +task codegen_blackbox_objects_initializationOrder (type: RunExternalTest) { + source = "codegen/blackbox/objects/initializationOrder.kt" +} + +task codegen_blackbox_objects_kt1047 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt1047.kt" +} + +task codegen_blackbox_objects_kt11117 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt11117.kt" +} + +task codegen_blackbox_objects_kt1136 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt1136.kt" +} + +task codegen_blackbox_objects_kt1186 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt1186.kt" +} + +task codegen_blackbox_objects_kt1600 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt1600.kt" +} + +task codegen_blackbox_objects_kt1737 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt1737.kt" +} + +task codegen_blackbox_objects_kt2398 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt2398.kt" +} + +task codegen_blackbox_objects_kt2663 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt2663.kt" +} + +task codegen_blackbox_objects_kt2663_2 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt2663_2.kt" +} + +task codegen_blackbox_objects_kt2675 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt2675.kt" +} + +task codegen_blackbox_objects_kt2719 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt2719.kt" +} + +task codegen_blackbox_objects_kt2822 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt2822.kt" +} + +task codegen_blackbox_objects_kt3238 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt3238.kt" +} + +task codegen_blackbox_objects_kt3684 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt3684.kt" +} + +task codegen_blackbox_objects_kt4086 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt4086.kt" +} + +task codegen_blackbox_objects_kt535 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt535.kt" +} + +task codegen_blackbox_objects_kt560 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt560.kt" +} + +task codegen_blackbox_objects_kt694 (type: RunExternalTest) { + source = "codegen/blackbox/objects/kt694.kt" +} + +task codegen_blackbox_objects_localFunctionInObjectInitializer_kt4516 (type: RunExternalTest) { + source = "codegen/blackbox/objects/localFunctionInObjectInitializer_kt4516.kt" +} + +task codegen_blackbox_objects_methodOnObject (type: RunExternalTest) { + source = "codegen/blackbox/objects/methodOnObject.kt" +} + +task codegen_blackbox_objects_nestedDerivedClassCallsProtectedFromCompanion (type: RunExternalTest) { + source = "codegen/blackbox/objects/nestedDerivedClassCallsProtectedFromCompanion.kt" +} + +task codegen_blackbox_objects_nestedObjectWithSuperclass (type: RunExternalTest) { + source = "codegen/blackbox/objects/nestedObjectWithSuperclass.kt" +} + +task codegen_blackbox_objects_objectExtendsInnerAndReferencesOuterMember (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectExtendsInnerAndReferencesOuterMember.kt" +} + +task codegen_blackbox_objects_objectInitialization_kt5523 (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectInitialization_kt5523.kt" +} + +task codegen_blackbox_objects_objectInLocalAnonymousObject (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectInLocalAnonymousObject.kt" +} + +task codegen_blackbox_objects_objectLiteral (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectLiteral.kt" +} + +task codegen_blackbox_objects_objectLiteralInClosure (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectLiteralInClosure.kt" +} + +task codegen_blackbox_objects_objectVsClassInitialization_kt5291 (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectVsClassInitialization_kt5291.kt" +} + +task codegen_blackbox_objects_objectWithSuperclass (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectWithSuperclass.kt" +} + +task codegen_blackbox_objects_objectWithSuperclassAndTrait (type: RunExternalTest) { + source = "codegen/blackbox/objects/objectWithSuperclassAndTrait.kt" +} + +task codegen_blackbox_objects_privateExtensionFromInitializer_kt4543 (type: RunExternalTest) { + source = "codegen/blackbox/objects/privateExtensionFromInitializer_kt4543.kt" +} + +task codegen_blackbox_objects_privateFunctionFromClosureInInitializer_kt5582 (type: RunExternalTest) { + source = "codegen/blackbox/objects/privateFunctionFromClosureInInitializer_kt5582.kt" +} + +task codegen_blackbox_objects_receiverInConstructor (type: RunExternalTest) { + source = "codegen/blackbox/objects/receiverInConstructor.kt" +} + +task codegen_blackbox_objects_safeAccess (type: RunExternalTest) { + source = "codegen/blackbox/objects/safeAccess.kt" +} + +task codegen_blackbox_objects_simpleObject (type: RunExternalTest) { + source = "codegen/blackbox/objects/simpleObject.kt" +} + +task codegen_blackbox_objects_thisInConstructor (type: RunExternalTest) { + source = "codegen/blackbox/objects/thisInConstructor.kt" +} + +task codegen_blackbox_objects_useAnonymousObjectAsIterator (type: RunExternalTest) { + source = "codegen/blackbox/objects/useAnonymousObjectAsIterator.kt" +} + +task codegen_blackbox_objects_useImportedMember (type: RunExternalTest) { + source = "codegen/blackbox/objects/useImportedMember.kt" +} + +task codegen_blackbox_objects_useImportedMemberFromCompanion (type: RunExternalTest) { + source = "codegen/blackbox/objects/useImportedMemberFromCompanion.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle new file mode 100644 index 00000000000..24e17e1c93d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle @@ -0,0 +1,58 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_operatorConventions_annotatedAssignment (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/annotatedAssignment.kt" +} + +task codegen_blackbox_operatorConventions_assignmentOperations (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/assignmentOperations.kt" +} + +task codegen_blackbox_operatorConventions_augmentedAssignmentWithArrayLHS (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/augmentedAssignmentWithArrayLHS.kt" +} + +task codegen_blackbox_operatorConventions_incDecOnObject (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/incDecOnObject.kt" +} + +task codegen_blackbox_operatorConventions_kt14201 (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/kt14201.kt" +} + +task codegen_blackbox_operatorConventions_kt14201_2 (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/kt14201_2.kt" +} + +task codegen_blackbox_operatorConventions_kt4152 (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/kt4152.kt" +} + +task codegen_blackbox_operatorConventions_kt4987 (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/kt4987.kt" +} + +task codegen_blackbox_operatorConventions_nestedMaps (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/nestedMaps.kt" +} + +task codegen_blackbox_operatorConventions_operatorSetLambda (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/operatorSetLambda.kt" +} + +task codegen_blackbox_operatorConventions_overloadedSet (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/overloadedSet.kt" +} + +task codegen_blackbox_operatorConventions_percentAsModOnBigIntegerWithoutRem (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt" +} + +task codegen_blackbox_operatorConventions_remAssignmentOperation (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/remAssignmentOperation.kt" +} + +task codegen_blackbox_operatorConventions_remOverModOperation (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/remOverModOperation.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle new file mode 100644 index 00000000000..b545d5536e3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_operatorConventions_compareTo_boolean (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/boolean.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_comparable (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/comparable.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_doubleInt (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/doubleInt.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_doubleLong (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/doubleLong.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_extensionArray (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/extensionArray.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_extensionObject (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/extensionObject.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_intDouble (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/intDouble.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_intLong (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/intLong.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_longDouble (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/longDouble.kt" +} + +task codegen_blackbox_operatorConventions_compareTo_longInt (type: RunExternalTest) { + source = "codegen/blackbox/operatorConventions/compareTo/longInt.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/package/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/package/build-generated.gradle new file mode 100644 index 00000000000..acee5c48b1b --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/package/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_package_boxPrimitiveTypeInClinit (type: RunExternalTest) { + source = "codegen/blackbox/package/boxPrimitiveTypeInClinit.kt" +} + +task codegen_blackbox_package_checkCast (type: RunExternalTest) { + source = "codegen/blackbox/package/checkCast.kt" +} + +task codegen_blackbox_package_incrementProperty (type: RunExternalTest) { + source = "codegen/blackbox/package/incrementProperty.kt" +} + +task codegen_blackbox_package_initializationOrder (type: RunExternalTest) { + source = "codegen/blackbox/package/initializationOrder.kt" +} + +task codegen_blackbox_package_invokespecial (type: RunExternalTest) { + source = "codegen/blackbox/package/invokespecial.kt" +} + +task codegen_blackbox_package_mainInFiles (type: RunExternalTest) { + source = "codegen/blackbox/package/mainInFiles.kt" +} + +task codegen_blackbox_package_nullablePrimitiveNoFieldInitializer (type: RunExternalTest) { + source = "codegen/blackbox/package/nullablePrimitiveNoFieldInitializer.kt" +} + +task codegen_blackbox_package_packageLocalClassNotImportedWithDefaultImport (type: RunExternalTest) { + source = "codegen/blackbox/package/packageLocalClassNotImportedWithDefaultImport.kt" +} + +task codegen_blackbox_package_packageQualifiedMethod (type: RunExternalTest) { + source = "codegen/blackbox/package/packageQualifiedMethod.kt" +} + +task codegen_blackbox_package_privateTopLevelPropAndVarInInner (type: RunExternalTest) { + source = "codegen/blackbox/package/privateTopLevelPropAndVarInInner.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle new file mode 100644 index 00000000000..e1860d19470 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle @@ -0,0 +1,82 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_platformTypes_primitives_assign (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/assign.kt" +} + +task codegen_blackbox_platformTypes_primitives_compareTo (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/compareTo.kt" +} + +task codegen_blackbox_platformTypes_primitives_dec (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/dec.kt" +} + +task codegen_blackbox_platformTypes_primitives_div (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/div.kt" +} + +task codegen_blackbox_platformTypes_primitives_equals (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/equals.kt" +} + +task codegen_blackbox_platformTypes_primitives_hashCode (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/hashCode.kt" +} + +task codegen_blackbox_platformTypes_primitives_identityEquals (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/identityEquals.kt" +} + +task codegen_blackbox_platformTypes_primitives_inc (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/inc.kt" +} + +task codegen_blackbox_platformTypes_primitives_minus (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/minus.kt" +} + +task codegen_blackbox_platformTypes_primitives_mod (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/mod.kt" +} + +task codegen_blackbox_platformTypes_primitives_not (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/not.kt" +} + +task codegen_blackbox_platformTypes_primitives_notEquals (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/notEquals.kt" +} + +task codegen_blackbox_platformTypes_primitives_plus (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/plus.kt" +} + +task codegen_blackbox_platformTypes_primitives_plusAssign (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/plusAssign.kt" +} + +task codegen_blackbox_platformTypes_primitives_rangeTo (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/rangeTo.kt" +} + +task codegen_blackbox_platformTypes_primitives_times (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/times.kt" +} + +task codegen_blackbox_platformTypes_primitives_toShort (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/toShort.kt" +} + +task codegen_blackbox_platformTypes_primitives_toString (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/toString.kt" +} + +task codegen_blackbox_platformTypes_primitives_unaryMinus (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/unaryMinus.kt" +} + +task codegen_blackbox_platformTypes_primitives_unaryPlus (type: RunExternalTest) { + source = "codegen/blackbox/platformTypes/primitives/unaryPlus.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle new file mode 100644 index 00000000000..9fda00c03f1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle @@ -0,0 +1,210 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_primitiveTypes_comparisonWithNaN (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/comparisonWithNaN.kt" +} + +task codegen_blackbox_primitiveTypes_comparisonWithNullCallsFun (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/comparisonWithNullCallsFun.kt" +} + +task codegen_blackbox_primitiveTypes_ea35963 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/ea35963.kt" +} + +task codegen_blackbox_primitiveTypes_equalsHashCodeToString (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/equalsHashCodeToString.kt" +} + +task codegen_blackbox_primitiveTypes_incrementByteCharShort (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/incrementByteCharShort.kt" +} + +task codegen_blackbox_primitiveTypes_intLiteralIsNotNull (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/intLiteralIsNotNull.kt" +} + +task codegen_blackbox_primitiveTypes_kt1054 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt1054.kt" +} + +task codegen_blackbox_primitiveTypes_kt1055 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt1055.kt" +} + +task codegen_blackbox_primitiveTypes_kt1093 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt1093.kt" +} + +task codegen_blackbox_primitiveTypes_kt13023 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt13023.kt" +} + +task codegen_blackbox_primitiveTypes_kt14868 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt14868.kt" +} + +task codegen_blackbox_primitiveTypes_kt1508 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt1508.kt" +} + +task codegen_blackbox_primitiveTypes_kt1634 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt1634.kt" +} + +task codegen_blackbox_primitiveTypes_kt2251 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt2251.kt" +} + +task codegen_blackbox_primitiveTypes_kt2269 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt2269.kt" +} + +task codegen_blackbox_primitiveTypes_kt2275 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt2275.kt" +} + +task codegen_blackbox_primitiveTypes_kt239 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt239.kt" +} + +task codegen_blackbox_primitiveTypes_kt242 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt242.kt" +} + +task codegen_blackbox_primitiveTypes_kt243 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt243.kt" +} + +task codegen_blackbox_primitiveTypes_kt248 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt248.kt" +} + +task codegen_blackbox_primitiveTypes_kt2768 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt2768.kt" +} + +task codegen_blackbox_primitiveTypes_kt2794 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt2794.kt" +} + +task codegen_blackbox_primitiveTypes_kt3078 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt3078.kt" +} + +task codegen_blackbox_primitiveTypes_kt3517 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt3517.kt" +} + +task codegen_blackbox_primitiveTypes_kt3576 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt3576.kt" +} + +task codegen_blackbox_primitiveTypes_kt3613 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt3613.kt" +} + +task codegen_blackbox_primitiveTypes_kt4097 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt4097.kt" +} + +task codegen_blackbox_primitiveTypes_kt4098 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt4098.kt" +} + +task codegen_blackbox_primitiveTypes_kt4210 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt4210.kt" +} + +task codegen_blackbox_primitiveTypes_kt4251 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt4251.kt" +} + +task codegen_blackbox_primitiveTypes_kt446 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt446.kt" +} + +task codegen_blackbox_primitiveTypes_kt518 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt518.kt" +} + +task codegen_blackbox_primitiveTypes_kt6590_identityEquals (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt6590_identityEquals.kt" +} + +task codegen_blackbox_primitiveTypes_kt665 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt665.kt" +} + +task codegen_blackbox_primitiveTypes_kt684 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt684.kt" +} + +task codegen_blackbox_primitiveTypes_kt711 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt711.kt" +} + +task codegen_blackbox_primitiveTypes_kt737 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt737.kt" +} + +task codegen_blackbox_primitiveTypes_kt752 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt752.kt" +} + +task codegen_blackbox_primitiveTypes_kt753 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt753.kt" +} + +task codegen_blackbox_primitiveTypes_kt756 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt756.kt" +} + +task codegen_blackbox_primitiveTypes_kt757 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt757.kt" +} + +task codegen_blackbox_primitiveTypes_kt828 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt828.kt" +} + +task codegen_blackbox_primitiveTypes_kt877 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt877.kt" +} + +task codegen_blackbox_primitiveTypes_kt882 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt882.kt" +} + +task codegen_blackbox_primitiveTypes_kt887 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt887.kt" +} + +task codegen_blackbox_primitiveTypes_kt935 (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/kt935.kt" +} + +task codegen_blackbox_primitiveTypes_nullableCharBoolean (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/nullableCharBoolean.kt" +} + +task codegen_blackbox_primitiveTypes_nullAsNullableIntIsNull (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/nullAsNullableIntIsNull.kt" +} + +task codegen_blackbox_primitiveTypes_number (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/number.kt" +} + +task codegen_blackbox_primitiveTypes_rangeTo (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/rangeTo.kt" +} + +task codegen_blackbox_primitiveTypes_substituteIntForGeneric (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt" +} + +task codegen_blackbox_primitiveTypes_unboxComparable (type: RunExternalTest) { + source = "codegen/blackbox/primitiveTypes/unboxComparable.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/private/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/private/build-generated.gradle new file mode 100644 index 00000000000..74e2e0167f5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/private/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_private_arrayConvention (type: RunExternalTest) { + source = "codegen/blackbox/private/arrayConvention.kt" +} + +task codegen_blackbox_private_kt9855 (type: RunExternalTest) { + source = "codegen/blackbox/private/kt9855.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle new file mode 100644 index 00000000000..c42a19dd6de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_privateConstructors_base (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/base.kt" +} + +task codegen_blackbox_privateConstructors_captured (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/captured.kt" +} + +task codegen_blackbox_privateConstructors_companion (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/companion.kt" +} + +task codegen_blackbox_privateConstructors_inline (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/inline.kt" +} + +task codegen_blackbox_privateConstructors_inner (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/inner.kt" +} + +task codegen_blackbox_privateConstructors_kt4860 (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/kt4860.kt" +} + +task codegen_blackbox_privateConstructors_secondary (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/secondary.kt" +} + +task codegen_blackbox_privateConstructors_synthetic (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/synthetic.kt" +} + +task codegen_blackbox_privateConstructors_withArguments (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/withArguments.kt" +} + +task codegen_blackbox_privateConstructors_withDefault (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/withDefault.kt" +} + +task codegen_blackbox_privateConstructors_withLinkedClasses (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/withLinkedClasses.kt" +} + +task codegen_blackbox_privateConstructors_withLinkedObjects (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/withLinkedObjects.kt" +} + +task codegen_blackbox_privateConstructors_withVarargs (type: RunExternalTest) { + source = "codegen/blackbox/privateConstructors/withVarargs.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle new file mode 100644 index 00000000000..1486fb37d5d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle @@ -0,0 +1,270 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_properties_accessToPrivateProperty (type: RunExternalTest) { + source = "codegen/blackbox/properties/accessToPrivateProperty.kt" +} + +task codegen_blackbox_properties_accessToPrivateSetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/accessToPrivateSetter.kt" +} + +task codegen_blackbox_properties_augmentedAssignmentsAndIncrements (type: RunExternalTest) { + source = "codegen/blackbox/properties/augmentedAssignmentsAndIncrements.kt" +} + +task codegen_blackbox_properties_classArtificialFieldInsideNested (type: RunExternalTest) { + source = "codegen/blackbox/properties/classArtificialFieldInsideNested.kt" +} + +task codegen_blackbox_properties_classFieldInsideLambda (type: RunExternalTest) { + source = "codegen/blackbox/properties/classFieldInsideLambda.kt" +} + +task codegen_blackbox_properties_classFieldInsideLocalInSetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/classFieldInsideLocalInSetter.kt" +} + +task codegen_blackbox_properties_classFieldInsideNested (type: RunExternalTest) { + source = "codegen/blackbox/properties/classFieldInsideNested.kt" +} + +task codegen_blackbox_properties_classObjectProperties (type: RunExternalTest) { + source = "codegen/blackbox/properties/classObjectProperties.kt" +} + +task codegen_blackbox_properties_classPrivateArtificialFieldInsideNested (type: RunExternalTest) { + source = "codegen/blackbox/properties/classPrivateArtificialFieldInsideNested.kt" +} + +task codegen_blackbox_properties_collectionSize (type: RunExternalTest) { + source = "codegen/blackbox/properties/collectionSize.kt" +} + +task codegen_blackbox_properties_commonPropertiesKJK (type: RunExternalTest) { + source = "codegen/blackbox/properties/commonPropertiesKJK.kt" +} + +task codegen_blackbox_properties_companionFieldInsideLambda (type: RunExternalTest) { + source = "codegen/blackbox/properties/companionFieldInsideLambda.kt" +} + +task codegen_blackbox_properties_companionObjectAccessor (type: RunExternalTest) { + source = "codegen/blackbox/properties/companionObjectAccessor.kt" +} + +task codegen_blackbox_properties_companionObjectPropertiesFromJava (type: RunExternalTest) { + source = "codegen/blackbox/properties/companionObjectPropertiesFromJava.kt" +} + +task codegen_blackbox_properties_companionPrivateField (type: RunExternalTest) { + source = "codegen/blackbox/properties/companionPrivateField.kt" +} + +task codegen_blackbox_properties_companionPrivateFieldInsideLambda (type: RunExternalTest) { + source = "codegen/blackbox/properties/companionPrivateFieldInsideLambda.kt" +} + +task codegen_blackbox_properties_field (type: RunExternalTest) { + source = "codegen/blackbox/properties/field.kt" +} + +task codegen_blackbox_properties_fieldInClass (type: RunExternalTest) { + source = "codegen/blackbox/properties/fieldInClass.kt" +} + +task codegen_blackbox_properties_fieldInsideField (type: RunExternalTest) { + source = "codegen/blackbox/properties/fieldInsideField.kt" +} + +task codegen_blackbox_properties_fieldInsideLambda (type: RunExternalTest) { + source = "codegen/blackbox/properties/fieldInsideLambda.kt" +} + +task codegen_blackbox_properties_fieldInsideNested (type: RunExternalTest) { + source = "codegen/blackbox/properties/fieldInsideNested.kt" +} + +task codegen_blackbox_properties_fieldSimple (type: RunExternalTest) { + source = "codegen/blackbox/properties/fieldSimple.kt" +} + +task codegen_blackbox_properties_generalAccess (type: RunExternalTest) { + source = "codegen/blackbox/properties/generalAccess.kt" +} + +task codegen_blackbox_properties_javaPropertyBoxedGetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/javaPropertyBoxedGetter.kt" +} + +task codegen_blackbox_properties_javaPropertyBoxedSetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/javaPropertyBoxedSetter.kt" +} + +task codegen_blackbox_properties_kt10715 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt10715.kt" +} + +task codegen_blackbox_properties_kt10729 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt10729.kt" +} + +task codegen_blackbox_properties_kt1159 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1159.kt" +} + +task codegen_blackbox_properties_kt1165 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1165.kt" +} + +task codegen_blackbox_properties_kt1168 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1168.kt" +} + +task codegen_blackbox_properties_kt1170 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1170.kt" +} + +task codegen_blackbox_properties_kt12200 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt12200.kt" +} + +task codegen_blackbox_properties_kt1398 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1398.kt" +} + +task codegen_blackbox_properties_kt1417 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1417.kt" +} + +task codegen_blackbox_properties_kt1482_2279 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1482_2279.kt" +} + +task codegen_blackbox_properties_kt1714 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1714.kt" +} + +task codegen_blackbox_properties_kt1714_minimal (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1714_minimal.kt" +} + +task codegen_blackbox_properties_kt1892 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt1892.kt" +} + +task codegen_blackbox_properties_kt2331 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt2331.kt" +} + +task codegen_blackbox_properties_kt257 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt257.kt" +} + +task codegen_blackbox_properties_kt2655 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt2655.kt" +} + +task codegen_blackbox_properties_kt2786 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt2786.kt" +} + +task codegen_blackbox_properties_kt2892 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt2892.kt" +} + +task codegen_blackbox_properties_kt3118 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt3118.kt" +} + +task codegen_blackbox_properties_kt3524 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt3524.kt" +} + +task codegen_blackbox_properties_kt3551 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt3551.kt" +} + +task codegen_blackbox_properties_kt3556 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt3556.kt" +} + +task codegen_blackbox_properties_kt3930 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt3930.kt" +} + +task codegen_blackbox_properties_kt4140 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt4140.kt" +} + +task codegen_blackbox_properties_kt4252 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt4252.kt" +} + +task codegen_blackbox_properties_kt4252_2 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt4252_2.kt" +} + +task codegen_blackbox_properties_kt4340 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt4340.kt" +} + +task codegen_blackbox_properties_kt4373 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt4373.kt" +} + +task codegen_blackbox_properties_kt4383 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt4383.kt" +} + +task codegen_blackbox_properties_kt613 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt613.kt" +} + +task codegen_blackbox_properties_kt8928 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt8928.kt" +} + +task codegen_blackbox_properties_kt9603 (type: RunExternalTest) { + source = "codegen/blackbox/properties/kt9603.kt" +} + +task codegen_blackbox_properties_primitiveOverrideDefaultAccessor (type: RunExternalTest) { + source = "codegen/blackbox/properties/primitiveOverrideDefaultAccessor.kt" +} + +task codegen_blackbox_properties_primitiveOverrideDelegateAccessor (type: RunExternalTest) { + source = "codegen/blackbox/properties/primitiveOverrideDelegateAccessor.kt" +} + +task codegen_blackbox_properties_privatePropertyInConstructor (type: RunExternalTest) { + source = "codegen/blackbox/properties/privatePropertyInConstructor.kt" +} + +task codegen_blackbox_properties_privatePropertyWithoutBackingField (type: RunExternalTest) { + source = "codegen/blackbox/properties/privatePropertyWithoutBackingField.kt" +} + +task codegen_blackbox_properties_protectedJavaFieldInInline (type: RunExternalTest) { + source = "codegen/blackbox/properties/protectedJavaFieldInInline.kt" +} + +task codegen_blackbox_properties_protectedJavaProperty (type: RunExternalTest) { + source = "codegen/blackbox/properties/protectedJavaProperty.kt" +} + +task codegen_blackbox_properties_protectedJavaPropertyInCompanion (type: RunExternalTest) { + source = "codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt" +} + +task codegen_blackbox_properties_substituteJavaSuperField (type: RunExternalTest) { + source = "codegen/blackbox/properties/substituteJavaSuperField.kt" +} + +task codegen_blackbox_properties_twoAnnotatedExtensionPropertiesWithoutBackingFields (type: RunExternalTest) { + source = "codegen/blackbox/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt" +} + +task codegen_blackbox_properties_typeInferredFromGetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/typeInferredFromGetter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle new file mode 100644 index 00000000000..8cdce0c658a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_properties_const_constFlags (type: RunExternalTest) { + source = "codegen/blackbox/properties/const/constFlags.kt" +} + +task codegen_blackbox_properties_const_constValInAnnotationDefault (type: RunExternalTest) { + source = "codegen/blackbox/properties/const/constValInAnnotationDefault.kt" +} + +task codegen_blackbox_properties_const_interfaceCompanion (type: RunExternalTest) { + source = "codegen/blackbox/properties/const/interfaceCompanion.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle new file mode 100644 index 00000000000..419121d00c1 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_properties_lateinit_accessor (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/accessor.kt" +} + +task codegen_blackbox_properties_lateinit_accessorException (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/accessorException.kt" +} + +task codegen_blackbox_properties_lateinit_exceptionField (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/exceptionField.kt" +} + +task codegen_blackbox_properties_lateinit_exceptionGetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/exceptionGetter.kt" +} + +task codegen_blackbox_properties_lateinit_override (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/override.kt" +} + +task codegen_blackbox_properties_lateinit_overrideException (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/overrideException.kt" +} + +task codegen_blackbox_properties_lateinit_privateSetter (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/privateSetter.kt" +} + +task codegen_blackbox_properties_lateinit_privateSetterFromLambda (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/privateSetterFromLambda.kt" +} + +task codegen_blackbox_properties_lateinit_simpleVar (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/simpleVar.kt" +} + +task codegen_blackbox_properties_lateinit_visibility (type: RunExternalTest) { + source = "codegen/blackbox/properties/lateinit/visibility.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle new file mode 100644 index 00000000000..423abd345db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_publishedApi_noMangling (type: RunExternalTest) { + source = "codegen/blackbox/publishedApi/noMangling.kt" +} + +task codegen_blackbox_publishedApi_simple (type: RunExternalTest) { + source = "codegen/blackbox/publishedApi/simple.kt" +} + +task codegen_blackbox_publishedApi_topLevel (type: RunExternalTest) { + source = "codegen/blackbox/publishedApi/topLevel.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle new file mode 100644 index 00000000000..7ed0070c04d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_forByteProgressionWithIntIncrement (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forByteProgressionWithIntIncrement.kt" +} + +task codegen_blackbox_ranges_forInRangeWithImplicitReceiver (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInRangeWithImplicitReceiver.kt" +} + +task codegen_blackbox_ranges_forIntRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forIntRange.kt" +} + +task codegen_blackbox_ranges_forNullableIntInRangeWithImplicitReceiver (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt" +} + +task codegen_blackbox_ranges_multiAssignmentIterationOverIntRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt" +} + +task codegen_blackbox_ranges_safeCallRangeTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/safeCallRangeTo.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle new file mode 100644 index 00000000000..60bf0d3fc50 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_contains_inComparableRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inComparableRange.kt" +} + +task codegen_blackbox_ranges_contains_inExtensionRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inExtensionRange.kt" +} + +task codegen_blackbox_ranges_contains_inIntRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inIntRange.kt" +} + +task codegen_blackbox_ranges_contains_inOptimizableDoubleRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt" +} + +task codegen_blackbox_ranges_contains_inOptimizableFloatRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt" +} + +task codegen_blackbox_ranges_contains_inOptimizableIntRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inOptimizableIntRange.kt" +} + +task codegen_blackbox_ranges_contains_inOptimizableLongRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inOptimizableLongRange.kt" +} + +task codegen_blackbox_ranges_contains_inRangeWithCustomContains (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt" +} + +task codegen_blackbox_ranges_contains_inRangeWithImplicitReceiver (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt" +} + +task codegen_blackbox_ranges_contains_inRangeWithNonmatchingArguments (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt" +} + +task codegen_blackbox_ranges_contains_inRangeWithSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt" +} + +task codegen_blackbox_ranges_contains_rangeContainsString (type: RunExternalTest) { + source = "codegen/blackbox/ranges/contains/rangeContainsString.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle new file mode 100644 index 00000000000..3e6fd8136d2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle @@ -0,0 +1,114 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_expression_emptyDownto (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/emptyDownto.kt" +} + +task codegen_blackbox_ranges_expression_emptyRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/emptyRange.kt" +} + +task codegen_blackbox_ranges_expression_inexactDownToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/inexactDownToMinValue.kt" +} + +task codegen_blackbox_ranges_expression_inexactSteppedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/inexactSteppedDownTo.kt" +} + +task codegen_blackbox_ranges_expression_inexactSteppedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/inexactSteppedRange.kt" +} + +task codegen_blackbox_ranges_expression_inexactToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/inexactToMaxValue.kt" +} + +task codegen_blackbox_ranges_expression_maxValueMinusTwoToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt" +} + +task codegen_blackbox_ranges_expression_maxValueToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/maxValueToMaxValue.kt" +} + +task codegen_blackbox_ranges_expression_maxValueToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/maxValueToMinValue.kt" +} + +task codegen_blackbox_ranges_expression_oneElementDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/oneElementDownTo.kt" +} + +task codegen_blackbox_ranges_expression_oneElementRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/oneElementRange.kt" +} + +task codegen_blackbox_ranges_expression_openRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/openRange.kt" +} + +task codegen_blackbox_ranges_expression_progressionDownToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/progressionDownToMinValue.kt" +} + +task codegen_blackbox_ranges_expression_progressionMaxValueMinusTwoToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt" +} + +task codegen_blackbox_ranges_expression_progressionMaxValueToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt" +} + +task codegen_blackbox_ranges_expression_progressionMaxValueToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt" +} + +task codegen_blackbox_ranges_expression_progressionMinValueToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt" +} + +task codegen_blackbox_ranges_expression_reversedBackSequence (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/reversedBackSequence.kt" +} + +task codegen_blackbox_ranges_expression_reversedEmptyBackSequence (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/reversedEmptyBackSequence.kt" +} + +task codegen_blackbox_ranges_expression_reversedEmptyRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/reversedEmptyRange.kt" +} + +task codegen_blackbox_ranges_expression_reversedInexactSteppedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/reversedInexactSteppedDownTo.kt" +} + +task codegen_blackbox_ranges_expression_reversedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/reversedRange.kt" +} + +task codegen_blackbox_ranges_expression_reversedSimpleSteppedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/reversedSimpleSteppedRange.kt" +} + +task codegen_blackbox_ranges_expression_simpleDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/simpleDownTo.kt" +} + +task codegen_blackbox_ranges_expression_simpleRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/simpleRange.kt" +} + +task codegen_blackbox_ranges_expression_simpleRangeWithNonConstantEnds (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/simpleRangeWithNonConstantEnds.kt" +} + +task codegen_blackbox_ranges_expression_simpleSteppedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/simpleSteppedDownTo.kt" +} + +task codegen_blackbox_ranges_expression_simpleSteppedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/expression/simpleSteppedRange.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle new file mode 100644 index 00000000000..37045d49c8c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_forInDownTo_forIntInDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInDownTo/forIntInDownTo.kt" +} + +task codegen_blackbox_ranges_forInDownTo_forIntInNonOptimizedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt" +} + +task codegen_blackbox_ranges_forInDownTo_forLongInDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInDownTo/forLongInDownTo.kt" +} + +task codegen_blackbox_ranges_forInDownTo_forNullableIntInDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInDownTo/forNullableIntInDownTo.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle new file mode 100644 index 00000000000..eef50d3088f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle @@ -0,0 +1,62 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_forInIndices_forInCharSequenceIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forInCharSequenceIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forInCollectionImplicitReceiverIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forInCollectionIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forInCollectionIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forInNonOptimizedIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forInNonOptimizedIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forInObjectArrayIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forInObjectArrayIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forInPrimitiveArrayIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forInPrimitiveArrayIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forNullableIntInArrayIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forNullableIntInArrayIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_forNullableIntInCollectionIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/forNullableIntInCollectionIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt12983_forInGenericArrayIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt12983_forInGenericCollectionIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt12983_forInSpecificArrayIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt12983_forInSpecificCollectionIndices (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt13241_Array (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt13241_Array.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt13241_CharSequence (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt13241_CharSequence.kt" +} + +task codegen_blackbox_ranges_forInIndices_kt13241_Collection (type: RunExternalTest) { + source = "codegen/blackbox/ranges/forInIndices/kt13241_Collection.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle new file mode 100644 index 00000000000..2aaace3a185 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle @@ -0,0 +1,114 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_literal_emptyDownto (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/emptyDownto.kt" +} + +task codegen_blackbox_ranges_literal_emptyRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/emptyRange.kt" +} + +task codegen_blackbox_ranges_literal_inexactDownToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/inexactDownToMinValue.kt" +} + +task codegen_blackbox_ranges_literal_inexactSteppedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/inexactSteppedDownTo.kt" +} + +task codegen_blackbox_ranges_literal_inexactSteppedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/inexactSteppedRange.kt" +} + +task codegen_blackbox_ranges_literal_inexactToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/inexactToMaxValue.kt" +} + +task codegen_blackbox_ranges_literal_maxValueMinusTwoToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt" +} + +task codegen_blackbox_ranges_literal_maxValueToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/maxValueToMaxValue.kt" +} + +task codegen_blackbox_ranges_literal_maxValueToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/maxValueToMinValue.kt" +} + +task codegen_blackbox_ranges_literal_oneElementDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/oneElementDownTo.kt" +} + +task codegen_blackbox_ranges_literal_oneElementRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/oneElementRange.kt" +} + +task codegen_blackbox_ranges_literal_openRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/openRange.kt" +} + +task codegen_blackbox_ranges_literal_progressionDownToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/progressionDownToMinValue.kt" +} + +task codegen_blackbox_ranges_literal_progressionMaxValueMinusTwoToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt" +} + +task codegen_blackbox_ranges_literal_progressionMaxValueToMaxValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt" +} + +task codegen_blackbox_ranges_literal_progressionMaxValueToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt" +} + +task codegen_blackbox_ranges_literal_progressionMinValueToMinValue (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt" +} + +task codegen_blackbox_ranges_literal_reversedBackSequence (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/reversedBackSequence.kt" +} + +task codegen_blackbox_ranges_literal_reversedEmptyBackSequence (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/reversedEmptyBackSequence.kt" +} + +task codegen_blackbox_ranges_literal_reversedEmptyRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/reversedEmptyRange.kt" +} + +task codegen_blackbox_ranges_literal_reversedInexactSteppedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/reversedInexactSteppedDownTo.kt" +} + +task codegen_blackbox_ranges_literal_reversedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/reversedRange.kt" +} + +task codegen_blackbox_ranges_literal_reversedSimpleSteppedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/reversedSimpleSteppedRange.kt" +} + +task codegen_blackbox_ranges_literal_simpleDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/simpleDownTo.kt" +} + +task codegen_blackbox_ranges_literal_simpleRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/simpleRange.kt" +} + +task codegen_blackbox_ranges_literal_simpleRangeWithNonConstantEnds (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/simpleRangeWithNonConstantEnds.kt" +} + +task codegen_blackbox_ranges_literal_simpleSteppedDownTo (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/simpleSteppedDownTo.kt" +} + +task codegen_blackbox_ranges_literal_simpleSteppedRange (type: RunExternalTest) { + source = "codegen/blackbox/ranges/literal/simpleSteppedRange.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle new file mode 100644 index 00000000000..474f5dd7ea5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_ranges_nullableLoopParameter_progressionExpression (type: RunExternalTest) { + source = "codegen/blackbox/ranges/nullableLoopParameter/progressionExpression.kt" +} + +task codegen_blackbox_ranges_nullableLoopParameter_rangeExpression (type: RunExternalTest) { + source = "codegen/blackbox/ranges/nullableLoopParameter/rangeExpression.kt" +} + +task codegen_blackbox_ranges_nullableLoopParameter_rangeLiteral (type: RunExternalTest) { + source = "codegen/blackbox/ranges/nullableLoopParameter/rangeLiteral.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle new file mode 100644 index 00000000000..d3cda249927 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_annotations_annotationRetentionAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt" +} + +task codegen_blackbox_reflection_annotations_annotationsOnJavaMembers (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt" +} + +task codegen_blackbox_reflection_annotations_findAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/findAnnotation.kt" +} + +task codegen_blackbox_reflection_annotations_propertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/propertyAccessors.kt" +} + +task codegen_blackbox_reflection_annotations_propertyWithoutBackingField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt" +} + +task codegen_blackbox_reflection_annotations_retentions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/retentions.kt" +} + +task codegen_blackbox_reflection_annotations_simpleClassAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt" +} + +task codegen_blackbox_reflection_annotations_simpleConstructorAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt" +} + +task codegen_blackbox_reflection_annotations_simpleFunAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt" +} + +task codegen_blackbox_reflection_annotations_simpleParamAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt" +} + +task codegen_blackbox_reflection_annotations_simpleValAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/annotations/simpleValAnnotation.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle new file mode 100644 index 00000000000..d4f5ed04728 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_call_bound_companionObjectPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_call_bound_extensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/extensionFunction.kt" +} + +task codegen_blackbox_reflection_call_bound_extensionPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_call_bound_innerClassConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/innerClassConstructor.kt" +} + +task codegen_blackbox_reflection_call_bound_javaInstanceField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/javaInstanceField.kt" +} + +task codegen_blackbox_reflection_call_bound_javaInstanceMethod (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt" +} + +task codegen_blackbox_reflection_call_bound_jvmStaticCompanionObjectPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_call_bound_jvmStaticObjectFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt" +} + +task codegen_blackbox_reflection_call_bound_jvmStaticObjectPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_call_bound_memberFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/memberFunction.kt" +} + +task codegen_blackbox_reflection_call_bound_memberPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_call_bound_objectFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/objectFunction.kt" +} + +task codegen_blackbox_reflection_call_bound_objectPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle new file mode 100644 index 00000000000..9eb04d5ed33 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle @@ -0,0 +1,90 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_call_callInstanceJavaMethod (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/callInstanceJavaMethod.kt" +} + +task codegen_blackbox_reflection_call_callPrivateJavaMethod (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/callPrivateJavaMethod.kt" +} + +task codegen_blackbox_reflection_call_callStaticJavaMethod (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/callStaticJavaMethod.kt" +} + +task codegen_blackbox_reflection_call_cannotCallEnumConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt" +} + +task codegen_blackbox_reflection_call_disallowNullValueForNotNullField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt" +} + +task codegen_blackbox_reflection_call_equalsHashCodeToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/equalsHashCodeToString.kt" +} + +task codegen_blackbox_reflection_call_exceptionHappened (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/exceptionHappened.kt" +} + +task codegen_blackbox_reflection_call_fakeOverride (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/fakeOverride.kt" +} + +task codegen_blackbox_reflection_call_fakeOverrideSubstituted (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt" +} + +task codegen_blackbox_reflection_call_incorrectNumberOfArguments (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt" +} + +task codegen_blackbox_reflection_call_innerClassConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/innerClassConstructor.kt" +} + +task codegen_blackbox_reflection_call_jvmStatic (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/jvmStatic.kt" +} + +task codegen_blackbox_reflection_call_jvmStaticInObjectIncorrectReceiver (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt" +} + +task codegen_blackbox_reflection_call_localClassMember (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/localClassMember.kt" +} + +task codegen_blackbox_reflection_call_memberOfGenericClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/memberOfGenericClass.kt" +} + +task codegen_blackbox_reflection_call_privateProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/privateProperty.kt" +} + +task codegen_blackbox_reflection_call_propertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/propertyAccessors.kt" +} + +task codegen_blackbox_reflection_call_propertyGetterAndGetFunctionDifferentReturnType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt" +} + +task codegen_blackbox_reflection_call_returnUnit (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/returnUnit.kt" +} + +task codegen_blackbox_reflection_call_simpleConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/simpleConstructor.kt" +} + +task codegen_blackbox_reflection_call_simpleMemberFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/simpleMemberFunction.kt" +} + +task codegen_blackbox_reflection_call_simpleTopLevelFunctions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle new file mode 100644 index 00000000000..fbb6febe8c2 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle @@ -0,0 +1,74 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_callBy_boundExtensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/boundExtensionFunction.kt" +} + +task codegen_blackbox_reflection_callBy_boundExtensionPropertyAcessor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt" +} + +task codegen_blackbox_reflection_callBy_boundJvmStaticInObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt" +} + +task codegen_blackbox_reflection_callBy_companionObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/companionObject.kt" +} + +task codegen_blackbox_reflection_callBy_defaultAndNonDefaultIntertwined (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt" +} + +task codegen_blackbox_reflection_callBy_extensionFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/extensionFunction.kt" +} + +task codegen_blackbox_reflection_callBy_jvmStaticInCompanionObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt" +} + +task codegen_blackbox_reflection_callBy_jvmStaticInObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/jvmStaticInObject.kt" +} + +task codegen_blackbox_reflection_callBy_manyArgumentsOnlyOneDefault (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt" +} + +task codegen_blackbox_reflection_callBy_manyMaskArguments (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/manyMaskArguments.kt" +} + +task codegen_blackbox_reflection_callBy_nonDefaultParameterOmitted (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt" +} + +task codegen_blackbox_reflection_callBy_nullValue (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/nullValue.kt" +} + +task codegen_blackbox_reflection_callBy_ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt" +} + +task codegen_blackbox_reflection_callBy_primitiveDefaultValues (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt" +} + +task codegen_blackbox_reflection_callBy_privateMemberFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/privateMemberFunction.kt" +} + +task codegen_blackbox_reflection_callBy_simpleConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/simpleConstructor.kt" +} + +task codegen_blackbox_reflection_callBy_simpleMemberFunciton (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt" +} + +task codegen_blackbox_reflection_callBy_simpleTopLevelFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle new file mode 100644 index 00000000000..da325e2661c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_classLiterals_annotationClassLiteral (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt" +} + +task codegen_blackbox_reflection_classLiterals_arrays (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/arrays.kt" +} + +task codegen_blackbox_reflection_classLiterals_builtinClassLiterals (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt" +} + +task codegen_blackbox_reflection_classLiterals_genericArrays (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/genericArrays.kt" +} + +task codegen_blackbox_reflection_classLiterals_genericClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/genericClass.kt" +} + +task codegen_blackbox_reflection_classLiterals_reifiedTypeClassLiteral (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt" +} + +task codegen_blackbox_reflection_classLiterals_simpleClassLiteral (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classLiterals/simpleClassLiteral.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle new file mode 100644 index 00000000000..23fa9804001 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_classes_classSimpleName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/classSimpleName.kt" +} + +task codegen_blackbox_reflection_classes_companionObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/companionObject.kt" +} + +task codegen_blackbox_reflection_classes_createInstance (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/createInstance.kt" +} + +task codegen_blackbox_reflection_classes_declaredMembers (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/declaredMembers.kt" +} + +task codegen_blackbox_reflection_classes_jvmName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/jvmName.kt" +} + +task codegen_blackbox_reflection_classes_localClassSimpleName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/localClassSimpleName.kt" +} + +task codegen_blackbox_reflection_classes_nestedClasses (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/nestedClasses.kt" +} + +task codegen_blackbox_reflection_classes_nestedClassesJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/nestedClassesJava.kt" +} + +task codegen_blackbox_reflection_classes_objectInstance (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/objectInstance.kt" +} + +task codegen_blackbox_reflection_classes_primitiveKClassEquality (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/primitiveKClassEquality.kt" +} + +task codegen_blackbox_reflection_classes_qualifiedName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/qualifiedName.kt" +} + +task codegen_blackbox_reflection_classes_starProjectedType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/classes/starProjectedType.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle new file mode 100644 index 00000000000..9f843b7a187 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_constructors_annotationClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/constructors/annotationClass.kt" +} + +task codegen_blackbox_reflection_constructors_classesWithoutConstructors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt" +} + +task codegen_blackbox_reflection_constructors_constructorName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/constructors/constructorName.kt" +} + +task codegen_blackbox_reflection_constructors_primaryConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/constructors/primaryConstructor.kt" +} + +task codegen_blackbox_reflection_constructors_simpleGetConstructors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/constructors/simpleGetConstructors.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle new file mode 100644 index 00000000000..d27d29612db --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_createAnnotation_annotationType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/annotationType.kt" +} + +task codegen_blackbox_reflection_createAnnotation_arrayOfKClasses (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt" +} + +task codegen_blackbox_reflection_createAnnotation_callByJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/callByJava.kt" +} + +task codegen_blackbox_reflection_createAnnotation_callByKotlin (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/callByKotlin.kt" +} + +task codegen_blackbox_reflection_createAnnotation_callJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/callJava.kt" +} + +task codegen_blackbox_reflection_createAnnotation_callKotlin (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/callKotlin.kt" +} + +task codegen_blackbox_reflection_createAnnotation_createJdkAnnotationInstance (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt" +} + +task codegen_blackbox_reflection_createAnnotation_enumKClassAnnotation (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt" +} + +task codegen_blackbox_reflection_createAnnotation_equalsHashCodeToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt" +} + +task codegen_blackbox_reflection_createAnnotation_floatingPointParameters (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt" +} + +task codegen_blackbox_reflection_createAnnotation_parameterNamedEquals (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt" +} + +task codegen_blackbox_reflection_createAnnotation_primitivesAndArrays (type: RunExternalTest) { + source = "codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle new file mode 100644 index 00000000000..c3cf7cfa48c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle @@ -0,0 +1,98 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_enclosing_anonymousObjectInInlinedLambda (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt" +} + +task codegen_blackbox_reflection_enclosing_classInLambda (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/classInLambda.kt" +} + +task codegen_blackbox_reflection_enclosing_functionExpressionInProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt" +} + +task codegen_blackbox_reflection_enclosing_kt11969 (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/kt11969.kt" +} + +task codegen_blackbox_reflection_enclosing_kt6368 (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/kt6368.kt" +} + +task codegen_blackbox_reflection_enclosing_kt6691_lambdaInSamConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInClassObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInFunction.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInLambda (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInLambda.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInLocalClassConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInLocalClassSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInLocalFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInMemberFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInMemberFunctionInLocalClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInMemberFunctionInNestedClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInObjectDeclaration (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInObjectExpression (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInObjectLiteralSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInPackage (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInPackage.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInPropertyGetter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt" +} + +task codegen_blackbox_reflection_enclosing_lambdaInPropertySetter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt" +} + +task codegen_blackbox_reflection_enclosing_localClassInTopLevelFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt" +} + +task codegen_blackbox_reflection_enclosing_objectInLambda (type: RunExternalTest) { + source = "codegen/blackbox/reflection/enclosing/objectInLambda.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle new file mode 100644 index 00000000000..c618dd49627 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_functions_declaredVsInheritedFunctions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt" +} + +task codegen_blackbox_reflection_functions_functionFromStdlib (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/functionFromStdlib.kt" +} + +task codegen_blackbox_reflection_functions_functionReferenceErasedToKFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt" +} + +task codegen_blackbox_reflection_functions_genericOverriddenFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/genericOverriddenFunction.kt" +} + +task codegen_blackbox_reflection_functions_instanceOfFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/instanceOfFunction.kt" +} + +task codegen_blackbox_reflection_functions_javaClassGetFunctions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/javaClassGetFunctions.kt" +} + +task codegen_blackbox_reflection_functions_javaMethodsSmokeTest (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/javaMethodsSmokeTest.kt" +} + +task codegen_blackbox_reflection_functions_platformName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/platformName.kt" +} + +task codegen_blackbox_reflection_functions_privateMemberFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/privateMemberFunction.kt" +} + +task codegen_blackbox_reflection_functions_simpleGetFunctions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/simpleGetFunctions.kt" +} + +task codegen_blackbox_reflection_functions_simpleNames (type: RunExternalTest) { + source = "codegen/blackbox/reflection/functions/simpleNames.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle new file mode 100644 index 00000000000..c784a337cdd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle @@ -0,0 +1,34 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_genericSignature_covariantOverride (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/covariantOverride.kt" +} + +task codegen_blackbox_reflection_genericSignature_defaultImplsGenericSignature (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt" +} + +task codegen_blackbox_reflection_genericSignature_functionLiteralGenericSignature (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt" +} + +task codegen_blackbox_reflection_genericSignature_genericBackingFieldSignature (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt" +} + +task codegen_blackbox_reflection_genericSignature_genericMethodSignature (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt" +} + +task codegen_blackbox_reflection_genericSignature_kt11121 (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/kt11121.kt" +} + +task codegen_blackbox_reflection_genericSignature_kt5112 (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/kt5112.kt" +} + +task codegen_blackbox_reflection_genericSignature_kt6106 (type: RunExternalTest) { + source = "codegen/blackbox/reflection/genericSignature/kt6106.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle new file mode 100644 index 00000000000..9045cf0c126 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_isInstance_isInstanceCastAndSafeCast (type: RunExternalTest) { + source = "codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle new file mode 100644 index 00000000000..713e2e498de --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_kClassInAnnotation_array (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/array.kt" +} + +task codegen_blackbox_reflection_kClassInAnnotation_arrayInJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt" +} + +task codegen_blackbox_reflection_kClassInAnnotation_basic (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/basic.kt" +} + +task codegen_blackbox_reflection_kClassInAnnotation_basicInJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt" +} + +task codegen_blackbox_reflection_kClassInAnnotation_checkcast (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt" +} + +task codegen_blackbox_reflection_kClassInAnnotation_vararg (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/vararg.kt" +} + +task codegen_blackbox_reflection_kClassInAnnotation_varargInJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle new file mode 100644 index 00000000000..388168d870d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_lambdaClasses_parameterNamesAndNullability (type: RunExternalTest) { + source = "codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle new file mode 100644 index 00000000000..373b89bf3fd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_mapping_constructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/constructor.kt" +} + +task codegen_blackbox_reflection_mapping_extensionProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/extensionProperty.kt" +} + +task codegen_blackbox_reflection_mapping_functions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/functions.kt" +} + +task codegen_blackbox_reflection_mapping_inlineReifiedFun (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/inlineReifiedFun.kt" +} + +task codegen_blackbox_reflection_mapping_mappedClassIsEqualToClassLiteral (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt" +} + +task codegen_blackbox_reflection_mapping_memberProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/memberProperty.kt" +} + +task codegen_blackbox_reflection_mapping_propertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/propertyAccessors.kt" +} + +task codegen_blackbox_reflection_mapping_propertyAccessorsWithJvmName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt" +} + +task codegen_blackbox_reflection_mapping_syntheticFields (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/syntheticFields.kt" +} + +task codegen_blackbox_reflection_mapping_topLevelFunctionOtherFile (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt" +} + +task codegen_blackbox_reflection_mapping_topLevelProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/topLevelProperty.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle new file mode 100644 index 00000000000..dfb2c7c4f0f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_mapping_fakeOverrides_javaFieldGetterSetter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt" +} + +task codegen_blackbox_reflection_mapping_fakeOverrides_javaMethod (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle new file mode 100644 index 00000000000..dd0d7a31716 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_mapping_jvmStatic_companionObjectFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt" +} + +task codegen_blackbox_reflection_mapping_jvmStatic_objectFunction (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle new file mode 100644 index 00000000000..2c1ea4e9ab6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_mapping_types_annotationConstructorParameters (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt" +} + +task codegen_blackbox_reflection_mapping_types_array (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/array.kt" +} + +task codegen_blackbox_reflection_mapping_types_constructors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/constructors.kt" +} + +task codegen_blackbox_reflection_mapping_types_genericArrayElementType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt" +} + +task codegen_blackbox_reflection_mapping_types_innerGenericTypeArgument (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt" +} + +task codegen_blackbox_reflection_mapping_types_memberFunctions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/memberFunctions.kt" +} + +task codegen_blackbox_reflection_mapping_types_overrideAnyWithPrimitive (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt" +} + +task codegen_blackbox_reflection_mapping_types_parameterizedTypeArgument (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt" +} + +task codegen_blackbox_reflection_mapping_types_parameterizedTypes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt" +} + +task codegen_blackbox_reflection_mapping_types_propertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/propertyAccessors.kt" +} + +task codegen_blackbox_reflection_mapping_types_rawTypeArgument (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/rawTypeArgument.kt" +} + +task codegen_blackbox_reflection_mapping_types_supertypes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/supertypes.kt" +} + +task codegen_blackbox_reflection_mapping_types_topLevelFunctions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt" +} + +task codegen_blackbox_reflection_mapping_types_typeParameters (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/typeParameters.kt" +} + +task codegen_blackbox_reflection_mapping_types_unit (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/unit.kt" +} + +task codegen_blackbox_reflection_mapping_types_withNullability (type: RunExternalTest) { + source = "codegen/blackbox/reflection/mapping/types/withNullability.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle new file mode 100644 index 00000000000..de7052b8a14 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle @@ -0,0 +1,62 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_methodsFromAny_callableReferencesEqualToCallablesFromAPI (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_classToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/classToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_extensionPropertyReceiverToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_functionEqualsHashCode (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_functionToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/functionToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_memberExtensionToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_parametersEqualsHashCode (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_parametersToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/parametersToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_propertyEqualsHashCode (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_propertyToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/propertyToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_typeEqualsHashCode (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_typeParametersEqualsHashCode (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_typeParametersToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_typeToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/typeToString.kt" +} + +task codegen_blackbox_reflection_methodsFromAny_typeToStringInnerGeneric (type: RunExternalTest) { + source = "codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle new file mode 100644 index 00000000000..436f35a65b5 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle @@ -0,0 +1,38 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_modifiers_callableModality (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/callableModality.kt" +} + +task codegen_blackbox_reflection_modifiers_callableVisibility (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/callableVisibility.kt" +} + +task codegen_blackbox_reflection_modifiers_classes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/classes.kt" +} + +task codegen_blackbox_reflection_modifiers_classModality (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/classModality.kt" +} + +task codegen_blackbox_reflection_modifiers_classVisibility (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/classVisibility.kt" +} + +task codegen_blackbox_reflection_modifiers_functions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/functions.kt" +} + +task codegen_blackbox_reflection_modifiers_javaVisibility (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/javaVisibility.kt" +} + +task codegen_blackbox_reflection_modifiers_properties (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/properties.kt" +} + +task codegen_blackbox_reflection_modifiers_typeParameters (type: RunExternalTest) { + source = "codegen/blackbox/reflection/modifiers/typeParameters.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle new file mode 100644 index 00000000000..f9c644ec7ed --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_multifileClasses_callFunctionsInMultifileClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt" +} + +task codegen_blackbox_reflection_multifileClasses_callPropertiesInMultifileClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt" +} + +task codegen_blackbox_reflection_multifileClasses_javaFieldForVarAndConstVal (type: RunExternalTest) { + source = "codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle new file mode 100644 index 00000000000..8cb65277838 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_noReflectAtRuntime_javaClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_primitiveJavaClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_propertyGetSetName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/propertyGetSetName.kt" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_propertyInstanceof (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/propertyInstanceof.kt" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_reifiedTypeJavaClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_simpleClassLiterals (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle new file mode 100644 index 00000000000..8338cb4294d --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny_callableReferences (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny_classReference (type: RunExternalTest) { + source = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle new file mode 100644 index 00000000000..de46832937c --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_parameters_boundInnerClassConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt" +} + +task codegen_blackbox_reflection_parameters_boundObjectMemberReferences (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt" +} + +task codegen_blackbox_reflection_parameters_boundReferences (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/boundReferences.kt" +} + +task codegen_blackbox_reflection_parameters_findParameterByName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/findParameterByName.kt" +} + +task codegen_blackbox_reflection_parameters_functionParameterNameAndIndex (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt" +} + +task codegen_blackbox_reflection_parameters_instanceExtensionReceiverAndValueParameters (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt" +} + +task codegen_blackbox_reflection_parameters_isMarkedNullable (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/isMarkedNullable.kt" +} + +task codegen_blackbox_reflection_parameters_isOptional (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/isOptional.kt" +} + +task codegen_blackbox_reflection_parameters_javaAnnotationConstructor (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt" +} + +task codegen_blackbox_reflection_parameters_javaParametersHaveNoNames (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt" +} + +task codegen_blackbox_reflection_parameters_kinds (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/kinds.kt" +} + +task codegen_blackbox_reflection_parameters_propertySetter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/parameters/propertySetter.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle new file mode 100644 index 00000000000..dde631bd4ea --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_properties_accessors_accessorNames (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/accessors/accessorNames.kt" +} + +task codegen_blackbox_reflection_properties_accessors_extensionPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_properties_accessors_memberExtensions (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/accessors/memberExtensions.kt" +} + +task codegen_blackbox_reflection_properties_accessors_memberPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt" +} + +task codegen_blackbox_reflection_properties_accessors_topLevelPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle new file mode 100644 index 00000000000..bbcb11f7171 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle @@ -0,0 +1,118 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_properties_allVsDeclared (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/allVsDeclared.kt" +} + +task codegen_blackbox_reflection_properties_callPrivatePropertyFromGetProperties (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt" +} + +task codegen_blackbox_reflection_properties_declaredVsInheritedProperties (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt" +} + +task codegen_blackbox_reflection_properties_fakeOverridesInSubclass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt" +} + +task codegen_blackbox_reflection_properties_genericClassLiteralPropertyReceiverIsStar (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt" +} + +task codegen_blackbox_reflection_properties_genericOverriddenProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/genericOverriddenProperty.kt" +} + +task codegen_blackbox_reflection_properties_genericProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/genericProperty.kt" +} + +task codegen_blackbox_reflection_properties_getExtensionPropertiesMutableVsReadonly (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt" +} + +task codegen_blackbox_reflection_properties_getPropertiesMutableVsReadonly (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt" +} + +task codegen_blackbox_reflection_properties_invokeKProperty (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/invokeKProperty.kt" +} + +task codegen_blackbox_reflection_properties_javaPropertyInheritedInKotlin (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt" +} + +task codegen_blackbox_reflection_properties_javaStaticField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/javaStaticField.kt" +} + +task codegen_blackbox_reflection_properties_kotlinPropertyInheritedInJava (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt" +} + +task codegen_blackbox_reflection_properties_memberAndMemberExtensionWithSameName (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt" +} + +task codegen_blackbox_reflection_properties_mutatePrivateJavaInstanceField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt" +} + +task codegen_blackbox_reflection_properties_mutatePrivateJavaStaticField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt" +} + +task codegen_blackbox_reflection_properties_noConflictOnKotlinGetterAndJavaField (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt" +} + +task codegen_blackbox_reflection_properties_overrideKotlinPropertyByJavaMethod (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt" +} + +task codegen_blackbox_reflection_properties_privateClassVal (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/privateClassVal.kt" +} + +task codegen_blackbox_reflection_properties_privateClassVar (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/privateClassVar.kt" +} + +task codegen_blackbox_reflection_properties_privateFakeOverrideFromSuperclass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt" +} + +task codegen_blackbox_reflection_properties_privateJvmStaticVarInObject (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt" +} + +task codegen_blackbox_reflection_properties_privatePropertyCallIsAccessibleOnAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt" +} + +task codegen_blackbox_reflection_properties_privateToThisAccessors (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/privateToThisAccessors.kt" +} + +task codegen_blackbox_reflection_properties_propertyOfNestedClassAndArrayType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt" +} + +task codegen_blackbox_reflection_properties_protectedClassVar (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/protectedClassVar.kt" +} + +task codegen_blackbox_reflection_properties_publicClassValAccessible (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/publicClassValAccessible.kt" +} + +task codegen_blackbox_reflection_properties_referenceToJavaFieldOfKotlinSubclass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt" +} + +task codegen_blackbox_reflection_properties_simpleGetProperties (type: RunExternalTest) { + source = "codegen/blackbox/reflection/properties/simpleGetProperties.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle new file mode 100644 index 00000000000..ec49f2310ce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle @@ -0,0 +1,6 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_specialBuiltIns_getMembersOfStandardJavaClasses (type: RunExternalTest) { + source = "codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle new file mode 100644 index 00000000000..ca70e787fae --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_supertypes_builtInClassSupertypes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt" +} + +task codegen_blackbox_reflection_supertypes_genericSubstitution (type: RunExternalTest) { + source = "codegen/blackbox/reflection/supertypes/genericSubstitution.kt" +} + +task codegen_blackbox_reflection_supertypes_isSubclassOfIsSuperclassOf (type: RunExternalTest) { + source = "codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt" +} + +task codegen_blackbox_reflection_supertypes_primitives (type: RunExternalTest) { + source = "codegen/blackbox/reflection/supertypes/primitives.kt" +} + +task codegen_blackbox_reflection_supertypes_simpleSupertypes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/supertypes/simpleSupertypes.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle new file mode 100644 index 00000000000..90da2c7278f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_typeParameters_declarationSiteVariance (type: RunExternalTest) { + source = "codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt" +} + +task codegen_blackbox_reflection_typeParameters_typeParametersAndNames (type: RunExternalTest) { + source = "codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt" +} + +task codegen_blackbox_reflection_typeParameters_upperBounds (type: RunExternalTest) { + source = "codegen/blackbox/reflection/typeParameters/upperBounds.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle new file mode 100644 index 00000000000..7731909e993 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_types_classifierIsClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/classifierIsClass.kt" +} + +task codegen_blackbox_reflection_types_classifierIsTypeParameter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/classifierIsTypeParameter.kt" +} + +task codegen_blackbox_reflection_types_classifiersOfBuiltInTypes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt" +} + +task codegen_blackbox_reflection_types_innerGenericArguments (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/innerGenericArguments.kt" +} + +task codegen_blackbox_reflection_types_jvmErasureOfClass (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/jvmErasureOfClass.kt" +} + +task codegen_blackbox_reflection_types_jvmErasureOfTypeParameter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt" +} + +task codegen_blackbox_reflection_types_platformTypeClassifier (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/platformTypeClassifier.kt" +} + +task codegen_blackbox_reflection_types_platformTypeNotEqualToKotlinType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt" +} + +task codegen_blackbox_reflection_types_platformTypeToString (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/platformTypeToString.kt" +} + +task codegen_blackbox_reflection_types_typeArguments (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/typeArguments.kt" +} + +task codegen_blackbox_reflection_types_useSiteVariance (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/useSiteVariance.kt" +} + +task codegen_blackbox_reflection_types_withNullability (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/withNullability.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle new file mode 100644 index 00000000000..c32f76c3997 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_types_createType_equality (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/createType/equality.kt" +} + +task codegen_blackbox_reflection_types_createType_innerGeneric (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/createType/innerGeneric.kt" +} + +task codegen_blackbox_reflection_types_createType_simpleCreateType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/createType/simpleCreateType.kt" +} + +task codegen_blackbox_reflection_types_createType_typeParameter (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/createType/typeParameter.kt" +} + +task codegen_blackbox_reflection_types_createType_wrongNumberOfArguments (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle new file mode 100644 index 00000000000..6a6b28eda0a --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle @@ -0,0 +1,18 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reflection_types_subtyping_platformType (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/subtyping/platformType.kt" +} + +task codegen_blackbox_reflection_types_subtyping_simpleGenericTypes (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt" +} + +task codegen_blackbox_reflection_types_subtyping_simpleSubtypeSupertype (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt" +} + +task codegen_blackbox_reflection_types_subtyping_typeProjection (type: RunExternalTest) { + source = "codegen/blackbox/reflection/types/subtyping/typeProjection.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle new file mode 100644 index 00000000000..012df1c8eb9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle @@ -0,0 +1,278 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_regressions_arrayLengthNPE (type: RunExternalTest) { + source = "codegen/blackbox/regressions/arrayLengthNPE.kt" +} + +task codegen_blackbox_regressions_collections (type: RunExternalTest) { + source = "codegen/blackbox/regressions/collections.kt" +} + +task codegen_blackbox_regressions_commonSupertypeContravariant (type: RunExternalTest) { + source = "codegen/blackbox/regressions/commonSupertypeContravariant.kt" +} + +task codegen_blackbox_regressions_commonSupertypeContravariant2 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/commonSupertypeContravariant2.kt" +} + +task codegen_blackbox_regressions_doubleMerge (type: RunExternalTest) { + source = "codegen/blackbox/regressions/doubleMerge.kt" +} + +task codegen_blackbox_regressions_floatMerge (type: RunExternalTest) { + source = "codegen/blackbox/regressions/floatMerge.kt" +} + +task codegen_blackbox_regressions_generic (type: RunExternalTest) { + source = "codegen/blackbox/regressions/generic.kt" +} + +task codegen_blackbox_regressions_getGenericInterfaces (type: RunExternalTest) { + source = "codegen/blackbox/regressions/getGenericInterfaces.kt" +} + +task codegen_blackbox_regressions_hashCodeNPE (type: RunExternalTest) { + source = "codegen/blackbox/regressions/hashCodeNPE.kt" +} + +task codegen_blackbox_regressions_internalTopLevelOtherPackage (type: RunExternalTest) { + source = "codegen/blackbox/regressions/internalTopLevelOtherPackage.kt" +} + +task codegen_blackbox_regressions_kt10143 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt10143.kt" +} + +task codegen_blackbox_regressions_kt10934 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt10934.kt" +} + +task codegen_blackbox_regressions_Kt1149 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/Kt1149.kt" +} + +task codegen_blackbox_regressions_kt1172 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1172.kt" +} + +task codegen_blackbox_regressions_kt1202 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1202.kt" +} + +task codegen_blackbox_regressions_kt13381 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt13381.kt" +} + +task codegen_blackbox_regressions_kt1406 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1406.kt" +} + +task codegen_blackbox_regressions_kt14447 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt14447.kt" +} + +task codegen_blackbox_regressions_kt1515 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1515.kt" +} + +task codegen_blackbox_regressions_kt1528 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1528.kt" +} + +task codegen_blackbox_regressions_kt1568 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1568.kt" +} + +task codegen_blackbox_regressions_Kt1619Test (type: RunExternalTest) { + source = "codegen/blackbox/regressions/Kt1619Test.kt" +} + +task codegen_blackbox_regressions_kt1779 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1779.kt" +} + +task codegen_blackbox_regressions_kt1800 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1800.kt" +} + +task codegen_blackbox_regressions_kt1845 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1845.kt" +} + +task codegen_blackbox_regressions_kt1932 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt1932.kt" +} + +task codegen_blackbox_regressions_kt2017 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2017.kt" +} + +task codegen_blackbox_regressions_kt2060 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2060.kt" +} + +task codegen_blackbox_regressions_kt2210 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2210.kt" +} + +task codegen_blackbox_regressions_kt2246 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2246.kt" +} + +task codegen_blackbox_regressions_kt2318 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2318.kt" +} + +task codegen_blackbox_regressions_Kt2495Test (type: RunExternalTest) { + source = "codegen/blackbox/regressions/Kt2495Test.kt" +} + +task codegen_blackbox_regressions_kt2509 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2509.kt" +} + +task codegen_blackbox_regressions_kt2593 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt2593.kt" +} + +task codegen_blackbox_regressions_kt274 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt274.kt" +} + +task codegen_blackbox_regressions_kt3046 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3046.kt" +} + +task codegen_blackbox_regressions_kt3107 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3107.kt" +} + +task codegen_blackbox_regressions_kt3421 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3421.kt" +} + +task codegen_blackbox_regressions_kt344 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt344.kt" +} + +task codegen_blackbox_regressions_kt3442 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3442.kt" +} + +task codegen_blackbox_regressions_kt3587 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3587.kt" +} + +task codegen_blackbox_regressions_kt3850 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3850.kt" +} + +task codegen_blackbox_regressions_kt3903 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt3903.kt" +} + +task codegen_blackbox_regressions_kt4142 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt4142.kt" +} + +task codegen_blackbox_regressions_kt4259 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt4259.kt" +} + +task codegen_blackbox_regressions_kt4262 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt4262.kt" +} + +task codegen_blackbox_regressions_kt4281 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt4281.kt" +} + +task codegen_blackbox_regressions_kt5056 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt5056.kt" +} + +task codegen_blackbox_regressions_kt528 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt528.kt" +} + +task codegen_blackbox_regressions_kt529 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt529.kt" +} + +task codegen_blackbox_regressions_kt533 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt533.kt" +} + +task codegen_blackbox_regressions_kt5395 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt5395.kt" +} + +task codegen_blackbox_regressions_kt5445 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt5445.kt" +} + +task codegen_blackbox_regressions_kt5445_2 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt5445_2.kt" +} + +task codegen_blackbox_regressions_kt5786_privateWithDefault (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt5786_privateWithDefault.kt" +} + +task codegen_blackbox_regressions_kt5953 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt5953.kt" +} + +task codegen_blackbox_regressions_kt6153 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt6153.kt" +} + +task codegen_blackbox_regressions_kt6434 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt6434.kt" +} + +task codegen_blackbox_regressions_kt6434_2 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt6434_2.kt" +} + +task codegen_blackbox_regressions_kt6485 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt6485.kt" +} + +task codegen_blackbox_regressions_kt715 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt715.kt" +} + +task codegen_blackbox_regressions_kt7401 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt7401.kt" +} + +task codegen_blackbox_regressions_kt789 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt789.kt" +} + +task codegen_blackbox_regressions_kt864 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt864.kt" +} + +task codegen_blackbox_regressions_kt998 (type: RunExternalTest) { + source = "codegen/blackbox/regressions/kt998.kt" +} + +task codegen_blackbox_regressions_nestedIntersection (type: RunExternalTest) { + source = "codegen/blackbox/regressions/nestedIntersection.kt" +} + +task codegen_blackbox_regressions_objectCaptureOuterConstructorProperty (type: RunExternalTest) { + source = "codegen/blackbox/regressions/objectCaptureOuterConstructorProperty.kt" +} + +task codegen_blackbox_regressions_referenceToSelfInLocal (type: RunExternalTest) { + source = "codegen/blackbox/regressions/referenceToSelfInLocal.kt" +} + +task codegen_blackbox_regressions_typeCastException (type: RunExternalTest) { + source = "codegen/blackbox/regressions/typeCastException.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle new file mode 100644 index 00000000000..fc12b2daa93 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reified_arraysReification_instanceOf (type: RunExternalTest) { + source = "codegen/blackbox/reified/arraysReification/instanceOf.kt" +} + +task codegen_blackbox_reified_arraysReification_instanceOfArrays (type: RunExternalTest) { + source = "codegen/blackbox/reified/arraysReification/instanceOfArrays.kt" +} + +task codegen_blackbox_reified_arraysReification_jaggedArray (type: RunExternalTest) { + source = "codegen/blackbox/reified/arraysReification/jaggedArray.kt" +} + +task codegen_blackbox_reified_arraysReification_jaggedArrayOfNulls (type: RunExternalTest) { + source = "codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt" +} + +task codegen_blackbox_reified_arraysReification_jaggedDeep (type: RunExternalTest) { + source = "codegen/blackbox/reified/arraysReification/jaggedDeep.kt" +} + +task codegen_blackbox_reified_arraysReification_jClass (type: RunExternalTest) { + source = "codegen/blackbox/reified/arraysReification/jClass.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle new file mode 100644 index 00000000000..d40c3c81536 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle @@ -0,0 +1,118 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_reified_anonymousObject (type: RunExternalTest) { + source = "codegen/blackbox/reified/anonymousObject.kt" +} + +task codegen_blackbox_reified_anonymousObjectNoPropagate (type: RunExternalTest) { + source = "codegen/blackbox/reified/anonymousObjectNoPropagate.kt" +} + +task codegen_blackbox_reified_anonymousObjectReifiedSupertype (type: RunExternalTest) { + source = "codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt" +} + +task codegen_blackbox_reified_approximateCapturedTypes (type: RunExternalTest) { + source = "codegen/blackbox/reified/approximateCapturedTypes.kt" +} + +task codegen_blackbox_reified_asOnPlatformType (type: RunExternalTest) { + source = "codegen/blackbox/reified/asOnPlatformType.kt" +} + +task codegen_blackbox_reified_checkcast (type: RunExternalTest) { + source = "codegen/blackbox/reified/checkcast.kt" +} + +task codegen_blackbox_reified_copyToArray (type: RunExternalTest) { + source = "codegen/blackbox/reified/copyToArray.kt" +} + +task codegen_blackbox_reified_defaultJavaClass (type: RunExternalTest) { + source = "codegen/blackbox/reified/defaultJavaClass.kt" +} + +task codegen_blackbox_reified_DIExample (type: RunExternalTest) { + source = "codegen/blackbox/reified/DIExample.kt" +} + +task codegen_blackbox_reified_filterIsInstance (type: RunExternalTest) { + source = "codegen/blackbox/reified/filterIsInstance.kt" +} + +task codegen_blackbox_reified_innerAnonymousObject (type: RunExternalTest) { + source = "codegen/blackbox/reified/innerAnonymousObject.kt" +} + +task codegen_blackbox_reified_instanceof (type: RunExternalTest) { + source = "codegen/blackbox/reified/instanceof.kt" +} + +task codegen_blackbox_reified_isOnPlatformType (type: RunExternalTest) { + source = "codegen/blackbox/reified/isOnPlatformType.kt" +} + +task codegen_blackbox_reified_javaClass (type: RunExternalTest) { + source = "codegen/blackbox/reified/javaClass.kt" +} + +task codegen_blackbox_reified_nestedReified (type: RunExternalTest) { + source = "codegen/blackbox/reified/nestedReified.kt" +} + +task codegen_blackbox_reified_nestedReifiedSignature (type: RunExternalTest) { + source = "codegen/blackbox/reified/nestedReifiedSignature.kt" +} + +task codegen_blackbox_reified_newArrayInt (type: RunExternalTest) { + source = "codegen/blackbox/reified/newArrayInt.kt" +} + +task codegen_blackbox_reified_nonInlineableLambdaInReifiedFunction (type: RunExternalTest) { + source = "codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt" +} + +task codegen_blackbox_reified_recursiveInnerAnonymousObject (type: RunExternalTest) { + source = "codegen/blackbox/reified/recursiveInnerAnonymousObject.kt" +} + +task codegen_blackbox_reified_recursiveNewArray (type: RunExternalTest) { + source = "codegen/blackbox/reified/recursiveNewArray.kt" +} + +task codegen_blackbox_reified_recursiveNonInlineableLambda (type: RunExternalTest) { + source = "codegen/blackbox/reified/recursiveNonInlineableLambda.kt" +} + +task codegen_blackbox_reified_reifiedChain (type: RunExternalTest) { + source = "codegen/blackbox/reified/reifiedChain.kt" +} + +task codegen_blackbox_reified_reifiedInlineFunOfObject (type: RunExternalTest) { + source = "codegen/blackbox/reified/reifiedInlineFunOfObject.kt" +} + +task codegen_blackbox_reified_reifiedInlineFunOfObjectWithinReified (type: RunExternalTest) { + source = "codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt" +} + +task codegen_blackbox_reified_reifiedInlineIntoNonInlineableLambda (type: RunExternalTest) { + source = "codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt" +} + +task codegen_blackbox_reified_safecast (type: RunExternalTest) { + source = "codegen/blackbox/reified/safecast.kt" +} + +task codegen_blackbox_reified_sameIndexRecursive (type: RunExternalTest) { + source = "codegen/blackbox/reified/sameIndexRecursive.kt" +} + +task codegen_blackbox_reified_spreads (type: RunExternalTest) { + source = "codegen/blackbox/reified/spreads.kt" +} + +task codegen_blackbox_reified_varargs (type: RunExternalTest) { + source = "codegen/blackbox/reified/varargs.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle new file mode 100644 index 00000000000..58006c71f27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle @@ -0,0 +1,38 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_safeCall_genericNull (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/genericNull.kt" +} + +task codegen_blackbox_safeCall_kt1572 (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/kt1572.kt" +} + +task codegen_blackbox_safeCall_kt232 (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/kt232.kt" +} + +task codegen_blackbox_safeCall_kt245 (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/kt245.kt" +} + +task codegen_blackbox_safeCall_kt247 (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/kt247.kt" +} + +task codegen_blackbox_safeCall_kt3430 (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/kt3430.kt" +} + +task codegen_blackbox_safeCall_kt4733 (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/kt4733.kt" +} + +task codegen_blackbox_safeCall_primitive (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/primitive.kt" +} + +task codegen_blackbox_safeCall_safeCallOnLong (type: RunExternalTest) { + source = "codegen/blackbox/safeCall/safeCallOnLong.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle new file mode 100644 index 00000000000..dbd464d3952 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle @@ -0,0 +1,2 @@ +import org.jetbrains.kotlin.* + diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle new file mode 100644 index 00000000000..f26f2c962c3 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_sam_constructors_comparator (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/comparator.kt" +} + +task codegen_blackbox_sam_constructors_filenameFilter (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/filenameFilter.kt" +} + +task codegen_blackbox_sam_constructors_nonLiteralComparator (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/nonLiteralComparator.kt" +} + +task codegen_blackbox_sam_constructors_nonLiteralFilenameFilter (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt" +} + +task codegen_blackbox_sam_constructors_nonLiteralRunnable (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/nonLiteralRunnable.kt" +} + +task codegen_blackbox_sam_constructors_nonTrivialRunnable (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/nonTrivialRunnable.kt" +} + +task codegen_blackbox_sam_constructors_runnable (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/runnable.kt" +} + +task codegen_blackbox_sam_constructors_runnableAccessingClosure1 (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/runnableAccessingClosure1.kt" +} + +task codegen_blackbox_sam_constructors_runnableAccessingClosure2 (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/runnableAccessingClosure2.kt" +} + +task codegen_blackbox_sam_constructors_sameWrapperClass (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/sameWrapperClass.kt" +} + +task codegen_blackbox_sam_constructors_samWrappersDifferentFiles (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt" +} + +task codegen_blackbox_sam_constructors_syntheticVsReal (type: RunExternalTest) { + source = "codegen/blackbox/sam/constructors/syntheticVsReal.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle new file mode 100644 index 00000000000..30d27028710 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle @@ -0,0 +1,10 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_sealed_objects (type: RunExternalTest) { + source = "codegen/blackbox/sealed/objects.kt" +} + +task codegen_blackbox_sealed_simple (type: RunExternalTest) { + source = "codegen/blackbox/sealed/simple.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle new file mode 100644 index 00000000000..094ad730caa --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle @@ -0,0 +1,126 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_secondaryConstructors_accessToCompanion (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/accessToCompanion.kt" +} + +task codegen_blackbox_secondaryConstructors_accessToNestedObject (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/accessToNestedObject.kt" +} + +task codegen_blackbox_secondaryConstructors_basicNoPrimaryManySinks (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/basicNoPrimaryManySinks.kt" +} + +task codegen_blackbox_secondaryConstructors_basicNoPrimaryOneSink (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/basicNoPrimaryOneSink.kt" +} + +task codegen_blackbox_secondaryConstructors_basicPrimary (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/basicPrimary.kt" +} + +task codegen_blackbox_secondaryConstructors_callFromLocalSubClass (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/callFromLocalSubClass.kt" +} + +task codegen_blackbox_secondaryConstructors_callFromPrimaryWithNamedArgs (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/callFromPrimaryWithNamedArgs.kt" +} + +task codegen_blackbox_secondaryConstructors_callFromPrimaryWithOptionalArgs (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt" +} + +task codegen_blackbox_secondaryConstructors_callFromSubClass (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/callFromSubClass.kt" +} + +task codegen_blackbox_secondaryConstructors_clashingDefaultConstructors (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/clashingDefaultConstructors.kt" +} + +task codegen_blackbox_secondaryConstructors_dataClasses (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/dataClasses.kt" +} + +task codegen_blackbox_secondaryConstructors_defaultArgs (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/defaultArgs.kt" +} + +task codegen_blackbox_secondaryConstructors_defaultParametersNotDuplicated (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/defaultParametersNotDuplicated.kt" +} + +task codegen_blackbox_secondaryConstructors_delegatedThisWithLambda (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/delegatedThisWithLambda.kt" +} + +task codegen_blackbox_secondaryConstructors_delegateWithComplexExpression (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/delegateWithComplexExpression.kt" +} + +task codegen_blackbox_secondaryConstructors_delegationWithPrimary (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/delegationWithPrimary.kt" +} + +task codegen_blackbox_secondaryConstructors_enums (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/enums.kt" +} + +task codegen_blackbox_secondaryConstructors_generics (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/generics.kt" +} + +task codegen_blackbox_secondaryConstructors_innerClasses (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/innerClasses.kt" +} + +task codegen_blackbox_secondaryConstructors_innerClassesInheritance (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/innerClassesInheritance.kt" +} + +task codegen_blackbox_secondaryConstructors_localClasses (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/localClasses.kt" +} + +task codegen_blackbox_secondaryConstructors_superCallPrimary (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/superCallPrimary.kt" +} + +task codegen_blackbox_secondaryConstructors_superCallSecondary (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/superCallSecondary.kt" +} + +task codegen_blackbox_secondaryConstructors_varargs (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/varargs.kt" +} + +task codegen_blackbox_secondaryConstructors_withGenerics (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withGenerics.kt" +} + +task codegen_blackbox_secondaryConstructors_withNonLocalReturn (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt" +} + +task codegen_blackbox_secondaryConstructors_withoutPrimary (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withoutPrimary.kt" +} + +task codegen_blackbox_secondaryConstructors_withPrimary (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withPrimary.kt" +} + +task codegen_blackbox_secondaryConstructors_withReturn (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withReturn.kt" +} + +task codegen_blackbox_secondaryConstructors_withReturnUnit (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withReturnUnit.kt" +} + +task codegen_blackbox_secondaryConstructors_withVarargs (type: RunExternalTest) { + source = "codegen/blackbox/secondaryConstructors/withVarargs.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle new file mode 100644 index 00000000000..29c412d7eb8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle @@ -0,0 +1,14 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_smap_chainCalls (type: RunExternalTest) { + source = "codegen/blackbox/smap/chainCalls.kt" +} + +task codegen_blackbox_smap_infixCalls (type: RunExternalTest) { + source = "codegen/blackbox/smap/infixCalls.kt" +} + +task codegen_blackbox_smap_simpleCallWithParams (type: RunExternalTest) { + source = "codegen/blackbox/smap/simpleCallWithParams.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle new file mode 100644 index 00000000000..73856601045 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle @@ -0,0 +1,50 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_smartCasts_falseSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/falseSmartCast.kt" +} + +task codegen_blackbox_smartCasts_genericIntersection (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/genericIntersection.kt" +} + +task codegen_blackbox_smartCasts_genericSet (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/genericSet.kt" +} + +task codegen_blackbox_smartCasts_implicitExtensionReceiver (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/implicitExtensionReceiver.kt" +} + +task codegen_blackbox_smartCasts_implicitMemberReceiver (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/implicitMemberReceiver.kt" +} + +task codegen_blackbox_smartCasts_implicitReceiver (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/implicitReceiver.kt" +} + +task codegen_blackbox_smartCasts_implicitReceiverInWhen (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/implicitReceiverInWhen.kt" +} + +task codegen_blackbox_smartCasts_implicitToGrandSon (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/implicitToGrandSon.kt" +} + +task codegen_blackbox_smartCasts_lambdaArgumentWithoutType (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt" +} + +task codegen_blackbox_smartCasts_nullSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/nullSmartCast.kt" +} + +task codegen_blackbox_smartCasts_smartCastInsideIf (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/smartCastInsideIf.kt" +} + +task codegen_blackbox_smartCasts_whenSmartCast (type: RunExternalTest) { + source = "codegen/blackbox/smartCasts/whenSmartCast.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle new file mode 100644 index 00000000000..c886a5ae13e --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle @@ -0,0 +1,82 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_specialBuiltins_bridgeNotEmptyMap (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt" +} + +task codegen_blackbox_specialBuiltins_bridges (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/bridges.kt" +} + +task codegen_blackbox_specialBuiltins_collectionImpl (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/collectionImpl.kt" +} + +task codegen_blackbox_specialBuiltins_commonBridgesTarget (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/commonBridgesTarget.kt" +} + +task codegen_blackbox_specialBuiltins_emptyList (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/emptyList.kt" +} + +task codegen_blackbox_specialBuiltins_emptyMap (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/emptyMap.kt" +} + +task codegen_blackbox_specialBuiltins_emptyStringMap (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/emptyStringMap.kt" +} + +task codegen_blackbox_specialBuiltins_entrySetSOE (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/entrySetSOE.kt" +} + +task codegen_blackbox_specialBuiltins_enumAsOrdinaled (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/enumAsOrdinaled.kt" +} + +task codegen_blackbox_specialBuiltins_explicitSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/explicitSuperCall.kt" +} + +task codegen_blackbox_specialBuiltins_irrelevantRemoveAtOverride (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/irrelevantRemoveAtOverride.kt" +} + +task codegen_blackbox_specialBuiltins_maps (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/maps.kt" +} + +task codegen_blackbox_specialBuiltins_noSpecialBridgeInSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/noSpecialBridgeInSuperClass.kt" +} + +task codegen_blackbox_specialBuiltins_notEmptyListAny (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/notEmptyListAny.kt" +} + +task codegen_blackbox_specialBuiltins_notEmptyMap (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/notEmptyMap.kt" +} + +task codegen_blackbox_specialBuiltins_redundantStubForSize (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/redundantStubForSize.kt" +} + +task codegen_blackbox_specialBuiltins_removeAtTwoSpecialBridges (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/removeAtTwoSpecialBridges.kt" +} + +task codegen_blackbox_specialBuiltins_throwable (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/throwable.kt" +} + +task codegen_blackbox_specialBuiltins_throwableImpl (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/throwableImpl.kt" +} + +task codegen_blackbox_specialBuiltins_valuesInsideEnum (type: RunExternalTest) { + source = "codegen/blackbox/specialBuiltins/valuesInsideEnum.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle new file mode 100644 index 00000000000..14d79c3bb27 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_statics_anonymousInitializerInClassObject (type: RunExternalTest) { + source = "codegen/blackbox/statics/anonymousInitializerInClassObject.kt" +} + +task codegen_blackbox_statics_anonymousInitializerIObject (type: RunExternalTest) { + source = "codegen/blackbox/statics/anonymousInitializerIObject.kt" +} + +task codegen_blackbox_statics_fields (type: RunExternalTest) { + source = "codegen/blackbox/statics/fields.kt" +} + +task codegen_blackbox_statics_functions (type: RunExternalTest) { + source = "codegen/blackbox/statics/functions.kt" +} + +task codegen_blackbox_statics_hidePrivateByPublic (type: RunExternalTest) { + source = "codegen/blackbox/statics/hidePrivateByPublic.kt" +} + +task codegen_blackbox_statics_incInClassObject (type: RunExternalTest) { + source = "codegen/blackbox/statics/incInClassObject.kt" +} + +task codegen_blackbox_statics_incInObject (type: RunExternalTest) { + source = "codegen/blackbox/statics/incInObject.kt" +} + +task codegen_blackbox_statics_inheritedPropertyInClassObject (type: RunExternalTest) { + source = "codegen/blackbox/statics/inheritedPropertyInClassObject.kt" +} + +task codegen_blackbox_statics_inheritedPropertyInObject (type: RunExternalTest) { + source = "codegen/blackbox/statics/inheritedPropertyInObject.kt" +} + +task codegen_blackbox_statics_inlineCallsStaticMethod (type: RunExternalTest) { + source = "codegen/blackbox/statics/inlineCallsStaticMethod.kt" +} + +task codegen_blackbox_statics_kt8089 (type: RunExternalTest) { + source = "codegen/blackbox/statics/kt8089.kt" +} + +task codegen_blackbox_statics_protectedSamConstructor (type: RunExternalTest) { + source = "codegen/blackbox/statics/protectedSamConstructor.kt" +} + +task codegen_blackbox_statics_protectedStatic (type: RunExternalTest) { + source = "codegen/blackbox/statics/protectedStatic.kt" +} + +task codegen_blackbox_statics_protectedStatic2 (type: RunExternalTest) { + source = "codegen/blackbox/statics/protectedStatic2.kt" +} + +task codegen_blackbox_statics_protectedStaticAndInline (type: RunExternalTest) { + source = "codegen/blackbox/statics/protectedStaticAndInline.kt" +} + +task codegen_blackbox_statics_syntheticAccessor (type: RunExternalTest) { + source = "codegen/blackbox/statics/syntheticAccessor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle new file mode 100644 index 00000000000..1b5e06c9838 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle @@ -0,0 +1,22 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_storeStackBeforeInline_differentTypes (type: RunExternalTest) { + source = "codegen/blackbox/storeStackBeforeInline/differentTypes.kt" +} + +task codegen_blackbox_storeStackBeforeInline_primitiveMerge (type: RunExternalTest) { + source = "codegen/blackbox/storeStackBeforeInline/primitiveMerge.kt" +} + +task codegen_blackbox_storeStackBeforeInline_simple (type: RunExternalTest) { + source = "codegen/blackbox/storeStackBeforeInline/simple.kt" +} + +task codegen_blackbox_storeStackBeforeInline_unreachableMarker (type: RunExternalTest) { + source = "codegen/blackbox/storeStackBeforeInline/unreachableMarker.kt" +} + +task codegen_blackbox_storeStackBeforeInline_withLambda (type: RunExternalTest) { + source = "codegen/blackbox/storeStackBeforeInline/withLambda.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle new file mode 100644 index 00000000000..48e2f952d84 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_strings_ea35743 (type: RunExternalTest) { + source = "codegen/blackbox/strings/ea35743.kt" +} + +task codegen_blackbox_strings_forInString (type: RunExternalTest) { + source = "codegen/blackbox/strings/forInString.kt" +} + +task codegen_blackbox_strings_interpolation (type: RunExternalTest) { + source = "codegen/blackbox/strings/interpolation.kt" +} + +task codegen_blackbox_strings_kt2592 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt2592.kt" +} + +task codegen_blackbox_strings_kt3571 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt3571.kt" +} + +task codegen_blackbox_strings_kt3652 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt3652.kt" +} + +task codegen_blackbox_strings_kt5389_stringBuilderGet (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt5389_stringBuilderGet.kt" +} + +task codegen_blackbox_strings_kt5956 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt5956.kt" +} + +task codegen_blackbox_strings_kt881 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt881.kt" +} + +task codegen_blackbox_strings_kt889 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt889.kt" +} + +task codegen_blackbox_strings_kt894 (type: RunExternalTest) { + source = "codegen/blackbox/strings/kt894.kt" +} + +task codegen_blackbox_strings_multilineStringsWithTemplates (type: RunExternalTest) { + source = "codegen/blackbox/strings/multilineStringsWithTemplates.kt" +} + +task codegen_blackbox_strings_rawStrings (type: RunExternalTest) { + source = "codegen/blackbox/strings/rawStrings.kt" +} + +task codegen_blackbox_strings_rawStringsWithManyQuotes (type: RunExternalTest) { + source = "codegen/blackbox/strings/rawStringsWithManyQuotes.kt" +} + +task codegen_blackbox_strings_stringBuilderAppend (type: RunExternalTest) { + source = "codegen/blackbox/strings/stringBuilderAppend.kt" +} + +task codegen_blackbox_strings_stringPlusOnlyWorksOnString (type: RunExternalTest) { + source = "codegen/blackbox/strings/stringPlusOnlyWorksOnString.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/super/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/super/build-generated.gradle new file mode 100644 index 00000000000..e3937c8ae5f --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/super/build-generated.gradle @@ -0,0 +1,114 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_super_basicmethodSuperClass (type: RunExternalTest) { + source = "codegen/blackbox/super/basicmethodSuperClass.kt" +} + +task codegen_blackbox_super_basicmethodSuperTrait (type: RunExternalTest) { + source = "codegen/blackbox/super/basicmethodSuperTrait.kt" +} + +task codegen_blackbox_super_basicproperty (type: RunExternalTest) { + source = "codegen/blackbox/super/basicproperty.kt" +} + +task codegen_blackbox_super_enclosedFun (type: RunExternalTest) { + source = "codegen/blackbox/super/enclosedFun.kt" +} + +task codegen_blackbox_super_enclosedVar (type: RunExternalTest) { + source = "codegen/blackbox/super/enclosedVar.kt" +} + +task codegen_blackbox_super_innerClassLabeledSuper (type: RunExternalTest) { + source = "codegen/blackbox/super/innerClassLabeledSuper.kt" +} + +task codegen_blackbox_super_innerClassLabeledSuper2 (type: RunExternalTest) { + source = "codegen/blackbox/super/innerClassLabeledSuper2.kt" +} + +task codegen_blackbox_super_innerClassLabeledSuperProperty (type: RunExternalTest) { + source = "codegen/blackbox/super/innerClassLabeledSuperProperty.kt" +} + +task codegen_blackbox_super_innerClassLabeledSuperProperty2 (type: RunExternalTest) { + source = "codegen/blackbox/super/innerClassLabeledSuperProperty2.kt" +} + +task codegen_blackbox_super_innerClassQualifiedFunctionCall (type: RunExternalTest) { + source = "codegen/blackbox/super/innerClassQualifiedFunctionCall.kt" +} + +task codegen_blackbox_super_innerClassQualifiedPropertyAccess (type: RunExternalTest) { + source = "codegen/blackbox/super/innerClassQualifiedPropertyAccess.kt" +} + +task codegen_blackbox_super_kt14243 (type: RunExternalTest) { + source = "codegen/blackbox/super/kt14243.kt" +} + +task codegen_blackbox_super_kt14243_2 (type: RunExternalTest) { + source = "codegen/blackbox/super/kt14243_2.kt" +} + +task codegen_blackbox_super_kt14243_class (type: RunExternalTest) { + source = "codegen/blackbox/super/kt14243_class.kt" +} + +task codegen_blackbox_super_kt14243_prop (type: RunExternalTest) { + source = "codegen/blackbox/super/kt14243_prop.kt" +} + +task codegen_blackbox_super_kt3492ClassFun (type: RunExternalTest) { + source = "codegen/blackbox/super/kt3492ClassFun.kt" +} + +task codegen_blackbox_super_kt3492ClassProperty (type: RunExternalTest) { + source = "codegen/blackbox/super/kt3492ClassProperty.kt" +} + +task codegen_blackbox_super_kt3492TraitFun (type: RunExternalTest) { + source = "codegen/blackbox/super/kt3492TraitFun.kt" +} + +task codegen_blackbox_super_kt3492TraitProperty (type: RunExternalTest) { + source = "codegen/blackbox/super/kt3492TraitProperty.kt" +} + +task codegen_blackbox_super_kt4173 (type: RunExternalTest) { + source = "codegen/blackbox/super/kt4173.kt" +} + +task codegen_blackbox_super_kt4173_2 (type: RunExternalTest) { + source = "codegen/blackbox/super/kt4173_2.kt" +} + +task codegen_blackbox_super_kt4173_3 (type: RunExternalTest) { + source = "codegen/blackbox/super/kt4173_3.kt" +} + +task codegen_blackbox_super_kt4982 (type: RunExternalTest) { + source = "codegen/blackbox/super/kt4982.kt" +} + +task codegen_blackbox_super_multipleSuperTraits (type: RunExternalTest) { + source = "codegen/blackbox/super/multipleSuperTraits.kt" +} + +task codegen_blackbox_super_traitproperty (type: RunExternalTest) { + source = "codegen/blackbox/super/traitproperty.kt" +} + +task codegen_blackbox_super_unqualifiedSuper (type: RunExternalTest) { + source = "codegen/blackbox/super/unqualifiedSuper.kt" +} + +task codegen_blackbox_super_unqualifiedSuperWithDeeperHierarchies (type: RunExternalTest) { + source = "codegen/blackbox/super/unqualifiedSuperWithDeeperHierarchies.kt" +} + +task codegen_blackbox_super_unqualifiedSuperWithMethodsOfAny (type: RunExternalTest) { + source = "codegen/blackbox/super/unqualifiedSuperWithMethodsOfAny.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle new file mode 100644 index 00000000000..35c72a8bc95 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_synchronized_changeMonitor (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/changeMonitor.kt" +} + +task codegen_blackbox_synchronized_exceptionInMonitorExpression (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/exceptionInMonitorExpression.kt" +} + +task codegen_blackbox_synchronized_finally (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/finally.kt" +} + +task codegen_blackbox_synchronized_longValue (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/longValue.kt" +} + +task codegen_blackbox_synchronized_nestedDifferentObjects (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/nestedDifferentObjects.kt" +} + +task codegen_blackbox_synchronized_nestedSameObject (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/nestedSameObject.kt" +} + +task codegen_blackbox_synchronized_nonLocalReturn (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/nonLocalReturn.kt" +} + +task codegen_blackbox_synchronized_objectValue (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/objectValue.kt" +} + +task codegen_blackbox_synchronized_sync (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/sync.kt" +} + +task codegen_blackbox_synchronized_value (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/value.kt" +} + +task codegen_blackbox_synchronized_wait (type: RunExternalTest) { + source = "codegen/blackbox/synchronized/wait.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle new file mode 100644 index 00000000000..3b3875883c9 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle @@ -0,0 +1,38 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_syntheticAccessors_accessorForProtected (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/accessorForProtected.kt" +} + +task codegen_blackbox_syntheticAccessors_accessorForProtectedInvokeVirtual (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/accessorForProtectedInvokeVirtual.kt" +} + +task codegen_blackbox_syntheticAccessors_kt10047 (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/kt10047.kt" +} + +task codegen_blackbox_syntheticAccessors_kt9717 (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/kt9717.kt" +} + +task codegen_blackbox_syntheticAccessors_kt9717DifferentPackages (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/kt9717DifferentPackages.kt" +} + +task codegen_blackbox_syntheticAccessors_kt9958 (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/kt9958.kt" +} + +task codegen_blackbox_syntheticAccessors_kt9958Interface (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/kt9958Interface.kt" +} + +task codegen_blackbox_syntheticAccessors_protectedFromLambda (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/protectedFromLambda.kt" +} + +task codegen_blackbox_syntheticAccessors_syntheticAccessorNames (type: RunExternalTest) { + source = "codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle new file mode 100644 index 00000000000..23a3b2e4bce --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_toArray_kt3177_toTypedArray (type: RunExternalTest) { + source = "codegen/blackbox/toArray/kt3177-toTypedArray.kt" +} + +task codegen_blackbox_toArray_returnToTypedArray (type: RunExternalTest) { + source = "codegen/blackbox/toArray/returnToTypedArray.kt" +} + +task codegen_blackbox_toArray_toArray (type: RunExternalTest) { + source = "codegen/blackbox/toArray/toArray.kt" +} + +task codegen_blackbox_toArray_toArrayAlreadyPresent (type: RunExternalTest) { + source = "codegen/blackbox/toArray/toArrayAlreadyPresent.kt" +} + +task codegen_blackbox_toArray_toArrayShouldBePublic (type: RunExternalTest) { + source = "codegen/blackbox/toArray/toArrayShouldBePublic.kt" +} + +task codegen_blackbox_toArray_toArrayShouldBePublicWithJava (type: RunExternalTest) { + source = "codegen/blackbox/toArray/toArrayShouldBePublicWithJava.kt" +} + +task codegen_blackbox_toArray_toTypedArray (type: RunExternalTest) { + source = "codegen/blackbox/toArray/toTypedArray.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle new file mode 100644 index 00000000000..0f7c438b126 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_topLevelPrivate_noPrivateNoAccessorsInMultiFileFacade (type: RunExternalTest) { + source = "codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt" +} + +task codegen_blackbox_topLevelPrivate_noPrivateNoAccessorsInMultiFileFacade2 (type: RunExternalTest) { + source = "codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt" +} + +task codegen_blackbox_topLevelPrivate_privateInInlineNested (type: RunExternalTest) { + source = "codegen/blackbox/topLevelPrivate/privateInInlineNested.kt" +} + +task codegen_blackbox_topLevelPrivate_privateVisibility (type: RunExternalTest) { + source = "codegen/blackbox/topLevelPrivate/privateVisibility.kt" +} + +task codegen_blackbox_topLevelPrivate_syntheticAccessor (type: RunExternalTest) { + source = "codegen/blackbox/topLevelPrivate/syntheticAccessor.kt" +} + +task codegen_blackbox_topLevelPrivate_syntheticAccessorInMultiFile (type: RunExternalTest) { + source = "codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle new file mode 100644 index 00000000000..18ebb040dab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle @@ -0,0 +1,114 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_traits_abstractClassInheritsFromInterface (type: RunExternalTest) { + source = "codegen/blackbox/traits/abstractClassInheritsFromInterface.kt" +} + +task codegen_blackbox_traits_diamondPropertyAccessors (type: RunExternalTest) { + source = "codegen/blackbox/traits/diamondPropertyAccessors.kt" +} + +task codegen_blackbox_traits_genericMethod (type: RunExternalTest) { + source = "codegen/blackbox/traits/genericMethod.kt" +} + +task codegen_blackbox_traits_indirectlyInheritPropertyGetter (type: RunExternalTest) { + source = "codegen/blackbox/traits/indirectlyInheritPropertyGetter.kt" +} + +task codegen_blackbox_traits_inheritedFun (type: RunExternalTest) { + source = "codegen/blackbox/traits/inheritedFun.kt" +} + +task codegen_blackbox_traits_inheritedVar (type: RunExternalTest) { + source = "codegen/blackbox/traits/inheritedVar.kt" +} + +task codegen_blackbox_traits_inheritJavaInterface (type: RunExternalTest) { + source = "codegen/blackbox/traits/inheritJavaInterface.kt" +} + +task codegen_blackbox_traits_interfaceDefaultImpls (type: RunExternalTest) { + source = "codegen/blackbox/traits/interfaceDefaultImpls.kt" +} + +task codegen_blackbox_traits_kt1936 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt1936.kt" +} + +task codegen_blackbox_traits_kt1936_1 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt1936_1.kt" +} + +task codegen_blackbox_traits_kt2260 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt2260.kt" +} + +task codegen_blackbox_traits_kt2399 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt2399.kt" +} + +task codegen_blackbox_traits_kt2541 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt2541.kt" +} + +task codegen_blackbox_traits_kt3315 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt3315.kt" +} + +task codegen_blackbox_traits_kt3500 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt3500.kt" +} + +task codegen_blackbox_traits_kt3579 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt3579.kt" +} + +task codegen_blackbox_traits_kt3579_2 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt3579_2.kt" +} + +task codegen_blackbox_traits_kt5393 (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt5393.kt" +} + +task codegen_blackbox_traits_kt5393_property (type: RunExternalTest) { + source = "codegen/blackbox/traits/kt5393_property.kt" +} + +task codegen_blackbox_traits_multiple (type: RunExternalTest) { + source = "codegen/blackbox/traits/multiple.kt" +} + +task codegen_blackbox_traits_noPrivateDelegation (type: RunExternalTest) { + source = "codegen/blackbox/traits/noPrivateDelegation.kt" +} + +task codegen_blackbox_traits_syntheticAccessor (type: RunExternalTest) { + source = "codegen/blackbox/traits/syntheticAccessor.kt" +} + +task codegen_blackbox_traits_traitImplDelegationWithCovariantOverride (type: RunExternalTest) { + source = "codegen/blackbox/traits/traitImplDelegationWithCovariantOverride.kt" +} + +task codegen_blackbox_traits_traitImplDiamond (type: RunExternalTest) { + source = "codegen/blackbox/traits/traitImplDiamond.kt" +} + +task codegen_blackbox_traits_traitImplGenericDelegation (type: RunExternalTest) { + source = "codegen/blackbox/traits/traitImplGenericDelegation.kt" +} + +task codegen_blackbox_traits_traitWithPrivateExtension (type: RunExternalTest) { + source = "codegen/blackbox/traits/traitWithPrivateExtension.kt" +} + +task codegen_blackbox_traits_traitWithPrivateMember (type: RunExternalTest) { + source = "codegen/blackbox/traits/traitWithPrivateMember.kt" +} + +task codegen_blackbox_traits_traitWithPrivateMemberAccessFromLambda (type: RunExternalTest) { + source = "codegen/blackbox/traits/traitWithPrivateMemberAccessFromLambda.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle new file mode 100644 index 00000000000..4db3a8aa7bd --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle @@ -0,0 +1,30 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_typeInfo_asInLoop (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/asInLoop.kt" +} + +task codegen_blackbox_typeInfo_ifOrWhenSpecialCall (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/ifOrWhenSpecialCall.kt" +} + +task codegen_blackbox_typeInfo_implicitSmartCastThis (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/implicitSmartCastThis.kt" +} + +task codegen_blackbox_typeInfo_inheritance (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/inheritance.kt" +} + +task codegen_blackbox_typeInfo_kt2811 (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/kt2811.kt" +} + +task codegen_blackbox_typeInfo_primitiveTypeInfo (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/primitiveTypeInfo.kt" +} + +task codegen_blackbox_typeInfo_smartCastThis (type: RunExternalTest) { + source = "codegen/blackbox/typeInfo/smartCastThis.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle new file mode 100644 index 00000000000..a457d49aae8 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_typeMapping_enhancedPrimitives (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/enhancedPrimitives.kt" +} + +task codegen_blackbox_typeMapping_genericTypeWithNothing (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/genericTypeWithNothing.kt" +} + +task codegen_blackbox_typeMapping_kt2831 (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/kt2831.kt" +} + +task codegen_blackbox_typeMapping_kt309 (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/kt309.kt" +} + +task codegen_blackbox_typeMapping_kt3286 (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/kt3286.kt" +} + +task codegen_blackbox_typeMapping_kt3863 (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/kt3863.kt" +} + +task codegen_blackbox_typeMapping_kt3976 (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/kt3976.kt" +} + +task codegen_blackbox_typeMapping_nothing (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/nothing.kt" +} + +task codegen_blackbox_typeMapping_nullableNothing (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/nullableNothing.kt" +} + +task codegen_blackbox_typeMapping_typeParameterMultipleBounds (type: RunExternalTest) { + source = "codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle new file mode 100644 index 00000000000..c10a5c2d228 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle @@ -0,0 +1,54 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_typealias_genericTypeAliasConstructor (type: RunExternalTest) { + source = "codegen/blackbox/typealias/genericTypeAliasConstructor.kt" +} + +task codegen_blackbox_typealias_innerClassTypeAliasConstructor (type: RunExternalTest) { + source = "codegen/blackbox/typealias/innerClassTypeAliasConstructor.kt" +} + +task codegen_blackbox_typealias_innerClassTypeAliasConstructorInSupertypes (type: RunExternalTest) { + source = "codegen/blackbox/typealias/innerClassTypeAliasConstructorInSupertypes.kt" +} + +task codegen_blackbox_typealias_simple (type: RunExternalTest) { + source = "codegen/blackbox/typealias/simple.kt" +} + +task codegen_blackbox_typealias_typeAliasAsBareType (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasAsBareType.kt" +} + +task codegen_blackbox_typealias_typeAliasCompanion (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasCompanion.kt" +} + +task codegen_blackbox_typealias_typeAliasConstructor (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasConstructor.kt" +} + +task codegen_blackbox_typealias_typeAliasConstructorAccessor (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasConstructorAccessor.kt" +} + +task codegen_blackbox_typealias_typeAliasConstructorInSuperCall (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasConstructorInSuperCall.kt" +} + +task codegen_blackbox_typealias_typeAliasInAnonymousObjectType (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasInAnonymousObjectType.kt" +} + +task codegen_blackbox_typealias_typeAliasObject (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasObject.kt" +} + +task codegen_blackbox_typealias_typeAliasObjectCallable (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasObjectCallable.kt" +} + +task codegen_blackbox_typealias_typeAliasSecondaryConstructor (type: RunExternalTest) { + source = "codegen/blackbox/typealias/typeAliasSecondaryConstructor.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle new file mode 100644 index 00000000000..e48318287b6 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_unaryOp_call (type: RunExternalTest) { + source = "codegen/blackbox/unaryOp/call.kt" +} + +task codegen_blackbox_unaryOp_callNullable (type: RunExternalTest) { + source = "codegen/blackbox/unaryOp/callNullable.kt" +} + +task codegen_blackbox_unaryOp_callWithCommonType (type: RunExternalTest) { + source = "codegen/blackbox/unaryOp/callWithCommonType.kt" +} + +task codegen_blackbox_unaryOp_intrinsic (type: RunExternalTest) { + source = "codegen/blackbox/unaryOp/intrinsic.kt" +} + +task codegen_blackbox_unaryOp_intrinsicNullable (type: RunExternalTest) { + source = "codegen/blackbox/unaryOp/intrinsicNullable.kt" +} + +task codegen_blackbox_unaryOp_longOverflow (type: RunExternalTest) { + source = "codegen/blackbox/unaryOp/longOverflow.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle new file mode 100644 index 00000000000..7e77246a989 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_unit_closureReturnsNullableUnit (type: RunExternalTest) { + source = "codegen/blackbox/unit/closureReturnsNullableUnit.kt" +} + +task codegen_blackbox_unit_ifElse (type: RunExternalTest) { + source = "codegen/blackbox/unit/ifElse.kt" +} + +task codegen_blackbox_unit_kt3634 (type: RunExternalTest) { + source = "codegen/blackbox/unit/kt3634.kt" +} + +task codegen_blackbox_unit_kt4212 (type: RunExternalTest) { + source = "codegen/blackbox/unit/kt4212.kt" +} + +task codegen_blackbox_unit_kt4265 (type: RunExternalTest) { + source = "codegen/blackbox/unit/kt4265.kt" +} + +task codegen_blackbox_unit_nullableUnit (type: RunExternalTest) { + source = "codegen/blackbox/unit/nullableUnit.kt" +} + +task codegen_blackbox_unit_nullableUnitInWhen1 (type: RunExternalTest) { + source = "codegen/blackbox/unit/nullableUnitInWhen1.kt" +} + +task codegen_blackbox_unit_nullableUnitInWhen2 (type: RunExternalTest) { + source = "codegen/blackbox/unit/nullableUnitInWhen2.kt" +} + +task codegen_blackbox_unit_nullableUnitInWhen3 (type: RunExternalTest) { + source = "codegen/blackbox/unit/nullableUnitInWhen3.kt" +} + +task codegen_blackbox_unit_unitClassObject (type: RunExternalTest) { + source = "codegen/blackbox/unit/unitClassObject.kt" +} + +task codegen_blackbox_unit_UnitValue (type: RunExternalTest) { + source = "codegen/blackbox/unit/UnitValue.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle new file mode 100644 index 00000000000..da62f61c2dc --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle @@ -0,0 +1,34 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_vararg_kt1978 (type: RunExternalTest) { + source = "codegen/blackbox/vararg/kt1978.kt" +} + +task codegen_blackbox_vararg_kt581 (type: RunExternalTest) { + source = "codegen/blackbox/vararg/kt581.kt" +} + +task codegen_blackbox_vararg_kt6192 (type: RunExternalTest) { + source = "codegen/blackbox/vararg/kt6192.kt" +} + +task codegen_blackbox_vararg_kt796_797 (type: RunExternalTest) { + source = "codegen/blackbox/vararg/kt796_797.kt" +} + +task codegen_blackbox_vararg_spreadCopiesArray (type: RunExternalTest) { + source = "codegen/blackbox/vararg/spreadCopiesArray.kt" +} + +task codegen_blackbox_vararg_varargInFunParam (type: RunExternalTest) { + source = "codegen/blackbox/vararg/varargInFunParam.kt" +} + +task codegen_blackbox_vararg_varargInJava (type: RunExternalTest) { + source = "codegen/blackbox/vararg/varargInJava.kt" +} + +task codegen_blackbox_vararg_varargsAndFunctionLiterals (type: RunExternalTest) { + source = "codegen/blackbox/vararg/varargsAndFunctionLiterals.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/when/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/when/build-generated.gradle new file mode 100644 index 00000000000..772b1b6d6ab --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/build-generated.gradle @@ -0,0 +1,134 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_when_callProperty (type: RunExternalTest) { + source = "codegen/blackbox/when/callProperty.kt" +} + +task codegen_blackbox_when_emptyWhen (type: RunExternalTest) { + source = "codegen/blackbox/when/emptyWhen.kt" +} + +task codegen_blackbox_when_exceptionOnNoMatch (type: RunExternalTest) { + source = "codegen/blackbox/when/exceptionOnNoMatch.kt" +} + +task codegen_blackbox_when_exhaustiveBoolean (type: RunExternalTest) { + source = "codegen/blackbox/when/exhaustiveBoolean.kt" +} + +task codegen_blackbox_when_exhaustiveBreakContinue (type: RunExternalTest) { + source = "codegen/blackbox/when/exhaustiveBreakContinue.kt" +} + +task codegen_blackbox_when_exhaustiveWhenInitialization (type: RunExternalTest) { + source = "codegen/blackbox/when/exhaustiveWhenInitialization.kt" +} + +task codegen_blackbox_when_exhaustiveWhenReturn (type: RunExternalTest) { + source = "codegen/blackbox/when/exhaustiveWhenReturn.kt" +} + +task codegen_blackbox_when_implicitExhaustiveAndReturn (type: RunExternalTest) { + source = "codegen/blackbox/when/implicitExhaustiveAndReturn.kt" +} + +task codegen_blackbox_when_integralWhenWithNoInlinedConstants (type: RunExternalTest) { + source = "codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt" +} + +task codegen_blackbox_when_is (type: RunExternalTest) { + source = "codegen/blackbox/when/is.kt" +} + +task codegen_blackbox_when_kt2457 (type: RunExternalTest) { + source = "codegen/blackbox/when/kt2457.kt" +} + +task codegen_blackbox_when_kt2466 (type: RunExternalTest) { + source = "codegen/blackbox/when/kt2466.kt" +} + +task codegen_blackbox_when_kt5307 (type: RunExternalTest) { + source = "codegen/blackbox/when/kt5307.kt" +} + +task codegen_blackbox_when_kt5448 (type: RunExternalTest) { + source = "codegen/blackbox/when/kt5448.kt" +} + +task codegen_blackbox_when_longInRange (type: RunExternalTest) { + source = "codegen/blackbox/when/longInRange.kt" +} + +task codegen_blackbox_when_matchNotNullAgainstNullable (type: RunExternalTest) { + source = "codegen/blackbox/when/matchNotNullAgainstNullable.kt" +} + +task codegen_blackbox_when_multipleEntries (type: RunExternalTest) { + source = "codegen/blackbox/when/multipleEntries.kt" +} + +task codegen_blackbox_when_noElseExhaustive (type: RunExternalTest) { + source = "codegen/blackbox/when/noElseExhaustive.kt" +} + +task codegen_blackbox_when_noElseExhaustiveStatement (type: RunExternalTest) { + source = "codegen/blackbox/when/noElseExhaustiveStatement.kt" +} + +task codegen_blackbox_when_noElseExhaustiveUnitExpected (type: RunExternalTest) { + source = "codegen/blackbox/when/noElseExhaustiveUnitExpected.kt" +} + +task codegen_blackbox_when_noElseInStatement (type: RunExternalTest) { + source = "codegen/blackbox/when/noElseInStatement.kt" +} + +task codegen_blackbox_when_noElseNoMatch (type: RunExternalTest) { + source = "codegen/blackbox/when/noElseNoMatch.kt" +} + +task codegen_blackbox_when_nullableWhen (type: RunExternalTest) { + source = "codegen/blackbox/when/nullableWhen.kt" +} + +task codegen_blackbox_when_range (type: RunExternalTest) { + source = "codegen/blackbox/when/range.kt" +} + +task codegen_blackbox_when_sealedWhenInitialization (type: RunExternalTest) { + source = "codegen/blackbox/when/sealedWhenInitialization.kt" +} + +task codegen_blackbox_when_switchOptimizationDense (type: RunExternalTest) { + source = "codegen/blackbox/when/switchOptimizationDense.kt" +} + +task codegen_blackbox_when_switchOptimizationMultipleConditions (type: RunExternalTest) { + source = "codegen/blackbox/when/switchOptimizationMultipleConditions.kt" +} + +task codegen_blackbox_when_switchOptimizationSparse (type: RunExternalTest) { + source = "codegen/blackbox/when/switchOptimizationSparse.kt" +} + +task codegen_blackbox_when_switchOptimizationStatement (type: RunExternalTest) { + source = "codegen/blackbox/when/switchOptimizationStatement.kt" +} + +task codegen_blackbox_when_switchOptimizationTypes (type: RunExternalTest) { + source = "codegen/blackbox/when/switchOptimizationTypes.kt" +} + +task codegen_blackbox_when_switchOptimizationUnordered (type: RunExternalTest) { + source = "codegen/blackbox/when/switchOptimizationUnordered.kt" +} + +task codegen_blackbox_when_typeDisjunction (type: RunExternalTest) { + source = "codegen/blackbox/when/typeDisjunction.kt" +} + +task codegen_blackbox_when_whenArgumentIsEvaluatedOnlyOnce (type: RunExternalTest) { + source = "codegen/blackbox/when/whenArgumentIsEvaluatedOnlyOnce.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle new file mode 100644 index 00000000000..c076e20a857 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_when_enumOptimization_bigEnum (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/bigEnum.kt" +} + +task codegen_blackbox_when_enumOptimization_duplicatingItems (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/duplicatingItems.kt" +} + +task codegen_blackbox_when_enumOptimization_enumInsideClassObject (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/enumInsideClassObject.kt" +} + +task codegen_blackbox_when_enumOptimization_expression (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/expression.kt" +} + +task codegen_blackbox_when_enumOptimization_functionLiteralInTopLevel (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/functionLiteralInTopLevel.kt" +} + +task codegen_blackbox_when_enumOptimization_manyWhensWithinClass (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/manyWhensWithinClass.kt" +} + +task codegen_blackbox_when_enumOptimization_nonConstantEnum (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/nonConstantEnum.kt" +} + +task codegen_blackbox_when_enumOptimization_nullability (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/nullability.kt" +} + +task codegen_blackbox_when_enumOptimization_nullableEnum (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/nullableEnum.kt" +} + +task codegen_blackbox_when_enumOptimization_subjectAny (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/subjectAny.kt" +} + +task codegen_blackbox_when_enumOptimization_withoutElse (type: RunExternalTest) { + source = "codegen/blackbox/when/enumOptimization/withoutElse.kt" +} + diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle new file mode 100644 index 00000000000..b308611f137 --- /dev/null +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle @@ -0,0 +1,26 @@ +import org.jetbrains.kotlin.* + +task codegen_blackbox_when_stringOptimization_duplicatingItems (type: RunExternalTest) { + source = "codegen/blackbox/when/stringOptimization/duplicatingItems.kt" +} + +task codegen_blackbox_when_stringOptimization_duplicatingItemsSameHashCode (type: RunExternalTest) { + source = "codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt" +} + +task codegen_blackbox_when_stringOptimization_expression (type: RunExternalTest) { + source = "codegen/blackbox/when/stringOptimization/expression.kt" +} + +task codegen_blackbox_when_stringOptimization_nullability (type: RunExternalTest) { + source = "codegen/blackbox/when/stringOptimization/nullability.kt" +} + +task codegen_blackbox_when_stringOptimization_sameHashCode (type: RunExternalTest) { + source = "codegen/blackbox/when/stringOptimization/sameHashCode.kt" +} + +task codegen_blackbox_when_stringOptimization_statement (type: RunExternalTest) { + source = "codegen/blackbox/when/stringOptimization/statement.kt" +} + From b6587252c083e53562a824cb92b7c27b2cccdf6b Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 18 Jan 2017 12:48:38 +0300 Subject: [PATCH 13/86] backend/tests: Added test group running --- backend.native/tests/build.gradle | 4 ++ .../org/jetbrains/kotlin/KonanTest.groovy | 46 ++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 676a7272511..6dc356a4494 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -79,6 +79,10 @@ task run_external () { } } +task run_external_group (type: RunExternalTestGroup) { + groupDirectory = "external/codegen/blackbox/binaryOp" +} + task sum (type:RunKonanTest) { source = "codegen/function/sum.kt" } diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 9e0f8a2f703..d38bd2b3a63 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -1,7 +1,11 @@ package org.jetbrains.kotlin +import groovy.io.FileType import org.gradle.api.DefaultTask +import org.gradle.api.internal.tasks.testing.detection.DefaultTestExecuter +import org.gradle.api.tasks.ParallelizableTask import org.gradle.api.tasks.TaskAction +import org.gradle.api.tasks.testing.Test abstract class KonanTest extends DefaultTask { protected String source @@ -157,7 +161,7 @@ class RunExternalTest extends RunKonanTest { def nextFileExists = matcher.find() def end = nextFileExists ? matcher.start() : srcText.length() def fileText = srcText.substring(start, end) - processedChars = end; + processedChars = end createFile(filePath, fileText) if (fileText =~ boxPattern && fileText =~ packagePattern){ boxPackage = (fileText =~ packagePattern)[0][1] @@ -181,3 +185,43 @@ class RunExternalTest extends RunKonanTest { } } +class RunExternalTestGroup extends RunExternalTest { + def groupDirectory = "." + def logFileName = "test-result.md" + String filter = project.property("filter") + + @TaskAction + void executeTest() { + def logFile = project.file(logFileName) + logFile.write("|Test|Status|Comment|\n|----|------|-------|") + def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() { + @Override + boolean accept(File pathname) { + pathname.isFile() && pathname.name.endsWith(".kt") + } + }) + if (filter != null) { + def pattern = ~filter + ktFiles = ktFiles.findAll { + it.name =~ pattern + } + } + def current = 0 + def passed = 0 + def total = ktFiles.size() + ktFiles.each { + source = project.relativePath(it) + println("TEST: ${++current}/$total (passed: $passed)") + try { + super.executeTest() + logFile.append("\n|$it.name|PASSED||") + println("TEST PASSED\n") + passed++ + } catch (Exception ex) { + println("TEST FAILED\n") + logFile.append("\n|$it.name|FAILED|${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}|") + } + } + } +} + From bfdda21da187158f5950ea93e6884d4dd79bdf13 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 18 Jan 2017 14:10:20 +0300 Subject: [PATCH 14/86] backend/tests: Added task generation for test groups instead of tests --- backend.native/tests/build.gradle | 52 +++++-------------- .../org/jetbrains/kotlin/KonanTest.groovy | 7 ++- 2 files changed, 18 insertions(+), 41 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 6dc356a4494..3fe46205a39 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -19,7 +19,8 @@ task regenerate_external_tests() { def gradleGenerated = externalTestsProject.file("build.gradle") def externalTestsDir = externalTestsProject.file("codegen/blackbox") gradleGenerated.write("import org.jetbrains.kotlin.*\n\n") - gradleGenerated.append("configurations {\n" + + gradleGenerated.append( + "configurations {\n" + " cli_bc\n" + "}\n" + "\n" + @@ -28,22 +29,19 @@ task regenerate_external_tests() { "}\n\n") externalTestsDir.eachDirRecurse { - if (it.name == "build") { + // Skip build directory and directories without *.kt files + if (it.name == "build" || it.listFiles().findAll { it.name.endsWith(".kt") }.isEmpty()) { return } - def directoryGradleGenerated = project.file("$it.absolutePath/build-generated.gradle") - directoryGradleGenerated.write("import org.jetbrains.kotlin.*\n\n") - gradleGenerated.append("\napply from: \"${externalTestsProject.relativePath(directoryGradleGenerated)}\"") + def taskDirectory = externalTestsProject.relativePath(it) + def taskName = taskDirectory.replace('/', '_').replace('-', '_') - it.eachFile(FileType.FILES) { - if (it.name.endsWith(".kt")) { - def taskSourcePath = externalTestsProject.relativePath(it) - //remove filename extension. TODO make better replacement - def taskName = taskSourcePath.replace('/', '_').replace('-', '_').replaceFirst(~/\.[^\.]+$/, '') - directoryGradleGenerated.append("task $taskName (type: RunExternalTest) {\n source = \"$taskSourcePath\"\n}\n\n") - } - } + gradleGenerated.append( + "task $taskName (type: RunExternalTestGroup) {\n" + + " groupDirectory = \"$taskDirectory\"\n" + + " logFileName = \"$taskDirectory/test-result.md\"\n" + + "}\n\n") } } } @@ -54,35 +52,11 @@ task run() { } task run_external () { - doLast { - //TODO make better output / make as dependencies - def externalTestsProject = project.childProjects["external"] - def logFile = externalTestsProject.file("test-result.md") - logFile.write("|Test|Status|Comment|\n|----|------|-------|") - def current = 1 - def passed = 0 - def total = externalTestsProject.tasks.size() - externalTestsProject.tasks.each { - println("TEST: $current/$total (passed: $passed)") - try { - (it as RunExternalTest).executeTest() - logFile.append("\n|$it.name|PASSED||") - println("TEST PASSED") - passed++ - } catch (Exception ex) { - println("TEST FAILED") - logFile.append("\n|$it.name|FAILED|${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}|") - } - current++ - } - logFile.append("\nPASSED: $passed/$total") + project.subprojects { + dependsOn(it.tasks.withType(RunExternalTestGroup).matching { it.enabled }) } } -task run_external_group (type: RunExternalTestGroup) { - groupDirectory = "external/codegen/blackbox/binaryOp" -} - task sum (type:RunKonanTest) { source = "codegen/function/sum.kt" } diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index d38bd2b3a63..f4f19a174eb 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -185,12 +185,14 @@ class RunExternalTest extends RunKonanTest { } } +@ParallelizableTask class RunExternalTestGroup extends RunExternalTest { def groupDirectory = "." def logFileName = "test-result.md" - String filter = project.property("filter") + String filter = project.findProperty("filter") @TaskAction + @Override void executeTest() { def logFile = project.file(logFileName) logFile.write("|Test|Status|Comment|\n|----|------|-------|") @@ -211,7 +213,7 @@ class RunExternalTestGroup extends RunExternalTest { def total = ktFiles.size() ktFiles.each { source = project.relativePath(it) - println("TEST: ${++current}/$total (passed: $passed)") + println("TEST: $it.name (${++current}/$total, passed: $passed)") try { super.executeTest() logFile.append("\n|$it.name|PASSED||") @@ -222,6 +224,7 @@ class RunExternalTestGroup extends RunExternalTest { logFile.append("\n|$it.name|FAILED|${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}|") } } + print("TOTAL PASSED: $passed/$total") } } From d24f9666006617d1eeca84bb505177f50e2cc961 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 19 Jan 2017 12:40:19 +0300 Subject: [PATCH 15/86] backend/tests: Regenerated external test tasks --- backend.native/tests/external/build.gradle | 1207 ++++++++++++++--- .../annotatedLambda/build-generated.gradle | 18 - .../annotations/build-generated.gradle | 74 - .../argumentOrder/build-generated.gradle | 46 - .../blackbox/arrays/build-generated.gradle | 230 ---- .../arrays/multiDecl/build-generated.gradle | 22 - .../multiDecl/int/build-generated.gradle | 18 - .../multiDecl/long/build-generated.gradle | 18 - .../blackbox/binaryOp/build-generated.gradle | 70 - .../boxingOptimization/build-generated.gradle | 66 - .../blackbox/bridges/build-generated.gradle | 190 --- .../build-generated.gradle | 46 - .../builtinStubMethods/build-generated.gradle | 94 -- .../build-generated.gradle | 30 - .../bound/build-generated.gradle | 54 - .../bound/equals/build-generated.gradle | 18 - .../bound/inline/build-generated.gradle | 10 - .../callableReference/build-generated.gradle | 2 - .../function/build-generated.gradle | 166 --- .../function/local/build-generated.gradle | 78 -- .../property/build-generated.gradle | 106 -- .../blackbox/casts/build-generated.gradle | 82 -- .../casts/functions/build-generated.gradle | 54 - .../build-generated.gradle | 30 - .../mutableCollections/build-generated.gradle | 34 - .../classLiteral/bound/build-generated.gradle | 18 - .../classLiteral/build-generated.gradle | 6 - .../classLiteral/java/build-generated.gradle | 34 - .../blackbox/classes/build-generated.gradle | 458 ------- .../classes/inner/build-generated.gradle | 26 - .../blackbox/closures/build-generated.gradle | 150 -- .../build-generated.gradle | 34 - .../build-generated.gradle | 26 - .../collections/build-generated.gradle | 74 - .../compatibility/build-generated.gradle | 6 - .../blackbox/constants/build-generated.gradle | 22 - .../build-generated.gradle | 58 - .../controlStructures/build-generated.gradle | 270 ---- .../returnsNothing/build-generated.gradle | 22 - .../build-generated.gradle | 90 -- .../coroutines/build-generated.gradle | 198 --- .../controlFlow/build-generated.gradle | 46 - .../intLikeVarSpilling/build-generated.gradle | 42 - .../multiModule/build-generated.gradle | 10 - .../stackUnwinding/build-generated.gradle | 18 - .../build-generated.gradle | 10 - .../unitTypeReturn/build-generated.gradle | 18 - .../dataClasses/build-generated.gradle | 62 - .../dataClasses/copy/build-generated.gradle | 30 - .../dataClasses/equals/build-generated.gradle | 26 - .../hashCode/build-generated.gradle | 54 - .../toString/build-generated.gradle | 30 - .../build-generated.gradle | 18 - .../defaultArguments/build-generated.gradle | 18 - .../constructor/build-generated.gradle | 54 - .../convention/build-generated.gradle | 14 - .../function/build-generated.gradle | 82 -- .../private/build-generated.gradle | 18 - .../signature/build-generated.gradle | 14 - .../delegatedProperty/build-generated.gradle | 150 -- .../local/build-generated.gradle | 50 - .../provideDelegate/build-generated.gradle | 62 - .../delegation/build-generated.gradle | 10 - .../build-generated.gradle | 34 - .../diagnostics/build-generated.gradle | 2 - .../functions/build-generated.gradle | 2 - .../inference/build-generated.gradle | 6 - .../functions/invoke/build-generated.gradle | 2 - .../invoke/onObjects/build-generated.gradle | 42 - .../tailRecursion/build-generated.gradle | 150 -- .../diagnostics/vararg/build-generated.gradle | 6 - .../blackbox/elvis/build-generated.gradle | 18 - .../blackbox/enum/build-generated.gradle | 110 -- .../blackbox/evaluate/build-generated.gradle | 62 - .../blackbox/exclExcl/build-generated.gradle | 10 - .../extensionFunctions/build-generated.gradle | 90 -- .../build-generated.gradle | 58 - .../blackbox/external/build-generated.gradle | 14 - .../fakeOverride/build-generated.gradle | 18 - .../fieldRename/build-generated.gradle | 14 - .../blackbox/finally/build-generated.gradle | 46 - .../blackbox/fullJdk/build-generated.gradle | 26 - .../fullJdk/native/build-generated.gradle | 14 - .../regressions/build-generated.gradle | 6 - .../blackbox/functions/build-generated.gradle | 174 --- .../functionExpression/build-generated.gradle | 18 - .../functions/invoke/build-generated.gradle | 62 - .../localFunctions/build-generated.gradle | 66 - .../blackbox/hashPMap/build-generated.gradle | 26 - .../blackbox/ieee754/build-generated.gradle | 78 -- .../blackbox/increment/build-generated.gradle | 90 -- .../innerNested/build-generated.gradle | 94 -- .../build-generated.gradle | 82 -- .../instructions/build-generated.gradle | 2 - .../instructions/swap/build-generated.gradle | 10 - .../intrinsics/build-generated.gradle | 78 -- .../javaInterop/build-generated.gradle | 6 - .../generics/build-generated.gradle | 14 - .../notNullAssertions/build-generated.gradle | 10 - .../objectMethods/build-generated.gradle | 26 - .../blackbox/jdk/build-generated.gradle | 18 - .../blackbox/jvmField/build-generated.gradle | 58 - .../blackbox/jvmName/build-generated.gradle | 46 - .../fileFacades/build-generated.gradle | 14 - .../jvmOverloads/build-generated.gradle | 58 - .../blackbox/jvmStatic/build-generated.gradle | 94 -- .../blackbox/labels/build-generated.gradle | 26 - .../lazyCodegen/build-generated.gradle | 38 - .../optimizations/build-generated.gradle | 38 - .../localClasses/build-generated.gradle | 110 -- .../blackbox/mangling/build-generated.gradle | 30 - .../blackbox/multiDecl/build-generated.gradle | 58 - .../forIterator/build-generated.gradle | 22 - .../longIterator/build-generated.gradle | 18 - .../multiDecl/forRange/build-generated.gradle | 30 - .../explicitRangeTo/build-generated.gradle | 22 - .../int/build-generated.gradle | 18 - .../long/build-generated.gradle | 18 - .../build-generated.gradle | 22 - .../int/build-generated.gradle | 18 - .../long/build-generated.gradle | 18 - .../forRange/int/build-generated.gradle | 18 - .../forRange/long/build-generated.gradle | 18 - .../multifileClasses/build-generated.gradle | 42 - .../optimized/build-generated.gradle | 58 - .../nonLocalReturns/build-generated.gradle | 18 - .../objectIntrinsics/build-generated.gradle | 6 - .../blackbox/objects/build-generated.gradle | 174 --- .../build-generated.gradle | 58 - .../compareTo/build-generated.gradle | 42 - .../blackbox/package/build-generated.gradle | 42 - .../platformTypes/build-generated.gradle | 2 - .../primitives/build-generated.gradle | 82 -- .../primitiveTypes/build-generated.gradle | 210 --- .../blackbox/private/build-generated.gradle | 10 - .../build-generated.gradle | 54 - .../properties/build-generated.gradle | 270 ---- .../properties/const/build-generated.gradle | 14 - .../lateinit/build-generated.gradle | 42 - .../publishedApi/build-generated.gradle | 14 - .../blackbox/ranges/build-generated.gradle | 26 - .../ranges/contains/build-generated.gradle | 50 - .../ranges/expression/build-generated.gradle | 114 -- .../ranges/forInDownTo/build-generated.gradle | 18 - .../forInIndices/build-generated.gradle | 62 - .../ranges/literal/build-generated.gradle | 114 -- .../build-generated.gradle | 14 - .../annotations/build-generated.gradle | 46 - .../reflection/build-generated.gradle | 2 - .../call/bound/build-generated.gradle | 54 - .../reflection/call/build-generated.gradle | 90 -- .../reflection/callBy/build-generated.gradle | 74 - .../classLiterals/build-generated.gradle | 30 - .../reflection/classes/build-generated.gradle | 50 - .../constructors/build-generated.gradle | 22 - .../createAnnotation/build-generated.gradle | 50 - .../enclosing/build-generated.gradle | 98 -- .../functions/build-generated.gradle | 46 - .../genericSignature/build-generated.gradle | 34 - .../isInstance/build-generated.gradle | 6 - .../kClassInAnnotation/build-generated.gradle | 30 - .../lambdaClasses/build-generated.gradle | 6 - .../reflection/mapping/build-generated.gradle | 46 - .../fakeOverrides/build-generated.gradle | 10 - .../mapping/jvmStatic/build-generated.gradle | 10 - .../mapping/types/build-generated.gradle | 66 - .../methodsFromAny/build-generated.gradle | 62 - .../modifiers/build-generated.gradle | 38 - .../multifileClasses/build-generated.gradle | 14 - .../noReflectAtRuntime/build-generated.gradle | 26 - .../methodsFromAny/build-generated.gradle | 10 - .../parameters/build-generated.gradle | 50 - .../accessors/build-generated.gradle | 22 - .../properties/build-generated.gradle | 118 -- .../specialBuiltIns/build-generated.gradle | 6 - .../supertypes/build-generated.gradle | 22 - .../typeParameters/build-generated.gradle | 14 - .../reflection/types/build-generated.gradle | 50 - .../types/createType/build-generated.gradle | 22 - .../types/subtyping/build-generated.gradle | 18 - .../regressions/build-generated.gradle | 278 ---- .../arraysReification/build-generated.gradle | 26 - .../blackbox/reified/build-generated.gradle | 118 -- .../blackbox/safeCall/build-generated.gradle | 38 - .../blackbox/sam/build-generated.gradle | 2 - .../sam/constructors/build-generated.gradle | 50 - .../blackbox/sealed/build-generated.gradle | 10 - .../build-generated.gradle | 126 -- .../blackbox/smap/build-generated.gradle | 14 - .../smartCasts/build-generated.gradle | 50 - .../specialBuiltins/build-generated.gradle | 82 -- .../blackbox/statics/build-generated.gradle | 66 - .../build-generated.gradle | 22 - .../blackbox/strings/build-generated.gradle | 66 - .../blackbox/super/build-generated.gradle | 114 -- .../synchronized/build-generated.gradle | 46 - .../syntheticAccessors/build-generated.gradle | 38 - .../blackbox/toArray/build-generated.gradle | 30 - .../topLevelPrivate/build-generated.gradle | 26 - .../blackbox/traits/build-generated.gradle | 114 -- .../blackbox/typeInfo/build-generated.gradle | 30 - .../typeMapping/build-generated.gradle | 42 - .../blackbox/typealias/build-generated.gradle | 54 - .../blackbox/unaryOp/build-generated.gradle | 26 - .../blackbox/unit/build-generated.gradle | 46 - .../blackbox/vararg/build-generated.gradle | 34 - .../blackbox/when/build-generated.gradle | 134 -- .../enumOptimization/build-generated.gradle | 46 - .../stringOptimization/build-generated.gradle | 26 - 209 files changed, 999 insertions(+), 11000 deletions(-) delete mode 100644 backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/external/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/package/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/private/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/super/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/when/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle delete mode 100644 backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle index 0b601eab88a..27965d406d2 100644 --- a/backend.native/tests/external/build.gradle +++ b/backend.native/tests/external/build.gradle @@ -8,212 +8,1003 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } +task codegen_blackbox_annotations (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/annotations" + logFileName = "codegen/blackbox/annotations/test-result.md" +} + +task codegen_blackbox_annotations_annotatedLambda (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/annotations/annotatedLambda" + logFileName = "codegen/blackbox/annotations/annotatedLambda/test-result.md" +} + +task codegen_blackbox_argumentOrder (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/argumentOrder" + logFileName = "codegen/blackbox/argumentOrder/test-result.md" +} + +task codegen_blackbox_arrays (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/arrays" + logFileName = "codegen/blackbox/arrays/test-result.md" +} + +task codegen_blackbox_arrays_multiDecl (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/arrays/multiDecl" + logFileName = "codegen/blackbox/arrays/multiDecl/test-result.md" +} + +task codegen_blackbox_arrays_multiDecl_int (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/arrays/multiDecl/int" + logFileName = "codegen/blackbox/arrays/multiDecl/int/test-result.md" +} + +task codegen_blackbox_arrays_multiDecl_long (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/arrays/multiDecl/long" + logFileName = "codegen/blackbox/arrays/multiDecl/long/test-result.md" +} + +task codegen_blackbox_binaryOp (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/binaryOp" + logFileName = "codegen/blackbox/binaryOp/test-result.md" +} + +task codegen_blackbox_boxingOptimization (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/boxingOptimization" + logFileName = "codegen/blackbox/boxingOptimization/test-result.md" +} + +task codegen_blackbox_bridges (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/bridges" + logFileName = "codegen/blackbox/bridges/test-result.md" +} + +task codegen_blackbox_bridges_substitutionInSuperClass (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/bridges/substitutionInSuperClass" + logFileName = "codegen/blackbox/bridges/substitutionInSuperClass/test-result.md" +} + +task codegen_blackbox_builtinStubMethods (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/builtinStubMethods" + logFileName = "codegen/blackbox/builtinStubMethods/test-result.md" +} + +task codegen_blackbox_builtinStubMethods_extendJavaCollections (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/builtinStubMethods/extendJavaCollections" + logFileName = "codegen/blackbox/builtinStubMethods/extendJavaCollections/test-result.md" +} + +task codegen_blackbox_callableReference_bound (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/callableReference/bound" + logFileName = "codegen/blackbox/callableReference/bound/test-result.md" +} + +task codegen_blackbox_callableReference_bound_equals (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/callableReference/bound/equals" + logFileName = "codegen/blackbox/callableReference/bound/equals/test-result.md" +} + +task codegen_blackbox_callableReference_bound_inline (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/callableReference/bound/inline" + logFileName = "codegen/blackbox/callableReference/bound/inline/test-result.md" +} + +task codegen_blackbox_callableReference_function (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/callableReference/function" + logFileName = "codegen/blackbox/callableReference/function/test-result.md" +} + +task codegen_blackbox_callableReference_function_local (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/callableReference/function/local" + logFileName = "codegen/blackbox/callableReference/function/local/test-result.md" +} + +task codegen_blackbox_callableReference_property (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/callableReference/property" + logFileName = "codegen/blackbox/callableReference/property/test-result.md" +} + +task codegen_blackbox_casts (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/casts" + logFileName = "codegen/blackbox/casts/test-result.md" +} + +task codegen_blackbox_casts_functions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/casts/functions" + logFileName = "codegen/blackbox/casts/functions/test-result.md" +} + +task codegen_blackbox_casts_literalExpressionAsGenericArgument (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/casts/literalExpressionAsGenericArgument" + logFileName = "codegen/blackbox/casts/literalExpressionAsGenericArgument/test-result.md" +} + +task codegen_blackbox_casts_mutableCollections (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/casts/mutableCollections" + logFileName = "codegen/blackbox/casts/mutableCollections/test-result.md" +} + +task codegen_blackbox_classes (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/classes" + logFileName = "codegen/blackbox/classes/test-result.md" +} + +task codegen_blackbox_classes_inner (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/classes/inner" + logFileName = "codegen/blackbox/classes/inner/test-result.md" +} + +task codegen_blackbox_classLiteral (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/classLiteral" + logFileName = "codegen/blackbox/classLiteral/test-result.md" +} + +task codegen_blackbox_classLiteral_bound (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/classLiteral/bound" + logFileName = "codegen/blackbox/classLiteral/bound/test-result.md" +} + +task codegen_blackbox_classLiteral_java (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/classLiteral/java" + logFileName = "codegen/blackbox/classLiteral/java/test-result.md" +} + +task codegen_blackbox_closures (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/closures" + logFileName = "codegen/blackbox/closures/test-result.md" +} + +task codegen_blackbox_closures_captureOuterProperty (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/closures/captureOuterProperty" + logFileName = "codegen/blackbox/closures/captureOuterProperty/test-result.md" +} + +task codegen_blackbox_closures_closureInsideClosure (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/closures/closureInsideClosure" + logFileName = "codegen/blackbox/closures/closureInsideClosure/test-result.md" +} + +task codegen_blackbox_collections (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/collections" + logFileName = "codegen/blackbox/collections/test-result.md" +} + +task codegen_blackbox_compatibility (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/compatibility" + logFileName = "codegen/blackbox/compatibility/test-result.md" +} + +task codegen_blackbox_constants (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/constants" + logFileName = "codegen/blackbox/constants/test-result.md" +} + +task codegen_blackbox_controlStructures (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/controlStructures" + logFileName = "codegen/blackbox/controlStructures/test-result.md" +} + +task codegen_blackbox_controlStructures_breakContinueInExpressions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/controlStructures/breakContinueInExpressions" + logFileName = "codegen/blackbox/controlStructures/breakContinueInExpressions/test-result.md" +} + +task codegen_blackbox_controlStructures_returnsNothing (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/controlStructures/returnsNothing" + logFileName = "codegen/blackbox/controlStructures/returnsNothing/test-result.md" +} + +task codegen_blackbox_controlStructures_tryCatchInExpressions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/controlStructures/tryCatchInExpressions" + logFileName = "codegen/blackbox/controlStructures/tryCatchInExpressions/test-result.md" +} + +task codegen_blackbox_coroutines (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines" + logFileName = "codegen/blackbox/coroutines/test-result.md" +} + +task codegen_blackbox_coroutines_controlFlow (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines/controlFlow" + logFileName = "codegen/blackbox/coroutines/controlFlow/test-result.md" +} + +task codegen_blackbox_coroutines_intLikeVarSpilling (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines/intLikeVarSpilling" + logFileName = "codegen/blackbox/coroutines/intLikeVarSpilling/test-result.md" +} + +task codegen_blackbox_coroutines_multiModule (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines/multiModule" + logFileName = "codegen/blackbox/coroutines/multiModule/test-result.md" +} + +task codegen_blackbox_coroutines_stackUnwinding (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines/stackUnwinding" + logFileName = "codegen/blackbox/coroutines/stackUnwinding/test-result.md" +} + +task codegen_blackbox_coroutines_suspendFunctionTypeCall (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines/suspendFunctionTypeCall" + logFileName = "codegen/blackbox/coroutines/suspendFunctionTypeCall/test-result.md" +} + +task codegen_blackbox_coroutines_unitTypeReturn (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/coroutines/unitTypeReturn" + logFileName = "codegen/blackbox/coroutines/unitTypeReturn/test-result.md" +} + +task codegen_blackbox_dataClasses (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/dataClasses" + logFileName = "codegen/blackbox/dataClasses/test-result.md" +} + +task codegen_blackbox_dataClasses_copy (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/dataClasses/copy" + logFileName = "codegen/blackbox/dataClasses/copy/test-result.md" +} + +task codegen_blackbox_dataClasses_equals (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/dataClasses/equals" + logFileName = "codegen/blackbox/dataClasses/equals/test-result.md" +} + +task codegen_blackbox_dataClasses_hashCode (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/dataClasses/hashCode" + logFileName = "codegen/blackbox/dataClasses/hashCode/test-result.md" +} + +task codegen_blackbox_dataClasses_toString (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/dataClasses/toString" + logFileName = "codegen/blackbox/dataClasses/toString/test-result.md" +} + +task codegen_blackbox_deadCodeElimination (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/deadCodeElimination" + logFileName = "codegen/blackbox/deadCodeElimination/test-result.md" +} + +task codegen_blackbox_defaultArguments (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/defaultArguments" + logFileName = "codegen/blackbox/defaultArguments/test-result.md" +} + +task codegen_blackbox_defaultArguments_constructor (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/defaultArguments/constructor" + logFileName = "codegen/blackbox/defaultArguments/constructor/test-result.md" +} + +task codegen_blackbox_defaultArguments_convention (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/defaultArguments/convention" + logFileName = "codegen/blackbox/defaultArguments/convention/test-result.md" +} + +task codegen_blackbox_defaultArguments_function (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/defaultArguments/function" + logFileName = "codegen/blackbox/defaultArguments/function/test-result.md" +} + +task codegen_blackbox_defaultArguments_private (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/defaultArguments/private" + logFileName = "codegen/blackbox/defaultArguments/private/test-result.md" +} + +task codegen_blackbox_defaultArguments_signature (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/defaultArguments/signature" + logFileName = "codegen/blackbox/defaultArguments/signature/test-result.md" +} + +task codegen_blackbox_delegatedProperty (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/delegatedProperty" + logFileName = "codegen/blackbox/delegatedProperty/test-result.md" +} + +task codegen_blackbox_delegatedProperty_local (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/delegatedProperty/local" + logFileName = "codegen/blackbox/delegatedProperty/local/test-result.md" +} + +task codegen_blackbox_delegatedProperty_provideDelegate (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/delegatedProperty/provideDelegate" + logFileName = "codegen/blackbox/delegatedProperty/provideDelegate/test-result.md" +} + +task codegen_blackbox_delegation (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/delegation" + logFileName = "codegen/blackbox/delegation/test-result.md" +} + +task codegen_blackbox_destructuringDeclInLambdaParam (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/destructuringDeclInLambdaParam" + logFileName = "codegen/blackbox/destructuringDeclInLambdaParam/test-result.md" +} + +task codegen_blackbox_diagnostics_functions_inference (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/diagnostics/functions/inference" + logFileName = "codegen/blackbox/diagnostics/functions/inference/test-result.md" +} + +task codegen_blackbox_diagnostics_functions_invoke_onObjects (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/diagnostics/functions/invoke/onObjects" + logFileName = "codegen/blackbox/diagnostics/functions/invoke/onObjects/test-result.md" +} + +task codegen_blackbox_diagnostics_functions_tailRecursion (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/diagnostics/functions/tailRecursion" + logFileName = "codegen/blackbox/diagnostics/functions/tailRecursion/test-result.md" +} + +task codegen_blackbox_diagnostics_vararg (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/diagnostics/vararg" + logFileName = "codegen/blackbox/diagnostics/vararg/test-result.md" +} + +task codegen_blackbox_elvis (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/elvis" + logFileName = "codegen/blackbox/elvis/test-result.md" +} + +task codegen_blackbox_enum (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/enum" + logFileName = "codegen/blackbox/enum/test-result.md" +} + +task codegen_blackbox_evaluate (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/evaluate" + logFileName = "codegen/blackbox/evaluate/test-result.md" +} + +task codegen_blackbox_exclExcl (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/exclExcl" + logFileName = "codegen/blackbox/exclExcl/test-result.md" +} + +task codegen_blackbox_extensionFunctions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/extensionFunctions" + logFileName = "codegen/blackbox/extensionFunctions/test-result.md" +} + +task codegen_blackbox_extensionProperties (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/extensionProperties" + logFileName = "codegen/blackbox/extensionProperties/test-result.md" +} + +task codegen_blackbox_external (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/external" + logFileName = "codegen/blackbox/external/test-result.md" +} + +task codegen_blackbox_fakeOverride (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/fakeOverride" + logFileName = "codegen/blackbox/fakeOverride/test-result.md" +} + +task codegen_blackbox_fieldRename (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/fieldRename" + logFileName = "codegen/blackbox/fieldRename/test-result.md" +} + +task codegen_blackbox_finally (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/finally" + logFileName = "codegen/blackbox/finally/test-result.md" +} + +task codegen_blackbox_fullJdk (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/fullJdk" + logFileName = "codegen/blackbox/fullJdk/test-result.md" +} + +task codegen_blackbox_fullJdk_native (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/fullJdk/native" + logFileName = "codegen/blackbox/fullJdk/native/test-result.md" +} + +task codegen_blackbox_fullJdk_regressions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/fullJdk/regressions" + logFileName = "codegen/blackbox/fullJdk/regressions/test-result.md" +} + +task codegen_blackbox_functions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/functions" + logFileName = "codegen/blackbox/functions/test-result.md" +} + +task codegen_blackbox_functions_functionExpression (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/functions/functionExpression" + logFileName = "codegen/blackbox/functions/functionExpression/test-result.md" +} + +task codegen_blackbox_functions_invoke (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/functions/invoke" + logFileName = "codegen/blackbox/functions/invoke/test-result.md" +} + +task codegen_blackbox_functions_localFunctions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/functions/localFunctions" + logFileName = "codegen/blackbox/functions/localFunctions/test-result.md" +} + +task codegen_blackbox_hashPMap (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/hashPMap" + logFileName = "codegen/blackbox/hashPMap/test-result.md" +} + +task codegen_blackbox_ieee754 (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ieee754" + logFileName = "codegen/blackbox/ieee754/test-result.md" +} + +task codegen_blackbox_increment (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/increment" + logFileName = "codegen/blackbox/increment/test-result.md" +} + +task codegen_blackbox_innerNested (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/innerNested" + logFileName = "codegen/blackbox/innerNested/test-result.md" +} + +task codegen_blackbox_innerNested_superConstructorCall (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/innerNested/superConstructorCall" + logFileName = "codegen/blackbox/innerNested/superConstructorCall/test-result.md" +} + +task codegen_blackbox_instructions_swap (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/instructions/swap" + logFileName = "codegen/blackbox/instructions/swap/test-result.md" +} + +task codegen_blackbox_intrinsics (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/intrinsics" + logFileName = "codegen/blackbox/intrinsics/test-result.md" +} + +task codegen_blackbox_javaInterop (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/javaInterop" + logFileName = "codegen/blackbox/javaInterop/test-result.md" +} + +task codegen_blackbox_javaInterop_generics (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/javaInterop/generics" + logFileName = "codegen/blackbox/javaInterop/generics/test-result.md" +} + +task codegen_blackbox_javaInterop_notNullAssertions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/javaInterop/notNullAssertions" + logFileName = "codegen/blackbox/javaInterop/notNullAssertions/test-result.md" +} + +task codegen_blackbox_javaInterop_objectMethods (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/javaInterop/objectMethods" + logFileName = "codegen/blackbox/javaInterop/objectMethods/test-result.md" +} + +task codegen_blackbox_jdk (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/jdk" + logFileName = "codegen/blackbox/jdk/test-result.md" +} + +task codegen_blackbox_jvmField (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/jvmField" + logFileName = "codegen/blackbox/jvmField/test-result.md" +} + +task codegen_blackbox_jvmName (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/jvmName" + logFileName = "codegen/blackbox/jvmName/test-result.md" +} + +task codegen_blackbox_jvmName_fileFacades (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/jvmName/fileFacades" + logFileName = "codegen/blackbox/jvmName/fileFacades/test-result.md" +} + +task codegen_blackbox_jvmOverloads (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/jvmOverloads" + logFileName = "codegen/blackbox/jvmOverloads/test-result.md" +} + +task codegen_blackbox_jvmStatic (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/jvmStatic" + logFileName = "codegen/blackbox/jvmStatic/test-result.md" +} + +task codegen_blackbox_labels (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/labels" + logFileName = "codegen/blackbox/labels/test-result.md" +} + +task codegen_blackbox_lazyCodegen (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/lazyCodegen" + logFileName = "codegen/blackbox/lazyCodegen/test-result.md" +} + +task codegen_blackbox_lazyCodegen_optimizations (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/lazyCodegen/optimizations" + logFileName = "codegen/blackbox/lazyCodegen/optimizations/test-result.md" +} + +task codegen_blackbox_localClasses (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/localClasses" + logFileName = "codegen/blackbox/localClasses/test-result.md" +} + +task codegen_blackbox_mangling (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/mangling" + logFileName = "codegen/blackbox/mangling/test-result.md" +} + +task codegen_blackbox_multiDecl (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl" + logFileName = "codegen/blackbox/multiDecl/test-result.md" +} + +task codegen_blackbox_multiDecl_forIterator (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forIterator" + logFileName = "codegen/blackbox/multiDecl/forIterator/test-result.md" +} + +task codegen_blackbox_multiDecl_forIterator_longIterator (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forIterator/longIterator" + logFileName = "codegen/blackbox/multiDecl/forIterator/longIterator/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange" + logFileName = "codegen/blackbox/multiDecl/forRange/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo" + logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int" + logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long" + logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot" + logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int" + logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long" + logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_int (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/int" + logFileName = "codegen/blackbox/multiDecl/forRange/int/test-result.md" +} + +task codegen_blackbox_multiDecl_forRange_long (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multiDecl/forRange/long" + logFileName = "codegen/blackbox/multiDecl/forRange/long/test-result.md" +} + +task codegen_blackbox_multifileClasses (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multifileClasses" + logFileName = "codegen/blackbox/multifileClasses/test-result.md" +} + +task codegen_blackbox_multifileClasses_optimized (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/multifileClasses/optimized" + logFileName = "codegen/blackbox/multifileClasses/optimized/test-result.md" +} + +task codegen_blackbox_nonLocalReturns (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/nonLocalReturns" + logFileName = "codegen/blackbox/nonLocalReturns/test-result.md" +} + +task codegen_blackbox_objectIntrinsics (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/objectIntrinsics" + logFileName = "codegen/blackbox/objectIntrinsics/test-result.md" +} + +task codegen_blackbox_objects (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/objects" + logFileName = "codegen/blackbox/objects/test-result.md" +} + +task codegen_blackbox_operatorConventions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/operatorConventions" + logFileName = "codegen/blackbox/operatorConventions/test-result.md" +} + +task codegen_blackbox_operatorConventions_compareTo (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/operatorConventions/compareTo" + logFileName = "codegen/blackbox/operatorConventions/compareTo/test-result.md" +} + +task codegen_blackbox_package (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/package" + logFileName = "codegen/blackbox/package/test-result.md" +} + +task codegen_blackbox_platformTypes_primitives (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/platformTypes/primitives" + logFileName = "codegen/blackbox/platformTypes/primitives/test-result.md" +} + +task codegen_blackbox_primitiveTypes (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/primitiveTypes" + logFileName = "codegen/blackbox/primitiveTypes/test-result.md" +} + +task codegen_blackbox_private (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/private" + logFileName = "codegen/blackbox/private/test-result.md" +} + +task codegen_blackbox_privateConstructors (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/privateConstructors" + logFileName = "codegen/blackbox/privateConstructors/test-result.md" +} + +task codegen_blackbox_properties (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/properties" + logFileName = "codegen/blackbox/properties/test-result.md" +} + +task codegen_blackbox_properties_const (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/properties/const" + logFileName = "codegen/blackbox/properties/const/test-result.md" +} + +task codegen_blackbox_properties_lateinit (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/properties/lateinit" + logFileName = "codegen/blackbox/properties/lateinit/test-result.md" +} + +task codegen_blackbox_publishedApi (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/publishedApi" + logFileName = "codegen/blackbox/publishedApi/test-result.md" +} + +task codegen_blackbox_ranges (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges" + logFileName = "codegen/blackbox/ranges/test-result.md" +} + +task codegen_blackbox_ranges_contains (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges/contains" + logFileName = "codegen/blackbox/ranges/contains/test-result.md" +} + +task codegen_blackbox_ranges_expression (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges/expression" + logFileName = "codegen/blackbox/ranges/expression/test-result.md" +} + +task codegen_blackbox_ranges_forInDownTo (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges/forInDownTo" + logFileName = "codegen/blackbox/ranges/forInDownTo/test-result.md" +} + +task codegen_blackbox_ranges_forInIndices (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges/forInIndices" + logFileName = "codegen/blackbox/ranges/forInIndices/test-result.md" +} + +task codegen_blackbox_ranges_literal (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges/literal" + logFileName = "codegen/blackbox/ranges/literal/test-result.md" +} + +task codegen_blackbox_ranges_nullableLoopParameter (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/ranges/nullableLoopParameter" + logFileName = "codegen/blackbox/ranges/nullableLoopParameter/test-result.md" +} + +task codegen_blackbox_reflection_annotations (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/annotations" + logFileName = "codegen/blackbox/reflection/annotations/test-result.md" +} + +task codegen_blackbox_reflection_call (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/call" + logFileName = "codegen/blackbox/reflection/call/test-result.md" +} + +task codegen_blackbox_reflection_call_bound (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/call/bound" + logFileName = "codegen/blackbox/reflection/call/bound/test-result.md" +} + +task codegen_blackbox_reflection_callBy (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/callBy" + logFileName = "codegen/blackbox/reflection/callBy/test-result.md" +} + +task codegen_blackbox_reflection_classes (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/classes" + logFileName = "codegen/blackbox/reflection/classes/test-result.md" +} + +task codegen_blackbox_reflection_classLiterals (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/classLiterals" + logFileName = "codegen/blackbox/reflection/classLiterals/test-result.md" +} + +task codegen_blackbox_reflection_constructors (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/constructors" + logFileName = "codegen/blackbox/reflection/constructors/test-result.md" +} + +task codegen_blackbox_reflection_createAnnotation (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/createAnnotation" + logFileName = "codegen/blackbox/reflection/createAnnotation/test-result.md" +} + +task codegen_blackbox_reflection_enclosing (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/enclosing" + logFileName = "codegen/blackbox/reflection/enclosing/test-result.md" +} + +task codegen_blackbox_reflection_functions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/functions" + logFileName = "codegen/blackbox/reflection/functions/test-result.md" +} + +task codegen_blackbox_reflection_genericSignature (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/genericSignature" + logFileName = "codegen/blackbox/reflection/genericSignature/test-result.md" +} + +task codegen_blackbox_reflection_isInstance (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/isInstance" + logFileName = "codegen/blackbox/reflection/isInstance/test-result.md" +} + +task codegen_blackbox_reflection_kClassInAnnotation (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/kClassInAnnotation" + logFileName = "codegen/blackbox/reflection/kClassInAnnotation/test-result.md" +} + +task codegen_blackbox_reflection_lambdaClasses (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/lambdaClasses" + logFileName = "codegen/blackbox/reflection/lambdaClasses/test-result.md" +} + +task codegen_blackbox_reflection_mapping (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/mapping" + logFileName = "codegen/blackbox/reflection/mapping/test-result.md" +} + +task codegen_blackbox_reflection_mapping_fakeOverrides (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/mapping/fakeOverrides" + logFileName = "codegen/blackbox/reflection/mapping/fakeOverrides/test-result.md" +} + +task codegen_blackbox_reflection_mapping_jvmStatic (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/mapping/jvmStatic" + logFileName = "codegen/blackbox/reflection/mapping/jvmStatic/test-result.md" +} + +task codegen_blackbox_reflection_mapping_types (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/mapping/types" + logFileName = "codegen/blackbox/reflection/mapping/types/test-result.md" +} + +task codegen_blackbox_reflection_methodsFromAny (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/methodsFromAny" + logFileName = "codegen/blackbox/reflection/methodsFromAny/test-result.md" +} + +task codegen_blackbox_reflection_modifiers (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/modifiers" + logFileName = "codegen/blackbox/reflection/modifiers/test-result.md" +} + +task codegen_blackbox_reflection_multifileClasses (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/multifileClasses" + logFileName = "codegen/blackbox/reflection/multifileClasses/test-result.md" +} + +task codegen_blackbox_reflection_noReflectAtRuntime (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime" + logFileName = "codegen/blackbox/reflection/noReflectAtRuntime/test-result.md" +} + +task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny" + logFileName = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/test-result.md" +} + +task codegen_blackbox_reflection_parameters (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/parameters" + logFileName = "codegen/blackbox/reflection/parameters/test-result.md" +} + +task codegen_blackbox_reflection_properties (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/properties" + logFileName = "codegen/blackbox/reflection/properties/test-result.md" +} + +task codegen_blackbox_reflection_properties_accessors (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/properties/accessors" + logFileName = "codegen/blackbox/reflection/properties/accessors/test-result.md" +} + +task codegen_blackbox_reflection_specialBuiltIns (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/specialBuiltIns" + logFileName = "codegen/blackbox/reflection/specialBuiltIns/test-result.md" +} + +task codegen_blackbox_reflection_supertypes (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/supertypes" + logFileName = "codegen/blackbox/reflection/supertypes/test-result.md" +} + +task codegen_blackbox_reflection_typeParameters (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/typeParameters" + logFileName = "codegen/blackbox/reflection/typeParameters/test-result.md" +} + +task codegen_blackbox_reflection_types (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/types" + logFileName = "codegen/blackbox/reflection/types/test-result.md" +} + +task codegen_blackbox_reflection_types_createType (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/types/createType" + logFileName = "codegen/blackbox/reflection/types/createType/test-result.md" +} + +task codegen_blackbox_reflection_types_subtyping (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reflection/types/subtyping" + logFileName = "codegen/blackbox/reflection/types/subtyping/test-result.md" +} + +task codegen_blackbox_regressions (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/regressions" + logFileName = "codegen/blackbox/regressions/test-result.md" +} + +task codegen_blackbox_reified (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reified" + logFileName = "codegen/blackbox/reified/test-result.md" +} + +task codegen_blackbox_reified_arraysReification (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/reified/arraysReification" + logFileName = "codegen/blackbox/reified/arraysReification/test-result.md" +} + +task codegen_blackbox_safeCall (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/safeCall" + logFileName = "codegen/blackbox/safeCall/test-result.md" +} + +task codegen_blackbox_sam_constructors (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/sam/constructors" + logFileName = "codegen/blackbox/sam/constructors/test-result.md" +} + +task codegen_blackbox_sealed (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/sealed" + logFileName = "codegen/blackbox/sealed/test-result.md" +} + +task codegen_blackbox_secondaryConstructors (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/secondaryConstructors" + logFileName = "codegen/blackbox/secondaryConstructors/test-result.md" +} + +task codegen_blackbox_smap (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/smap" + logFileName = "codegen/blackbox/smap/test-result.md" +} + +task codegen_blackbox_smartCasts (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/smartCasts" + logFileName = "codegen/blackbox/smartCasts/test-result.md" +} + +task codegen_blackbox_specialBuiltins (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/specialBuiltins" + logFileName = "codegen/blackbox/specialBuiltins/test-result.md" +} + +task codegen_blackbox_statics (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/statics" + logFileName = "codegen/blackbox/statics/test-result.md" +} + +task codegen_blackbox_storeStackBeforeInline (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/storeStackBeforeInline" + logFileName = "codegen/blackbox/storeStackBeforeInline/test-result.md" +} + +task codegen_blackbox_strings (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/strings" + logFileName = "codegen/blackbox/strings/test-result.md" +} + +task codegen_blackbox_super (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/super" + logFileName = "codegen/blackbox/super/test-result.md" +} + +task codegen_blackbox_synchronized (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/synchronized" + logFileName = "codegen/blackbox/synchronized/test-result.md" +} + +task codegen_blackbox_syntheticAccessors (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/syntheticAccessors" + logFileName = "codegen/blackbox/syntheticAccessors/test-result.md" +} + +task codegen_blackbox_toArray (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/toArray" + logFileName = "codegen/blackbox/toArray/test-result.md" +} + +task codegen_blackbox_topLevelPrivate (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/topLevelPrivate" + logFileName = "codegen/blackbox/topLevelPrivate/test-result.md" +} + +task codegen_blackbox_traits (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/traits" + logFileName = "codegen/blackbox/traits/test-result.md" +} + +task codegen_blackbox_typealias (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/typealias" + logFileName = "codegen/blackbox/typealias/test-result.md" +} + +task codegen_blackbox_typeInfo (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/typeInfo" + logFileName = "codegen/blackbox/typeInfo/test-result.md" +} + +task codegen_blackbox_typeMapping (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/typeMapping" + logFileName = "codegen/blackbox/typeMapping/test-result.md" +} + +task codegen_blackbox_unaryOp (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/unaryOp" + logFileName = "codegen/blackbox/unaryOp/test-result.md" +} + +task codegen_blackbox_unit (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/unit" + logFileName = "codegen/blackbox/unit/test-result.md" +} + +task codegen_blackbox_vararg (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/vararg" + logFileName = "codegen/blackbox/vararg/test-result.md" +} + +task codegen_blackbox_when (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/when" + logFileName = "codegen/blackbox/when/test-result.md" +} + +task codegen_blackbox_when_enumOptimization (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/when/enumOptimization" + logFileName = "codegen/blackbox/when/enumOptimization/test-result.md" +} + +task codegen_blackbox_when_stringOptimization (type: RunExternalTestGroup) { + groupDirectory = "codegen/blackbox/when/stringOptimization" + logFileName = "codegen/blackbox/when/stringOptimization/test-result.md" +} -apply from: "codegen/blackbox/annotations/build-generated.gradle" -apply from: "codegen/blackbox/annotations/annotatedLambda/build-generated.gradle" -apply from: "codegen/blackbox/argumentOrder/build-generated.gradle" -apply from: "codegen/blackbox/arrays/build-generated.gradle" -apply from: "codegen/blackbox/arrays/multiDecl/build-generated.gradle" -apply from: "codegen/blackbox/arrays/multiDecl/int/build-generated.gradle" -apply from: "codegen/blackbox/arrays/multiDecl/long/build-generated.gradle" -apply from: "codegen/blackbox/binaryOp/build-generated.gradle" -apply from: "codegen/blackbox/boxingOptimization/build-generated.gradle" -apply from: "codegen/blackbox/bridges/build-generated.gradle" -apply from: "codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle" -apply from: "codegen/blackbox/builtinStubMethods/build-generated.gradle" -apply from: "codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/bound/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/bound/equals/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/bound/inline/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/function/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/function/local/build-generated.gradle" -apply from: "codegen/blackbox/callableReference/property/build-generated.gradle" -apply from: "codegen/blackbox/casts/build-generated.gradle" -apply from: "codegen/blackbox/casts/functions/build-generated.gradle" -apply from: "codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle" -apply from: "codegen/blackbox/casts/mutableCollections/build-generated.gradle" -apply from: "codegen/blackbox/classes/build-generated.gradle" -apply from: "codegen/blackbox/classes/inner/build-generated.gradle" -apply from: "codegen/blackbox/classLiteral/build-generated.gradle" -apply from: "codegen/blackbox/classLiteral/bound/build-generated.gradle" -apply from: "codegen/blackbox/classLiteral/java/build-generated.gradle" -apply from: "codegen/blackbox/closures/build-generated.gradle" -apply from: "codegen/blackbox/closures/captureOuterProperty/build-generated.gradle" -apply from: "codegen/blackbox/closures/closureInsideClosure/build-generated.gradle" -apply from: "codegen/blackbox/collections/build-generated.gradle" -apply from: "codegen/blackbox/compatibility/build-generated.gradle" -apply from: "codegen/blackbox/constants/build-generated.gradle" -apply from: "codegen/blackbox/controlStructures/build-generated.gradle" -apply from: "codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle" -apply from: "codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle" -apply from: "codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/controlFlow/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/multiModule/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle" -apply from: "codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle" -apply from: "codegen/blackbox/dataClasses/build-generated.gradle" -apply from: "codegen/blackbox/dataClasses/copy/build-generated.gradle" -apply from: "codegen/blackbox/dataClasses/equals/build-generated.gradle" -apply from: "codegen/blackbox/dataClasses/hashCode/build-generated.gradle" -apply from: "codegen/blackbox/dataClasses/toString/build-generated.gradle" -apply from: "codegen/blackbox/deadCodeElimination/build-generated.gradle" -apply from: "codegen/blackbox/defaultArguments/build-generated.gradle" -apply from: "codegen/blackbox/defaultArguments/constructor/build-generated.gradle" -apply from: "codegen/blackbox/defaultArguments/convention/build-generated.gradle" -apply from: "codegen/blackbox/defaultArguments/function/build-generated.gradle" -apply from: "codegen/blackbox/defaultArguments/private/build-generated.gradle" -apply from: "codegen/blackbox/defaultArguments/signature/build-generated.gradle" -apply from: "codegen/blackbox/delegatedProperty/build-generated.gradle" -apply from: "codegen/blackbox/delegatedProperty/local/build-generated.gradle" -apply from: "codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle" -apply from: "codegen/blackbox/delegation/build-generated.gradle" -apply from: "codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/functions/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/functions/inference/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle" -apply from: "codegen/blackbox/diagnostics/vararg/build-generated.gradle" -apply from: "codegen/blackbox/elvis/build-generated.gradle" -apply from: "codegen/blackbox/enum/build-generated.gradle" -apply from: "codegen/blackbox/evaluate/build-generated.gradle" -apply from: "codegen/blackbox/exclExcl/build-generated.gradle" -apply from: "codegen/blackbox/extensionFunctions/build-generated.gradle" -apply from: "codegen/blackbox/extensionProperties/build-generated.gradle" -apply from: "codegen/blackbox/external/build-generated.gradle" -apply from: "codegen/blackbox/fakeOverride/build-generated.gradle" -apply from: "codegen/blackbox/fieldRename/build-generated.gradle" -apply from: "codegen/blackbox/finally/build-generated.gradle" -apply from: "codegen/blackbox/fullJdk/build-generated.gradle" -apply from: "codegen/blackbox/fullJdk/native/build-generated.gradle" -apply from: "codegen/blackbox/fullJdk/regressions/build-generated.gradle" -apply from: "codegen/blackbox/functions/build-generated.gradle" -apply from: "codegen/blackbox/functions/functionExpression/build-generated.gradle" -apply from: "codegen/blackbox/functions/invoke/build-generated.gradle" -apply from: "codegen/blackbox/functions/localFunctions/build-generated.gradle" -apply from: "codegen/blackbox/hashPMap/build-generated.gradle" -apply from: "codegen/blackbox/ieee754/build-generated.gradle" -apply from: "codegen/blackbox/increment/build-generated.gradle" -apply from: "codegen/blackbox/innerNested/build-generated.gradle" -apply from: "codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle" -apply from: "codegen/blackbox/instructions/build-generated.gradle" -apply from: "codegen/blackbox/instructions/swap/build-generated.gradle" -apply from: "codegen/blackbox/intrinsics/build-generated.gradle" -apply from: "codegen/blackbox/javaInterop/build-generated.gradle" -apply from: "codegen/blackbox/javaInterop/generics/build-generated.gradle" -apply from: "codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle" -apply from: "codegen/blackbox/javaInterop/objectMethods/build-generated.gradle" -apply from: "codegen/blackbox/jdk/build-generated.gradle" -apply from: "codegen/blackbox/jvmField/build-generated.gradle" -apply from: "codegen/blackbox/jvmName/build-generated.gradle" -apply from: "codegen/blackbox/jvmName/fileFacades/build-generated.gradle" -apply from: "codegen/blackbox/jvmOverloads/build-generated.gradle" -apply from: "codegen/blackbox/jvmStatic/build-generated.gradle" -apply from: "codegen/blackbox/labels/build-generated.gradle" -apply from: "codegen/blackbox/lazyCodegen/build-generated.gradle" -apply from: "codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle" -apply from: "codegen/blackbox/localClasses/build-generated.gradle" -apply from: "codegen/blackbox/mangling/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forIterator/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/int/build-generated.gradle" -apply from: "codegen/blackbox/multiDecl/forRange/long/build-generated.gradle" -apply from: "codegen/blackbox/multifileClasses/build-generated.gradle" -apply from: "codegen/blackbox/multifileClasses/optimized/build-generated.gradle" -apply from: "codegen/blackbox/nonLocalReturns/build-generated.gradle" -apply from: "codegen/blackbox/objectIntrinsics/build-generated.gradle" -apply from: "codegen/blackbox/objects/build-generated.gradle" -apply from: "codegen/blackbox/operatorConventions/build-generated.gradle" -apply from: "codegen/blackbox/operatorConventions/compareTo/build-generated.gradle" -apply from: "codegen/blackbox/package/build-generated.gradle" -apply from: "codegen/blackbox/platformTypes/build-generated.gradle" -apply from: "codegen/blackbox/platformTypes/primitives/build-generated.gradle" -apply from: "codegen/blackbox/primitiveTypes/build-generated.gradle" -apply from: "codegen/blackbox/private/build-generated.gradle" -apply from: "codegen/blackbox/privateConstructors/build-generated.gradle" -apply from: "codegen/blackbox/properties/build-generated.gradle" -apply from: "codegen/blackbox/properties/const/build-generated.gradle" -apply from: "codegen/blackbox/properties/lateinit/build-generated.gradle" -apply from: "codegen/blackbox/publishedApi/build-generated.gradle" -apply from: "codegen/blackbox/ranges/build-generated.gradle" -apply from: "codegen/blackbox/ranges/contains/build-generated.gradle" -apply from: "codegen/blackbox/ranges/expression/build-generated.gradle" -apply from: "codegen/blackbox/ranges/forInDownTo/build-generated.gradle" -apply from: "codegen/blackbox/ranges/forInIndices/build-generated.gradle" -apply from: "codegen/blackbox/ranges/literal/build-generated.gradle" -apply from: "codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle" -apply from: "codegen/blackbox/reflection/build-generated.gradle" -apply from: "codegen/blackbox/reflection/annotations/build-generated.gradle" -apply from: "codegen/blackbox/reflection/call/build-generated.gradle" -apply from: "codegen/blackbox/reflection/call/bound/build-generated.gradle" -apply from: "codegen/blackbox/reflection/callBy/build-generated.gradle" -apply from: "codegen/blackbox/reflection/classes/build-generated.gradle" -apply from: "codegen/blackbox/reflection/classLiterals/build-generated.gradle" -apply from: "codegen/blackbox/reflection/constructors/build-generated.gradle" -apply from: "codegen/blackbox/reflection/createAnnotation/build-generated.gradle" -apply from: "codegen/blackbox/reflection/enclosing/build-generated.gradle" -apply from: "codegen/blackbox/reflection/functions/build-generated.gradle" -apply from: "codegen/blackbox/reflection/genericSignature/build-generated.gradle" -apply from: "codegen/blackbox/reflection/isInstance/build-generated.gradle" -apply from: "codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle" -apply from: "codegen/blackbox/reflection/lambdaClasses/build-generated.gradle" -apply from: "codegen/blackbox/reflection/mapping/build-generated.gradle" -apply from: "codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle" -apply from: "codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle" -apply from: "codegen/blackbox/reflection/mapping/types/build-generated.gradle" -apply from: "codegen/blackbox/reflection/methodsFromAny/build-generated.gradle" -apply from: "codegen/blackbox/reflection/modifiers/build-generated.gradle" -apply from: "codegen/blackbox/reflection/multifileClasses/build-generated.gradle" -apply from: "codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle" -apply from: "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle" -apply from: "codegen/blackbox/reflection/parameters/build-generated.gradle" -apply from: "codegen/blackbox/reflection/properties/build-generated.gradle" -apply from: "codegen/blackbox/reflection/properties/accessors/build-generated.gradle" -apply from: "codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle" -apply from: "codegen/blackbox/reflection/supertypes/build-generated.gradle" -apply from: "codegen/blackbox/reflection/typeParameters/build-generated.gradle" -apply from: "codegen/blackbox/reflection/types/build-generated.gradle" -apply from: "codegen/blackbox/reflection/types/createType/build-generated.gradle" -apply from: "codegen/blackbox/reflection/types/subtyping/build-generated.gradle" -apply from: "codegen/blackbox/regressions/build-generated.gradle" -apply from: "codegen/blackbox/reified/build-generated.gradle" -apply from: "codegen/blackbox/reified/arraysReification/build-generated.gradle" -apply from: "codegen/blackbox/safeCall/build-generated.gradle" -apply from: "codegen/blackbox/sam/build-generated.gradle" -apply from: "codegen/blackbox/sam/constructors/build-generated.gradle" -apply from: "codegen/blackbox/sealed/build-generated.gradle" -apply from: "codegen/blackbox/secondaryConstructors/build-generated.gradle" -apply from: "codegen/blackbox/smap/build-generated.gradle" -apply from: "codegen/blackbox/smartCasts/build-generated.gradle" -apply from: "codegen/blackbox/specialBuiltins/build-generated.gradle" -apply from: "codegen/blackbox/statics/build-generated.gradle" -apply from: "codegen/blackbox/storeStackBeforeInline/build-generated.gradle" -apply from: "codegen/blackbox/strings/build-generated.gradle" -apply from: "codegen/blackbox/super/build-generated.gradle" -apply from: "codegen/blackbox/synchronized/build-generated.gradle" -apply from: "codegen/blackbox/syntheticAccessors/build-generated.gradle" -apply from: "codegen/blackbox/toArray/build-generated.gradle" -apply from: "codegen/blackbox/topLevelPrivate/build-generated.gradle" -apply from: "codegen/blackbox/traits/build-generated.gradle" -apply from: "codegen/blackbox/typealias/build-generated.gradle" -apply from: "codegen/blackbox/typeInfo/build-generated.gradle" -apply from: "codegen/blackbox/typeMapping/build-generated.gradle" -apply from: "codegen/blackbox/unaryOp/build-generated.gradle" -apply from: "codegen/blackbox/unit/build-generated.gradle" -apply from: "codegen/blackbox/vararg/build-generated.gradle" -apply from: "codegen/blackbox/when/build-generated.gradle" -apply from: "codegen/blackbox/when/enumOptimization/build-generated.gradle" -apply from: "codegen/blackbox/when/stringOptimization/build-generated.gradle" \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle deleted file mode 100644 index 56a21e90c91..00000000000 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_annotations_annotatedLambda_funExpression (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotatedLambda/funExpression.kt" -} - -task codegen_blackbox_annotations_annotatedLambda_lambda (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotatedLambda/lambda.kt" -} - -task codegen_blackbox_annotations_annotatedLambda_samFunExpression (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt" -} - -task codegen_blackbox_annotations_annotatedLambda_samLambda (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotatedLambda/samLambda.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle deleted file mode 100644 index eceae97d5c4..00000000000 --- a/backend.native/tests/external/codegen/blackbox/annotations/build-generated.gradle +++ /dev/null @@ -1,74 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_annotations_annotatedEnumEntry (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotatedEnumEntry.kt" -} - -task codegen_blackbox_annotations_annotatedObjectLiteral (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotatedObjectLiteral.kt" -} - -task codegen_blackbox_annotations_annotationsOnDefault (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotationsOnDefault.kt" -} - -task codegen_blackbox_annotations_annotationsOnTypeAliases (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotationsOnTypeAliases.kt" -} - -task codegen_blackbox_annotations_annotationWithKotlinProperty (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotationWithKotlinProperty.kt" -} - -task codegen_blackbox_annotations_annotationWithKotlinPropertyFromInterfaceCompanion (type: RunExternalTest) { - source = "codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt" -} - -task codegen_blackbox_annotations_defaultParameterValues (type: RunExternalTest) { - source = "codegen/blackbox/annotations/defaultParameterValues.kt" -} - -task codegen_blackbox_annotations_delegatedPropertySetter (type: RunExternalTest) { - source = "codegen/blackbox/annotations/delegatedPropertySetter.kt" -} - -task codegen_blackbox_annotations_fileClassWithFileAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/annotations/fileClassWithFileAnnotation.kt" -} - -task codegen_blackbox_annotations_jvmAnnotationFlags (type: RunExternalTest) { - source = "codegen/blackbox/annotations/jvmAnnotationFlags.kt" -} - -task codegen_blackbox_annotations_kotlinPropertyFromClassObjectAsParameter (type: RunExternalTest) { - source = "codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt" -} - -task codegen_blackbox_annotations_kotlinTopLevelPropertyAsParameter (type: RunExternalTest) { - source = "codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt" -} - -task codegen_blackbox_annotations_kt10136 (type: RunExternalTest) { - source = "codegen/blackbox/annotations/kt10136.kt" -} - -task codegen_blackbox_annotations_nestedClassPropertyAsParameter (type: RunExternalTest) { - source = "codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt" -} - -task codegen_blackbox_annotations_parameterWithPrimitiveType (type: RunExternalTest) { - source = "codegen/blackbox/annotations/parameterWithPrimitiveType.kt" -} - -task codegen_blackbox_annotations_propertyWithPropertyInInitializerAsParameter (type: RunExternalTest) { - source = "codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt" -} - -task codegen_blackbox_annotations_resolveWithLowPriorityAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/annotations/resolveWithLowPriorityAnnotation.kt" -} - -task codegen_blackbox_annotations_varargInAnnotationParameter (type: RunExternalTest) { - source = "codegen/blackbox/annotations/varargInAnnotationParameter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle deleted file mode 100644 index c15f184f81a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_argumentOrder_arguments (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/arguments.kt" -} - -task codegen_blackbox_argumentOrder_captured (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/captured.kt" -} - -task codegen_blackbox_argumentOrder_capturedInExtension (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/capturedInExtension.kt" -} - -task codegen_blackbox_argumentOrder_defaults (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/defaults.kt" -} - -task codegen_blackbox_argumentOrder_extension (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/extension.kt" -} - -task codegen_blackbox_argumentOrder_extensionInClass (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/extensionInClass.kt" -} - -task codegen_blackbox_argumentOrder_kt9277 (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/kt9277.kt" -} - -task codegen_blackbox_argumentOrder_lambdaMigration (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/lambdaMigration.kt" -} - -task codegen_blackbox_argumentOrder_lambdaMigrationInClass (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/lambdaMigrationInClass.kt" -} - -task codegen_blackbox_argumentOrder_simple (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/simple.kt" -} - -task codegen_blackbox_argumentOrder_simpleInClass (type: RunExternalTest) { - source = "codegen/blackbox/argumentOrder/simpleInClass.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle deleted file mode 100644 index ed92b77b47d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/arrays/build-generated.gradle +++ /dev/null @@ -1,230 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_arrays_arrayConstructorsSimple (type: RunExternalTest) { - source = "codegen/blackbox/arrays/arrayConstructorsSimple.kt" -} - -task codegen_blackbox_arrays_arrayGetAssignMultiIndex (type: RunExternalTest) { - source = "codegen/blackbox/arrays/arrayGetAssignMultiIndex.kt" -} - -task codegen_blackbox_arrays_arrayGetMultiIndex (type: RunExternalTest) { - source = "codegen/blackbox/arrays/arrayGetMultiIndex.kt" -} - -task codegen_blackbox_arrays_arrayInstanceOf (type: RunExternalTest) { - source = "codegen/blackbox/arrays/arrayInstanceOf.kt" -} - -task codegen_blackbox_arrays_arrayPlusAssign (type: RunExternalTest) { - source = "codegen/blackbox/arrays/arrayPlusAssign.kt" -} - -task codegen_blackbox_arrays_arraysAreCloneable (type: RunExternalTest) { - source = "codegen/blackbox/arrays/arraysAreCloneable.kt" -} - -task codegen_blackbox_arrays_cloneArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/cloneArray.kt" -} - -task codegen_blackbox_arrays_clonePrimitiveArrays (type: RunExternalTest) { - source = "codegen/blackbox/arrays/clonePrimitiveArrays.kt" -} - -task codegen_blackbox_arrays_collectionAssignGetMultiIndex (type: RunExternalTest) { - source = "codegen/blackbox/arrays/collectionAssignGetMultiIndex.kt" -} - -task codegen_blackbox_arrays_collectionGetMultiIndex (type: RunExternalTest) { - source = "codegen/blackbox/arrays/collectionGetMultiIndex.kt" -} - -task codegen_blackbox_arrays_forEachBooleanArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachBooleanArray.kt" -} - -task codegen_blackbox_arrays_forEachByteArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachByteArray.kt" -} - -task codegen_blackbox_arrays_forEachCharArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachCharArray.kt" -} - -task codegen_blackbox_arrays_forEachDoubleArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachDoubleArray.kt" -} - -task codegen_blackbox_arrays_forEachFloatArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachFloatArray.kt" -} - -task codegen_blackbox_arrays_forEachIntArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachIntArray.kt" -} - -task codegen_blackbox_arrays_forEachLongArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachLongArray.kt" -} - -task codegen_blackbox_arrays_forEachShortArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/forEachShortArray.kt" -} - -task codegen_blackbox_arrays_hashMap (type: RunExternalTest) { - source = "codegen/blackbox/arrays/hashMap.kt" -} - -task codegen_blackbox_arrays_indices (type: RunExternalTest) { - source = "codegen/blackbox/arrays/indices.kt" -} - -task codegen_blackbox_arrays_indicesChar (type: RunExternalTest) { - source = "codegen/blackbox/arrays/indicesChar.kt" -} - -task codegen_blackbox_arrays_inProjectionAsParameter (type: RunExternalTest) { - source = "codegen/blackbox/arrays/inProjectionAsParameter.kt" -} - -task codegen_blackbox_arrays_inProjectionOfArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/inProjectionOfArray.kt" -} - -task codegen_blackbox_arrays_inProjectionOfList (type: RunExternalTest) { - source = "codegen/blackbox/arrays/inProjectionOfList.kt" -} - -task codegen_blackbox_arrays_iterator (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iterator.kt" -} - -task codegen_blackbox_arrays_iteratorBooleanArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorBooleanArray.kt" -} - -task codegen_blackbox_arrays_iteratorByteArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorByteArray.kt" -} - -task codegen_blackbox_arrays_iteratorByteArrayNextByte (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorByteArrayNextByte.kt" -} - -task codegen_blackbox_arrays_iteratorCharArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorCharArray.kt" -} - -task codegen_blackbox_arrays_iteratorDoubleArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorDoubleArray.kt" -} - -task codegen_blackbox_arrays_iteratorFloatArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorFloatArray.kt" -} - -task codegen_blackbox_arrays_iteratorIntArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorIntArray.kt" -} - -task codegen_blackbox_arrays_iteratorLongArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorLongArray.kt" -} - -task codegen_blackbox_arrays_iteratorLongArrayNextLong (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorLongArrayNextLong.kt" -} - -task codegen_blackbox_arrays_iteratorShortArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/iteratorShortArray.kt" -} - -task codegen_blackbox_arrays_kt1291 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt1291.kt" -} - -task codegen_blackbox_arrays_kt238 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt238.kt" -} - -task codegen_blackbox_arrays_kt2997 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt2997.kt" -} - -task codegen_blackbox_arrays_kt33 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt33.kt" -} - -task codegen_blackbox_arrays_kt3771 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt3771.kt" -} - -task codegen_blackbox_arrays_kt4118 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt4118.kt" -} - -task codegen_blackbox_arrays_kt4348 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt4348.kt" -} - -task codegen_blackbox_arrays_kt4357 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt4357.kt" -} - -task codegen_blackbox_arrays_kt503 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt503.kt" -} - -task codegen_blackbox_arrays_kt594 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt594.kt" -} - -task codegen_blackbox_arrays_kt602 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt602.kt" -} - -task codegen_blackbox_arrays_kt7009 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt7009.kt" -} - -task codegen_blackbox_arrays_kt7288 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt7288.kt" -} - -task codegen_blackbox_arrays_kt7338 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt7338.kt" -} - -task codegen_blackbox_arrays_kt779 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt779.kt" -} - -task codegen_blackbox_arrays_kt945 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt945.kt" -} - -task codegen_blackbox_arrays_kt950 (type: RunExternalTest) { - source = "codegen/blackbox/arrays/kt950.kt" -} - -task codegen_blackbox_arrays_longAsIndex (type: RunExternalTest) { - source = "codegen/blackbox/arrays/longAsIndex.kt" -} - -task codegen_blackbox_arrays_multiArrayConstructors (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiArrayConstructors.kt" -} - -task codegen_blackbox_arrays_nonLocalReturnArrayConstructor (type: RunExternalTest) { - source = "codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt" -} - -task codegen_blackbox_arrays_nonNullArray (type: RunExternalTest) { - source = "codegen/blackbox/arrays/nonNullArray.kt" -} - -task codegen_blackbox_arrays_stdlib (type: RunExternalTest) { - source = "codegen/blackbox/arrays/stdlib.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle deleted file mode 100644 index 97de5253c2a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_arrays_multiDecl_MultiDeclFor (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/MultiDeclFor.kt" -} - -task codegen_blackbox_arrays_multiDecl_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_arrays_multiDecl_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_arrays_multiDecl_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - -task codegen_blackbox_arrays_multiDecl_MultiDeclForValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/MultiDeclForValCaptured.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle deleted file mode 100644 index 2414f8fe4a9..00000000000 --- a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/int/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_arrays_multiDecl_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle deleted file mode 100644 index d5d294ba40e..00000000000 --- a/backend.native/tests/external/codegen/blackbox/arrays/multiDecl/long/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_arrays_multiDecl_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/arrays/multiDecl/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle deleted file mode 100644 index c621537b53c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/build-generated.gradle +++ /dev/null @@ -1,70 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_binaryOp_bitwiseOp (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/bitwiseOp.kt" -} - -task codegen_blackbox_binaryOp_bitwiseOpAny (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/bitwiseOpAny.kt" -} - -task codegen_blackbox_binaryOp_bitwiseOpNullable (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/bitwiseOpNullable.kt" -} - -task codegen_blackbox_binaryOp_call (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/call.kt" -} - -task codegen_blackbox_binaryOp_callAny (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/callAny.kt" -} - -task codegen_blackbox_binaryOp_callNullable (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/callNullable.kt" -} - -task codegen_blackbox_binaryOp_compareWithBoxedDouble (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/compareWithBoxedDouble.kt" -} - -task codegen_blackbox_binaryOp_compareWithBoxedLong (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/compareWithBoxedLong.kt" -} - -task codegen_blackbox_binaryOp_divisionByZero (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/divisionByZero.kt" -} - -task codegen_blackbox_binaryOp_intrinsic (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/intrinsic.kt" -} - -task codegen_blackbox_binaryOp_intrinsicAny (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/intrinsicAny.kt" -} - -task codegen_blackbox_binaryOp_intrinsicNullable (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/intrinsicNullable.kt" -} - -task codegen_blackbox_binaryOp_kt11163 (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/kt11163.kt" -} - -task codegen_blackbox_binaryOp_kt6747_identityEquals (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/kt6747_identityEquals.kt" -} - -task codegen_blackbox_binaryOp_overflowChar (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/overflowChar.kt" -} - -task codegen_blackbox_binaryOp_overflowInt (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/overflowInt.kt" -} - -task codegen_blackbox_binaryOp_overflowLong (type: RunExternalTest) { - source = "codegen/blackbox/binaryOp/overflowLong.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle deleted file mode 100644 index a9a401714ff..00000000000 --- a/backend.native/tests/external/codegen/blackbox/boxingOptimization/build-generated.gradle +++ /dev/null @@ -1,66 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_boxingOptimization_casts (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/casts.kt" -} - -task codegen_blackbox_boxingOptimization_checkcastAndInstanceOf (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt" -} - -task codegen_blackbox_boxingOptimization_fold (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/fold.kt" -} - -task codegen_blackbox_boxingOptimization_foldRange (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/foldRange.kt" -} - -task codegen_blackbox_boxingOptimization_kt5493 (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/kt5493.kt" -} - -task codegen_blackbox_boxingOptimization_kt5588 (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/kt5588.kt" -} - -task codegen_blackbox_boxingOptimization_kt5844 (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/kt5844.kt" -} - -task codegen_blackbox_boxingOptimization_kt6047 (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/kt6047.kt" -} - -task codegen_blackbox_boxingOptimization_kt6842 (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/kt6842.kt" -} - -task codegen_blackbox_boxingOptimization_nullCheck (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/nullCheck.kt" -} - -task codegen_blackbox_boxingOptimization_progressions (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/progressions.kt" -} - -task codegen_blackbox_boxingOptimization_safeCallWithElvis (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/safeCallWithElvis.kt" -} - -task codegen_blackbox_boxingOptimization_simple (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/simple.kt" -} - -task codegen_blackbox_boxingOptimization_simpleUninitializedMerge (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/simpleUninitializedMerge.kt" -} - -task codegen_blackbox_boxingOptimization_unsafeRemoving (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/unsafeRemoving.kt" -} - -task codegen_blackbox_boxingOptimization_variables (type: RunExternalTest) { - source = "codegen/blackbox/boxingOptimization/variables.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle deleted file mode 100644 index b6a5918acc5..00000000000 --- a/backend.native/tests/external/codegen/blackbox/bridges/build-generated.gradle +++ /dev/null @@ -1,190 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_bridges_complexMultiInheritance (type: RunExternalTest) { - source = "codegen/blackbox/bridges/complexMultiInheritance.kt" -} - -task codegen_blackbox_bridges_complexTraitImpl (type: RunExternalTest) { - source = "codegen/blackbox/bridges/complexTraitImpl.kt" -} - -task codegen_blackbox_bridges_delegation (type: RunExternalTest) { - source = "codegen/blackbox/bridges/delegation.kt" -} - -task codegen_blackbox_bridges_delegationComplex (type: RunExternalTest) { - source = "codegen/blackbox/bridges/delegationComplex.kt" -} - -task codegen_blackbox_bridges_delegationComplexWithList (type: RunExternalTest) { - source = "codegen/blackbox/bridges/delegationComplexWithList.kt" -} - -task codegen_blackbox_bridges_delegationProperty (type: RunExternalTest) { - source = "codegen/blackbox/bridges/delegationProperty.kt" -} - -task codegen_blackbox_bridges_diamond (type: RunExternalTest) { - source = "codegen/blackbox/bridges/diamond.kt" -} - -task codegen_blackbox_bridges_fakeCovariantOverride (type: RunExternalTest) { - source = "codegen/blackbox/bridges/fakeCovariantOverride.kt" -} - -task codegen_blackbox_bridges_fakeGenericCovariantOverride (type: RunExternalTest) { - source = "codegen/blackbox/bridges/fakeGenericCovariantOverride.kt" -} - -task codegen_blackbox_bridges_fakeGenericCovariantOverrideWithDelegation (type: RunExternalTest) { - source = "codegen/blackbox/bridges/fakeGenericCovariantOverrideWithDelegation.kt" -} - -task codegen_blackbox_bridges_fakeOverrideOfTraitImpl (type: RunExternalTest) { - source = "codegen/blackbox/bridges/fakeOverrideOfTraitImpl.kt" -} - -task codegen_blackbox_bridges_fakeOverrideWithSeveralSuperDeclarations (type: RunExternalTest) { - source = "codegen/blackbox/bridges/fakeOverrideWithSeveralSuperDeclarations.kt" -} - -task codegen_blackbox_bridges_fakeOverrideWithSynthesizedImplementation (type: RunExternalTest) { - source = "codegen/blackbox/bridges/fakeOverrideWithSynthesizedImplementation.kt" -} - -task codegen_blackbox_bridges_genericProperty (type: RunExternalTest) { - source = "codegen/blackbox/bridges/genericProperty.kt" -} - -task codegen_blackbox_bridges_jsName (type: RunExternalTest) { - source = "codegen/blackbox/bridges/jsName.kt" -} - -task codegen_blackbox_bridges_jsNative (type: RunExternalTest) { - source = "codegen/blackbox/bridges/jsNative.kt" -} - -task codegen_blackbox_bridges_kt12416 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt12416.kt" -} - -task codegen_blackbox_bridges_kt1939 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt1939.kt" -} - -task codegen_blackbox_bridges_kt1959 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt1959.kt" -} - -task codegen_blackbox_bridges_kt2498 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt2498.kt" -} - -task codegen_blackbox_bridges_kt2702 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt2702.kt" -} - -task codegen_blackbox_bridges_kt2833 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt2833.kt" -} - -task codegen_blackbox_bridges_kt2920 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt2920.kt" -} - -task codegen_blackbox_bridges_kt318 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/kt318.kt" -} - -task codegen_blackbox_bridges_longChainOneBridge (type: RunExternalTest) { - source = "codegen/blackbox/bridges/longChainOneBridge.kt" -} - -task codegen_blackbox_bridges_manyTypeArgumentsSubstitutedSuccessively (type: RunExternalTest) { - source = "codegen/blackbox/bridges/manyTypeArgumentsSubstitutedSuccessively.kt" -} - -task codegen_blackbox_bridges_methodFromTrait (type: RunExternalTest) { - source = "codegen/blackbox/bridges/methodFromTrait.kt" -} - -task codegen_blackbox_bridges_noBridgeOnMutableCollectionInheritance (type: RunExternalTest) { - source = "codegen/blackbox/bridges/noBridgeOnMutableCollectionInheritance.kt" -} - -task codegen_blackbox_bridges_objectClone (type: RunExternalTest) { - source = "codegen/blackbox/bridges/objectClone.kt" -} - -task codegen_blackbox_bridges_overrideAbstractProperty (type: RunExternalTest) { - source = "codegen/blackbox/bridges/overrideAbstractProperty.kt" -} - -task codegen_blackbox_bridges_overrideReturnType (type: RunExternalTest) { - source = "codegen/blackbox/bridges/overrideReturnType.kt" -} - -task codegen_blackbox_bridges_propertyAccessorsWithoutBody (type: RunExternalTest) { - source = "codegen/blackbox/bridges/propertyAccessorsWithoutBody.kt" -} - -task codegen_blackbox_bridges_propertyDiamond (type: RunExternalTest) { - source = "codegen/blackbox/bridges/propertyDiamond.kt" -} - -task codegen_blackbox_bridges_propertyInConstructor (type: RunExternalTest) { - source = "codegen/blackbox/bridges/propertyInConstructor.kt" -} - -task codegen_blackbox_bridges_propertySetter (type: RunExternalTest) { - source = "codegen/blackbox/bridges/propertySetter.kt" -} - -task codegen_blackbox_bridges_simple (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simple.kt" -} - -task codegen_blackbox_bridges_simpleEnum (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simpleEnum.kt" -} - -task codegen_blackbox_bridges_simpleGenericMethod (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simpleGenericMethod.kt" -} - -task codegen_blackbox_bridges_simpleObject (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simpleObject.kt" -} - -task codegen_blackbox_bridges_simpleReturnType (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simpleReturnType.kt" -} - -task codegen_blackbox_bridges_simpleTraitImpl (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simpleTraitImpl.kt" -} - -task codegen_blackbox_bridges_simpleUpperBound (type: RunExternalTest) { - source = "codegen/blackbox/bridges/simpleUpperBound.kt" -} - -task codegen_blackbox_bridges_strListContains (type: RunExternalTest) { - source = "codegen/blackbox/bridges/strListContains.kt" -} - -task codegen_blackbox_bridges_traitImplInheritsTraitImpl (type: RunExternalTest) { - source = "codegen/blackbox/bridges/traitImplInheritsTraitImpl.kt" -} - -task codegen_blackbox_bridges_twoParentsWithDifferentMethodsTwoBridges (type: RunExternalTest) { - source = "codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges.kt" -} - -task codegen_blackbox_bridges_twoParentsWithDifferentMethodsTwoBridges2 (type: RunExternalTest) { - source = "codegen/blackbox/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt" -} - -task codegen_blackbox_bridges_twoParentsWithTheSameMethodOneBridge (type: RunExternalTest) { - source = "codegen/blackbox/bridges/twoParentsWithTheSameMethodOneBridge.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle deleted file mode 100644 index f2d9278cb6a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/bridges/substitutionInSuperClass/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_bridges_substitutionInSuperClass_abstractFun (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/abstractFun.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_boundedTypeArguments (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/boundedTypeArguments.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_delegation (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/delegation.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_differentErasureInSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClass.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_differentErasureInSuperClassComplex (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/differentErasureInSuperClassComplex.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_enum (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/enum.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_genericMethod (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/genericMethod.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_object (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/object.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_property (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/property.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_simple (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/simple.kt" -} - -task codegen_blackbox_bridges_substitutionInSuperClass_upperBound (type: RunExternalTest) { - source = "codegen/blackbox/bridges/substitutionInSuperClass/upperBound.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle deleted file mode 100644 index 0c90cf468fc..00000000000 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/build-generated.gradle +++ /dev/null @@ -1,94 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_builtinStubMethods_abstractMember (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/abstractMember.kt" -} - -task codegen_blackbox_builtinStubMethods_Collection (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/Collection.kt" -} - -task codegen_blackbox_builtinStubMethods_customReadOnlyIterator (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/customReadOnlyIterator.kt" -} - -task codegen_blackbox_builtinStubMethods_delegationToArrayList (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/delegationToArrayList.kt" -} - -task codegen_blackbox_builtinStubMethods_immutableRemove (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/immutableRemove.kt" -} - -task codegen_blackbox_builtinStubMethods_implementationInTrait (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/implementationInTrait.kt" -} - -task codegen_blackbox_builtinStubMethods_inheritedImplementations (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/inheritedImplementations.kt" -} - -task codegen_blackbox_builtinStubMethods_Iterator (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/Iterator.kt" -} - -task codegen_blackbox_builtinStubMethods_IteratorWithRemove (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt" -} - -task codegen_blackbox_builtinStubMethods_List (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/List.kt" -} - -task codegen_blackbox_builtinStubMethods_ListIterator (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/ListIterator.kt" -} - -task codegen_blackbox_builtinStubMethods_ListWithAllImplementations (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt" -} - -task codegen_blackbox_builtinStubMethods_ListWithAllInheritedImplementations (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt" -} - -task codegen_blackbox_builtinStubMethods_manyTypeParametersWithUpperBounds (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/manyTypeParametersWithUpperBounds.kt" -} - -task codegen_blackbox_builtinStubMethods_Map (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/Map.kt" -} - -task codegen_blackbox_builtinStubMethods_MapEntry (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/MapEntry.kt" -} - -task codegen_blackbox_builtinStubMethods_MapEntryWithSetValue (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt" -} - -task codegen_blackbox_builtinStubMethods_MapWithAllImplementations (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt" -} - -task codegen_blackbox_builtinStubMethods_nonTrivialSubstitution (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt" -} - -task codegen_blackbox_builtinStubMethods_nonTrivialUpperBound (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt" -} - -task codegen_blackbox_builtinStubMethods_substitutedIterable (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/substitutedIterable.kt" -} - -task codegen_blackbox_builtinStubMethods_SubstitutedList (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/SubstitutedList.kt" -} - -task codegen_blackbox_builtinStubMethods_substitutedListWithExtraSuperInterface (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle deleted file mode 100644 index a7e14664184..00000000000 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/extendJavaCollections/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_abstractList (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractList.kt" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_abstractMap (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractMap.kt" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_abstractSet (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/abstractSet.kt" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_arrayList (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/arrayList.kt" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_hashMap (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/hashMap.kt" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_hashSet (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/hashSet.kt" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections_mapEntry (type: RunExternalTest) { - source = "codegen/blackbox/builtinStubMethods/extendJavaCollections/mapEntry.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle deleted file mode 100644 index b0efd5dcebe..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_callableReference_bound_array (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/array.kt" -} - -task codegen_blackbox_callableReference_bound_companionObjectReceiver (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/companionObjectReceiver.kt" -} - -task codegen_blackbox_callableReference_bound_enumEntryMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/enumEntryMember.kt" -} - -task codegen_blackbox_callableReference_bound_kCallableNameIntrinsic (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt" -} - -task codegen_blackbox_callableReference_bound_kt12738 (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/kt12738.kt" -} - -task codegen_blackbox_callableReference_bound_kt15446 (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/kt15446.kt" -} - -task codegen_blackbox_callableReference_bound_multiCase (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/multiCase.kt" -} - -task codegen_blackbox_callableReference_bound_nullReceiver (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/nullReceiver.kt" -} - -task codegen_blackbox_callableReference_bound_objectReceiver (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/objectReceiver.kt" -} - -task codegen_blackbox_callableReference_bound_primitiveReceiver (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/primitiveReceiver.kt" -} - -task codegen_blackbox_callableReference_bound_simpleFunction (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/simpleFunction.kt" -} - -task codegen_blackbox_callableReference_bound_simpleProperty (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/simpleProperty.kt" -} - -task codegen_blackbox_callableReference_bound_syntheticExtensionOnLHS (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/syntheticExtensionOnLHS.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle deleted file mode 100644 index 6a87ba1ea9d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_callableReference_bound_equals_nullableReceiverInEquals (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt" -} - -task codegen_blackbox_callableReference_bound_equals_propertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt" -} - -task codegen_blackbox_callableReference_bound_equals_receiverInEquals (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt" -} - -task codegen_blackbox_callableReference_bound_equals_reflectionReference (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/equals/reflectionReference.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle deleted file mode 100644 index 6147b6278e6..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/inline/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_callableReference_bound_inline_simple (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/inline/simple.kt" -} - -task codegen_blackbox_callableReference_bound_inline_simpleVal (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/bound/inline/simpleVal.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle deleted file mode 100644 index 0c69fcd1d21..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/build-generated.gradle +++ /dev/null @@ -1,166 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_callableReference_function_abstractClassMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/abstractClassMember.kt" -} - -task codegen_blackbox_callableReference_function_booleanNotIntrinsic (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt" -} - -task codegen_blackbox_callableReference_function_classMemberFromClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/classMemberFromClass.kt" -} - -task codegen_blackbox_callableReference_function_classMemberFromExtension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/classMemberFromExtension.kt" -} - -task codegen_blackbox_callableReference_function_classMemberFromTopLevelStringNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelStringNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_classMemberFromTopLevelStringOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelStringOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_classMemberFromTopLevelUnitNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_classMemberFromTopLevelUnitOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/classMemberFromTopLevelUnitOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_constructorFromTopLevelNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/constructorFromTopLevelNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_constructorFromTopLevelOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/constructorFromTopLevelOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_enumValueOfMethod (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/enumValueOfMethod.kt" -} - -task codegen_blackbox_callableReference_function_equalsIntrinsic (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/equalsIntrinsic.kt" -} - -task codegen_blackbox_callableReference_function_extensionFromClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/extensionFromClass.kt" -} - -task codegen_blackbox_callableReference_function_extensionFromExtension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/extensionFromExtension.kt" -} - -task codegen_blackbox_callableReference_function_extensionFromTopLevelStringNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/extensionFromTopLevelStringNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_extensionFromTopLevelStringOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/extensionFromTopLevelStringOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_extensionFromTopLevelUnitNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/extensionFromTopLevelUnitNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_extensionFromTopLevelUnitOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/extensionFromTopLevelUnitOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_genericMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/genericMember.kt" -} - -task codegen_blackbox_callableReference_function_getArityViaFunctionImpl (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt" -} - -task codegen_blackbox_callableReference_function_innerConstructorFromClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/innerConstructorFromClass.kt" -} - -task codegen_blackbox_callableReference_function_innerConstructorFromExtension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/innerConstructorFromExtension.kt" -} - -task codegen_blackbox_callableReference_function_innerConstructorFromTopLevelNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/innerConstructorFromTopLevelNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_innerConstructorFromTopLevelOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/innerConstructorFromTopLevelOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_javaCollectionsStaticMethod (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt" -} - -task codegen_blackbox_callableReference_function_nestedConstructorFromClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/nestedConstructorFromClass.kt" -} - -task codegen_blackbox_callableReference_function_nestedConstructorFromTopLevelNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_nestedConstructorFromTopLevelOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/nestedConstructorFromTopLevelOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_newArray (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/newArray.kt" -} - -task codegen_blackbox_callableReference_function_overloadedFun (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/overloadedFun.kt" -} - -task codegen_blackbox_callableReference_function_overloadedFunVsVal (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/overloadedFunVsVal.kt" -} - -task codegen_blackbox_callableReference_function_privateClassMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/privateClassMember.kt" -} - -task codegen_blackbox_callableReference_function_sortListOfStrings (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/sortListOfStrings.kt" -} - -task codegen_blackbox_callableReference_function_topLevelFromClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/topLevelFromClass.kt" -} - -task codegen_blackbox_callableReference_function_topLevelFromExtension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/topLevelFromExtension.kt" -} - -task codegen_blackbox_callableReference_function_topLevelFromTopLevelStringNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelStringNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_topLevelFromTopLevelStringOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelStringOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_topLevelFromTopLevelUnitNoArgs (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitNoArgs.kt" -} - -task codegen_blackbox_callableReference_function_topLevelFromTopLevelUnitOneStringArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/topLevelFromTopLevelUnitOneStringArg.kt" -} - -task codegen_blackbox_callableReference_function_traitImplMethodWithClassReceiver (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/traitImplMethodWithClassReceiver.kt" -} - -task codegen_blackbox_callableReference_function_traitMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/traitMember.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle deleted file mode 100644 index a045b2474a3..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/build-generated.gradle +++ /dev/null @@ -1,78 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_callableReference_function_local_captureOuter (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/captureOuter.kt" -} - -task codegen_blackbox_callableReference_function_local_classMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/classMember.kt" -} - -task codegen_blackbox_callableReference_function_local_closureWithSideEffect (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/closureWithSideEffect.kt" -} - -task codegen_blackbox_callableReference_function_local_constructor (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/constructor.kt" -} - -task codegen_blackbox_callableReference_function_local_constructorWithInitializer (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/constructorWithInitializer.kt" -} - -task codegen_blackbox_callableReference_function_local_enumExtendsTrait (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/enumExtendsTrait.kt" -} - -task codegen_blackbox_callableReference_function_local_extension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/extension.kt" -} - -task codegen_blackbox_callableReference_function_local_extensionToLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/extensionToLocalClass.kt" -} - -task codegen_blackbox_callableReference_function_local_extensionToPrimitive (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/extensionToPrimitive.kt" -} - -task codegen_blackbox_callableReference_function_local_extensionWithClosure (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/extensionWithClosure.kt" -} - -task codegen_blackbox_callableReference_function_local_genericMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/genericMember.kt" -} - -task codegen_blackbox_callableReference_function_local_localClassMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/localClassMember.kt" -} - -task codegen_blackbox_callableReference_function_local_localFunctionName (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/localFunctionName.kt" -} - -task codegen_blackbox_callableReference_function_local_localLocal (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/localLocal.kt" -} - -task codegen_blackbox_callableReference_function_local_recursiveClosure (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/recursiveClosure.kt" -} - -task codegen_blackbox_callableReference_function_local_simple (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/simple.kt" -} - -task codegen_blackbox_callableReference_function_local_simpleClosure (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/simpleClosure.kt" -} - -task codegen_blackbox_callableReference_function_local_simpleWithArg (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/simpleWithArg.kt" -} - -task codegen_blackbox_callableReference_function_local_unitWithSideEffect (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/function/local/unitWithSideEffect.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle deleted file mode 100644 index 8baf8a03b46..00000000000 --- a/backend.native/tests/external/codegen/blackbox/callableReference/property/build-generated.gradle +++ /dev/null @@ -1,106 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_callableReference_property_accessViaSubclass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/accessViaSubclass.kt" -} - -task codegen_blackbox_callableReference_property_delegated (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/delegated.kt" -} - -task codegen_blackbox_callableReference_property_delegatedMutable (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/delegatedMutable.kt" -} - -task codegen_blackbox_callableReference_property_enumNameOrdinal (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/enumNameOrdinal.kt" -} - -task codegen_blackbox_callableReference_property_extensionToArray (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/extensionToArray.kt" -} - -task codegen_blackbox_callableReference_property_genericProperty (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/genericProperty.kt" -} - -task codegen_blackbox_callableReference_property_invokePropertyReference (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/invokePropertyReference.kt" -} - -task codegen_blackbox_callableReference_property_javaBeanConvention (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/javaBeanConvention.kt" -} - -task codegen_blackbox_callableReference_property_kClassInstanceIsInitializedFirst (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kClassInstanceIsInitializedFirst.kt" -} - -task codegen_blackbox_callableReference_property_kt12044 (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kt12044.kt" -} - -task codegen_blackbox_callableReference_property_kt12982_protectedPropertyReference (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kt12982_protectedPropertyReference.kt" -} - -task codegen_blackbox_callableReference_property_kt14330 (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kt14330.kt" -} - -task codegen_blackbox_callableReference_property_kt14330_2 (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kt14330_2.kt" -} - -task codegen_blackbox_callableReference_property_kt15447 (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kt15447.kt" -} - -task codegen_blackbox_callableReference_property_kt6870_privatePropertyReference (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt" -} - -task codegen_blackbox_callableReference_property_listOfStringsMapLength (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/listOfStringsMapLength.kt" -} - -task codegen_blackbox_callableReference_property_localClassVar (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/localClassVar.kt" -} - -task codegen_blackbox_callableReference_property_overriddenInSubclass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/overriddenInSubclass.kt" -} - -task codegen_blackbox_callableReference_property_privateSetterInsideClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/privateSetterInsideClass.kt" -} - -task codegen_blackbox_callableReference_property_privateSetterOutsideClass (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt" -} - -task codegen_blackbox_callableReference_property_simpleExtension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/simpleExtension.kt" -} - -task codegen_blackbox_callableReference_property_simpleMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/simpleMember.kt" -} - -task codegen_blackbox_callableReference_property_simpleMutableExtension (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/simpleMutableExtension.kt" -} - -task codegen_blackbox_callableReference_property_simpleMutableMember (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/simpleMutableMember.kt" -} - -task codegen_blackbox_callableReference_property_simpleMutableTopLevel (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/simpleMutableTopLevel.kt" -} - -task codegen_blackbox_callableReference_property_simpleTopLevel (type: RunExternalTest) { - source = "codegen/blackbox/callableReference/property/simpleTopLevel.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle deleted file mode 100644 index dada0f04f76..00000000000 --- a/backend.native/tests/external/codegen/blackbox/casts/build-generated.gradle +++ /dev/null @@ -1,82 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_casts_as (type: RunExternalTest) { - source = "codegen/blackbox/casts/as.kt" -} - -task codegen_blackbox_casts_asForConstants (type: RunExternalTest) { - source = "codegen/blackbox/casts/asForConstants.kt" -} - -task codegen_blackbox_casts_asSafe (type: RunExternalTest) { - source = "codegen/blackbox/casts/asSafe.kt" -} - -task codegen_blackbox_casts_asSafeFail (type: RunExternalTest) { - source = "codegen/blackbox/casts/asSafeFail.kt" -} - -task codegen_blackbox_casts_asSafeForConstants (type: RunExternalTest) { - source = "codegen/blackbox/casts/asSafeForConstants.kt" -} - -task codegen_blackbox_casts_asUnit (type: RunExternalTest) { - source = "codegen/blackbox/casts/asUnit.kt" -} - -task codegen_blackbox_casts_asWithGeneric (type: RunExternalTest) { - source = "codegen/blackbox/casts/asWithGeneric.kt" -} - -task codegen_blackbox_casts_castGenericNull (type: RunExternalTest) { - source = "codegen/blackbox/casts/castGenericNull.kt" -} - -task codegen_blackbox_casts_intersectionTypeMultipleBounds (type: RunExternalTest) { - source = "codegen/blackbox/casts/intersectionTypeMultipleBounds.kt" -} - -task codegen_blackbox_casts_intersectionTypeMultipleBoundsImplicitReceiver (type: RunExternalTest) { - source = "codegen/blackbox/casts/intersectionTypeMultipleBoundsImplicitReceiver.kt" -} - -task codegen_blackbox_casts_intersectionTypeSmartcast (type: RunExternalTest) { - source = "codegen/blackbox/casts/intersectionTypeSmartcast.kt" -} - -task codegen_blackbox_casts_intersectionTypeWithMultipleBoundsAsReceiver (type: RunExternalTest) { - source = "codegen/blackbox/casts/intersectionTypeWithMultipleBoundsAsReceiver.kt" -} - -task codegen_blackbox_casts_intersectionTypeWithoutGenericsAsReceiver (type: RunExternalTest) { - source = "codegen/blackbox/casts/intersectionTypeWithoutGenericsAsReceiver.kt" -} - -task codegen_blackbox_casts_is (type: RunExternalTest) { - source = "codegen/blackbox/casts/is.kt" -} - -task codegen_blackbox_casts_lambdaToUnitCast (type: RunExternalTest) { - source = "codegen/blackbox/casts/lambdaToUnitCast.kt" -} - -task codegen_blackbox_casts_notIs (type: RunExternalTest) { - source = "codegen/blackbox/casts/notIs.kt" -} - -task codegen_blackbox_casts_unitAsAny (type: RunExternalTest) { - source = "codegen/blackbox/casts/unitAsAny.kt" -} - -task codegen_blackbox_casts_unitAsInt (type: RunExternalTest) { - source = "codegen/blackbox/casts/unitAsInt.kt" -} - -task codegen_blackbox_casts_unitAsSafeAny (type: RunExternalTest) { - source = "codegen/blackbox/casts/unitAsSafeAny.kt" -} - -task codegen_blackbox_casts_unitNullableCast (type: RunExternalTest) { - source = "codegen/blackbox/casts/unitNullableCast.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle deleted file mode 100644 index 09bae99c38c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_casts_functions_asFunKBig (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/asFunKBig.kt" -} - -task codegen_blackbox_casts_functions_asFunKSmall (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/asFunKSmall.kt" -} - -task codegen_blackbox_casts_functions_isFunKBig (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/isFunKBig.kt" -} - -task codegen_blackbox_casts_functions_isFunKSmall (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/isFunKSmall.kt" -} - -task codegen_blackbox_casts_functions_javaTypeIsFunK (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/javaTypeIsFunK.kt" -} - -task codegen_blackbox_casts_functions_reifiedAsFunKBig (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/reifiedAsFunKBig.kt" -} - -task codegen_blackbox_casts_functions_reifiedAsFunKSmall (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt" -} - -task codegen_blackbox_casts_functions_reifiedIsFunKBig (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/reifiedIsFunKBig.kt" -} - -task codegen_blackbox_casts_functions_reifiedIsFunKSmall (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt" -} - -task codegen_blackbox_casts_functions_reifiedSafeAsFunKBig (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt" -} - -task codegen_blackbox_casts_functions_reifiedSafeAsFunKSmall (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt" -} - -task codegen_blackbox_casts_functions_safeAsFunKBig (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/safeAsFunKBig.kt" -} - -task codegen_blackbox_casts_functions_safeAsFunKSmall (type: RunExternalTest) { - source = "codegen/blackbox/casts/functions/safeAsFunKSmall.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle deleted file mode 100644 index 30ed41e9fc8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_binaryExpressionCast (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/binaryExpressionCast.kt" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_javaBox (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_labeledExpressionCast (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/labeledExpressionCast.kt" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_parenthesizedExpressionCast (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/parenthesizedExpressionCast.kt" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_superConstructor (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/superConstructor.kt" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_unaryExpressionCast (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/unaryExpressionCast.kt" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument_vararg (type: RunExternalTest) { - source = "codegen/blackbox/casts/literalExpressionAsGenericArgument/vararg.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle deleted file mode 100644 index aa4f4f22706..00000000000 --- a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/build-generated.gradle +++ /dev/null @@ -1,34 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_casts_mutableCollections_asWithMutable (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/asWithMutable.kt" -} - -task codegen_blackbox_casts_mutableCollections_isWithMutable (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/isWithMutable.kt" -} - -task codegen_blackbox_casts_mutableCollections_mutabilityMarkerInterfaces (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt" -} - -task codegen_blackbox_casts_mutableCollections_reifiedAsWithMutable (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/reifiedAsWithMutable.kt" -} - -task codegen_blackbox_casts_mutableCollections_reifiedIsWithMutable (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/reifiedIsWithMutable.kt" -} - -task codegen_blackbox_casts_mutableCollections_reifiedSafeAsWithMutable (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/reifiedSafeAsWithMutable.kt" -} - -task codegen_blackbox_casts_mutableCollections_safeAsWithMutable (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/safeAsWithMutable.kt" -} - -task codegen_blackbox_casts_mutableCollections_weirdMutableCasts (type: RunExternalTest) { - source = "codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle deleted file mode 100644 index 258cf6f26d8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_classLiteral_bound_javaIntrinsicWithSideEffect (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt" -} - -task codegen_blackbox_classLiteral_bound_primitives (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/bound/primitives.kt" -} - -task codegen_blackbox_classLiteral_bound_sideEffect (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/bound/sideEffect.kt" -} - -task codegen_blackbox_classLiteral_bound_simple (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/bound/simple.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle deleted file mode 100644 index c7fc2724961..00000000000 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_classLiteral_primitiveKClassEquality (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/primitiveKClassEquality.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle deleted file mode 100644 index 114205a30a8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/build-generated.gradle +++ /dev/null @@ -1,34 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_classLiteral_java_java (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/java.kt" -} - -task codegen_blackbox_classLiteral_java_javaObjectType (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/javaObjectType.kt" -} - -task codegen_blackbox_classLiteral_java_javaObjectTypeReified (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt" -} - -task codegen_blackbox_classLiteral_java_javaPrimitiveType (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/javaPrimitiveType.kt" -} - -task codegen_blackbox_classLiteral_java_javaPrimitiveTypeReified (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt" -} - -task codegen_blackbox_classLiteral_java_javaReified (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/javaReified.kt" -} - -task codegen_blackbox_classLiteral_java_kt11943 (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/kt11943.kt" -} - -task codegen_blackbox_classLiteral_java_objectSuperConstructorCall (type: RunExternalTest) { - source = "codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle deleted file mode 100644 index 8cc9d66117f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/classes/build-generated.gradle +++ /dev/null @@ -1,458 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_classes_boxPrimitiveTypeInClinitOfClassObject (type: RunExternalTest) { - source = "codegen/blackbox/classes/boxPrimitiveTypeInClinitOfClassObject.kt" -} - -task codegen_blackbox_classes_classCompanionInitializationWithJava (type: RunExternalTest) { - source = "codegen/blackbox/classes/classCompanionInitializationWithJava.kt" -} - -task codegen_blackbox_classes_classNamedAsOldPackageFacade (type: RunExternalTest) { - source = "codegen/blackbox/classes/classNamedAsOldPackageFacade.kt" -} - -task codegen_blackbox_classes_classObject (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObject.kt" -} - -task codegen_blackbox_classes_classObjectAsExtensionReceiver (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectAsExtensionReceiver.kt" -} - -task codegen_blackbox_classes_classObjectAsStaticInitializer (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectAsStaticInitializer.kt" -} - -task codegen_blackbox_classes_classObjectField (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectField.kt" -} - -task codegen_blackbox_classes_classObjectInTrait (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectInTrait.kt" -} - -task codegen_blackbox_classes_classObjectNotOfEnum (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectNotOfEnum.kt" -} - -task codegen_blackbox_classes_classObjectsWithParentClasses (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectsWithParentClasses.kt" -} - -task codegen_blackbox_classes_classObjectToString (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectToString.kt" -} - -task codegen_blackbox_classes_classObjectWithPrivateGenericMember (type: RunExternalTest) { - source = "codegen/blackbox/classes/classObjectWithPrivateGenericMember.kt" -} - -task codegen_blackbox_classes_defaultObjectSameNamesAsInOuter (type: RunExternalTest) { - source = "codegen/blackbox/classes/defaultObjectSameNamesAsInOuter.kt" -} - -task codegen_blackbox_classes_delegation2 (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegation2.kt" -} - -task codegen_blackbox_classes_delegation3 (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegation3.kt" -} - -task codegen_blackbox_classes_delegation4 (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegation4.kt" -} - -task codegen_blackbox_classes_delegationGenericArg (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegationGenericArg.kt" -} - -task codegen_blackbox_classes_delegationGenericArgUpperBound (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegationGenericArgUpperBound.kt" -} - -task codegen_blackbox_classes_delegationGenericLongArg (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegationGenericLongArg.kt" -} - -task codegen_blackbox_classes_delegationJava (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegationJava.kt" -} - -task codegen_blackbox_classes_delegationMethodsWithArgs (type: RunExternalTest) { - source = "codegen/blackbox/classes/delegationMethodsWithArgs.kt" -} - -task codegen_blackbox_classes_exceptionConstructor (type: RunExternalTest) { - source = "codegen/blackbox/classes/exceptionConstructor.kt" -} - -task codegen_blackbox_classes_extensionOnNamedClassObject (type: RunExternalTest) { - source = "codegen/blackbox/classes/extensionOnNamedClassObject.kt" -} - -task codegen_blackbox_classes_funDelegation (type: RunExternalTest) { - source = "codegen/blackbox/classes/funDelegation.kt" -} - -task codegen_blackbox_classes_implementComparableInSubclass (type: RunExternalTest) { - source = "codegen/blackbox/classes/implementComparableInSubclass.kt" -} - -task codegen_blackbox_classes_inheritance (type: RunExternalTest) { - source = "codegen/blackbox/classes/inheritance.kt" -} - -task codegen_blackbox_classes_inheritedInnerClass (type: RunExternalTest) { - source = "codegen/blackbox/classes/inheritedInnerClass.kt" -} - -task codegen_blackbox_classes_inheritedMethod (type: RunExternalTest) { - source = "codegen/blackbox/classes/inheritedMethod.kt" -} - -task codegen_blackbox_classes_inheritSetAndHashSet (type: RunExternalTest) { - source = "codegen/blackbox/classes/inheritSetAndHashSet.kt" -} - -task codegen_blackbox_classes_initializerBlock (type: RunExternalTest) { - source = "codegen/blackbox/classes/initializerBlock.kt" -} - -task codegen_blackbox_classes_initializerBlockDImpl (type: RunExternalTest) { - source = "codegen/blackbox/classes/initializerBlockDImpl.kt" -} - -task codegen_blackbox_classes_innerClass (type: RunExternalTest) { - source = "codegen/blackbox/classes/innerClass.kt" -} - -task codegen_blackbox_classes_interfaceCompanionInitializationWithJava (type: RunExternalTest) { - source = "codegen/blackbox/classes/interfaceCompanionInitializationWithJava.kt" -} - -task codegen_blackbox_classes_kt1018 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1018.kt" -} - -task codegen_blackbox_classes_kt1120 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1120.kt" -} - -task codegen_blackbox_classes_kt1134 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1134.kt" -} - -task codegen_blackbox_classes_kt1157 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1157.kt" -} - -task codegen_blackbox_classes_kt1247 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1247.kt" -} - -task codegen_blackbox_classes_kt1345 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1345.kt" -} - -task codegen_blackbox_classes_kt1439 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1439.kt" -} - -task codegen_blackbox_classes_kt1535 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1535.kt" -} - -task codegen_blackbox_classes_kt1538 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1538.kt" -} - -task codegen_blackbox_classes_kt1578 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1578.kt" -} - -task codegen_blackbox_classes_kt1611 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1611.kt" -} - -task codegen_blackbox_classes_kt1721 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1721.kt" -} - -task codegen_blackbox_classes_kt1726 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1726.kt" -} - -task codegen_blackbox_classes_kt1759 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1759.kt" -} - -task codegen_blackbox_classes_kt1891 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1891.kt" -} - -task codegen_blackbox_classes_kt1918 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1918.kt" -} - -task codegen_blackbox_classes_kt1976 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1976.kt" -} - -task codegen_blackbox_classes_kt1980 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt1980.kt" -} - -task codegen_blackbox_classes_kt2224 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2224.kt" -} - -task codegen_blackbox_classes_kt2288 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2288.kt" -} - -task codegen_blackbox_classes_kt2384 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2384.kt" -} - -task codegen_blackbox_classes_kt2390 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2390.kt" -} - -task codegen_blackbox_classes_kt2391 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2391.kt" -} - -task codegen_blackbox_classes_kt2395 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2395.kt" -} - -task codegen_blackbox_classes_kt2417 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2417.kt" -} - -task codegen_blackbox_classes_kt2477 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2477.kt" -} - -task codegen_blackbox_classes_kt2480 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2480.kt" -} - -task codegen_blackbox_classes_kt2482 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2482.kt" -} - -task codegen_blackbox_classes_kt2485 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2485.kt" -} - -task codegen_blackbox_classes_kt249 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt249.kt" -} - -task codegen_blackbox_classes_kt2532 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2532.kt" -} - -task codegen_blackbox_classes_kt2566 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2566.kt" -} - -task codegen_blackbox_classes_kt2566_2 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2566_2.kt" -} - -task codegen_blackbox_classes_kt2607 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2607.kt" -} - -task codegen_blackbox_classes_kt2626 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2626.kt" -} - -task codegen_blackbox_classes_kt2711 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2711.kt" -} - -task codegen_blackbox_classes_kt2784 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt2784.kt" -} - -task codegen_blackbox_classes_kt285 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt285.kt" -} - -task codegen_blackbox_classes_kt3001 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt3001.kt" -} - -task codegen_blackbox_classes_kt3114 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt3114.kt" -} - -task codegen_blackbox_classes_kt3414 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt3414.kt" -} - -task codegen_blackbox_classes_kt343 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt343.kt" -} - -task codegen_blackbox_classes_kt3546 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt3546.kt" -} - -task codegen_blackbox_classes_kt454 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt454.kt" -} - -task codegen_blackbox_classes_kt471 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt471.kt" -} - -task codegen_blackbox_classes_kt48 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt48.kt" -} - -task codegen_blackbox_classes_kt496 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt496.kt" -} - -task codegen_blackbox_classes_kt500 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt500.kt" -} - -task codegen_blackbox_classes_kt501 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt501.kt" -} - -task codegen_blackbox_classes_kt504 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt504.kt" -} - -task codegen_blackbox_classes_kt508 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt508.kt" -} - -task codegen_blackbox_classes_kt5347 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt5347.kt" -} - -task codegen_blackbox_classes_kt6136 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt6136.kt" -} - -task codegen_blackbox_classes_kt633 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt633.kt" -} - -task codegen_blackbox_classes_kt6816 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt6816.kt" -} - -task codegen_blackbox_classes_kt707 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt707.kt" -} - -task codegen_blackbox_classes_kt723 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt723.kt" -} - -task codegen_blackbox_classes_kt725 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt725.kt" -} - -task codegen_blackbox_classes_kt8011 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt8011.kt" -} - -task codegen_blackbox_classes_kt8011a (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt8011a.kt" -} - -task codegen_blackbox_classes_kt903 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt903.kt" -} - -task codegen_blackbox_classes_kt940 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt940.kt" -} - -task codegen_blackbox_classes_kt9642 (type: RunExternalTest) { - source = "codegen/blackbox/classes/kt9642.kt" -} - -task codegen_blackbox_classes_namedClassObject (type: RunExternalTest) { - source = "codegen/blackbox/classes/namedClassObject.kt" -} - -task codegen_blackbox_classes_outerThis (type: RunExternalTest) { - source = "codegen/blackbox/classes/outerThis.kt" -} - -task codegen_blackbox_classes_overloadBinaryOperator (type: RunExternalTest) { - source = "codegen/blackbox/classes/overloadBinaryOperator.kt" -} - -task codegen_blackbox_classes_overloadPlusAssign (type: RunExternalTest) { - source = "codegen/blackbox/classes/overloadPlusAssign.kt" -} - -task codegen_blackbox_classes_overloadPlusAssignReturn (type: RunExternalTest) { - source = "codegen/blackbox/classes/overloadPlusAssignReturn.kt" -} - -task codegen_blackbox_classes_overloadPlusToPlusAssign (type: RunExternalTest) { - source = "codegen/blackbox/classes/overloadPlusToPlusAssign.kt" -} - -task codegen_blackbox_classes_overloadUnaryOperator (type: RunExternalTest) { - source = "codegen/blackbox/classes/overloadUnaryOperator.kt" -} - -task codegen_blackbox_classes_privateOuterFunctions (type: RunExternalTest) { - source = "codegen/blackbox/classes/privateOuterFunctions.kt" -} - -task codegen_blackbox_classes_privateOuterProperty (type: RunExternalTest) { - source = "codegen/blackbox/classes/privateOuterProperty.kt" -} - -task codegen_blackbox_classes_privateToThis (type: RunExternalTest) { - source = "codegen/blackbox/classes/privateToThis.kt" -} - -task codegen_blackbox_classes_propertyDelegation (type: RunExternalTest) { - source = "codegen/blackbox/classes/propertyDelegation.kt" -} - -task codegen_blackbox_classes_propertyInInitializer (type: RunExternalTest) { - source = "codegen/blackbox/classes/propertyInInitializer.kt" -} - -task codegen_blackbox_classes_rightHandOverride (type: RunExternalTest) { - source = "codegen/blackbox/classes/rightHandOverride.kt" -} - -task codegen_blackbox_classes_sealedInSameFile (type: RunExternalTest) { - source = "codegen/blackbox/classes/sealedInSameFile.kt" -} - -task codegen_blackbox_classes_selfcreate (type: RunExternalTest) { - source = "codegen/blackbox/classes/selfcreate.kt" -} - -task codegen_blackbox_classes_simpleBox (type: RunExternalTest) { - source = "codegen/blackbox/classes/simpleBox.kt" -} - -task codegen_blackbox_classes_superConstructorCallWithComplexArg (type: RunExternalTest) { - source = "codegen/blackbox/classes/superConstructorCallWithComplexArg.kt" -} - -task codegen_blackbox_classes_typedDelegation (type: RunExternalTest) { - source = "codegen/blackbox/classes/typedDelegation.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle deleted file mode 100644 index 0b6b2f86520..00000000000 --- a/backend.native/tests/external/codegen/blackbox/classes/inner/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_classes_inner_instantiateInDerived (type: RunExternalTest) { - source = "codegen/blackbox/classes/inner/instantiateInDerived.kt" -} - -task codegen_blackbox_classes_inner_instantiateInDerivedLabeled (type: RunExternalTest) { - source = "codegen/blackbox/classes/inner/instantiateInDerivedLabeled.kt" -} - -task codegen_blackbox_classes_inner_instantiateInSameClass (type: RunExternalTest) { - source = "codegen/blackbox/classes/inner/instantiateInSameClass.kt" -} - -task codegen_blackbox_classes_inner_kt6708 (type: RunExternalTest) { - source = "codegen/blackbox/classes/inner/kt6708.kt" -} - -task codegen_blackbox_classes_inner_properOuter (type: RunExternalTest) { - source = "codegen/blackbox/classes/inner/properOuter.kt" -} - -task codegen_blackbox_classes_inner_properSuperLinking (type: RunExternalTest) { - source = "codegen/blackbox/classes/inner/properSuperLinking.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle deleted file mode 100644 index 337ebd665d3..00000000000 --- a/backend.native/tests/external/codegen/blackbox/closures/build-generated.gradle +++ /dev/null @@ -1,150 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_closures_capturedLocalGenericFun (type: RunExternalTest) { - source = "codegen/blackbox/closures/capturedLocalGenericFun.kt" -} - -task codegen_blackbox_closures_captureExtensionReceiver (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureExtensionReceiver.kt" -} - -task codegen_blackbox_closures_closureInsideConstrucor (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideConstrucor.kt" -} - -task codegen_blackbox_closures_closureOnTopLevel1 (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureOnTopLevel1.kt" -} - -task codegen_blackbox_closures_closureOnTopLevel2 (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureOnTopLevel2.kt" -} - -task codegen_blackbox_closures_closureWithParameter (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureWithParameter.kt" -} - -task codegen_blackbox_closures_closureWithParameterAndBoxing (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureWithParameterAndBoxing.kt" -} - -task codegen_blackbox_closures_doubleEnclosedLocalVariable (type: RunExternalTest) { - source = "codegen/blackbox/closures/doubleEnclosedLocalVariable.kt" -} - -task codegen_blackbox_closures_enclosingLocalVariable (type: RunExternalTest) { - source = "codegen/blackbox/closures/enclosingLocalVariable.kt" -} - -task codegen_blackbox_closures_enclosingThis (type: RunExternalTest) { - source = "codegen/blackbox/closures/enclosingThis.kt" -} - -task codegen_blackbox_closures_extensionClosure (type: RunExternalTest) { - source = "codegen/blackbox/closures/extensionClosure.kt" -} - -task codegen_blackbox_closures_kt10044 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt10044.kt" -} - -task codegen_blackbox_closures_kt11634 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt11634.kt" -} - -task codegen_blackbox_closures_kt11634_2 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt11634_2.kt" -} - -task codegen_blackbox_closures_kt11634_3 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt11634_3.kt" -} - -task codegen_blackbox_closures_kt11634_4 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt11634_4.kt" -} - -task codegen_blackbox_closures_kt2151 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt2151.kt" -} - -task codegen_blackbox_closures_kt3152 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt3152.kt" -} - -task codegen_blackbox_closures_kt3523 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt3523.kt" -} - -task codegen_blackbox_closures_kt3738 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt3738.kt" -} - -task codegen_blackbox_closures_kt3905 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt3905.kt" -} - -task codegen_blackbox_closures_kt4106 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt4106.kt" -} - -task codegen_blackbox_closures_kt4137 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt4137.kt" -} - -task codegen_blackbox_closures_kt5589 (type: RunExternalTest) { - source = "codegen/blackbox/closures/kt5589.kt" -} - -task codegen_blackbox_closures_localClassFunClosure (type: RunExternalTest) { - source = "codegen/blackbox/closures/localClassFunClosure.kt" -} - -task codegen_blackbox_closures_localClassLambdaClosure (type: RunExternalTest) { - source = "codegen/blackbox/closures/localClassLambdaClosure.kt" -} - -task codegen_blackbox_closures_localFunctionInFunction (type: RunExternalTest) { - source = "codegen/blackbox/closures/localFunctionInFunction.kt" -} - -task codegen_blackbox_closures_localFunctionInInitializer (type: RunExternalTest) { - source = "codegen/blackbox/closures/localFunctionInInitializer.kt" -} - -task codegen_blackbox_closures_localGenericFun (type: RunExternalTest) { - source = "codegen/blackbox/closures/localGenericFun.kt" -} - -task codegen_blackbox_closures_localReturn (type: RunExternalTest) { - source = "codegen/blackbox/closures/localReturn.kt" -} - -task codegen_blackbox_closures_localReturnWithAutolabel (type: RunExternalTest) { - source = "codegen/blackbox/closures/localReturnWithAutolabel.kt" -} - -task codegen_blackbox_closures_noRefToOuter (type: RunExternalTest) { - source = "codegen/blackbox/closures/noRefToOuter.kt" -} - -task codegen_blackbox_closures_recursiveClosure (type: RunExternalTest) { - source = "codegen/blackbox/closures/recursiveClosure.kt" -} - -task codegen_blackbox_closures_simplestClosure (type: RunExternalTest) { - source = "codegen/blackbox/closures/simplestClosure.kt" -} - -task codegen_blackbox_closures_simplestClosureAndBoxing (type: RunExternalTest) { - source = "codegen/blackbox/closures/simplestClosureAndBoxing.kt" -} - -task codegen_blackbox_closures_subclosuresWithinInitializers (type: RunExternalTest) { - source = "codegen/blackbox/closures/subclosuresWithinInitializers.kt" -} - -task codegen_blackbox_closures_underscoreParameters (type: RunExternalTest) { - source = "codegen/blackbox/closures/underscoreParameters.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle deleted file mode 100644 index 552b3079aa2..00000000000 --- a/backend.native/tests/external/codegen/blackbox/closures/captureOuterProperty/build-generated.gradle +++ /dev/null @@ -1,34 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_closures_captureOuterProperty_captureFunctionInProperty (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/captureFunctionInProperty.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_inFunction (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/inFunction.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_inProperty (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/inProperty.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_inPropertyDeepObjectChain (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/inPropertyDeepObjectChain.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_inPropertyFromSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperClass.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_inPropertyFromSuperSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/inPropertyFromSuperSuperClass.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_kt4176 (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/kt4176.kt" -} - -task codegen_blackbox_closures_captureOuterProperty_kt4656 (type: RunExternalTest) { - source = "codegen/blackbox/closures/captureOuterProperty/kt4656.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle deleted file mode 100644 index 0bd7ff2623a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/closures/closureInsideClosure/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_closures_closureInsideClosure_localFunInsideLocalFun (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFun.kt" -} - -task codegen_blackbox_closures_closureInsideClosure_localFunInsideLocalFunDifferentSignatures (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideClosure/localFunInsideLocalFunDifferentSignatures.kt" -} - -task codegen_blackbox_closures_closureInsideClosure_propertyAndFunctionNameClash (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideClosure/propertyAndFunctionNameClash.kt" -} - -task codegen_blackbox_closures_closureInsideClosure_threeLevels (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideClosure/threeLevels.kt" -} - -task codegen_blackbox_closures_closureInsideClosure_threeLevelsDifferentSignatures (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideClosure/threeLevelsDifferentSignatures.kt" -} - -task codegen_blackbox_closures_closureInsideClosure_varAsFunInsideLocalFun (type: RunExternalTest) { - source = "codegen/blackbox/closures/closureInsideClosure/varAsFunInsideLocalFun.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle deleted file mode 100644 index ac248c2874e..00000000000 --- a/backend.native/tests/external/codegen/blackbox/collections/build-generated.gradle +++ /dev/null @@ -1,74 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_collections_charSequence (type: RunExternalTest) { - source = "codegen/blackbox/collections/charSequence.kt" -} - -task codegen_blackbox_collections_implementCollectionThroughKotlin (type: RunExternalTest) { - source = "codegen/blackbox/collections/implementCollectionThroughKotlin.kt" -} - -task codegen_blackbox_collections_inSetWithSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/collections/inSetWithSmartCast.kt" -} - -task codegen_blackbox_collections_irrelevantImplCharSequence (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantImplCharSequence.kt" -} - -task codegen_blackbox_collections_irrelevantImplCharSequenceKotlin (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt" -} - -task codegen_blackbox_collections_irrelevantImplMutableList (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantImplMutableList.kt" -} - -task codegen_blackbox_collections_irrelevantImplMutableListKotlin (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt" -} - -task codegen_blackbox_collections_irrelevantImplMutableListSubstitution (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantImplMutableListSubstitution.kt" -} - -task codegen_blackbox_collections_irrelevantRemoveAtOverrideInJava (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantRemoveAtOverrideInJava.kt" -} - -task codegen_blackbox_collections_irrelevantSizeOverrideInJava (type: RunExternalTest) { - source = "codegen/blackbox/collections/irrelevantSizeOverrideInJava.kt" -} - -task codegen_blackbox_collections_mutableList (type: RunExternalTest) { - source = "codegen/blackbox/collections/mutableList.kt" -} - -task codegen_blackbox_collections_noStubsInJavaSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/collections/noStubsInJavaSuperClass.kt" -} - -task codegen_blackbox_collections_platformValueContains (type: RunExternalTest) { - source = "codegen/blackbox/collections/platformValueContains.kt" -} - -task codegen_blackbox_collections_readOnlyList (type: RunExternalTest) { - source = "codegen/blackbox/collections/readOnlyList.kt" -} - -task codegen_blackbox_collections_readOnlyMap (type: RunExternalTest) { - source = "codegen/blackbox/collections/readOnlyMap.kt" -} - -task codegen_blackbox_collections_removeAtInt (type: RunExternalTest) { - source = "codegen/blackbox/collections/removeAtInt.kt" -} - -task codegen_blackbox_collections_strList (type: RunExternalTest) { - source = "codegen/blackbox/collections/strList.kt" -} - -task codegen_blackbox_collections_toArrayInJavaClass (type: RunExternalTest) { - source = "codegen/blackbox/collections/toArrayInJavaClass.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle deleted file mode 100644 index 7f6f3319a0b..00000000000 --- a/backend.native/tests/external/codegen/blackbox/compatibility/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_compatibility_dataClassEqualsHashCodeToString (type: RunExternalTest) { - source = "codegen/blackbox/compatibility/dataClassEqualsHashCodeToString.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle deleted file mode 100644 index 9472bc858ec..00000000000 --- a/backend.native/tests/external/codegen/blackbox/constants/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_constants_constantsInWhen (type: RunExternalTest) { - source = "codegen/blackbox/constants/constantsInWhen.kt" -} - -task codegen_blackbox_constants_float (type: RunExternalTest) { - source = "codegen/blackbox/constants/float.kt" -} - -task codegen_blackbox_constants_kt9532 (type: RunExternalTest) { - source = "codegen/blackbox/constants/kt9532.kt" -} - -task codegen_blackbox_constants_long (type: RunExternalTest) { - source = "codegen/blackbox/constants/long.kt" -} - -task codegen_blackbox_constants_privateConst (type: RunExternalTest) { - source = "codegen/blackbox/constants/privateConst.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle deleted file mode 100644 index a16b2212325..00000000000 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_controlStructures_breakContinueInExpressions_breakFromOuter (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_breakInDoWhile (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/breakInDoWhile.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_breakInExpr (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/breakInExpr.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_continueInDoWhile (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/continueInDoWhile.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_continueInExpr (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/continueInExpr.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_inlineWithStack (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/inlineWithStack.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_innerLoopWithStack (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/innerLoopWithStack.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_kt14581 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/kt14581.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_kt9022And (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022And.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_kt9022Or (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/kt9022Or.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_popSizes (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/popSizes.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_tryFinally1 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally1.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_tryFinally2 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/tryFinally2.kt" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions_whileTrueBreak (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakContinueInExpressions/whileTrueBreak.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle deleted file mode 100644 index 0cdf521e7aa..00000000000 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/build-generated.gradle +++ /dev/null @@ -1,270 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_controlStructures_bottles (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/bottles.kt" -} - -task codegen_blackbox_controlStructures_breakInFinally (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/breakInFinally.kt" -} - -task codegen_blackbox_controlStructures_compareBoxedIntegerToZero (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/compareBoxedIntegerToZero.kt" -} - -task codegen_blackbox_controlStructures_conditionOfEmptyIf (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/conditionOfEmptyIf.kt" -} - -task codegen_blackbox_controlStructures_continueInExpr (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/continueInExpr.kt" -} - -task codegen_blackbox_controlStructures_continueInFor (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/continueInFor.kt" -} - -task codegen_blackbox_controlStructures_continueInForCondition (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/continueInForCondition.kt" -} - -task codegen_blackbox_controlStructures_continueInWhile (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/continueInWhile.kt" -} - -task codegen_blackbox_controlStructures_continueToLabelInFor (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/continueToLabelInFor.kt" -} - -task codegen_blackbox_controlStructures_doWhile (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/doWhile.kt" -} - -task codegen_blackbox_controlStructures_doWhileFib (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/doWhileFib.kt" -} - -task codegen_blackbox_controlStructures_doWhileWithContinue (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/doWhileWithContinue.kt" -} - -task codegen_blackbox_controlStructures_emptyDoWhile (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/emptyDoWhile.kt" -} - -task codegen_blackbox_controlStructures_emptyFor (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/emptyFor.kt" -} - -task codegen_blackbox_controlStructures_emptyWhile (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/emptyWhile.kt" -} - -task codegen_blackbox_controlStructures_factorialTest (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/factorialTest.kt" -} - -task codegen_blackbox_controlStructures_finallyOnEmptyReturn (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/finallyOnEmptyReturn.kt" -} - -task codegen_blackbox_controlStructures_forArrayList (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forArrayList.kt" -} - -task codegen_blackbox_controlStructures_forArrayListMultiDecl (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forArrayListMultiDecl.kt" -} - -task codegen_blackbox_controlStructures_forInSmartCastToArray (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forInSmartCastToArray.kt" -} - -task codegen_blackbox_controlStructures_forIntArray (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forIntArray.kt" -} - -task codegen_blackbox_controlStructures_forLoopMemberExtensionAll (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt" -} - -task codegen_blackbox_controlStructures_forLoopMemberExtensionHasNext (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forLoopMemberExtensionHasNext.kt" -} - -task codegen_blackbox_controlStructures_forLoopMemberExtensionNext (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt" -} - -task codegen_blackbox_controlStructures_forNullableIntArray (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forNullableIntArray.kt" -} - -task codegen_blackbox_controlStructures_forPrimitiveIntArray (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forPrimitiveIntArray.kt" -} - -task codegen_blackbox_controlStructures_forUserType (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/forUserType.kt" -} - -task codegen_blackbox_controlStructures_inRangeConditionsInWhen (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/inRangeConditionsInWhen.kt" -} - -task codegen_blackbox_controlStructures_kt12908 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt12908.kt" -} - -task codegen_blackbox_controlStructures_kt12908_2 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt12908_2.kt" -} - -task codegen_blackbox_controlStructures_kt1441 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt1441.kt" -} - -task codegen_blackbox_controlStructures_kt14839 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt14839.kt" -} - -task codegen_blackbox_controlStructures_kt1688 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt1688.kt" -} - -task codegen_blackbox_controlStructures_kt1742 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt1742.kt" -} - -task codegen_blackbox_controlStructures_kt1899 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt1899.kt" -} - -task codegen_blackbox_controlStructures_kt2147 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2147.kt" -} - -task codegen_blackbox_controlStructures_kt2259 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2259.kt" -} - -task codegen_blackbox_controlStructures_kt2291 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2291.kt" -} - -task codegen_blackbox_controlStructures_kt237 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt237.kt" -} - -task codegen_blackbox_controlStructures_kt2416 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2416.kt" -} - -task codegen_blackbox_controlStructures_kt2423 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2423.kt" -} - -task codegen_blackbox_controlStructures_kt2577 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2577.kt" -} - -task codegen_blackbox_controlStructures_kt2597 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt2597.kt" -} - -task codegen_blackbox_controlStructures_kt299 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt299.kt" -} - -task codegen_blackbox_controlStructures_kt3087 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt3087.kt" -} - -task codegen_blackbox_controlStructures_kt3203_1 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt3203_1.kt" -} - -task codegen_blackbox_controlStructures_kt3203_2 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt3203_2.kt" -} - -task codegen_blackbox_controlStructures_kt3273 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt3273.kt" -} - -task codegen_blackbox_controlStructures_kt3280 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt3280.kt" -} - -task codegen_blackbox_controlStructures_kt3574 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt3574.kt" -} - -task codegen_blackbox_controlStructures_kt416 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt416.kt" -} - -task codegen_blackbox_controlStructures_kt513 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt513.kt" -} - -task codegen_blackbox_controlStructures_kt628 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt628.kt" -} - -task codegen_blackbox_controlStructures_kt769 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt769.kt" -} - -task codegen_blackbox_controlStructures_kt772 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt772.kt" -} - -task codegen_blackbox_controlStructures_kt773 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt773.kt" -} - -task codegen_blackbox_controlStructures_kt8148 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt8148.kt" -} - -task codegen_blackbox_controlStructures_kt8148_break (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt8148_break.kt" -} - -task codegen_blackbox_controlStructures_kt8148_continue (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt8148_continue.kt" -} - -task codegen_blackbox_controlStructures_kt870 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt870.kt" -} - -task codegen_blackbox_controlStructures_kt9022Return (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt9022Return.kt" -} - -task codegen_blackbox_controlStructures_kt9022Throw (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt9022Throw.kt" -} - -task codegen_blackbox_controlStructures_kt910 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt910.kt" -} - -task codegen_blackbox_controlStructures_kt958 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/kt958.kt" -} - -task codegen_blackbox_controlStructures_longRange (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/longRange.kt" -} - -task codegen_blackbox_controlStructures_quicksort (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/quicksort.kt" -} - -task codegen_blackbox_controlStructures_tryCatchFinallyChain (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchFinallyChain.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle deleted file mode 100644 index 99785c13a72..00000000000 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/returnsNothing/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_controlStructures_returnsNothing_ifElse (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/returnsNothing/ifElse.kt" -} - -task codegen_blackbox_controlStructures_returnsNothing_inlineMethod (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/returnsNothing/inlineMethod.kt" -} - -task codegen_blackbox_controlStructures_returnsNothing_propertyGetter (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/returnsNothing/propertyGetter.kt" -} - -task codegen_blackbox_controlStructures_returnsNothing_tryCatch (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/returnsNothing/tryCatch.kt" -} - -task codegen_blackbox_controlStructures_returnsNothing_when (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/returnsNothing/when.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle deleted file mode 100644 index ec04d74ebbb..00000000000 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/build-generated.gradle +++ /dev/null @@ -1,90 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_controlStructures_tryCatchInExpressions_catch (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/catch.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_complexChain (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/complexChain.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_deadTryCatch (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/deadTryCatch.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_differentTypes (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_expectException (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/expectException.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_finally (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/finally.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_inlineTryCatch (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryCatch.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_inlineTryExpr (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryExpr.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_inlineTryFinally (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/inlineTryFinally.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_kt8608 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/kt8608.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_kt9644try (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/kt9644try.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_multipleCatchBlocks (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_splitTry (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/splitTry.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_splitTryCorner1 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner1.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_splitTryCorner2 (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/splitTryCorner2.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_try (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/try.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_tryAfterTry (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryAfterTry.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_tryAndBreak (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndBreak.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_tryAndContinue (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryAndContinue.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_tryInsideCatch (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideCatch.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_tryInsideTry (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/tryInsideTry.kt" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions_unmatchedInlineMarkers (type: RunExternalTest) { - source = "codegen/blackbox/controlStructures/tryCatchInExpressions/unmatchedInlineMarkers.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle deleted file mode 100644 index 037ff7b0bc8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/build-generated.gradle +++ /dev/null @@ -1,198 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_asyncIterator (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/asyncIterator.kt" -} - -task codegen_blackbox_coroutines_await (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/await.kt" -} - -task codegen_blackbox_coroutines_beginWithException (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/beginWithException.kt" -} - -task codegen_blackbox_coroutines_beginWithExceptionNoHandleException (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/beginWithExceptionNoHandleException.kt" -} - -task codegen_blackbox_coroutines_coercionToUnit (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/coercionToUnit.kt" -} - -task codegen_blackbox_coroutines_controllerAccessFromInnerLambda (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controllerAccessFromInnerLambda.kt" -} - -task codegen_blackbox_coroutines_defaultParametersInSuspend (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/defaultParametersInSuspend.kt" -} - -task codegen_blackbox_coroutines_dispatchResume (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/dispatchResume.kt" -} - -task codegen_blackbox_coroutines_emptyClosure (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/emptyClosure.kt" -} - -task codegen_blackbox_coroutines_falseUnitCoercion (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/falseUnitCoercion.kt" -} - -task codegen_blackbox_coroutines_generate (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/generate.kt" -} - -task codegen_blackbox_coroutines_handleException (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/handleException.kt" -} - -task codegen_blackbox_coroutines_handleResultCallEmptyBody (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/handleResultCallEmptyBody.kt" -} - -task codegen_blackbox_coroutines_handleResultNonUnitExpression (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/handleResultNonUnitExpression.kt" -} - -task codegen_blackbox_coroutines_handleResultSuspended (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/handleResultSuspended.kt" -} - -task codegen_blackbox_coroutines_illegalState (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/illegalState.kt" -} - -task codegen_blackbox_coroutines_inlinedTryCatchFinally (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/inlinedTryCatchFinally.kt" -} - -task codegen_blackbox_coroutines_inlineSuspendFunction (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/inlineSuspendFunction.kt" -} - -task codegen_blackbox_coroutines_innerSuspensionCalls (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/innerSuspensionCalls.kt" -} - -task codegen_blackbox_coroutines_instanceOfContinuation (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/instanceOfContinuation.kt" -} - -task codegen_blackbox_coroutines_iterateOverArray (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/iterateOverArray.kt" -} - -task codegen_blackbox_coroutines_kt12958 (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/kt12958.kt" -} - -task codegen_blackbox_coroutines_lastExpressionIsLoop (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/lastExpressionIsLoop.kt" -} - -task codegen_blackbox_coroutines_lastStatementInc (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/lastStatementInc.kt" -} - -task codegen_blackbox_coroutines_lastStementAssignment (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/lastStementAssignment.kt" -} - -task codegen_blackbox_coroutines_lastUnitExpression (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/lastUnitExpression.kt" -} - -task codegen_blackbox_coroutines_multipleInvokeCalls (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/multipleInvokeCalls.kt" -} - -task codegen_blackbox_coroutines_multipleInvokeCallsInsideInlineLambda1 (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda1.kt" -} - -task codegen_blackbox_coroutines_multipleInvokeCallsInsideInlineLambda2 (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda2.kt" -} - -task codegen_blackbox_coroutines_multipleInvokeCallsInsideInlineLambda3 (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/multipleInvokeCallsInsideInlineLambda3.kt" -} - -task codegen_blackbox_coroutines_nestedTryCatch (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/nestedTryCatch.kt" -} - -task codegen_blackbox_coroutines_nonLocalReturnFromInlineLambda (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/nonLocalReturnFromInlineLambda.kt" -} - -task codegen_blackbox_coroutines_nonLocalReturnFromInlineLambdaDeep (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/nonLocalReturnFromInlineLambdaDeep.kt" -} - -task codegen_blackbox_coroutines_noSuspensionPoints (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/noSuspensionPoints.kt" -} - -task codegen_blackbox_coroutines_returnByLabel (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/returnByLabel.kt" -} - -task codegen_blackbox_coroutines_simple (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/simple.kt" -} - -task codegen_blackbox_coroutines_simpleException (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/simpleException.kt" -} - -task codegen_blackbox_coroutines_simpleWithHandleResult (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/simpleWithHandleResult.kt" -} - -task codegen_blackbox_coroutines_statementLikeLastExpression (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/statementLikeLastExpression.kt" -} - -task codegen_blackbox_coroutines_suspendDelegation (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/suspendDelegation.kt" -} - -task codegen_blackbox_coroutines_suspendFromInlineLambda (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/suspendFromInlineLambda.kt" -} - -task codegen_blackbox_coroutines_suspendInCycle (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/suspendInCycle.kt" -} - -task codegen_blackbox_coroutines_suspendInTheMiddleOfObjectConstruction (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/suspendInTheMiddleOfObjectConstruction.kt" -} - -task codegen_blackbox_coroutines_tryCatchFinallyWithHandleResult (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/tryCatchFinallyWithHandleResult.kt" -} - -task codegen_blackbox_coroutines_tryCatchWithHandleResult (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/tryCatchWithHandleResult.kt" -} - -task codegen_blackbox_coroutines_tryFinallyInsideInlineLambda (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/tryFinallyInsideInlineLambda.kt" -} - -task codegen_blackbox_coroutines_tryFinallyWithHandleResult (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/tryFinallyWithHandleResult.kt" -} - -task codegen_blackbox_coroutines_varValueConflictsWithTable (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/varValueConflictsWithTable.kt" -} - -task codegen_blackbox_coroutines_varValueConflictsWithTableSameSort (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/varValueConflictsWithTableSameSort.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle deleted file mode 100644 index 836c22d4207..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/controlFlow/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_controlFlow_breakFinally (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/breakFinally.kt" -} - -task codegen_blackbox_coroutines_controlFlow_breakStatement (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/breakStatement.kt" -} - -task codegen_blackbox_coroutines_controlFlow_doWhileStatement (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/doWhileStatement.kt" -} - -task codegen_blackbox_coroutines_controlFlow_forContinue (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/forContinue.kt" -} - -task codegen_blackbox_coroutines_controlFlow_forStatement (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/forStatement.kt" -} - -task codegen_blackbox_coroutines_controlFlow_ifStatement (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/ifStatement.kt" -} - -task codegen_blackbox_coroutines_controlFlow_returnFromFinally (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/returnFromFinally.kt" -} - -task codegen_blackbox_coroutines_controlFlow_switchLikeWhen (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/switchLikeWhen.kt" -} - -task codegen_blackbox_coroutines_controlFlow_throwFromCatch (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/throwFromCatch.kt" -} - -task codegen_blackbox_coroutines_controlFlow_throwInTryWithHandleResult (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/throwInTryWithHandleResult.kt" -} - -task codegen_blackbox_coroutines_controlFlow_whileStatement (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/controlFlow/whileStatement.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle deleted file mode 100644 index 4d33ceb6580..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/intLikeVarSpilling/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_intLikeVarSpilling_complicatedMerge (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/complicatedMerge.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_i2bResult (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/i2bResult.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_loadFromBooleanArray (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_loadFromByteArray (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/loadFromByteArray.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_noVariableInTable (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/noVariableInTable.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_sameIconst1ManyVars (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_usedInArrayStore (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInArrayStore.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_usedInMethodCall (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInMethodCall.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_usedInPutfield (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInPutfield.kt" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling_usedInVarStore (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/intLikeVarSpilling/usedInVarStore.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle deleted file mode 100644 index 4ac7ae13d6b..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/multiModule/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_multiModule_inlineFunctionWithOptionalParam (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/multiModule/inlineFunctionWithOptionalParam.kt" -} - -task codegen_blackbox_coroutines_multiModule_simple (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/multiModule/simple.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle deleted file mode 100644 index 9acee24c01f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/stackUnwinding/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_stackUnwinding_exception (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/stackUnwinding/exception.kt" -} - -task codegen_blackbox_coroutines_stackUnwinding_inlineSuspendFunction (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/stackUnwinding/inlineSuspendFunction.kt" -} - -task codegen_blackbox_coroutines_stackUnwinding_simple (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/stackUnwinding/simple.kt" -} - -task codegen_blackbox_coroutines_stackUnwinding_suspendInCycle (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/stackUnwinding/suspendInCycle.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle deleted file mode 100644 index 102174207e1..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/suspendFunctionTypeCall/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_suspendFunctionTypeCall_manyParameters (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/suspendFunctionTypeCall/manyParameters.kt" -} - -task codegen_blackbox_coroutines_suspendFunctionTypeCall_simple (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/suspendFunctionTypeCall/simple.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle deleted file mode 100644 index 91315961617..00000000000 --- a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_coroutines_unitTypeReturn_coroutineNonLocalReturn (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt" -} - -task codegen_blackbox_coroutines_unitTypeReturn_coroutineReturn (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/unitTypeReturn/coroutineReturn.kt" -} - -task codegen_blackbox_coroutines_unitTypeReturn_suspendNonLocalReturn (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt" -} - -task codegen_blackbox_coroutines_unitTypeReturn_suspendReturn (type: RunExternalTest) { - source = "codegen/blackbox/coroutines/unitTypeReturn/suspendReturn.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle deleted file mode 100644 index 9558c630034..00000000000 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/build-generated.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_dataClasses_arrayParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/arrayParams.kt" -} - -task codegen_blackbox_dataClasses_changingVarParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/changingVarParam.kt" -} - -task codegen_blackbox_dataClasses_doubleParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/doubleParam.kt" -} - -task codegen_blackbox_dataClasses_floatParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/floatParam.kt" -} - -task codegen_blackbox_dataClasses_genericParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/genericParam.kt" -} - -task codegen_blackbox_dataClasses_kt5002 (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/kt5002.kt" -} - -task codegen_blackbox_dataClasses_mixedParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/mixedParams.kt" -} - -task codegen_blackbox_dataClasses_multiDeclaration (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/multiDeclaration.kt" -} - -task codegen_blackbox_dataClasses_multiDeclarationFor (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/multiDeclarationFor.kt" -} - -task codegen_blackbox_dataClasses_nonTrivialFinalMemberInSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/nonTrivialFinalMemberInSuperClass.kt" -} - -task codegen_blackbox_dataClasses_nonTrivialMemberInSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/nonTrivialMemberInSuperClass.kt" -} - -task codegen_blackbox_dataClasses_privateValParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/privateValParams.kt" -} - -task codegen_blackbox_dataClasses_twoValParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/twoValParams.kt" -} - -task codegen_blackbox_dataClasses_twoVarParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/twoVarParams.kt" -} - -task codegen_blackbox_dataClasses_unitComponent (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/unitComponent.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle deleted file mode 100644 index 383e50cdbc8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/copy/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_dataClasses_copy_constructorWithDefaultParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/constructorWithDefaultParam.kt" -} - -task codegen_blackbox_dataClasses_copy_copyInObjectNestedDataClass (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/copyInObjectNestedDataClass.kt" -} - -task codegen_blackbox_dataClasses_copy_kt12708 (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/kt12708.kt" -} - -task codegen_blackbox_dataClasses_copy_kt3033 (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/kt3033.kt" -} - -task codegen_blackbox_dataClasses_copy_valInConstructorParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/valInConstructorParams.kt" -} - -task codegen_blackbox_dataClasses_copy_varInConstructorParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/varInConstructorParams.kt" -} - -task codegen_blackbox_dataClasses_copy_withGenericParameter (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/copy/withGenericParameter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle deleted file mode 100644 index b3ce55015fd..00000000000 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_dataClasses_equals_alreadyDeclared (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/equals/alreadyDeclared.kt" -} - -task codegen_blackbox_dataClasses_equals_alreadyDeclaredWrongSignature (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt" -} - -task codegen_blackbox_dataClasses_equals_genericarray (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/equals/genericarray.kt" -} - -task codegen_blackbox_dataClasses_equals_intarray (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/equals/intarray.kt" -} - -task codegen_blackbox_dataClasses_equals_nullother (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/equals/nullother.kt" -} - -task codegen_blackbox_dataClasses_equals_sameinstance (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/equals/sameinstance.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle deleted file mode 100644 index e6a4e26f5e1..00000000000 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_dataClasses_hashCode_alreadyDeclared (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/alreadyDeclared.kt" -} - -task codegen_blackbox_dataClasses_hashCode_alreadyDeclaredWrongSignature (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt" -} - -task codegen_blackbox_dataClasses_hashCode_array (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/array.kt" -} - -task codegen_blackbox_dataClasses_hashCode_boolean (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/boolean.kt" -} - -task codegen_blackbox_dataClasses_hashCode_byte (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/byte.kt" -} - -task codegen_blackbox_dataClasses_hashCode_char (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/char.kt" -} - -task codegen_blackbox_dataClasses_hashCode_double (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/double.kt" -} - -task codegen_blackbox_dataClasses_hashCode_float (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/float.kt" -} - -task codegen_blackbox_dataClasses_hashCode_genericNull (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/genericNull.kt" -} - -task codegen_blackbox_dataClasses_hashCode_int (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/int.kt" -} - -task codegen_blackbox_dataClasses_hashCode_long (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/long.kt" -} - -task codegen_blackbox_dataClasses_hashCode_null (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/null.kt" -} - -task codegen_blackbox_dataClasses_hashCode_short (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/hashCode/short.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle deleted file mode 100644 index 6e10a5157cb..00000000000 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_dataClasses_toString_alreadyDeclared (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/alreadyDeclared.kt" -} - -task codegen_blackbox_dataClasses_toString_alreadyDeclaredWrongSignature (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt" -} - -task codegen_blackbox_dataClasses_toString_arrayParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/arrayParams.kt" -} - -task codegen_blackbox_dataClasses_toString_changingVarParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/changingVarParam.kt" -} - -task codegen_blackbox_dataClasses_toString_genericParam (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/genericParam.kt" -} - -task codegen_blackbox_dataClasses_toString_mixedParams (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/mixedParams.kt" -} - -task codegen_blackbox_dataClasses_toString_unitComponent (type: RunExternalTest) { - source = "codegen/blackbox/dataClasses/toString/unitComponent.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle deleted file mode 100644 index 61555c67913..00000000000 --- a/backend.native/tests/external/codegen/blackbox/deadCodeElimination/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_deadCodeElimination_emptyVariableRange (type: RunExternalTest) { - source = "codegen/blackbox/deadCodeElimination/emptyVariableRange.kt" -} - -task codegen_blackbox_deadCodeElimination_intersectingVariableRange (type: RunExternalTest) { - source = "codegen/blackbox/deadCodeElimination/intersectingVariableRange.kt" -} - -task codegen_blackbox_deadCodeElimination_intersectingVariableRangeInFinally (type: RunExternalTest) { - source = "codegen/blackbox/deadCodeElimination/intersectingVariableRangeInFinally.kt" -} - -task codegen_blackbox_deadCodeElimination_kt14357 (type: RunExternalTest) { - source = "codegen/blackbox/deadCodeElimination/kt14357.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle deleted file mode 100644 index 26267364d16..00000000000 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_defaultArguments_kt6382 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/kt6382.kt" -} - -task codegen_blackbox_defaultArguments_protected (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/protected.kt" -} - -task codegen_blackbox_defaultArguments_simpleFromOtherFile (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/simpleFromOtherFile.kt" -} - -task codegen_blackbox_defaultArguments_superCallCheck (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/superCallCheck.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle deleted file mode 100644 index 0c3b27ffcae..00000000000 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_defaultArguments_constructor_annotation (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/annotation.kt" -} - -task codegen_blackbox_defaultArguments_constructor_checkIfConstructorIsSynthetic (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt" -} - -task codegen_blackbox_defaultArguments_constructor_defArgs1 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/defArgs1.kt" -} - -task codegen_blackbox_defaultArguments_constructor_defArgs1InnerClass (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/defArgs1InnerClass.kt" -} - -task codegen_blackbox_defaultArguments_constructor_defArgs2 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/defArgs2.kt" -} - -task codegen_blackbox_defaultArguments_constructor_doubleDefArgs1InnerClass (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/doubleDefArgs1InnerClass.kt" -} - -task codegen_blackbox_defaultArguments_constructor_enum (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/enum.kt" -} - -task codegen_blackbox_defaultArguments_constructor_enumWithOneDefArg (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/enumWithOneDefArg.kt" -} - -task codegen_blackbox_defaultArguments_constructor_enumWithTwoDefArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/enumWithTwoDefArgs.kt" -} - -task codegen_blackbox_defaultArguments_constructor_enumWithTwoDoubleDefArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt" -} - -task codegen_blackbox_defaultArguments_constructor_kt2852 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/kt2852.kt" -} - -task codegen_blackbox_defaultArguments_constructor_kt3060 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/kt3060.kt" -} - -task codegen_blackbox_defaultArguments_constructor_manyArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/constructor/manyArgs.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle deleted file mode 100644 index b1c9a9234b4..00000000000 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/convention/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_defaultArguments_convention_incWithDefaultInGetter (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/convention/incWithDefaultInGetter.kt" -} - -task codegen_blackbox_defaultArguments_convention_kt9140 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/convention/kt9140.kt" -} - -task codegen_blackbox_defaultArguments_convention_plusAssignWithDefaultInGetter (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/convention/plusAssignWithDefaultInGetter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle deleted file mode 100644 index 99778f909c1..00000000000 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/function/build-generated.gradle +++ /dev/null @@ -1,82 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_defaultArguments_function_abstractClass (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/abstractClass.kt" -} - -task codegen_blackbox_defaultArguments_function_covariantOverride (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/covariantOverride.kt" -} - -task codegen_blackbox_defaultArguments_function_covariantOverrideGeneric (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/covariantOverrideGeneric.kt" -} - -task codegen_blackbox_defaultArguments_function_extensionFunctionManyArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extensionFunctionManyArgs.kt" -} - -task codegen_blackbox_defaultArguments_function_extentionFunction (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extentionFunction.kt" -} - -task codegen_blackbox_defaultArguments_function_extentionFunctionDouble (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extentionFunctionDouble.kt" -} - -task codegen_blackbox_defaultArguments_function_extentionFunctionDoubleTwoArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extentionFunctionDoubleTwoArgs.kt" -} - -task codegen_blackbox_defaultArguments_function_extentionFunctionInClassObject (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extentionFunctionInClassObject.kt" -} - -task codegen_blackbox_defaultArguments_function_extentionFunctionInObject (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extentionFunctionInObject.kt" -} - -task codegen_blackbox_defaultArguments_function_extentionFunctionWithOneDefArg (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/extentionFunctionWithOneDefArg.kt" -} - -task codegen_blackbox_defaultArguments_function_funInTrait (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/funInTrait.kt" -} - -task codegen_blackbox_defaultArguments_function_innerExtentionFunction (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/innerExtentionFunction.kt" -} - -task codegen_blackbox_defaultArguments_function_innerExtentionFunctionDouble (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/innerExtentionFunctionDouble.kt" -} - -task codegen_blackbox_defaultArguments_function_innerExtentionFunctionDoubleTwoArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/innerExtentionFunctionDoubleTwoArgs.kt" -} - -task codegen_blackbox_defaultArguments_function_innerExtentionFunctionManyArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/innerExtentionFunctionManyArgs.kt" -} - -task codegen_blackbox_defaultArguments_function_kt5232 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/kt5232.kt" -} - -task codegen_blackbox_defaultArguments_function_memberFunctionManyArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/memberFunctionManyArgs.kt" -} - -task codegen_blackbox_defaultArguments_function_mixingNamedAndPositioned (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/mixingNamedAndPositioned.kt" -} - -task codegen_blackbox_defaultArguments_function_topLevelManyArgs (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/topLevelManyArgs.kt" -} - -task codegen_blackbox_defaultArguments_function_trait (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/function/trait.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle deleted file mode 100644 index 7c464172c7d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/private/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_defaultArguments_private_memberExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/private/memberExtensionFunction.kt" -} - -task codegen_blackbox_defaultArguments_private_memberFunction (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/private/memberFunction.kt" -} - -task codegen_blackbox_defaultArguments_private_primaryConstructor (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/private/primaryConstructor.kt" -} - -task codegen_blackbox_defaultArguments_private_secondaryConstructor (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/private/secondaryConstructor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle deleted file mode 100644 index 9d00a16a78f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/signature/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_defaultArguments_signature_kt2789 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/signature/kt2789.kt" -} - -task codegen_blackbox_defaultArguments_signature_kt9428 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/signature/kt9428.kt" -} - -task codegen_blackbox_defaultArguments_signature_kt9924 (type: RunExternalTest) { - source = "codegen/blackbox/defaultArguments/signature/kt9924.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle deleted file mode 100644 index 64b91cddbd4..00000000000 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/build-generated.gradle +++ /dev/null @@ -1,150 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_delegatedProperty_accessTopLevelDelegatedPropertyInClinit (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/accessTopLevelDelegatedPropertyInClinit.kt" -} - -task codegen_blackbox_delegatedProperty_capturePropertyInClosure (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/capturePropertyInClosure.kt" -} - -task codegen_blackbox_delegatedProperty_castGetReturnType (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/castGetReturnType.kt" -} - -task codegen_blackbox_delegatedProperty_castSetParameter (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/castSetParameter.kt" -} - -task codegen_blackbox_delegatedProperty_delegateAsInnerClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateAsInnerClass.kt" -} - -task codegen_blackbox_delegatedProperty_delegateByOtherProperty (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateByOtherProperty.kt" -} - -task codegen_blackbox_delegatedProperty_delegateByTopLevelFun (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateByTopLevelFun.kt" -} - -task codegen_blackbox_delegatedProperty_delegateByTopLevelProperty (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateByTopLevelProperty.kt" -} - -task codegen_blackbox_delegatedProperty_delegateForExtProperty (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateForExtProperty.kt" -} - -task codegen_blackbox_delegatedProperty_delegateForExtPropertyInClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateForExtPropertyInClass.kt" -} - -task codegen_blackbox_delegatedProperty_delegateWithPrivateSet (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/delegateWithPrivateSet.kt" -} - -task codegen_blackbox_delegatedProperty_extensionDelegatesWithSameNames (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/extensionDelegatesWithSameNames.kt" -} - -task codegen_blackbox_delegatedProperty_extensionPropertyAndExtensionGetValue (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/extensionPropertyAndExtensionGetValue.kt" -} - -task codegen_blackbox_delegatedProperty_genericDelegate (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/genericDelegate.kt" -} - -task codegen_blackbox_delegatedProperty_getAsExtensionFun (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/getAsExtensionFun.kt" -} - -task codegen_blackbox_delegatedProperty_getAsExtensionFunInClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/getAsExtensionFunInClass.kt" -} - -task codegen_blackbox_delegatedProperty_inClassVal (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/inClassVal.kt" -} - -task codegen_blackbox_delegatedProperty_inClassVar (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/inClassVar.kt" -} - -task codegen_blackbox_delegatedProperty_inferredPropertyType (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/inferredPropertyType.kt" -} - -task codegen_blackbox_delegatedProperty_inTrait (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/inTrait.kt" -} - -task codegen_blackbox_delegatedProperty_kt4138 (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/kt4138.kt" -} - -task codegen_blackbox_delegatedProperty_kt6722 (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/kt6722.kt" -} - -task codegen_blackbox_delegatedProperty_kt9712 (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/kt9712.kt" -} - -task codegen_blackbox_delegatedProperty_privateSetterKPropertyIsNotMutable (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt" -} - -task codegen_blackbox_delegatedProperty_privateVar (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/privateVar.kt" -} - -task codegen_blackbox_delegatedProperty_propertyMetadataShouldBeCached (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt" -} - -task codegen_blackbox_delegatedProperty_protectedVarWithPrivateSet (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/protectedVarWithPrivateSet.kt" -} - -task codegen_blackbox_delegatedProperty_setAsExtensionFun (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/setAsExtensionFun.kt" -} - -task codegen_blackbox_delegatedProperty_setAsExtensionFunInClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/setAsExtensionFunInClass.kt" -} - -task codegen_blackbox_delegatedProperty_stackOverflowOnCallFromGetValue (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt" -} - -task codegen_blackbox_delegatedProperty_topLevelVal (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/topLevelVal.kt" -} - -task codegen_blackbox_delegatedProperty_topLevelVar (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/topLevelVar.kt" -} - -task codegen_blackbox_delegatedProperty_twoPropByOneDelegete (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/twoPropByOneDelegete.kt" -} - -task codegen_blackbox_delegatedProperty_useKPropertyLater (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/useKPropertyLater.kt" -} - -task codegen_blackbox_delegatedProperty_useReflectionOnKProperty (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt" -} - -task codegen_blackbox_delegatedProperty_valInInnerClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/valInInnerClass.kt" -} - -task codegen_blackbox_delegatedProperty_varInInnerClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/varInInnerClass.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle deleted file mode 100644 index df09fe9d0b1..00000000000 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/local/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_delegatedProperty_local_capturedLocalVal (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/capturedLocalVal.kt" -} - -task codegen_blackbox_delegatedProperty_local_capturedLocalValNoInline (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/capturedLocalValNoInline.kt" -} - -task codegen_blackbox_delegatedProperty_local_capturedLocalVar (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/capturedLocalVar.kt" -} - -task codegen_blackbox_delegatedProperty_local_capturedLocalVarNoInline (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/capturedLocalVarNoInline.kt" -} - -task codegen_blackbox_delegatedProperty_local_inlineGetValue (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/inlineGetValue.kt" -} - -task codegen_blackbox_delegatedProperty_local_inlineOperators (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/inlineOperators.kt" -} - -task codegen_blackbox_delegatedProperty_local_kt12891 (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/kt12891.kt" -} - -task codegen_blackbox_delegatedProperty_local_kt13557 (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/kt13557.kt" -} - -task codegen_blackbox_delegatedProperty_local_localVal (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/localVal.kt" -} - -task codegen_blackbox_delegatedProperty_local_localValNoExplicitType (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/localValNoExplicitType.kt" -} - -task codegen_blackbox_delegatedProperty_local_localVar (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/localVar.kt" -} - -task codegen_blackbox_delegatedProperty_local_localVarNoExplicitType (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/local/localVarNoExplicitType.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle deleted file mode 100644 index 11d0067e096..00000000000 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/build-generated.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_delegatedProperty_provideDelegate_differentReceivers (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/differentReceivers.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_evaluationOrder (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrder.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_evaluationOrderVar (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/evaluationOrderVar.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_extensionDelegated (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/extensionDelegated.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_generic (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/generic.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_hostCheck (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/hostCheck.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_inClass (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/inClass.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_inlineProvideDelegate (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/inlineProvideDelegate.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_jvmStaticInObject (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_kt15437 (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/kt15437.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_local (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/local.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_localCaptured (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/localCaptured.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_localDifferentReceivers (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/localDifferentReceivers.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_memberExtension (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/memberExtension.kt" -} - -task codegen_blackbox_delegatedProperty_provideDelegate_propertyMetadata (type: RunExternalTest) { - source = "codegen/blackbox/delegatedProperty/provideDelegate/propertyMetadata.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle deleted file mode 100644 index c1d52b9f6f7..00000000000 --- a/backend.native/tests/external/codegen/blackbox/delegation/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_delegation_delegationToVal (type: RunExternalTest) { - source = "codegen/blackbox/delegation/delegationToVal.kt" -} - -task codegen_blackbox_delegation_kt8154 (type: RunExternalTest) { - source = "codegen/blackbox/delegation/kt8154.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle deleted file mode 100644 index d8fb2071174..00000000000 --- a/backend.native/tests/external/codegen/blackbox/destructuringDeclInLambdaParam/build-generated.gradle +++ /dev/null @@ -1,34 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_destructuringDeclInLambdaParam_extensionComponents (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/extensionComponents.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_generic (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/generic.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_inline (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/inline.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_otherParameters (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/otherParameters.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_simple (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/simple.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_stdlibUsages (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/stdlibUsages.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_underscoreNames (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/underscoreNames.kt" -} - -task codegen_blackbox_destructuringDeclInLambdaParam_withIndexed (type: RunExternalTest) { - source = "codegen/blackbox/destructuringDeclInLambdaParam/withIndexed.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle deleted file mode 100644 index 3ac388b8d16..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/inference/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_diagnostics_functions_inference_kt6176 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/inference/kt6176.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle deleted file mode 100644 index ebca3df30c2..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/invoke/onObjects/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObject1 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject1.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObject2 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObject2.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObjectOfNestedClass1 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass1.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnClassObjectOfNestedClass2 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnClassObjectOfNestedClass2.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnEnum1 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnEnum2 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnImportedEnum1 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnImportedEnum2 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnObject1 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject1.kt" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects_invokeOnObject2 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/invoke/onObjects/invokeOnObject2.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle deleted file mode 100644 index c4873bc324f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/functions/tailRecursion/build-generated.gradle +++ /dev/null @@ -1,150 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_diagnostics_functions_tailRecursion_defaultArgs (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgs.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_defaultArgsOverridden (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_extensionTailCall (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/extensionTailCall.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_functionWithNonTailRecursions (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_functionWithNoTails (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/functionWithNoTails.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_functionWithoutAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/functionWithoutAnnotation.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_infixCall (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/infixCall.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_infixRecursiveCall (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/infixRecursiveCall.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_insideElvis (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/insideElvis.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_labeledThisReferences (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/labeledThisReferences.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_loops (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/loops.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_multilevelBlocks (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/multilevelBlocks.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_realIteratorFoldl (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/realIteratorFoldl.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_realStringEscape (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/realStringEscape.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_realStringRepeat (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/realStringRepeat.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_recursiveCallInLambda (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_recursiveCallInLocalFunction (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_recursiveInnerFunction (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/recursiveInnerFunction.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_returnIf (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnIf.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_returnInCatch (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInCatch.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_returnInFinally (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInFinally.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_returnInIfInFinally (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInIfInFinally.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_returnInParentheses (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInParentheses.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_returnInTry (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/returnInTry.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_simpleBlock (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/simpleBlock.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_simpleReturn (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturn.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_simpleReturnWithElse (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_sum (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/sum.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_tailCallInBlockInParentheses (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInBlockInParentheses.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_tailCallInParentheses (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/tailCallInParentheses.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_tailRecursionInFinally (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_thisReferences (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/thisReferences.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_unitBlocks (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/unitBlocks.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithCondition (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithCondition.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithInRange (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithInRange.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithIs (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithIs.kt" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion_whenWithoutCondition (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/functions/tailRecursion/whenWithoutCondition.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle deleted file mode 100644 index 4529422e175..00000000000 --- a/backend.native/tests/external/codegen/blackbox/diagnostics/vararg/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_diagnostics_vararg_kt4172 (type: RunExternalTest) { - source = "codegen/blackbox/diagnostics/vararg/kt4172.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle deleted file mode 100644 index 18494aef99f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/elvis/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_elvis_genericNull (type: RunExternalTest) { - source = "codegen/blackbox/elvis/genericNull.kt" -} - -task codegen_blackbox_elvis_kt6694ExactAnnotationForElvis (type: RunExternalTest) { - source = "codegen/blackbox/elvis/kt6694ExactAnnotationForElvis.kt" -} - -task codegen_blackbox_elvis_nullNullOk (type: RunExternalTest) { - source = "codegen/blackbox/elvis/nullNullOk.kt" -} - -task codegen_blackbox_elvis_primitive (type: RunExternalTest) { - source = "codegen/blackbox/elvis/primitive.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle deleted file mode 100644 index ca2e41e47ec..00000000000 --- a/backend.native/tests/external/codegen/blackbox/enum/build-generated.gradle +++ /dev/null @@ -1,110 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_enum_abstractMethodInEnum (type: RunExternalTest) { - source = "codegen/blackbox/enum/abstractMethodInEnum.kt" -} - -task codegen_blackbox_enum_abstractNestedClass (type: RunExternalTest) { - source = "codegen/blackbox/enum/abstractNestedClass.kt" -} - -task codegen_blackbox_enum_asReturnExpression (type: RunExternalTest) { - source = "codegen/blackbox/enum/asReturnExpression.kt" -} - -task codegen_blackbox_enum_classForEnumEntry (type: RunExternalTest) { - source = "codegen/blackbox/enum/classForEnumEntry.kt" -} - -task codegen_blackbox_enum_companionObjectInEnum (type: RunExternalTest) { - source = "codegen/blackbox/enum/companionObjectInEnum.kt" -} - -task codegen_blackbox_enum_emptyConstructor (type: RunExternalTest) { - source = "codegen/blackbox/enum/emptyConstructor.kt" -} - -task codegen_blackbox_enum_emptyEnumValuesValueOf (type: RunExternalTest) { - source = "codegen/blackbox/enum/emptyEnumValuesValueOf.kt" -} - -task codegen_blackbox_enum_enumInheritedFromTrait (type: RunExternalTest) { - source = "codegen/blackbox/enum/enumInheritedFromTrait.kt" -} - -task codegen_blackbox_enum_enumShort (type: RunExternalTest) { - source = "codegen/blackbox/enum/enumShort.kt" -} - -task codegen_blackbox_enum_enumWithLambdaParameter (type: RunExternalTest) { - source = "codegen/blackbox/enum/enumWithLambdaParameter.kt" -} - -task codegen_blackbox_enum_inclassobj (type: RunExternalTest) { - source = "codegen/blackbox/enum/inclassobj.kt" -} - -task codegen_blackbox_enum_inner (type: RunExternalTest) { - source = "codegen/blackbox/enum/inner.kt" -} - -task codegen_blackbox_enum_innerWithExistingClassObject (type: RunExternalTest) { - source = "codegen/blackbox/enum/innerWithExistingClassObject.kt" -} - -task codegen_blackbox_enum_inPackage (type: RunExternalTest) { - source = "codegen/blackbox/enum/inPackage.kt" -} - -task codegen_blackbox_enum_kt1119 (type: RunExternalTest) { - source = "codegen/blackbox/enum/kt1119.kt" -} - -task codegen_blackbox_enum_kt2350 (type: RunExternalTest) { - source = "codegen/blackbox/enum/kt2350.kt" -} - -task codegen_blackbox_enum_kt9711 (type: RunExternalTest) { - source = "codegen/blackbox/enum/kt9711.kt" -} - -task codegen_blackbox_enum_kt9711_2 (type: RunExternalTest) { - source = "codegen/blackbox/enum/kt9711_2.kt" -} - -task codegen_blackbox_enum_modifierFlags (type: RunExternalTest) { - source = "codegen/blackbox/enum/modifierFlags.kt" -} - -task codegen_blackbox_enum_noClassForSimpleEnum (type: RunExternalTest) { - source = "codegen/blackbox/enum/noClassForSimpleEnum.kt" -} - -task codegen_blackbox_enum_objectInEnum (type: RunExternalTest) { - source = "codegen/blackbox/enum/objectInEnum.kt" -} - -task codegen_blackbox_enum_ordinal (type: RunExternalTest) { - source = "codegen/blackbox/enum/ordinal.kt" -} - -task codegen_blackbox_enum_simple (type: RunExternalTest) { - source = "codegen/blackbox/enum/simple.kt" -} - -task codegen_blackbox_enum_sortEnumEntries (type: RunExternalTest) { - source = "codegen/blackbox/enum/sortEnumEntries.kt" -} - -task codegen_blackbox_enum_superCallInEnumLiteral (type: RunExternalTest) { - source = "codegen/blackbox/enum/superCallInEnumLiteral.kt" -} - -task codegen_blackbox_enum_toString (type: RunExternalTest) { - source = "codegen/blackbox/enum/toString.kt" -} - -task codegen_blackbox_enum_valueof (type: RunExternalTest) { - source = "codegen/blackbox/enum/valueof.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle deleted file mode 100644 index 57455ff0614..00000000000 --- a/backend.native/tests/external/codegen/blackbox/evaluate/build-generated.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_evaluate_char (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/char.kt" -} - -task codegen_blackbox_evaluate_divide (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/divide.kt" -} - -task codegen_blackbox_evaluate_intrinsics (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/intrinsics.kt" -} - -task codegen_blackbox_evaluate_kt9443 (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/kt9443.kt" -} - -task codegen_blackbox_evaluate_maxValue (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/maxValue.kt" -} - -task codegen_blackbox_evaluate_maxValueByte (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/maxValueByte.kt" -} - -task codegen_blackbox_evaluate_maxValueInt (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/maxValueInt.kt" -} - -task codegen_blackbox_evaluate_minus (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/minus.kt" -} - -task codegen_blackbox_evaluate_mod (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/mod.kt" -} - -task codegen_blackbox_evaluate_multiply (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/multiply.kt" -} - -task codegen_blackbox_evaluate_parenthesized (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/parenthesized.kt" -} - -task codegen_blackbox_evaluate_plus (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/plus.kt" -} - -task codegen_blackbox_evaluate_simpleCallBinary (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/simpleCallBinary.kt" -} - -task codegen_blackbox_evaluate_unaryMinus (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/unaryMinus.kt" -} - -task codegen_blackbox_evaluate_unaryPlus (type: RunExternalTest) { - source = "codegen/blackbox/evaluate/unaryPlus.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle deleted file mode 100644 index 9bb6c4d3165..00000000000 --- a/backend.native/tests/external/codegen/blackbox/exclExcl/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_exclExcl_genericNull (type: RunExternalTest) { - source = "codegen/blackbox/exclExcl/genericNull.kt" -} - -task codegen_blackbox_exclExcl_primitive (type: RunExternalTest) { - source = "codegen/blackbox/exclExcl/primitive.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle deleted file mode 100644 index fe1d57a1532..00000000000 --- a/backend.native/tests/external/codegen/blackbox/extensionFunctions/build-generated.gradle +++ /dev/null @@ -1,90 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_extensionFunctions_executionOrder (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/executionOrder.kt" -} - -task codegen_blackbox_extensionFunctions_kt1061 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt1061.kt" -} - -task codegen_blackbox_extensionFunctions_kt1249 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt1249.kt" -} - -task codegen_blackbox_extensionFunctions_kt1290 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt1290.kt" -} - -task codegen_blackbox_extensionFunctions_kt1776 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt1776.kt" -} - -task codegen_blackbox_extensionFunctions_kt1953 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt1953.kt" -} - -task codegen_blackbox_extensionFunctions_kt1953_class (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt1953_class.kt" -} - -task codegen_blackbox_extensionFunctions_kt3285 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt3285.kt" -} - -task codegen_blackbox_extensionFunctions_kt3298 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt3298.kt" -} - -task codegen_blackbox_extensionFunctions_kt3646 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt3646.kt" -} - -task codegen_blackbox_extensionFunctions_kt3969 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt3969.kt" -} - -task codegen_blackbox_extensionFunctions_kt4228 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt4228.kt" -} - -task codegen_blackbox_extensionFunctions_kt475 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt475.kt" -} - -task codegen_blackbox_extensionFunctions_kt5467 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt5467.kt" -} - -task codegen_blackbox_extensionFunctions_kt606 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt606.kt" -} - -task codegen_blackbox_extensionFunctions_kt865 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/kt865.kt" -} - -task codegen_blackbox_extensionFunctions_nested2 (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/nested2.kt" -} - -task codegen_blackbox_extensionFunctions_shared (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/shared.kt" -} - -task codegen_blackbox_extensionFunctions_simple (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/simple.kt" -} - -task codegen_blackbox_extensionFunctions_thisMethodInObjectLiteral (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/thisMethodInObjectLiteral.kt" -} - -task codegen_blackbox_extensionFunctions_virtual (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/virtual.kt" -} - -task codegen_blackbox_extensionFunctions_whenFail (type: RunExternalTest) { - source = "codegen/blackbox/extensionFunctions/whenFail.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle deleted file mode 100644 index 4e5ae5cb71a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/extensionProperties/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_extensionProperties_accessorForPrivateSetter (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/accessorForPrivateSetter.kt" -} - -task codegen_blackbox_extensionProperties_genericValForPrimitiveType (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/genericValForPrimitiveType.kt" -} - -task codegen_blackbox_extensionProperties_genericValMultipleUpperBounds (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt" -} - -task codegen_blackbox_extensionProperties_genericVarForPrimitiveType (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/genericVarForPrimitiveType.kt" -} - -task codegen_blackbox_extensionProperties_inClass (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/inClass.kt" -} - -task codegen_blackbox_extensionProperties_inClassLongTypeInReceiver (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/inClassLongTypeInReceiver.kt" -} - -task codegen_blackbox_extensionProperties_inClassWithGetter (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/inClassWithGetter.kt" -} - -task codegen_blackbox_extensionProperties_inClassWithPrivateGetter (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/inClassWithPrivateGetter.kt" -} - -task codegen_blackbox_extensionProperties_inClassWithPrivateSetter (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/inClassWithPrivateSetter.kt" -} - -task codegen_blackbox_extensionProperties_inClassWithSetter (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/inClassWithSetter.kt" -} - -task codegen_blackbox_extensionProperties_kt9897 (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/kt9897.kt" -} - -task codegen_blackbox_extensionProperties_kt9897_topLevel (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/kt9897_topLevel.kt" -} - -task codegen_blackbox_extensionProperties_topLevel (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/topLevel.kt" -} - -task codegen_blackbox_extensionProperties_topLevelLongTypeInReceiver (type: RunExternalTest) { - source = "codegen/blackbox/extensionProperties/topLevelLongTypeInReceiver.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/external/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/external/build-generated.gradle deleted file mode 100644 index 0173ebf7211..00000000000 --- a/backend.native/tests/external/codegen/blackbox/external/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_external_jvmStaticExternal (type: RunExternalTest) { - source = "codegen/blackbox/external/jvmStaticExternal.kt" -} - -task codegen_blackbox_external_jvmStaticExternalPrivate (type: RunExternalTest) { - source = "codegen/blackbox/external/jvmStaticExternalPrivate.kt" -} - -task codegen_blackbox_external_withDefaultArg (type: RunExternalTest) { - source = "codegen/blackbox/external/withDefaultArg.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle deleted file mode 100644 index 5757b912608..00000000000 --- a/backend.native/tests/external/codegen/blackbox/fakeOverride/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_fakeOverride_diamondFunction (type: RunExternalTest) { - source = "codegen/blackbox/fakeOverride/diamondFunction.kt" -} - -task codegen_blackbox_fakeOverride_function (type: RunExternalTest) { - source = "codegen/blackbox/fakeOverride/function.kt" -} - -task codegen_blackbox_fakeOverride_propertyGetter (type: RunExternalTest) { - source = "codegen/blackbox/fakeOverride/propertyGetter.kt" -} - -task codegen_blackbox_fakeOverride_propertySetter (type: RunExternalTest) { - source = "codegen/blackbox/fakeOverride/propertySetter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle deleted file mode 100644 index 2c65a719a02..00000000000 --- a/backend.native/tests/external/codegen/blackbox/fieldRename/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_fieldRename_constructorAndClassObject (type: RunExternalTest) { - source = "codegen/blackbox/fieldRename/constructorAndClassObject.kt" -} - -task codegen_blackbox_fieldRename_delegates (type: RunExternalTest) { - source = "codegen/blackbox/fieldRename/delegates.kt" -} - -task codegen_blackbox_fieldRename_genericPropertyWithItself (type: RunExternalTest) { - source = "codegen/blackbox/fieldRename/genericPropertyWithItself.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle deleted file mode 100644 index 7df5ad718ae..00000000000 --- a/backend.native/tests/external/codegen/blackbox/finally/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_finally_finallyAndFinally (type: RunExternalTest) { - source = "codegen/blackbox/finally/finallyAndFinally.kt" -} - -task codegen_blackbox_finally_kt3549 (type: RunExternalTest) { - source = "codegen/blackbox/finally/kt3549.kt" -} - -task codegen_blackbox_finally_kt3706 (type: RunExternalTest) { - source = "codegen/blackbox/finally/kt3706.kt" -} - -task codegen_blackbox_finally_kt3867 (type: RunExternalTest) { - source = "codegen/blackbox/finally/kt3867.kt" -} - -task codegen_blackbox_finally_kt3874 (type: RunExternalTest) { - source = "codegen/blackbox/finally/kt3874.kt" -} - -task codegen_blackbox_finally_kt3894 (type: RunExternalTest) { - source = "codegen/blackbox/finally/kt3894.kt" -} - -task codegen_blackbox_finally_kt4134 (type: RunExternalTest) { - source = "codegen/blackbox/finally/kt4134.kt" -} - -task codegen_blackbox_finally_loopAndFinally (type: RunExternalTest) { - source = "codegen/blackbox/finally/loopAndFinally.kt" -} - -task codegen_blackbox_finally_notChainCatch (type: RunExternalTest) { - source = "codegen/blackbox/finally/notChainCatch.kt" -} - -task codegen_blackbox_finally_tryFinally (type: RunExternalTest) { - source = "codegen/blackbox/finally/tryFinally.kt" -} - -task codegen_blackbox_finally_tryLoopTry (type: RunExternalTest) { - source = "codegen/blackbox/finally/tryLoopTry.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle deleted file mode 100644 index 9773989905d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_fullJdk_charBuffer (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/charBuffer.kt" -} - -task codegen_blackbox_fullJdk_classpath (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/classpath.kt" -} - -task codegen_blackbox_fullJdk_ifInWhile (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/ifInWhile.kt" -} - -task codegen_blackbox_fullJdk_intCountDownLatchExtension (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/intCountDownLatchExtension.kt" -} - -task codegen_blackbox_fullJdk_kt434 (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/kt434.kt" -} - -task codegen_blackbox_fullJdk_platformTypeAssertionStackTrace (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/platformTypeAssertionStackTrace.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle deleted file mode 100644 index 976aa8bda77..00000000000 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/native/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_fullJdk_native_nativePropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt" -} - -task codegen_blackbox_fullJdk_native_simpleNative (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/native/simpleNative.kt" -} - -task codegen_blackbox_fullJdk_native_topLevel (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/native/topLevel.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle deleted file mode 100644 index c4dcbd4bfbc..00000000000 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_fullJdk_regressions_kt1770 (type: RunExternalTest) { - source = "codegen/blackbox/fullJdk/regressions/kt1770.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle deleted file mode 100644 index a8d74d6c87e..00000000000 --- a/backend.native/tests/external/codegen/blackbox/functions/build-generated.gradle +++ /dev/null @@ -1,174 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_functions_coerceVoidToArray (type: RunExternalTest) { - source = "codegen/blackbox/functions/coerceVoidToArray.kt" -} - -task codegen_blackbox_functions_coerceVoidToObject (type: RunExternalTest) { - source = "codegen/blackbox/functions/coerceVoidToObject.kt" -} - -task codegen_blackbox_functions_dataLocalVariable (type: RunExternalTest) { - source = "codegen/blackbox/functions/dataLocalVariable.kt" -} - -task codegen_blackbox_functions_defaultargs (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs.kt" -} - -task codegen_blackbox_functions_defaultargs1 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs1.kt" -} - -task codegen_blackbox_functions_defaultargs2 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs2.kt" -} - -task codegen_blackbox_functions_defaultargs3 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs3.kt" -} - -task codegen_blackbox_functions_defaultargs4 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs4.kt" -} - -task codegen_blackbox_functions_defaultargs5 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs5.kt" -} - -task codegen_blackbox_functions_defaultargs6 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs6.kt" -} - -task codegen_blackbox_functions_defaultargs7 (type: RunExternalTest) { - source = "codegen/blackbox/functions/defaultargs7.kt" -} - -task codegen_blackbox_functions_ea33909 (type: RunExternalTest) { - source = "codegen/blackbox/functions/ea33909.kt" -} - -task codegen_blackbox_functions_fakeDescriptorWithSeveralOverridenOne (type: RunExternalTest) { - source = "codegen/blackbox/functions/fakeDescriptorWithSeveralOverridenOne.kt" -} - -task codegen_blackbox_functions_functionNtoString (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionNtoString.kt" -} - -task codegen_blackbox_functions_functionNtoStringGeneric (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionNtoStringGeneric.kt" -} - -task codegen_blackbox_functions_functionNtoStringNoReflect (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionNtoStringNoReflect.kt" -} - -task codegen_blackbox_functions_infixRecursiveCall (type: RunExternalTest) { - source = "codegen/blackbox/functions/infixRecursiveCall.kt" -} - -task codegen_blackbox_functions_kt1038 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt1038.kt" -} - -task codegen_blackbox_functions_kt1199 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt1199.kt" -} - -task codegen_blackbox_functions_kt1413 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt1413.kt" -} - -task codegen_blackbox_functions_kt1649_1 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt1649_1.kt" -} - -task codegen_blackbox_functions_kt1649_2 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt1649_2.kt" -} - -task codegen_blackbox_functions_kt1739 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt1739.kt" -} - -task codegen_blackbox_functions_kt2270 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2270.kt" -} - -task codegen_blackbox_functions_kt2271 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2271.kt" -} - -task codegen_blackbox_functions_kt2280 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2280.kt" -} - -task codegen_blackbox_functions_kt2481 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2481.kt" -} - -task codegen_blackbox_functions_kt2716 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2716.kt" -} - -task codegen_blackbox_functions_kt2739 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2739.kt" -} - -task codegen_blackbox_functions_kt2929 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt2929.kt" -} - -task codegen_blackbox_functions_kt3214 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt3214.kt" -} - -task codegen_blackbox_functions_kt3313 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt3313.kt" -} - -task codegen_blackbox_functions_kt3573 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt3573.kt" -} - -task codegen_blackbox_functions_kt3724 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt3724.kt" -} - -task codegen_blackbox_functions_kt395 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt395.kt" -} - -task codegen_blackbox_functions_kt785 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt785.kt" -} - -task codegen_blackbox_functions_kt873 (type: RunExternalTest) { - source = "codegen/blackbox/functions/kt873.kt" -} - -task codegen_blackbox_functions_localFunction (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunction.kt" -} - -task codegen_blackbox_functions_localReturnInsideFunctionExpression (type: RunExternalTest) { - source = "codegen/blackbox/functions/localReturnInsideFunctionExpression.kt" -} - -task codegen_blackbox_functions_nothisnoclosure (type: RunExternalTest) { - source = "codegen/blackbox/functions/nothisnoclosure.kt" -} - -task codegen_blackbox_functions_prefixRecursiveCall (type: RunExternalTest) { - source = "codegen/blackbox/functions/prefixRecursiveCall.kt" -} - -task codegen_blackbox_functions_recursiveCompareTo (type: RunExternalTest) { - source = "codegen/blackbox/functions/recursiveCompareTo.kt" -} - -task codegen_blackbox_functions_recursiveIncrementCall (type: RunExternalTest) { - source = "codegen/blackbox/functions/recursiveIncrementCall.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle deleted file mode 100644 index 445c6cb2aef..00000000000 --- a/backend.native/tests/external/codegen/blackbox/functions/functionExpression/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_functions_functionExpression_functionExpression (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionExpression/functionExpression.kt" -} - -task codegen_blackbox_functions_functionExpression_functionExpressionWithThisReference (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionExpression/functionExpressionWithThisReference.kt" -} - -task codegen_blackbox_functions_functionExpression_functionLiteralExpression (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionExpression/functionLiteralExpression.kt" -} - -task codegen_blackbox_functions_functionExpression_underscoreParameters (type: RunExternalTest) { - source = "codegen/blackbox/functions/functionExpression/underscoreParameters.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle deleted file mode 100644 index f2a55b99390..00000000000 --- a/backend.native/tests/external/codegen/blackbox/functions/invoke/build-generated.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_functions_invoke_castFunctionToExtension (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/castFunctionToExtension.kt" -} - -task codegen_blackbox_functions_invoke_extensionInvokeOnExpr (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/extensionInvokeOnExpr.kt" -} - -task codegen_blackbox_functions_invoke_implicitInvokeInCompanionObjectWithFunctionalArgument (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/implicitInvokeInCompanionObjectWithFunctionalArgument.kt" -} - -task codegen_blackbox_functions_invoke_implicitInvokeWithFunctionLiteralArgument (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/implicitInvokeWithFunctionLiteralArgument.kt" -} - -task codegen_blackbox_functions_invoke_invoke (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/invoke.kt" -} - -task codegen_blackbox_functions_invoke_invokeOnExprByConvention (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/invokeOnExprByConvention.kt" -} - -task codegen_blackbox_functions_invoke_invokeOnSyntheticProperty (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt" -} - -task codegen_blackbox_functions_invoke_kt3189 (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3189.kt" -} - -task codegen_blackbox_functions_invoke_kt3190 (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3190.kt" -} - -task codegen_blackbox_functions_invoke_kt3297 (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3297.kt" -} - -task codegen_blackbox_functions_invoke_kt3450getAndInvoke (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3450getAndInvoke.kt" -} - -task codegen_blackbox_functions_invoke_kt3631invokeOnString (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3631invokeOnString.kt" -} - -task codegen_blackbox_functions_invoke_kt3772 (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3772.kt" -} - -task codegen_blackbox_functions_invoke_kt3821invokeOnThis (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3821invokeOnThis.kt" -} - -task codegen_blackbox_functions_invoke_kt3822invokeOnThis (type: RunExternalTest) { - source = "codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle deleted file mode 100644 index c247feb3eaa..00000000000 --- a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/build-generated.gradle +++ /dev/null @@ -1,66 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_functions_localFunctions_callInlineLocalInLambda (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/callInlineLocalInLambda.kt" -} - -task codegen_blackbox_functions_localFunctions_definedWithinLambda (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/definedWithinLambda.kt" -} - -task codegen_blackbox_functions_localFunctions_definedWithinLambdaInnerUsage1 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage1.kt" -} - -task codegen_blackbox_functions_localFunctions_definedWithinLambdaInnerUsage2 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/definedWithinLambdaInnerUsage2.kt" -} - -task codegen_blackbox_functions_localFunctions_kt2895 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt2895.kt" -} - -task codegen_blackbox_functions_localFunctions_kt3308 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt3308.kt" -} - -task codegen_blackbox_functions_localFunctions_kt3978 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt3978.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4119 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4119.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4119_2 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4119_2.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4514 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4514.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4777 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4777.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4783 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4783.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4784 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4784.kt" -} - -task codegen_blackbox_functions_localFunctions_kt4989 (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/kt4989.kt" -} - -task codegen_blackbox_functions_localFunctions_localExtensionOnNullableParameter (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/localExtensionOnNullableParameter.kt" -} - -task codegen_blackbox_functions_localFunctions_localFunctionInConstructor (type: RunExternalTest) { - source = "codegen/blackbox/functions/localFunctions/localFunctionInConstructor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle deleted file mode 100644 index 4487ba50080..00000000000 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_hashPMap_empty (type: RunExternalTest) { - source = "codegen/blackbox/hashPMap/empty.kt" -} - -task codegen_blackbox_hashPMap_manyNumbers (type: RunExternalTest) { - source = "codegen/blackbox/hashPMap/manyNumbers.kt" -} - -task codegen_blackbox_hashPMap_rewriteWithDifferent (type: RunExternalTest) { - source = "codegen/blackbox/hashPMap/rewriteWithDifferent.kt" -} - -task codegen_blackbox_hashPMap_rewriteWithEqual (type: RunExternalTest) { - source = "codegen/blackbox/hashPMap/rewriteWithEqual.kt" -} - -task codegen_blackbox_hashPMap_simplePlusGet (type: RunExternalTest) { - source = "codegen/blackbox/hashPMap/simplePlusGet.kt" -} - -task codegen_blackbox_hashPMap_simplePlusMinus (type: RunExternalTest) { - source = "codegen/blackbox/hashPMap/simplePlusMinus.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle deleted file mode 100644 index 01362d55a40..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ieee754/build-generated.gradle +++ /dev/null @@ -1,78 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ieee754_anyToReal (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/anyToReal.kt" -} - -task codegen_blackbox_ieee754_comparableTypeCast (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/comparableTypeCast.kt" -} - -task codegen_blackbox_ieee754_dataClass (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/dataClass.kt" -} - -task codegen_blackbox_ieee754_equalsDouble (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/equalsDouble.kt" -} - -task codegen_blackbox_ieee754_equalsFloat (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/equalsFloat.kt" -} - -task codegen_blackbox_ieee754_equalsNullableDouble (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/equalsNullableDouble.kt" -} - -task codegen_blackbox_ieee754_explicitCompareCall (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/explicitCompareCall.kt" -} - -task codegen_blackbox_ieee754_explicitEqualsCall (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/explicitEqualsCall.kt" -} - -task codegen_blackbox_ieee754_generic (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/generic.kt" -} - -task codegen_blackbox_ieee754_greaterDouble (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/greaterDouble.kt" -} - -task codegen_blackbox_ieee754_greaterFloat (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/greaterFloat.kt" -} - -task codegen_blackbox_ieee754_inline (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/inline.kt" -} - -task codegen_blackbox_ieee754_lessDouble (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/lessDouble.kt" -} - -task codegen_blackbox_ieee754_lessFloat (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/lessFloat.kt" -} - -task codegen_blackbox_ieee754_nullableAnyToReal (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/nullableAnyToReal.kt" -} - -task codegen_blackbox_ieee754_safeCall (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/safeCall.kt" -} - -task codegen_blackbox_ieee754_smartCastToDifferentTypes (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/smartCastToDifferentTypes.kt" -} - -task codegen_blackbox_ieee754_when (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/when.kt" -} - -task codegen_blackbox_ieee754_whenNoSubject (type: RunExternalTest) { - source = "codegen/blackbox/ieee754/whenNoSubject.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle deleted file mode 100644 index ac438342187..00000000000 --- a/backend.native/tests/external/codegen/blackbox/increment/build-generated.gradle +++ /dev/null @@ -1,90 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_increment_arrayElement (type: RunExternalTest) { - source = "codegen/blackbox/increment/arrayElement.kt" -} - -task codegen_blackbox_increment_assignPlusOnSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/assignPlusOnSmartCast.kt" -} - -task codegen_blackbox_increment_augmentedAssignmentWithComplexRhs (type: RunExternalTest) { - source = "codegen/blackbox/increment/augmentedAssignmentWithComplexRhs.kt" -} - -task codegen_blackbox_increment_classNaryGetSet (type: RunExternalTest) { - source = "codegen/blackbox/increment/classNaryGetSet.kt" -} - -task codegen_blackbox_increment_classWithGetSet (type: RunExternalTest) { - source = "codegen/blackbox/increment/classWithGetSet.kt" -} - -task codegen_blackbox_increment_extOnLong (type: RunExternalTest) { - source = "codegen/blackbox/increment/extOnLong.kt" -} - -task codegen_blackbox_increment_genericClassWithGetSet (type: RunExternalTest) { - source = "codegen/blackbox/increment/genericClassWithGetSet.kt" -} - -task codegen_blackbox_increment_memberExtOnLong (type: RunExternalTest) { - source = "codegen/blackbox/increment/memberExtOnLong.kt" -} - -task codegen_blackbox_increment_mutableListElement (type: RunExternalTest) { - source = "codegen/blackbox/increment/mutableListElement.kt" -} - -task codegen_blackbox_increment_nullable (type: RunExternalTest) { - source = "codegen/blackbox/increment/nullable.kt" -} - -task codegen_blackbox_increment_postfixIncrementDoubleSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixIncrementDoubleSmartCast.kt" -} - -task codegen_blackbox_increment_postfixIncrementOnClass (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixIncrementOnClass.kt" -} - -task codegen_blackbox_increment_postfixIncrementOnClassSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixIncrementOnClassSmartCast.kt" -} - -task codegen_blackbox_increment_postfixIncrementOnShortSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixIncrementOnShortSmartCast.kt" -} - -task codegen_blackbox_increment_postfixIncrementOnSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixIncrementOnSmartCast.kt" -} - -task codegen_blackbox_increment_postfixNullableClassIncrement (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixNullableClassIncrement.kt" -} - -task codegen_blackbox_increment_postfixNullableIncrement (type: RunExternalTest) { - source = "codegen/blackbox/increment/postfixNullableIncrement.kt" -} - -task codegen_blackbox_increment_prefixIncrementOnClass (type: RunExternalTest) { - source = "codegen/blackbox/increment/prefixIncrementOnClass.kt" -} - -task codegen_blackbox_increment_prefixIncrementOnClassSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/prefixIncrementOnClassSmartCast.kt" -} - -task codegen_blackbox_increment_prefixIncrementOnSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/increment/prefixIncrementOnSmartCast.kt" -} - -task codegen_blackbox_increment_prefixNullableClassIncrement (type: RunExternalTest) { - source = "codegen/blackbox/increment/prefixNullableClassIncrement.kt" -} - -task codegen_blackbox_increment_prefixNullableIncrement (type: RunExternalTest) { - source = "codegen/blackbox/increment/prefixNullableIncrement.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle deleted file mode 100644 index c39b6a0cb4c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/innerNested/build-generated.gradle +++ /dev/null @@ -1,94 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_innerNested_createdNestedInOuterMember (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/createdNestedInOuterMember.kt" -} - -task codegen_blackbox_innerNested_createNestedClass (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/createNestedClass.kt" -} - -task codegen_blackbox_innerNested_extensionFun (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/extensionFun.kt" -} - -task codegen_blackbox_innerNested_extensionToNested (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/extensionToNested.kt" -} - -task codegen_blackbox_innerNested_importNestedClass (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/importNestedClass.kt" -} - -task codegen_blackbox_innerNested_innerGeneric (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/innerGeneric.kt" -} - -task codegen_blackbox_innerNested_innerGenericClassFromJava (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/innerGenericClassFromJava.kt" -} - -task codegen_blackbox_innerNested_innerJavaClass (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/innerJavaClass.kt" -} - -task codegen_blackbox_innerNested_innerLabeledThis (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/innerLabeledThis.kt" -} - -task codegen_blackbox_innerNested_innerSimple (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/innerSimple.kt" -} - -task codegen_blackbox_innerNested_kt3132 (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/kt3132.kt" -} - -task codegen_blackbox_innerNested_kt3927 (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/kt3927.kt" -} - -task codegen_blackbox_innerNested_kt5363 (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/kt5363.kt" -} - -task codegen_blackbox_innerNested_kt6804 (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/kt6804.kt" -} - -task codegen_blackbox_innerNested_nestedClassInObject (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedClassInObject.kt" -} - -task codegen_blackbox_innerNested_nestedClassObject (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedClassObject.kt" -} - -task codegen_blackbox_innerNested_nestedEnumConstant (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedEnumConstant.kt" -} - -task codegen_blackbox_innerNested_nestedGeneric (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedGeneric.kt" -} - -task codegen_blackbox_innerNested_nestedInPackage (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedInPackage.kt" -} - -task codegen_blackbox_innerNested_nestedObjects (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedObjects.kt" -} - -task codegen_blackbox_innerNested_nestedSimple (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/nestedSimple.kt" -} - -task codegen_blackbox_innerNested_protectedNestedClass (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/protectedNestedClass.kt" -} - -task codegen_blackbox_innerNested_protectedNestedClassFromJava (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/protectedNestedClassFromJava.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle deleted file mode 100644 index f8e1f3b4259..00000000000 --- a/backend.native/tests/external/codegen/blackbox/innerNested/superConstructorCall/build-generated.gradle +++ /dev/null @@ -1,82 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_innerNested_superConstructorCall_deepInnerHierarchy (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/deepInnerHierarchy.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_deepLocalHierarchy (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/deepLocalHierarchy.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_innerExtendsInnerViaSecondaryConstuctor (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_innerExtendsInnerWithProperOuterCapture (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_innerExtendsOuter (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/innerExtendsOuter.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_kt11833_1 (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/kt11833_1.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_kt11833_2 (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/kt11833_2.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_localClassOuterDiffersFromInnerOuter (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_localExtendsInner (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/localExtendsInner.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_localExtendsLocalWithClosure (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/localExtendsLocalWithClosure.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_localWithClosureExtendsLocalWithClosure (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/localWithClosureExtendsLocalWithClosure.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsClassDefaultArgument (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassDefaultArgument.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsClassVararg (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsClassVararg.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInner (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInner.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInnerDefaultArgument (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerDefaultArgument.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInnerOfLocalVarargAndDefault (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalVarargAndDefault.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsInnerOfLocalWithCapture (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsInnerOfLocalWithCapture.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsLocalCaptureInSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalCaptureInSuperCall.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectExtendsLocalWithClosure (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectExtendsLocalWithClosure.kt" -} - -task codegen_blackbox_innerNested_superConstructorCall_objectOuterDiffersFromInnerOuter (type: RunExternalTest) { - source = "codegen/blackbox/innerNested/superConstructorCall/objectOuterDiffersFromInnerOuter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/instructions/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle deleted file mode 100644 index 51d5a95b1da..00000000000 --- a/backend.native/tests/external/codegen/blackbox/instructions/swap/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_instructions_swap_swapRefToSharedVarInt (type: RunExternalTest) { - source = "codegen/blackbox/instructions/swap/swapRefToSharedVarInt.kt" -} - -task codegen_blackbox_instructions_swap_swapRefToSharedVarLong (type: RunExternalTest) { - source = "codegen/blackbox/instructions/swap/swapRefToSharedVarLong.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle deleted file mode 100644 index 9c2d8fdc99a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/build-generated.gradle +++ /dev/null @@ -1,78 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_intrinsics_charToInt (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/charToInt.kt" -} - -task codegen_blackbox_intrinsics_defaultObjectMapping (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/defaultObjectMapping.kt" -} - -task codegen_blackbox_intrinsics_ea35953 (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/ea35953.kt" -} - -task codegen_blackbox_intrinsics_incWithLabel (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/incWithLabel.kt" -} - -task codegen_blackbox_intrinsics_kt10131 (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt10131.kt" -} - -task codegen_blackbox_intrinsics_kt10131a (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt10131a.kt" -} - -task codegen_blackbox_intrinsics_kt12125 (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt12125.kt" -} - -task codegen_blackbox_intrinsics_kt12125_2 (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt12125_2.kt" -} - -task codegen_blackbox_intrinsics_kt12125_inc (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt12125_inc.kt" -} - -task codegen_blackbox_intrinsics_kt12125_inc_2 (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt12125_inc_2.kt" -} - -task codegen_blackbox_intrinsics_kt5937 (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/kt5937.kt" -} - -task codegen_blackbox_intrinsics_longRangeWithExplicitDot (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/longRangeWithExplicitDot.kt" -} - -task codegen_blackbox_intrinsics_prefixIncDec (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/prefixIncDec.kt" -} - -task codegen_blackbox_intrinsics_rangeFromCollection (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/rangeFromCollection.kt" -} - -task codegen_blackbox_intrinsics_stringFromCollection (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/stringFromCollection.kt" -} - -task codegen_blackbox_intrinsics_throwable (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/throwable.kt" -} - -task codegen_blackbox_intrinsics_throwableCallableReference (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/throwableCallableReference.kt" -} - -task codegen_blackbox_intrinsics_throwableParamOrder (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/throwableParamOrder.kt" -} - -task codegen_blackbox_intrinsics_tostring (type: RunExternalTest) { - source = "codegen/blackbox/intrinsics/tostring.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle deleted file mode 100644 index 60b8692b389..00000000000 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_javaInterop_lambdaInstanceOf (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/lambdaInstanceOf.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle deleted file mode 100644 index 1d55d886343..00000000000 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_javaInterop_generics_allWildcardsOnClass (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt" -} - -task codegen_blackbox_javaInterop_generics_covariantOverrideWithDeclarationSiteProjection (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt" -} - -task codegen_blackbox_javaInterop_generics_invariantArgumentsNoWildcard (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle deleted file mode 100644 index 9831abbbc07..00000000000 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_javaInterop_notNullAssertions_extensionReceiverParameter (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt" -} - -task codegen_blackbox_javaInterop_notNullAssertions_mapPut (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/notNullAssertions/mapPut.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle deleted file mode 100644 index 7c46fe3ca31..00000000000 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_javaInterop_objectMethods_cloneableClassWithoutClone (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt" -} - -task codegen_blackbox_javaInterop_objectMethods_cloneCallsConstructor (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt" -} - -task codegen_blackbox_javaInterop_objectMethods_cloneCallsSuper (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt" -} - -task codegen_blackbox_javaInterop_objectMethods_cloneCallsSuperAndModifies (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt" -} - -task codegen_blackbox_javaInterop_objectMethods_cloneHashSet (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/objectMethods/cloneHashSet.kt" -} - -task codegen_blackbox_javaInterop_objectMethods_cloneHierarchy (type: RunExternalTest) { - source = "codegen/blackbox/javaInterop/objectMethods/cloneHierarchy.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle deleted file mode 100644 index 4e6bf2d4813..00000000000 --- a/backend.native/tests/external/codegen/blackbox/jdk/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_jdk_arrayList (type: RunExternalTest) { - source = "codegen/blackbox/jdk/arrayList.kt" -} - -task codegen_blackbox_jdk_hashMap (type: RunExternalTest) { - source = "codegen/blackbox/jdk/hashMap.kt" -} - -task codegen_blackbox_jdk_iteratingOverHashMap (type: RunExternalTest) { - source = "codegen/blackbox/jdk/iteratingOverHashMap.kt" -} - -task codegen_blackbox_jdk_kt1397 (type: RunExternalTest) { - source = "codegen/blackbox/jdk/kt1397.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle deleted file mode 100644 index dfdfb68fb1c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/jvmField/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_jvmField_captureClassFields (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/captureClassFields.kt" -} - -task codegen_blackbox_jvmField_capturePackageFields (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/capturePackageFields.kt" -} - -task codegen_blackbox_jvmField_checkNoAccessors (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/checkNoAccessors.kt" -} - -task codegen_blackbox_jvmField_classFieldReference (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/classFieldReference.kt" -} - -task codegen_blackbox_jvmField_classFieldReflection (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/classFieldReflection.kt" -} - -task codegen_blackbox_jvmField_constructorProperty (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/constructorProperty.kt" -} - -task codegen_blackbox_jvmField_publicField (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/publicField.kt" -} - -task codegen_blackbox_jvmField_simpleMemberProperty (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/simpleMemberProperty.kt" -} - -task codegen_blackbox_jvmField_superCall (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/superCall.kt" -} - -task codegen_blackbox_jvmField_superCall2 (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/superCall2.kt" -} - -task codegen_blackbox_jvmField_topLevelFieldReference (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/topLevelFieldReference.kt" -} - -task codegen_blackbox_jvmField_topLevelFieldReflection (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/topLevelFieldReflection.kt" -} - -task codegen_blackbox_jvmField_visibility (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/visibility.kt" -} - -task codegen_blackbox_jvmField_writeFieldReference (type: RunExternalTest) { - source = "codegen/blackbox/jvmField/writeFieldReference.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle deleted file mode 100644 index 2727eaf4a1c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/jvmName/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_jvmName_callableReference (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/callableReference.kt" -} - -task codegen_blackbox_jvmName_clashingErasure (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/clashingErasure.kt" -} - -task codegen_blackbox_jvmName_classMembers (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/classMembers.kt" -} - -task codegen_blackbox_jvmName_fakeJvmNameInJava (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/fakeJvmNameInJava.kt" -} - -task codegen_blackbox_jvmName_functionName (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/functionName.kt" -} - -task codegen_blackbox_jvmName_multifileClass (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/multifileClass.kt" -} - -task codegen_blackbox_jvmName_multifileClassWithLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/multifileClassWithLocalClass.kt" -} - -task codegen_blackbox_jvmName_multifileClassWithLocalGeneric (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt" -} - -task codegen_blackbox_jvmName_propertyAccessorsUseSite (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/propertyAccessorsUseSite.kt" -} - -task codegen_blackbox_jvmName_propertyName (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/propertyName.kt" -} - -task codegen_blackbox_jvmName_renamedFileClass (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/renamedFileClass.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle deleted file mode 100644 index b4db50d6e8a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_jvmName_fileFacades_differentFiles (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/fileFacades/differentFiles.kt" -} - -task codegen_blackbox_jvmName_fileFacades_javaAnnotationOnFileFacade (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt" -} - -task codegen_blackbox_jvmName_fileFacades_simple (type: RunExternalTest) { - source = "codegen/blackbox/jvmName/fileFacades/simple.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle deleted file mode 100644 index 7ec750346ab..00000000000 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_jvmOverloads_companionObject (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/companionObject.kt" -} - -task codegen_blackbox_jvmOverloads_defaultsNotAtEnd (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt" -} - -task codegen_blackbox_jvmOverloads_doubleParameters (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/doubleParameters.kt" -} - -task codegen_blackbox_jvmOverloads_extensionMethod (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/extensionMethod.kt" -} - -task codegen_blackbox_jvmOverloads_generics (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/generics.kt" -} - -task codegen_blackbox_jvmOverloads_innerClass (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/innerClass.kt" -} - -task codegen_blackbox_jvmOverloads_multipleDefaultParameters (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt" -} - -task codegen_blackbox_jvmOverloads_nonDefaultParameter (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/nonDefaultParameter.kt" -} - -task codegen_blackbox_jvmOverloads_primaryConstructor (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/primaryConstructor.kt" -} - -task codegen_blackbox_jvmOverloads_privateClass (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/privateClass.kt" -} - -task codegen_blackbox_jvmOverloads_secondaryConstructor (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/secondaryConstructor.kt" -} - -task codegen_blackbox_jvmOverloads_simple (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/simple.kt" -} - -task codegen_blackbox_jvmOverloads_simpleJavaCall (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/simpleJavaCall.kt" -} - -task codegen_blackbox_jvmOverloads_varargs (type: RunExternalTest) { - source = "codegen/blackbox/jvmOverloads/varargs.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle deleted file mode 100644 index a87d54bd081..00000000000 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/build-generated.gradle +++ /dev/null @@ -1,94 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_jvmStatic_annotations (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/annotations.kt" -} - -task codegen_blackbox_jvmStatic_closure (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/closure.kt" -} - -task codegen_blackbox_jvmStatic_companionObject (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/companionObject.kt" -} - -task codegen_blackbox_jvmStatic_convention (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/convention.kt" -} - -task codegen_blackbox_jvmStatic_default (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/default.kt" -} - -task codegen_blackbox_jvmStatic_enumCompanion (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/enumCompanion.kt" -} - -task codegen_blackbox_jvmStatic_explicitObject (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/explicitObject.kt" -} - -task codegen_blackbox_jvmStatic_funAccess (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/funAccess.kt" -} - -task codegen_blackbox_jvmStatic_importStaticMemberFromObject (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt" -} - -task codegen_blackbox_jvmStatic_inline (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/inline.kt" -} - -task codegen_blackbox_jvmStatic_inlinePropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt" -} - -task codegen_blackbox_jvmStatic_kt9897_static (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/kt9897_static.kt" -} - -task codegen_blackbox_jvmStatic_object (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/object.kt" -} - -task codegen_blackbox_jvmStatic_postfixInc (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/postfixInc.kt" -} - -task codegen_blackbox_jvmStatic_prefixInc (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/prefixInc.kt" -} - -task codegen_blackbox_jvmStatic_privateMethod (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/privateMethod.kt" -} - -task codegen_blackbox_jvmStatic_privateSetter (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/privateSetter.kt" -} - -task codegen_blackbox_jvmStatic_propertyAccess (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/propertyAccess.kt" -} - -task codegen_blackbox_jvmStatic_propertyAccessorsCompanion (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt" -} - -task codegen_blackbox_jvmStatic_propertyAccessorsObject (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/propertyAccessorsObject.kt" -} - -task codegen_blackbox_jvmStatic_propertyAsDefault (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/propertyAsDefault.kt" -} - -task codegen_blackbox_jvmStatic_simple (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/simple.kt" -} - -task codegen_blackbox_jvmStatic_syntheticAccessor (type: RunExternalTest) { - source = "codegen/blackbox/jvmStatic/syntheticAccessor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle deleted file mode 100644 index 92506486612..00000000000 --- a/backend.native/tests/external/codegen/blackbox/labels/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_labels_labeledDeclarations (type: RunExternalTest) { - source = "codegen/blackbox/labels/labeledDeclarations.kt" -} - -task codegen_blackbox_labels_propertyAccessor (type: RunExternalTest) { - source = "codegen/blackbox/labels/propertyAccessor.kt" -} - -task codegen_blackbox_labels_propertyAccessorFunctionLiteral (type: RunExternalTest) { - source = "codegen/blackbox/labels/propertyAccessorFunctionLiteral.kt" -} - -task codegen_blackbox_labels_propertyAccessorInnerExtensionFun (type: RunExternalTest) { - source = "codegen/blackbox/labels/propertyAccessorInnerExtensionFun.kt" -} - -task codegen_blackbox_labels_propertyAccessorObject (type: RunExternalTest) { - source = "codegen/blackbox/labels/propertyAccessorObject.kt" -} - -task codegen_blackbox_labels_propertyInClassAccessor (type: RunExternalTest) { - source = "codegen/blackbox/labels/propertyInClassAccessor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle deleted file mode 100644 index 714032e87df..00000000000 --- a/backend.native/tests/external/codegen/blackbox/lazyCodegen/build-generated.gradle +++ /dev/null @@ -1,38 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_lazyCodegen_exceptionInFieldInitializer (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/exceptionInFieldInitializer.kt" -} - -task codegen_blackbox_lazyCodegen_ifElse (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/ifElse.kt" -} - -task codegen_blackbox_lazyCodegen_increment (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/increment.kt" -} - -task codegen_blackbox_lazyCodegen_safeAssign (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/safeAssign.kt" -} - -task codegen_blackbox_lazyCodegen_safeAssignComplex (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/safeAssignComplex.kt" -} - -task codegen_blackbox_lazyCodegen_safeCallAndArray (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/safeCallAndArray.kt" -} - -task codegen_blackbox_lazyCodegen_toString (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/toString.kt" -} - -task codegen_blackbox_lazyCodegen_tryCatchExpression (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/tryCatchExpression.kt" -} - -task codegen_blackbox_lazyCodegen_when (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/when.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle deleted file mode 100644 index f2114e9737c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/lazyCodegen/optimizations/build-generated.gradle +++ /dev/null @@ -1,38 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_lazyCodegen_optimizations_negateConstantCompare (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateConstantCompare.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateFalse (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateFalse.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateFalseVar (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateFalseVar.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateFalseVarChain (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateFalseVarChain.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateObjectComp (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateObjectComp.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateObjectComp2 (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateObjectComp2.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateTrue (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateTrue.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_negateTrueVar (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/negateTrueVar.kt" -} - -task codegen_blackbox_lazyCodegen_optimizations_noOptimization (type: RunExternalTest) { - source = "codegen/blackbox/lazyCodegen/optimizations/noOptimization.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle deleted file mode 100644 index 999b1c3d607..00000000000 --- a/backend.native/tests/external/codegen/blackbox/localClasses/build-generated.gradle +++ /dev/null @@ -1,110 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_localClasses_anonymousObjectInInitializer (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/anonymousObjectInInitializer.kt" -} - -task codegen_blackbox_localClasses_anonymousObjectInParameterInitializer (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/anonymousObjectInParameterInitializer.kt" -} - -task codegen_blackbox_localClasses_closureOfInnerLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/closureOfInnerLocalClass.kt" -} - -task codegen_blackbox_localClasses_closureOfLambdaInLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/closureOfLambdaInLocalClass.kt" -} - -task codegen_blackbox_localClasses_closureWithSelfInstantiation (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/closureWithSelfInstantiation.kt" -} - -task codegen_blackbox_localClasses_inExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/inExtensionFunction.kt" -} - -task codegen_blackbox_localClasses_inExtensionProperty (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/inExtensionProperty.kt" -} - -task codegen_blackbox_localClasses_inLocalExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/inLocalExtensionFunction.kt" -} - -task codegen_blackbox_localClasses_inLocalExtensionProperty (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/inLocalExtensionProperty.kt" -} - -task codegen_blackbox_localClasses_innerClassInLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/innerClassInLocalClass.kt" -} - -task codegen_blackbox_localClasses_innerOfLocalCaptureExtensionReceiver (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/innerOfLocalCaptureExtensionReceiver.kt" -} - -task codegen_blackbox_localClasses_kt2700 (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/kt2700.kt" -} - -task codegen_blackbox_localClasses_kt2873 (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/kt2873.kt" -} - -task codegen_blackbox_localClasses_kt3210 (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/kt3210.kt" -} - -task codegen_blackbox_localClasses_kt3389 (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/kt3389.kt" -} - -task codegen_blackbox_localClasses_kt3584 (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/kt3584.kt" -} - -task codegen_blackbox_localClasses_kt4174 (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/kt4174.kt" -} - -task codegen_blackbox_localClasses_localClass (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/localClass.kt" -} - -task codegen_blackbox_localClasses_localClassCaptureExtensionReceiver (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/localClassCaptureExtensionReceiver.kt" -} - -task codegen_blackbox_localClasses_localClassInInitializer (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/localClassInInitializer.kt" -} - -task codegen_blackbox_localClasses_localClassInParameterInitializer (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/localClassInParameterInitializer.kt" -} - -task codegen_blackbox_localClasses_localDataClass (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/localDataClass.kt" -} - -task codegen_blackbox_localClasses_localExtendsInnerAndReferencesOuterMember (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/localExtendsInnerAndReferencesOuterMember.kt" -} - -task codegen_blackbox_localClasses_noclosure (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/noclosure.kt" -} - -task codegen_blackbox_localClasses_object (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/object.kt" -} - -task codegen_blackbox_localClasses_ownClosureOfInnerLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/ownClosureOfInnerLocalClass.kt" -} - -task codegen_blackbox_localClasses_withclosure (type: RunExternalTest) { - source = "codegen/blackbox/localClasses/withclosure.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle deleted file mode 100644 index e6f64c8e593..00000000000 --- a/backend.native/tests/external/codegen/blackbox/mangling/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_mangling_field (type: RunExternalTest) { - source = "codegen/blackbox/mangling/field.kt" -} - -task codegen_blackbox_mangling_fun (type: RunExternalTest) { - source = "codegen/blackbox/mangling/fun.kt" -} - -task codegen_blackbox_mangling_internalOverride (type: RunExternalTest) { - source = "codegen/blackbox/mangling/internalOverride.kt" -} - -task codegen_blackbox_mangling_internalOverrideSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/mangling/internalOverrideSuperCall.kt" -} - -task codegen_blackbox_mangling_noOverrideWithJava (type: RunExternalTest) { - source = "codegen/blackbox/mangling/noOverrideWithJava.kt" -} - -task codegen_blackbox_mangling_publicOverride (type: RunExternalTest) { - source = "codegen/blackbox/mangling/publicOverride.kt" -} - -task codegen_blackbox_mangling_publicOverrideSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/mangling/publicOverrideSuperCall.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle deleted file mode 100644 index 8c27b2f90c6..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_ComplexInitializer (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/ComplexInitializer.kt" -} - -task codegen_blackbox_multiDecl_component (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/component.kt" -} - -task codegen_blackbox_multiDecl_kt9828_hashMap (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/kt9828_hashMap.kt" -} - -task codegen_blackbox_multiDecl_returnInElvis (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/returnInElvis.kt" -} - -task codegen_blackbox_multiDecl_SimpleVals (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/SimpleVals.kt" -} - -task codegen_blackbox_multiDecl_SimpleValsExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/SimpleValsExtensions.kt" -} - -task codegen_blackbox_multiDecl_SimpleVarsExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/SimpleVarsExtensions.kt" -} - -task codegen_blackbox_multiDecl_UnderscoreNames (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/UnderscoreNames.kt" -} - -task codegen_blackbox_multiDecl_ValCapturedInFunctionLiteral (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/ValCapturedInFunctionLiteral.kt" -} - -task codegen_blackbox_multiDecl_ValCapturedInLocalFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/ValCapturedInLocalFunction.kt" -} - -task codegen_blackbox_multiDecl_ValCapturedInObjectLiteral (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/ValCapturedInObjectLiteral.kt" -} - -task codegen_blackbox_multiDecl_VarCapturedInFunctionLiteral (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/VarCapturedInFunctionLiteral.kt" -} - -task codegen_blackbox_multiDecl_VarCapturedInLocalFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/VarCapturedInLocalFunction.kt" -} - -task codegen_blackbox_multiDecl_VarCapturedInObjectLiteral (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/VarCapturedInObjectLiteral.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle deleted file mode 100644 index 16d8c7c97ae..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forIterator_MultiDeclFor (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/MultiDeclFor.kt" -} - -task codegen_blackbox_multiDecl_forIterator_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forIterator_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forIterator_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - -task codegen_blackbox_multiDecl_forIterator_MultiDeclForValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/MultiDeclForValCaptured.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle deleted file mode 100644 index 3173f0e5afa..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forIterator/longIterator/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forIterator_longIterator_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle deleted file mode 100644 index df9a76bdae7..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_MultiDeclFor (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/MultiDeclFor.kt" -} - -task codegen_blackbox_multiDecl_forRange_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - -task codegen_blackbox_multiDecl_forRange_MultiDeclForValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/MultiDeclForValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_UnderscoreNames (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/UnderscoreNames.kt" -} - -task codegen_blackbox_multiDecl_forRange_UnderscoreNamesDontCallComponent (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle deleted file mode 100644 index 38f54a00320..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclFor (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_MultiDeclForValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle deleted file mode 100644 index 765d8ef6c59..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle deleted file mode 100644 index 3f61fc445ab..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle deleted file mode 100644 index 43091265daa..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclFor (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_MultiDeclForValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle deleted file mode 100644 index 15b88292449..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle deleted file mode 100644 index cd8778e5ee2..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle deleted file mode 100644 index 319e045c3e9..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/int/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_int_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle deleted file mode 100644 index 2e9faa2e850..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multiDecl/forRange/long/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentExtensionsValCaptured (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt" -} - -task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentMemberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt" -} - -task codegen_blackbox_multiDecl_forRange_long_MultiDeclForComponentMemberExtensionsInExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle deleted file mode 100644 index 49f4b309ba3..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multifileClasses_callMultifileClassMemberFromOtherPackage (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt" -} - -task codegen_blackbox_multifileClasses_callsToMultifileClassFromOtherPackage (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt" -} - -task codegen_blackbox_multifileClasses_constPropertyReferenceFromMultifileClass (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt" -} - -task codegen_blackbox_multifileClasses_inlineMultifileClassMemberFromOtherPackage (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt" -} - -task codegen_blackbox_multifileClasses_multifileClassPartsInitialization (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt" -} - -task codegen_blackbox_multifileClasses_multifileClassWith2Files (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/multifileClassWith2Files.kt" -} - -task codegen_blackbox_multifileClasses_multifileClassWithCrossCall (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt" -} - -task codegen_blackbox_multifileClasses_multifileClassWithPrivate (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt" -} - -task codegen_blackbox_multifileClasses_privateConstVal (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/privateConstVal.kt" -} - -task codegen_blackbox_multifileClasses_samePartNameDifferentFacades (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle deleted file mode 100644 index 3bd8dee69a4..00000000000 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_multifileClasses_optimized_callableRefToFun (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt" -} - -task codegen_blackbox_multifileClasses_optimized_callableRefToInternalValInline (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt" -} - -task codegen_blackbox_multifileClasses_optimized_callableRefToPrivateVal (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt" -} - -task codegen_blackbox_multifileClasses_optimized_callableRefToVal (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt" -} - -task codegen_blackbox_multifileClasses_optimized_calls (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/calls.kt" -} - -task codegen_blackbox_multifileClasses_optimized_deferredStaticInitialization (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt" -} - -task codegen_blackbox_multifileClasses_optimized_delegatedVal (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/delegatedVal.kt" -} - -task codegen_blackbox_multifileClasses_optimized_initializePrivateVal (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt" -} - -task codegen_blackbox_multifileClasses_optimized_initializePublicVal (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt" -} - -task codegen_blackbox_multifileClasses_optimized_overlappingFuns (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt" -} - -task codegen_blackbox_multifileClasses_optimized_overlappingVals (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/overlappingVals.kt" -} - -task codegen_blackbox_multifileClasses_optimized_valAccessFromInlinedToDifferentPackage (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt" -} - -task codegen_blackbox_multifileClasses_optimized_valAccessFromInlineFunCalledFromJava (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt" -} - -task codegen_blackbox_multifileClasses_optimized_valWithAccessor (type: RunExternalTest) { - source = "codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle deleted file mode 100644 index a060b6a165b..00000000000 --- a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_nonLocalReturns_kt6895 (type: RunExternalTest) { - source = "codegen/blackbox/nonLocalReturns/kt6895.kt" -} - -task codegen_blackbox_nonLocalReturns_kt9644let (type: RunExternalTest) { - source = "codegen/blackbox/nonLocalReturns/kt9644let.kt" -} - -task codegen_blackbox_nonLocalReturns_use (type: RunExternalTest) { - source = "codegen/blackbox/nonLocalReturns/use.kt" -} - -task codegen_blackbox_nonLocalReturns_useWithException (type: RunExternalTest) { - source = "codegen/blackbox/nonLocalReturns/useWithException.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle deleted file mode 100644 index 32ce1634a71..00000000000 --- a/backend.native/tests/external/codegen/blackbox/objectIntrinsics/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_objectIntrinsics_objects (type: RunExternalTest) { - source = "codegen/blackbox/objectIntrinsics/objects.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle deleted file mode 100644 index 6a6be6f480c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/objects/build-generated.gradle +++ /dev/null @@ -1,174 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_objects_anonymousObjectPropertyInitialization (type: RunExternalTest) { - source = "codegen/blackbox/objects/anonymousObjectPropertyInitialization.kt" -} - -task codegen_blackbox_objects_classCallsProtectedInheritedByCompanion (type: RunExternalTest) { - source = "codegen/blackbox/objects/classCallsProtectedInheritedByCompanion.kt" -} - -task codegen_blackbox_objects_flist (type: RunExternalTest) { - source = "codegen/blackbox/objects/flist.kt" -} - -task codegen_blackbox_objects_initializationOrder (type: RunExternalTest) { - source = "codegen/blackbox/objects/initializationOrder.kt" -} - -task codegen_blackbox_objects_kt1047 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt1047.kt" -} - -task codegen_blackbox_objects_kt11117 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt11117.kt" -} - -task codegen_blackbox_objects_kt1136 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt1136.kt" -} - -task codegen_blackbox_objects_kt1186 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt1186.kt" -} - -task codegen_blackbox_objects_kt1600 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt1600.kt" -} - -task codegen_blackbox_objects_kt1737 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt1737.kt" -} - -task codegen_blackbox_objects_kt2398 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt2398.kt" -} - -task codegen_blackbox_objects_kt2663 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt2663.kt" -} - -task codegen_blackbox_objects_kt2663_2 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt2663_2.kt" -} - -task codegen_blackbox_objects_kt2675 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt2675.kt" -} - -task codegen_blackbox_objects_kt2719 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt2719.kt" -} - -task codegen_blackbox_objects_kt2822 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt2822.kt" -} - -task codegen_blackbox_objects_kt3238 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt3238.kt" -} - -task codegen_blackbox_objects_kt3684 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt3684.kt" -} - -task codegen_blackbox_objects_kt4086 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt4086.kt" -} - -task codegen_blackbox_objects_kt535 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt535.kt" -} - -task codegen_blackbox_objects_kt560 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt560.kt" -} - -task codegen_blackbox_objects_kt694 (type: RunExternalTest) { - source = "codegen/blackbox/objects/kt694.kt" -} - -task codegen_blackbox_objects_localFunctionInObjectInitializer_kt4516 (type: RunExternalTest) { - source = "codegen/blackbox/objects/localFunctionInObjectInitializer_kt4516.kt" -} - -task codegen_blackbox_objects_methodOnObject (type: RunExternalTest) { - source = "codegen/blackbox/objects/methodOnObject.kt" -} - -task codegen_blackbox_objects_nestedDerivedClassCallsProtectedFromCompanion (type: RunExternalTest) { - source = "codegen/blackbox/objects/nestedDerivedClassCallsProtectedFromCompanion.kt" -} - -task codegen_blackbox_objects_nestedObjectWithSuperclass (type: RunExternalTest) { - source = "codegen/blackbox/objects/nestedObjectWithSuperclass.kt" -} - -task codegen_blackbox_objects_objectExtendsInnerAndReferencesOuterMember (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectExtendsInnerAndReferencesOuterMember.kt" -} - -task codegen_blackbox_objects_objectInitialization_kt5523 (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectInitialization_kt5523.kt" -} - -task codegen_blackbox_objects_objectInLocalAnonymousObject (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectInLocalAnonymousObject.kt" -} - -task codegen_blackbox_objects_objectLiteral (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectLiteral.kt" -} - -task codegen_blackbox_objects_objectLiteralInClosure (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectLiteralInClosure.kt" -} - -task codegen_blackbox_objects_objectVsClassInitialization_kt5291 (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectVsClassInitialization_kt5291.kt" -} - -task codegen_blackbox_objects_objectWithSuperclass (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectWithSuperclass.kt" -} - -task codegen_blackbox_objects_objectWithSuperclassAndTrait (type: RunExternalTest) { - source = "codegen/blackbox/objects/objectWithSuperclassAndTrait.kt" -} - -task codegen_blackbox_objects_privateExtensionFromInitializer_kt4543 (type: RunExternalTest) { - source = "codegen/blackbox/objects/privateExtensionFromInitializer_kt4543.kt" -} - -task codegen_blackbox_objects_privateFunctionFromClosureInInitializer_kt5582 (type: RunExternalTest) { - source = "codegen/blackbox/objects/privateFunctionFromClosureInInitializer_kt5582.kt" -} - -task codegen_blackbox_objects_receiverInConstructor (type: RunExternalTest) { - source = "codegen/blackbox/objects/receiverInConstructor.kt" -} - -task codegen_blackbox_objects_safeAccess (type: RunExternalTest) { - source = "codegen/blackbox/objects/safeAccess.kt" -} - -task codegen_blackbox_objects_simpleObject (type: RunExternalTest) { - source = "codegen/blackbox/objects/simpleObject.kt" -} - -task codegen_blackbox_objects_thisInConstructor (type: RunExternalTest) { - source = "codegen/blackbox/objects/thisInConstructor.kt" -} - -task codegen_blackbox_objects_useAnonymousObjectAsIterator (type: RunExternalTest) { - source = "codegen/blackbox/objects/useAnonymousObjectAsIterator.kt" -} - -task codegen_blackbox_objects_useImportedMember (type: RunExternalTest) { - source = "codegen/blackbox/objects/useImportedMember.kt" -} - -task codegen_blackbox_objects_useImportedMemberFromCompanion (type: RunExternalTest) { - source = "codegen/blackbox/objects/useImportedMemberFromCompanion.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle deleted file mode 100644 index 24e17e1c93d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/operatorConventions/build-generated.gradle +++ /dev/null @@ -1,58 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_operatorConventions_annotatedAssignment (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/annotatedAssignment.kt" -} - -task codegen_blackbox_operatorConventions_assignmentOperations (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/assignmentOperations.kt" -} - -task codegen_blackbox_operatorConventions_augmentedAssignmentWithArrayLHS (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/augmentedAssignmentWithArrayLHS.kt" -} - -task codegen_blackbox_operatorConventions_incDecOnObject (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/incDecOnObject.kt" -} - -task codegen_blackbox_operatorConventions_kt14201 (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/kt14201.kt" -} - -task codegen_blackbox_operatorConventions_kt14201_2 (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/kt14201_2.kt" -} - -task codegen_blackbox_operatorConventions_kt4152 (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/kt4152.kt" -} - -task codegen_blackbox_operatorConventions_kt4987 (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/kt4987.kt" -} - -task codegen_blackbox_operatorConventions_nestedMaps (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/nestedMaps.kt" -} - -task codegen_blackbox_operatorConventions_operatorSetLambda (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/operatorSetLambda.kt" -} - -task codegen_blackbox_operatorConventions_overloadedSet (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/overloadedSet.kt" -} - -task codegen_blackbox_operatorConventions_percentAsModOnBigIntegerWithoutRem (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/percentAsModOnBigIntegerWithoutRem.kt" -} - -task codegen_blackbox_operatorConventions_remAssignmentOperation (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/remAssignmentOperation.kt" -} - -task codegen_blackbox_operatorConventions_remOverModOperation (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/remOverModOperation.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle deleted file mode 100644 index b545d5536e3..00000000000 --- a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_operatorConventions_compareTo_boolean (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/boolean.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_comparable (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/comparable.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_doubleInt (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/doubleInt.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_doubleLong (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/doubleLong.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_extensionArray (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/extensionArray.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_extensionObject (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/extensionObject.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_intDouble (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/intDouble.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_intLong (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/intLong.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_longDouble (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/longDouble.kt" -} - -task codegen_blackbox_operatorConventions_compareTo_longInt (type: RunExternalTest) { - source = "codegen/blackbox/operatorConventions/compareTo/longInt.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/package/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/package/build-generated.gradle deleted file mode 100644 index acee5c48b1b..00000000000 --- a/backend.native/tests/external/codegen/blackbox/package/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_package_boxPrimitiveTypeInClinit (type: RunExternalTest) { - source = "codegen/blackbox/package/boxPrimitiveTypeInClinit.kt" -} - -task codegen_blackbox_package_checkCast (type: RunExternalTest) { - source = "codegen/blackbox/package/checkCast.kt" -} - -task codegen_blackbox_package_incrementProperty (type: RunExternalTest) { - source = "codegen/blackbox/package/incrementProperty.kt" -} - -task codegen_blackbox_package_initializationOrder (type: RunExternalTest) { - source = "codegen/blackbox/package/initializationOrder.kt" -} - -task codegen_blackbox_package_invokespecial (type: RunExternalTest) { - source = "codegen/blackbox/package/invokespecial.kt" -} - -task codegen_blackbox_package_mainInFiles (type: RunExternalTest) { - source = "codegen/blackbox/package/mainInFiles.kt" -} - -task codegen_blackbox_package_nullablePrimitiveNoFieldInitializer (type: RunExternalTest) { - source = "codegen/blackbox/package/nullablePrimitiveNoFieldInitializer.kt" -} - -task codegen_blackbox_package_packageLocalClassNotImportedWithDefaultImport (type: RunExternalTest) { - source = "codegen/blackbox/package/packageLocalClassNotImportedWithDefaultImport.kt" -} - -task codegen_blackbox_package_packageQualifiedMethod (type: RunExternalTest) { - source = "codegen/blackbox/package/packageQualifiedMethod.kt" -} - -task codegen_blackbox_package_privateTopLevelPropAndVarInInner (type: RunExternalTest) { - source = "codegen/blackbox/package/privateTopLevelPropAndVarInInner.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/platformTypes/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle deleted file mode 100644 index e1860d19470..00000000000 --- a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/build-generated.gradle +++ /dev/null @@ -1,82 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_platformTypes_primitives_assign (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/assign.kt" -} - -task codegen_blackbox_platformTypes_primitives_compareTo (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/compareTo.kt" -} - -task codegen_blackbox_platformTypes_primitives_dec (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/dec.kt" -} - -task codegen_blackbox_platformTypes_primitives_div (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/div.kt" -} - -task codegen_blackbox_platformTypes_primitives_equals (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/equals.kt" -} - -task codegen_blackbox_platformTypes_primitives_hashCode (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/hashCode.kt" -} - -task codegen_blackbox_platformTypes_primitives_identityEquals (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/identityEquals.kt" -} - -task codegen_blackbox_platformTypes_primitives_inc (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/inc.kt" -} - -task codegen_blackbox_platformTypes_primitives_minus (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/minus.kt" -} - -task codegen_blackbox_platformTypes_primitives_mod (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/mod.kt" -} - -task codegen_blackbox_platformTypes_primitives_not (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/not.kt" -} - -task codegen_blackbox_platformTypes_primitives_notEquals (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/notEquals.kt" -} - -task codegen_blackbox_platformTypes_primitives_plus (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/plus.kt" -} - -task codegen_blackbox_platformTypes_primitives_plusAssign (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/plusAssign.kt" -} - -task codegen_blackbox_platformTypes_primitives_rangeTo (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/rangeTo.kt" -} - -task codegen_blackbox_platformTypes_primitives_times (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/times.kt" -} - -task codegen_blackbox_platformTypes_primitives_toShort (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/toShort.kt" -} - -task codegen_blackbox_platformTypes_primitives_toString (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/toString.kt" -} - -task codegen_blackbox_platformTypes_primitives_unaryMinus (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/unaryMinus.kt" -} - -task codegen_blackbox_platformTypes_primitives_unaryPlus (type: RunExternalTest) { - source = "codegen/blackbox/platformTypes/primitives/unaryPlus.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle deleted file mode 100644 index 9fda00c03f1..00000000000 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/build-generated.gradle +++ /dev/null @@ -1,210 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_primitiveTypes_comparisonWithNaN (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/comparisonWithNaN.kt" -} - -task codegen_blackbox_primitiveTypes_comparisonWithNullCallsFun (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/comparisonWithNullCallsFun.kt" -} - -task codegen_blackbox_primitiveTypes_ea35963 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/ea35963.kt" -} - -task codegen_blackbox_primitiveTypes_equalsHashCodeToString (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/equalsHashCodeToString.kt" -} - -task codegen_blackbox_primitiveTypes_incrementByteCharShort (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/incrementByteCharShort.kt" -} - -task codegen_blackbox_primitiveTypes_intLiteralIsNotNull (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/intLiteralIsNotNull.kt" -} - -task codegen_blackbox_primitiveTypes_kt1054 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt1054.kt" -} - -task codegen_blackbox_primitiveTypes_kt1055 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt1055.kt" -} - -task codegen_blackbox_primitiveTypes_kt1093 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt1093.kt" -} - -task codegen_blackbox_primitiveTypes_kt13023 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt13023.kt" -} - -task codegen_blackbox_primitiveTypes_kt14868 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt14868.kt" -} - -task codegen_blackbox_primitiveTypes_kt1508 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt1508.kt" -} - -task codegen_blackbox_primitiveTypes_kt1634 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt1634.kt" -} - -task codegen_blackbox_primitiveTypes_kt2251 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt2251.kt" -} - -task codegen_blackbox_primitiveTypes_kt2269 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt2269.kt" -} - -task codegen_blackbox_primitiveTypes_kt2275 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt2275.kt" -} - -task codegen_blackbox_primitiveTypes_kt239 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt239.kt" -} - -task codegen_blackbox_primitiveTypes_kt242 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt242.kt" -} - -task codegen_blackbox_primitiveTypes_kt243 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt243.kt" -} - -task codegen_blackbox_primitiveTypes_kt248 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt248.kt" -} - -task codegen_blackbox_primitiveTypes_kt2768 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt2768.kt" -} - -task codegen_blackbox_primitiveTypes_kt2794 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt2794.kt" -} - -task codegen_blackbox_primitiveTypes_kt3078 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt3078.kt" -} - -task codegen_blackbox_primitiveTypes_kt3517 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt3517.kt" -} - -task codegen_blackbox_primitiveTypes_kt3576 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt3576.kt" -} - -task codegen_blackbox_primitiveTypes_kt3613 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt3613.kt" -} - -task codegen_blackbox_primitiveTypes_kt4097 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt4097.kt" -} - -task codegen_blackbox_primitiveTypes_kt4098 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt4098.kt" -} - -task codegen_blackbox_primitiveTypes_kt4210 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt4210.kt" -} - -task codegen_blackbox_primitiveTypes_kt4251 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt4251.kt" -} - -task codegen_blackbox_primitiveTypes_kt446 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt446.kt" -} - -task codegen_blackbox_primitiveTypes_kt518 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt518.kt" -} - -task codegen_blackbox_primitiveTypes_kt6590_identityEquals (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt6590_identityEquals.kt" -} - -task codegen_blackbox_primitiveTypes_kt665 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt665.kt" -} - -task codegen_blackbox_primitiveTypes_kt684 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt684.kt" -} - -task codegen_blackbox_primitiveTypes_kt711 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt711.kt" -} - -task codegen_blackbox_primitiveTypes_kt737 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt737.kt" -} - -task codegen_blackbox_primitiveTypes_kt752 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt752.kt" -} - -task codegen_blackbox_primitiveTypes_kt753 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt753.kt" -} - -task codegen_blackbox_primitiveTypes_kt756 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt756.kt" -} - -task codegen_blackbox_primitiveTypes_kt757 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt757.kt" -} - -task codegen_blackbox_primitiveTypes_kt828 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt828.kt" -} - -task codegen_blackbox_primitiveTypes_kt877 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt877.kt" -} - -task codegen_blackbox_primitiveTypes_kt882 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt882.kt" -} - -task codegen_blackbox_primitiveTypes_kt887 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt887.kt" -} - -task codegen_blackbox_primitiveTypes_kt935 (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/kt935.kt" -} - -task codegen_blackbox_primitiveTypes_nullableCharBoolean (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/nullableCharBoolean.kt" -} - -task codegen_blackbox_primitiveTypes_nullAsNullableIntIsNull (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/nullAsNullableIntIsNull.kt" -} - -task codegen_blackbox_primitiveTypes_number (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/number.kt" -} - -task codegen_blackbox_primitiveTypes_rangeTo (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/rangeTo.kt" -} - -task codegen_blackbox_primitiveTypes_substituteIntForGeneric (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt" -} - -task codegen_blackbox_primitiveTypes_unboxComparable (type: RunExternalTest) { - source = "codegen/blackbox/primitiveTypes/unboxComparable.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/private/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/private/build-generated.gradle deleted file mode 100644 index 74e2e0167f5..00000000000 --- a/backend.native/tests/external/codegen/blackbox/private/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_private_arrayConvention (type: RunExternalTest) { - source = "codegen/blackbox/private/arrayConvention.kt" -} - -task codegen_blackbox_private_kt9855 (type: RunExternalTest) { - source = "codegen/blackbox/private/kt9855.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle deleted file mode 100644 index c42a19dd6de..00000000000 --- a/backend.native/tests/external/codegen/blackbox/privateConstructors/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_privateConstructors_base (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/base.kt" -} - -task codegen_blackbox_privateConstructors_captured (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/captured.kt" -} - -task codegen_blackbox_privateConstructors_companion (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/companion.kt" -} - -task codegen_blackbox_privateConstructors_inline (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/inline.kt" -} - -task codegen_blackbox_privateConstructors_inner (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/inner.kt" -} - -task codegen_blackbox_privateConstructors_kt4860 (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/kt4860.kt" -} - -task codegen_blackbox_privateConstructors_secondary (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/secondary.kt" -} - -task codegen_blackbox_privateConstructors_synthetic (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/synthetic.kt" -} - -task codegen_blackbox_privateConstructors_withArguments (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/withArguments.kt" -} - -task codegen_blackbox_privateConstructors_withDefault (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/withDefault.kt" -} - -task codegen_blackbox_privateConstructors_withLinkedClasses (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/withLinkedClasses.kt" -} - -task codegen_blackbox_privateConstructors_withLinkedObjects (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/withLinkedObjects.kt" -} - -task codegen_blackbox_privateConstructors_withVarargs (type: RunExternalTest) { - source = "codegen/blackbox/privateConstructors/withVarargs.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle deleted file mode 100644 index 1486fb37d5d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/properties/build-generated.gradle +++ /dev/null @@ -1,270 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_properties_accessToPrivateProperty (type: RunExternalTest) { - source = "codegen/blackbox/properties/accessToPrivateProperty.kt" -} - -task codegen_blackbox_properties_accessToPrivateSetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/accessToPrivateSetter.kt" -} - -task codegen_blackbox_properties_augmentedAssignmentsAndIncrements (type: RunExternalTest) { - source = "codegen/blackbox/properties/augmentedAssignmentsAndIncrements.kt" -} - -task codegen_blackbox_properties_classArtificialFieldInsideNested (type: RunExternalTest) { - source = "codegen/blackbox/properties/classArtificialFieldInsideNested.kt" -} - -task codegen_blackbox_properties_classFieldInsideLambda (type: RunExternalTest) { - source = "codegen/blackbox/properties/classFieldInsideLambda.kt" -} - -task codegen_blackbox_properties_classFieldInsideLocalInSetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/classFieldInsideLocalInSetter.kt" -} - -task codegen_blackbox_properties_classFieldInsideNested (type: RunExternalTest) { - source = "codegen/blackbox/properties/classFieldInsideNested.kt" -} - -task codegen_blackbox_properties_classObjectProperties (type: RunExternalTest) { - source = "codegen/blackbox/properties/classObjectProperties.kt" -} - -task codegen_blackbox_properties_classPrivateArtificialFieldInsideNested (type: RunExternalTest) { - source = "codegen/blackbox/properties/classPrivateArtificialFieldInsideNested.kt" -} - -task codegen_blackbox_properties_collectionSize (type: RunExternalTest) { - source = "codegen/blackbox/properties/collectionSize.kt" -} - -task codegen_blackbox_properties_commonPropertiesKJK (type: RunExternalTest) { - source = "codegen/blackbox/properties/commonPropertiesKJK.kt" -} - -task codegen_blackbox_properties_companionFieldInsideLambda (type: RunExternalTest) { - source = "codegen/blackbox/properties/companionFieldInsideLambda.kt" -} - -task codegen_blackbox_properties_companionObjectAccessor (type: RunExternalTest) { - source = "codegen/blackbox/properties/companionObjectAccessor.kt" -} - -task codegen_blackbox_properties_companionObjectPropertiesFromJava (type: RunExternalTest) { - source = "codegen/blackbox/properties/companionObjectPropertiesFromJava.kt" -} - -task codegen_blackbox_properties_companionPrivateField (type: RunExternalTest) { - source = "codegen/blackbox/properties/companionPrivateField.kt" -} - -task codegen_blackbox_properties_companionPrivateFieldInsideLambda (type: RunExternalTest) { - source = "codegen/blackbox/properties/companionPrivateFieldInsideLambda.kt" -} - -task codegen_blackbox_properties_field (type: RunExternalTest) { - source = "codegen/blackbox/properties/field.kt" -} - -task codegen_blackbox_properties_fieldInClass (type: RunExternalTest) { - source = "codegen/blackbox/properties/fieldInClass.kt" -} - -task codegen_blackbox_properties_fieldInsideField (type: RunExternalTest) { - source = "codegen/blackbox/properties/fieldInsideField.kt" -} - -task codegen_blackbox_properties_fieldInsideLambda (type: RunExternalTest) { - source = "codegen/blackbox/properties/fieldInsideLambda.kt" -} - -task codegen_blackbox_properties_fieldInsideNested (type: RunExternalTest) { - source = "codegen/blackbox/properties/fieldInsideNested.kt" -} - -task codegen_blackbox_properties_fieldSimple (type: RunExternalTest) { - source = "codegen/blackbox/properties/fieldSimple.kt" -} - -task codegen_blackbox_properties_generalAccess (type: RunExternalTest) { - source = "codegen/blackbox/properties/generalAccess.kt" -} - -task codegen_blackbox_properties_javaPropertyBoxedGetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/javaPropertyBoxedGetter.kt" -} - -task codegen_blackbox_properties_javaPropertyBoxedSetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/javaPropertyBoxedSetter.kt" -} - -task codegen_blackbox_properties_kt10715 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt10715.kt" -} - -task codegen_blackbox_properties_kt10729 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt10729.kt" -} - -task codegen_blackbox_properties_kt1159 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1159.kt" -} - -task codegen_blackbox_properties_kt1165 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1165.kt" -} - -task codegen_blackbox_properties_kt1168 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1168.kt" -} - -task codegen_blackbox_properties_kt1170 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1170.kt" -} - -task codegen_blackbox_properties_kt12200 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt12200.kt" -} - -task codegen_blackbox_properties_kt1398 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1398.kt" -} - -task codegen_blackbox_properties_kt1417 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1417.kt" -} - -task codegen_blackbox_properties_kt1482_2279 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1482_2279.kt" -} - -task codegen_blackbox_properties_kt1714 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1714.kt" -} - -task codegen_blackbox_properties_kt1714_minimal (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1714_minimal.kt" -} - -task codegen_blackbox_properties_kt1892 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt1892.kt" -} - -task codegen_blackbox_properties_kt2331 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt2331.kt" -} - -task codegen_blackbox_properties_kt257 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt257.kt" -} - -task codegen_blackbox_properties_kt2655 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt2655.kt" -} - -task codegen_blackbox_properties_kt2786 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt2786.kt" -} - -task codegen_blackbox_properties_kt2892 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt2892.kt" -} - -task codegen_blackbox_properties_kt3118 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt3118.kt" -} - -task codegen_blackbox_properties_kt3524 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt3524.kt" -} - -task codegen_blackbox_properties_kt3551 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt3551.kt" -} - -task codegen_blackbox_properties_kt3556 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt3556.kt" -} - -task codegen_blackbox_properties_kt3930 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt3930.kt" -} - -task codegen_blackbox_properties_kt4140 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt4140.kt" -} - -task codegen_blackbox_properties_kt4252 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt4252.kt" -} - -task codegen_blackbox_properties_kt4252_2 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt4252_2.kt" -} - -task codegen_blackbox_properties_kt4340 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt4340.kt" -} - -task codegen_blackbox_properties_kt4373 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt4373.kt" -} - -task codegen_blackbox_properties_kt4383 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt4383.kt" -} - -task codegen_blackbox_properties_kt613 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt613.kt" -} - -task codegen_blackbox_properties_kt8928 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt8928.kt" -} - -task codegen_blackbox_properties_kt9603 (type: RunExternalTest) { - source = "codegen/blackbox/properties/kt9603.kt" -} - -task codegen_blackbox_properties_primitiveOverrideDefaultAccessor (type: RunExternalTest) { - source = "codegen/blackbox/properties/primitiveOverrideDefaultAccessor.kt" -} - -task codegen_blackbox_properties_primitiveOverrideDelegateAccessor (type: RunExternalTest) { - source = "codegen/blackbox/properties/primitiveOverrideDelegateAccessor.kt" -} - -task codegen_blackbox_properties_privatePropertyInConstructor (type: RunExternalTest) { - source = "codegen/blackbox/properties/privatePropertyInConstructor.kt" -} - -task codegen_blackbox_properties_privatePropertyWithoutBackingField (type: RunExternalTest) { - source = "codegen/blackbox/properties/privatePropertyWithoutBackingField.kt" -} - -task codegen_blackbox_properties_protectedJavaFieldInInline (type: RunExternalTest) { - source = "codegen/blackbox/properties/protectedJavaFieldInInline.kt" -} - -task codegen_blackbox_properties_protectedJavaProperty (type: RunExternalTest) { - source = "codegen/blackbox/properties/protectedJavaProperty.kt" -} - -task codegen_blackbox_properties_protectedJavaPropertyInCompanion (type: RunExternalTest) { - source = "codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt" -} - -task codegen_blackbox_properties_substituteJavaSuperField (type: RunExternalTest) { - source = "codegen/blackbox/properties/substituteJavaSuperField.kt" -} - -task codegen_blackbox_properties_twoAnnotatedExtensionPropertiesWithoutBackingFields (type: RunExternalTest) { - source = "codegen/blackbox/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt" -} - -task codegen_blackbox_properties_typeInferredFromGetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/typeInferredFromGetter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle deleted file mode 100644 index 8cdce0c658a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/properties/const/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_properties_const_constFlags (type: RunExternalTest) { - source = "codegen/blackbox/properties/const/constFlags.kt" -} - -task codegen_blackbox_properties_const_constValInAnnotationDefault (type: RunExternalTest) { - source = "codegen/blackbox/properties/const/constValInAnnotationDefault.kt" -} - -task codegen_blackbox_properties_const_interfaceCompanion (type: RunExternalTest) { - source = "codegen/blackbox/properties/const/interfaceCompanion.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle deleted file mode 100644 index 419121d00c1..00000000000 --- a/backend.native/tests/external/codegen/blackbox/properties/lateinit/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_properties_lateinit_accessor (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/accessor.kt" -} - -task codegen_blackbox_properties_lateinit_accessorException (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/accessorException.kt" -} - -task codegen_blackbox_properties_lateinit_exceptionField (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/exceptionField.kt" -} - -task codegen_blackbox_properties_lateinit_exceptionGetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/exceptionGetter.kt" -} - -task codegen_blackbox_properties_lateinit_override (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/override.kt" -} - -task codegen_blackbox_properties_lateinit_overrideException (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/overrideException.kt" -} - -task codegen_blackbox_properties_lateinit_privateSetter (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/privateSetter.kt" -} - -task codegen_blackbox_properties_lateinit_privateSetterFromLambda (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/privateSetterFromLambda.kt" -} - -task codegen_blackbox_properties_lateinit_simpleVar (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/simpleVar.kt" -} - -task codegen_blackbox_properties_lateinit_visibility (type: RunExternalTest) { - source = "codegen/blackbox/properties/lateinit/visibility.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle deleted file mode 100644 index 423abd345db..00000000000 --- a/backend.native/tests/external/codegen/blackbox/publishedApi/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_publishedApi_noMangling (type: RunExternalTest) { - source = "codegen/blackbox/publishedApi/noMangling.kt" -} - -task codegen_blackbox_publishedApi_simple (type: RunExternalTest) { - source = "codegen/blackbox/publishedApi/simple.kt" -} - -task codegen_blackbox_publishedApi_topLevel (type: RunExternalTest) { - source = "codegen/blackbox/publishedApi/topLevel.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle deleted file mode 100644 index 7ed0070c04d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_forByteProgressionWithIntIncrement (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forByteProgressionWithIntIncrement.kt" -} - -task codegen_blackbox_ranges_forInRangeWithImplicitReceiver (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInRangeWithImplicitReceiver.kt" -} - -task codegen_blackbox_ranges_forIntRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forIntRange.kt" -} - -task codegen_blackbox_ranges_forNullableIntInRangeWithImplicitReceiver (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forNullableIntInRangeWithImplicitReceiver.kt" -} - -task codegen_blackbox_ranges_multiAssignmentIterationOverIntRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/multiAssignmentIterationOverIntRange.kt" -} - -task codegen_blackbox_ranges_safeCallRangeTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/safeCallRangeTo.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle deleted file mode 100644 index 60bf0d3fc50..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_contains_inComparableRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inComparableRange.kt" -} - -task codegen_blackbox_ranges_contains_inExtensionRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inExtensionRange.kt" -} - -task codegen_blackbox_ranges_contains_inIntRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inIntRange.kt" -} - -task codegen_blackbox_ranges_contains_inOptimizableDoubleRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt" -} - -task codegen_blackbox_ranges_contains_inOptimizableFloatRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt" -} - -task codegen_blackbox_ranges_contains_inOptimizableIntRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inOptimizableIntRange.kt" -} - -task codegen_blackbox_ranges_contains_inOptimizableLongRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inOptimizableLongRange.kt" -} - -task codegen_blackbox_ranges_contains_inRangeWithCustomContains (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt" -} - -task codegen_blackbox_ranges_contains_inRangeWithImplicitReceiver (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt" -} - -task codegen_blackbox_ranges_contains_inRangeWithNonmatchingArguments (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt" -} - -task codegen_blackbox_ranges_contains_inRangeWithSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt" -} - -task codegen_blackbox_ranges_contains_rangeContainsString (type: RunExternalTest) { - source = "codegen/blackbox/ranges/contains/rangeContainsString.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle deleted file mode 100644 index 3e6fd8136d2..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/build-generated.gradle +++ /dev/null @@ -1,114 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_expression_emptyDownto (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/emptyDownto.kt" -} - -task codegen_blackbox_ranges_expression_emptyRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/emptyRange.kt" -} - -task codegen_blackbox_ranges_expression_inexactDownToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/inexactDownToMinValue.kt" -} - -task codegen_blackbox_ranges_expression_inexactSteppedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/inexactSteppedDownTo.kt" -} - -task codegen_blackbox_ranges_expression_inexactSteppedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/inexactSteppedRange.kt" -} - -task codegen_blackbox_ranges_expression_inexactToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/inexactToMaxValue.kt" -} - -task codegen_blackbox_ranges_expression_maxValueMinusTwoToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt" -} - -task codegen_blackbox_ranges_expression_maxValueToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/maxValueToMaxValue.kt" -} - -task codegen_blackbox_ranges_expression_maxValueToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/maxValueToMinValue.kt" -} - -task codegen_blackbox_ranges_expression_oneElementDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/oneElementDownTo.kt" -} - -task codegen_blackbox_ranges_expression_oneElementRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/oneElementRange.kt" -} - -task codegen_blackbox_ranges_expression_openRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/openRange.kt" -} - -task codegen_blackbox_ranges_expression_progressionDownToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/progressionDownToMinValue.kt" -} - -task codegen_blackbox_ranges_expression_progressionMaxValueMinusTwoToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt" -} - -task codegen_blackbox_ranges_expression_progressionMaxValueToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt" -} - -task codegen_blackbox_ranges_expression_progressionMaxValueToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt" -} - -task codegen_blackbox_ranges_expression_progressionMinValueToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt" -} - -task codegen_blackbox_ranges_expression_reversedBackSequence (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/reversedBackSequence.kt" -} - -task codegen_blackbox_ranges_expression_reversedEmptyBackSequence (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/reversedEmptyBackSequence.kt" -} - -task codegen_blackbox_ranges_expression_reversedEmptyRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/reversedEmptyRange.kt" -} - -task codegen_blackbox_ranges_expression_reversedInexactSteppedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/reversedInexactSteppedDownTo.kt" -} - -task codegen_blackbox_ranges_expression_reversedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/reversedRange.kt" -} - -task codegen_blackbox_ranges_expression_reversedSimpleSteppedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/reversedSimpleSteppedRange.kt" -} - -task codegen_blackbox_ranges_expression_simpleDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/simpleDownTo.kt" -} - -task codegen_blackbox_ranges_expression_simpleRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/simpleRange.kt" -} - -task codegen_blackbox_ranges_expression_simpleRangeWithNonConstantEnds (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/simpleRangeWithNonConstantEnds.kt" -} - -task codegen_blackbox_ranges_expression_simpleSteppedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/simpleSteppedDownTo.kt" -} - -task codegen_blackbox_ranges_expression_simpleSteppedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/expression/simpleSteppedRange.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle deleted file mode 100644 index 37045d49c8c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/forInDownTo/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_forInDownTo_forIntInDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInDownTo/forIntInDownTo.kt" -} - -task codegen_blackbox_ranges_forInDownTo_forIntInNonOptimizedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInDownTo/forIntInNonOptimizedDownTo.kt" -} - -task codegen_blackbox_ranges_forInDownTo_forLongInDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInDownTo/forLongInDownTo.kt" -} - -task codegen_blackbox_ranges_forInDownTo_forNullableIntInDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInDownTo/forNullableIntInDownTo.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle deleted file mode 100644 index eef50d3088f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/build-generated.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_forInIndices_forInCharSequenceIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forInCharSequenceIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forInCollectionImplicitReceiverIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forInCollectionImplicitReceiverIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forInCollectionIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forInCollectionIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forInNonOptimizedIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forInNonOptimizedIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forInObjectArrayIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forInObjectArrayIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forInPrimitiveArrayIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forInPrimitiveArrayIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forNullableIntInArrayIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forNullableIntInArrayIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_forNullableIntInCollectionIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/forNullableIntInCollectionIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt12983_forInGenericArrayIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt12983_forInGenericArrayIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt12983_forInGenericCollectionIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt12983_forInGenericCollectionIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt12983_forInSpecificArrayIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificArrayIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt12983_forInSpecificCollectionIndices (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt12983_forInSpecificCollectionIndices.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt13241_Array (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt13241_Array.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt13241_CharSequence (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt13241_CharSequence.kt" -} - -task codegen_blackbox_ranges_forInIndices_kt13241_Collection (type: RunExternalTest) { - source = "codegen/blackbox/ranges/forInIndices/kt13241_Collection.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle deleted file mode 100644 index 2aaace3a185..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/build-generated.gradle +++ /dev/null @@ -1,114 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_literal_emptyDownto (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/emptyDownto.kt" -} - -task codegen_blackbox_ranges_literal_emptyRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/emptyRange.kt" -} - -task codegen_blackbox_ranges_literal_inexactDownToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/inexactDownToMinValue.kt" -} - -task codegen_blackbox_ranges_literal_inexactSteppedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/inexactSteppedDownTo.kt" -} - -task codegen_blackbox_ranges_literal_inexactSteppedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/inexactSteppedRange.kt" -} - -task codegen_blackbox_ranges_literal_inexactToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/inexactToMaxValue.kt" -} - -task codegen_blackbox_ranges_literal_maxValueMinusTwoToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt" -} - -task codegen_blackbox_ranges_literal_maxValueToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/maxValueToMaxValue.kt" -} - -task codegen_blackbox_ranges_literal_maxValueToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/maxValueToMinValue.kt" -} - -task codegen_blackbox_ranges_literal_oneElementDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/oneElementDownTo.kt" -} - -task codegen_blackbox_ranges_literal_oneElementRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/oneElementRange.kt" -} - -task codegen_blackbox_ranges_literal_openRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/openRange.kt" -} - -task codegen_blackbox_ranges_literal_progressionDownToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/progressionDownToMinValue.kt" -} - -task codegen_blackbox_ranges_literal_progressionMaxValueMinusTwoToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt" -} - -task codegen_blackbox_ranges_literal_progressionMaxValueToMaxValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt" -} - -task codegen_blackbox_ranges_literal_progressionMaxValueToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt" -} - -task codegen_blackbox_ranges_literal_progressionMinValueToMinValue (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt" -} - -task codegen_blackbox_ranges_literal_reversedBackSequence (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/reversedBackSequence.kt" -} - -task codegen_blackbox_ranges_literal_reversedEmptyBackSequence (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/reversedEmptyBackSequence.kt" -} - -task codegen_blackbox_ranges_literal_reversedEmptyRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/reversedEmptyRange.kt" -} - -task codegen_blackbox_ranges_literal_reversedInexactSteppedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/reversedInexactSteppedDownTo.kt" -} - -task codegen_blackbox_ranges_literal_reversedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/reversedRange.kt" -} - -task codegen_blackbox_ranges_literal_reversedSimpleSteppedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/reversedSimpleSteppedRange.kt" -} - -task codegen_blackbox_ranges_literal_simpleDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/simpleDownTo.kt" -} - -task codegen_blackbox_ranges_literal_simpleRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/simpleRange.kt" -} - -task codegen_blackbox_ranges_literal_simpleRangeWithNonConstantEnds (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/simpleRangeWithNonConstantEnds.kt" -} - -task codegen_blackbox_ranges_literal_simpleSteppedDownTo (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/simpleSteppedDownTo.kt" -} - -task codegen_blackbox_ranges_literal_simpleSteppedRange (type: RunExternalTest) { - source = "codegen/blackbox/ranges/literal/simpleSteppedRange.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle deleted file mode 100644 index 474f5dd7ea5..00000000000 --- a/backend.native/tests/external/codegen/blackbox/ranges/nullableLoopParameter/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_ranges_nullableLoopParameter_progressionExpression (type: RunExternalTest) { - source = "codegen/blackbox/ranges/nullableLoopParameter/progressionExpression.kt" -} - -task codegen_blackbox_ranges_nullableLoopParameter_rangeExpression (type: RunExternalTest) { - source = "codegen/blackbox/ranges/nullableLoopParameter/rangeExpression.kt" -} - -task codegen_blackbox_ranges_nullableLoopParameter_rangeLiteral (type: RunExternalTest) { - source = "codegen/blackbox/ranges/nullableLoopParameter/rangeLiteral.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle deleted file mode 100644 index d3cda249927..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_annotations_annotationRetentionAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt" -} - -task codegen_blackbox_reflection_annotations_annotationsOnJavaMembers (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt" -} - -task codegen_blackbox_reflection_annotations_findAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/findAnnotation.kt" -} - -task codegen_blackbox_reflection_annotations_propertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/propertyAccessors.kt" -} - -task codegen_blackbox_reflection_annotations_propertyWithoutBackingField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt" -} - -task codegen_blackbox_reflection_annotations_retentions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/retentions.kt" -} - -task codegen_blackbox_reflection_annotations_simpleClassAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt" -} - -task codegen_blackbox_reflection_annotations_simpleConstructorAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt" -} - -task codegen_blackbox_reflection_annotations_simpleFunAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt" -} - -task codegen_blackbox_reflection_annotations_simpleParamAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt" -} - -task codegen_blackbox_reflection_annotations_simpleValAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/annotations/simpleValAnnotation.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle deleted file mode 100644 index d4f5ed04728..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_call_bound_companionObjectPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_call_bound_extensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/extensionFunction.kt" -} - -task codegen_blackbox_reflection_call_bound_extensionPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_call_bound_innerClassConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/innerClassConstructor.kt" -} - -task codegen_blackbox_reflection_call_bound_javaInstanceField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/javaInstanceField.kt" -} - -task codegen_blackbox_reflection_call_bound_javaInstanceMethod (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt" -} - -task codegen_blackbox_reflection_call_bound_jvmStaticCompanionObjectPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_call_bound_jvmStaticObjectFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt" -} - -task codegen_blackbox_reflection_call_bound_jvmStaticObjectPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_call_bound_memberFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/memberFunction.kt" -} - -task codegen_blackbox_reflection_call_bound_memberPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_call_bound_objectFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/objectFunction.kt" -} - -task codegen_blackbox_reflection_call_bound_objectPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle deleted file mode 100644 index 9eb04d5ed33..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/build-generated.gradle +++ /dev/null @@ -1,90 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_call_callInstanceJavaMethod (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/callInstanceJavaMethod.kt" -} - -task codegen_blackbox_reflection_call_callPrivateJavaMethod (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/callPrivateJavaMethod.kt" -} - -task codegen_blackbox_reflection_call_callStaticJavaMethod (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/callStaticJavaMethod.kt" -} - -task codegen_blackbox_reflection_call_cannotCallEnumConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt" -} - -task codegen_blackbox_reflection_call_disallowNullValueForNotNullField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt" -} - -task codegen_blackbox_reflection_call_equalsHashCodeToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/equalsHashCodeToString.kt" -} - -task codegen_blackbox_reflection_call_exceptionHappened (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/exceptionHappened.kt" -} - -task codegen_blackbox_reflection_call_fakeOverride (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/fakeOverride.kt" -} - -task codegen_blackbox_reflection_call_fakeOverrideSubstituted (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt" -} - -task codegen_blackbox_reflection_call_incorrectNumberOfArguments (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt" -} - -task codegen_blackbox_reflection_call_innerClassConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/innerClassConstructor.kt" -} - -task codegen_blackbox_reflection_call_jvmStatic (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/jvmStatic.kt" -} - -task codegen_blackbox_reflection_call_jvmStaticInObjectIncorrectReceiver (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt" -} - -task codegen_blackbox_reflection_call_localClassMember (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/localClassMember.kt" -} - -task codegen_blackbox_reflection_call_memberOfGenericClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/memberOfGenericClass.kt" -} - -task codegen_blackbox_reflection_call_privateProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/privateProperty.kt" -} - -task codegen_blackbox_reflection_call_propertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/propertyAccessors.kt" -} - -task codegen_blackbox_reflection_call_propertyGetterAndGetFunctionDifferentReturnType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt" -} - -task codegen_blackbox_reflection_call_returnUnit (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/returnUnit.kt" -} - -task codegen_blackbox_reflection_call_simpleConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/simpleConstructor.kt" -} - -task codegen_blackbox_reflection_call_simpleMemberFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/simpleMemberFunction.kt" -} - -task codegen_blackbox_reflection_call_simpleTopLevelFunctions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle deleted file mode 100644 index fbb6febe8c2..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/build-generated.gradle +++ /dev/null @@ -1,74 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_callBy_boundExtensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/boundExtensionFunction.kt" -} - -task codegen_blackbox_reflection_callBy_boundExtensionPropertyAcessor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt" -} - -task codegen_blackbox_reflection_callBy_boundJvmStaticInObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt" -} - -task codegen_blackbox_reflection_callBy_companionObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/companionObject.kt" -} - -task codegen_blackbox_reflection_callBy_defaultAndNonDefaultIntertwined (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt" -} - -task codegen_blackbox_reflection_callBy_extensionFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/extensionFunction.kt" -} - -task codegen_blackbox_reflection_callBy_jvmStaticInCompanionObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt" -} - -task codegen_blackbox_reflection_callBy_jvmStaticInObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/jvmStaticInObject.kt" -} - -task codegen_blackbox_reflection_callBy_manyArgumentsOnlyOneDefault (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt" -} - -task codegen_blackbox_reflection_callBy_manyMaskArguments (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/manyMaskArguments.kt" -} - -task codegen_blackbox_reflection_callBy_nonDefaultParameterOmitted (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt" -} - -task codegen_blackbox_reflection_callBy_nullValue (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/nullValue.kt" -} - -task codegen_blackbox_reflection_callBy_ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt" -} - -task codegen_blackbox_reflection_callBy_primitiveDefaultValues (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt" -} - -task codegen_blackbox_reflection_callBy_privateMemberFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/privateMemberFunction.kt" -} - -task codegen_blackbox_reflection_callBy_simpleConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/simpleConstructor.kt" -} - -task codegen_blackbox_reflection_callBy_simpleMemberFunciton (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt" -} - -task codegen_blackbox_reflection_callBy_simpleTopLevelFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle deleted file mode 100644 index da325e2661c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_classLiterals_annotationClassLiteral (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt" -} - -task codegen_blackbox_reflection_classLiterals_arrays (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/arrays.kt" -} - -task codegen_blackbox_reflection_classLiterals_builtinClassLiterals (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt" -} - -task codegen_blackbox_reflection_classLiterals_genericArrays (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/genericArrays.kt" -} - -task codegen_blackbox_reflection_classLiterals_genericClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/genericClass.kt" -} - -task codegen_blackbox_reflection_classLiterals_reifiedTypeClassLiteral (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt" -} - -task codegen_blackbox_reflection_classLiterals_simpleClassLiteral (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classLiterals/simpleClassLiteral.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle deleted file mode 100644 index 23fa9804001..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_classes_classSimpleName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/classSimpleName.kt" -} - -task codegen_blackbox_reflection_classes_companionObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/companionObject.kt" -} - -task codegen_blackbox_reflection_classes_createInstance (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/createInstance.kt" -} - -task codegen_blackbox_reflection_classes_declaredMembers (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/declaredMembers.kt" -} - -task codegen_blackbox_reflection_classes_jvmName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/jvmName.kt" -} - -task codegen_blackbox_reflection_classes_localClassSimpleName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/localClassSimpleName.kt" -} - -task codegen_blackbox_reflection_classes_nestedClasses (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/nestedClasses.kt" -} - -task codegen_blackbox_reflection_classes_nestedClassesJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/nestedClassesJava.kt" -} - -task codegen_blackbox_reflection_classes_objectInstance (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/objectInstance.kt" -} - -task codegen_blackbox_reflection_classes_primitiveKClassEquality (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/primitiveKClassEquality.kt" -} - -task codegen_blackbox_reflection_classes_qualifiedName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/qualifiedName.kt" -} - -task codegen_blackbox_reflection_classes_starProjectedType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/classes/starProjectedType.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle deleted file mode 100644 index 9f843b7a187..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/constructors/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_constructors_annotationClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/constructors/annotationClass.kt" -} - -task codegen_blackbox_reflection_constructors_classesWithoutConstructors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt" -} - -task codegen_blackbox_reflection_constructors_constructorName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/constructors/constructorName.kt" -} - -task codegen_blackbox_reflection_constructors_primaryConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/constructors/primaryConstructor.kt" -} - -task codegen_blackbox_reflection_constructors_simpleGetConstructors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/constructors/simpleGetConstructors.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle deleted file mode 100644 index d27d29612db..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_createAnnotation_annotationType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/annotationType.kt" -} - -task codegen_blackbox_reflection_createAnnotation_arrayOfKClasses (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt" -} - -task codegen_blackbox_reflection_createAnnotation_callByJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/callByJava.kt" -} - -task codegen_blackbox_reflection_createAnnotation_callByKotlin (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/callByKotlin.kt" -} - -task codegen_blackbox_reflection_createAnnotation_callJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/callJava.kt" -} - -task codegen_blackbox_reflection_createAnnotation_callKotlin (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/callKotlin.kt" -} - -task codegen_blackbox_reflection_createAnnotation_createJdkAnnotationInstance (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt" -} - -task codegen_blackbox_reflection_createAnnotation_enumKClassAnnotation (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt" -} - -task codegen_blackbox_reflection_createAnnotation_equalsHashCodeToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt" -} - -task codegen_blackbox_reflection_createAnnotation_floatingPointParameters (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt" -} - -task codegen_blackbox_reflection_createAnnotation_parameterNamedEquals (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt" -} - -task codegen_blackbox_reflection_createAnnotation_primitivesAndArrays (type: RunExternalTest) { - source = "codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle deleted file mode 100644 index c3cf7cfa48c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/build-generated.gradle +++ /dev/null @@ -1,98 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_enclosing_anonymousObjectInInlinedLambda (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt" -} - -task codegen_blackbox_reflection_enclosing_classInLambda (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/classInLambda.kt" -} - -task codegen_blackbox_reflection_enclosing_functionExpressionInProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt" -} - -task codegen_blackbox_reflection_enclosing_kt11969 (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/kt11969.kt" -} - -task codegen_blackbox_reflection_enclosing_kt6368 (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/kt6368.kt" -} - -task codegen_blackbox_reflection_enclosing_kt6691_lambdaInSamConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInClassObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInFunction.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInLambda (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInLambda.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInLocalClassConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInLocalClassSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInLocalFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInMemberFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInMemberFunctionInLocalClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInMemberFunctionInNestedClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInObjectDeclaration (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInObjectExpression (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInObjectLiteralSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInPackage (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInPackage.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInPropertyGetter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt" -} - -task codegen_blackbox_reflection_enclosing_lambdaInPropertySetter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt" -} - -task codegen_blackbox_reflection_enclosing_localClassInTopLevelFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt" -} - -task codegen_blackbox_reflection_enclosing_objectInLambda (type: RunExternalTest) { - source = "codegen/blackbox/reflection/enclosing/objectInLambda.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle deleted file mode 100644 index c618dd49627..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_functions_declaredVsInheritedFunctions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt" -} - -task codegen_blackbox_reflection_functions_functionFromStdlib (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/functionFromStdlib.kt" -} - -task codegen_blackbox_reflection_functions_functionReferenceErasedToKFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt" -} - -task codegen_blackbox_reflection_functions_genericOverriddenFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/genericOverriddenFunction.kt" -} - -task codegen_blackbox_reflection_functions_instanceOfFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/instanceOfFunction.kt" -} - -task codegen_blackbox_reflection_functions_javaClassGetFunctions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/javaClassGetFunctions.kt" -} - -task codegen_blackbox_reflection_functions_javaMethodsSmokeTest (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/javaMethodsSmokeTest.kt" -} - -task codegen_blackbox_reflection_functions_platformName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/platformName.kt" -} - -task codegen_blackbox_reflection_functions_privateMemberFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/privateMemberFunction.kt" -} - -task codegen_blackbox_reflection_functions_simpleGetFunctions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/simpleGetFunctions.kt" -} - -task codegen_blackbox_reflection_functions_simpleNames (type: RunExternalTest) { - source = "codegen/blackbox/reflection/functions/simpleNames.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle deleted file mode 100644 index c784a337cdd..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/build-generated.gradle +++ /dev/null @@ -1,34 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_genericSignature_covariantOverride (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/covariantOverride.kt" -} - -task codegen_blackbox_reflection_genericSignature_defaultImplsGenericSignature (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt" -} - -task codegen_blackbox_reflection_genericSignature_functionLiteralGenericSignature (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt" -} - -task codegen_blackbox_reflection_genericSignature_genericBackingFieldSignature (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt" -} - -task codegen_blackbox_reflection_genericSignature_genericMethodSignature (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt" -} - -task codegen_blackbox_reflection_genericSignature_kt11121 (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/kt11121.kt" -} - -task codegen_blackbox_reflection_genericSignature_kt5112 (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/kt5112.kt" -} - -task codegen_blackbox_reflection_genericSignature_kt6106 (type: RunExternalTest) { - source = "codegen/blackbox/reflection/genericSignature/kt6106.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle deleted file mode 100644 index 9045cf0c126..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/isInstance/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_isInstance_isInstanceCastAndSafeCast (type: RunExternalTest) { - source = "codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle deleted file mode 100644 index 713e2e498de..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_kClassInAnnotation_array (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/array.kt" -} - -task codegen_blackbox_reflection_kClassInAnnotation_arrayInJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt" -} - -task codegen_blackbox_reflection_kClassInAnnotation_basic (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/basic.kt" -} - -task codegen_blackbox_reflection_kClassInAnnotation_basicInJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt" -} - -task codegen_blackbox_reflection_kClassInAnnotation_checkcast (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt" -} - -task codegen_blackbox_reflection_kClassInAnnotation_vararg (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/vararg.kt" -} - -task codegen_blackbox_reflection_kClassInAnnotation_varargInJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle deleted file mode 100644 index 388168d870d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_lambdaClasses_parameterNamesAndNullability (type: RunExternalTest) { - source = "codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle deleted file mode 100644 index 373b89bf3fd..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_mapping_constructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/constructor.kt" -} - -task codegen_blackbox_reflection_mapping_extensionProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/extensionProperty.kt" -} - -task codegen_blackbox_reflection_mapping_functions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/functions.kt" -} - -task codegen_blackbox_reflection_mapping_inlineReifiedFun (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/inlineReifiedFun.kt" -} - -task codegen_blackbox_reflection_mapping_mappedClassIsEqualToClassLiteral (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt" -} - -task codegen_blackbox_reflection_mapping_memberProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/memberProperty.kt" -} - -task codegen_blackbox_reflection_mapping_propertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/propertyAccessors.kt" -} - -task codegen_blackbox_reflection_mapping_propertyAccessorsWithJvmName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt" -} - -task codegen_blackbox_reflection_mapping_syntheticFields (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/syntheticFields.kt" -} - -task codegen_blackbox_reflection_mapping_topLevelFunctionOtherFile (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt" -} - -task codegen_blackbox_reflection_mapping_topLevelProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/topLevelProperty.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle deleted file mode 100644 index dfb2c7c4f0f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_mapping_fakeOverrides_javaFieldGetterSetter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt" -} - -task codegen_blackbox_reflection_mapping_fakeOverrides_javaMethod (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle deleted file mode 100644 index dd0d7a31716..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_mapping_jvmStatic_companionObjectFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt" -} - -task codegen_blackbox_reflection_mapping_jvmStatic_objectFunction (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle deleted file mode 100644 index 2c1ea4e9ab6..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/build-generated.gradle +++ /dev/null @@ -1,66 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_mapping_types_annotationConstructorParameters (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt" -} - -task codegen_blackbox_reflection_mapping_types_array (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/array.kt" -} - -task codegen_blackbox_reflection_mapping_types_constructors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/constructors.kt" -} - -task codegen_blackbox_reflection_mapping_types_genericArrayElementType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt" -} - -task codegen_blackbox_reflection_mapping_types_innerGenericTypeArgument (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt" -} - -task codegen_blackbox_reflection_mapping_types_memberFunctions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/memberFunctions.kt" -} - -task codegen_blackbox_reflection_mapping_types_overrideAnyWithPrimitive (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt" -} - -task codegen_blackbox_reflection_mapping_types_parameterizedTypeArgument (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt" -} - -task codegen_blackbox_reflection_mapping_types_parameterizedTypes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt" -} - -task codegen_blackbox_reflection_mapping_types_propertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/propertyAccessors.kt" -} - -task codegen_blackbox_reflection_mapping_types_rawTypeArgument (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/rawTypeArgument.kt" -} - -task codegen_blackbox_reflection_mapping_types_supertypes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/supertypes.kt" -} - -task codegen_blackbox_reflection_mapping_types_topLevelFunctions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt" -} - -task codegen_blackbox_reflection_mapping_types_typeParameters (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/typeParameters.kt" -} - -task codegen_blackbox_reflection_mapping_types_unit (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/unit.kt" -} - -task codegen_blackbox_reflection_mapping_types_withNullability (type: RunExternalTest) { - source = "codegen/blackbox/reflection/mapping/types/withNullability.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle deleted file mode 100644 index de7052b8a14..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/build-generated.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_methodsFromAny_callableReferencesEqualToCallablesFromAPI (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_classToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/classToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_extensionPropertyReceiverToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_functionEqualsHashCode (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_functionToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/functionToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_memberExtensionToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_parametersEqualsHashCode (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_parametersToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/parametersToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_propertyEqualsHashCode (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_propertyToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/propertyToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_typeEqualsHashCode (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_typeParametersEqualsHashCode (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_typeParametersToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_typeToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/typeToString.kt" -} - -task codegen_blackbox_reflection_methodsFromAny_typeToStringInnerGeneric (type: RunExternalTest) { - source = "codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle deleted file mode 100644 index 436f35a65b5..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/build-generated.gradle +++ /dev/null @@ -1,38 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_modifiers_callableModality (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/callableModality.kt" -} - -task codegen_blackbox_reflection_modifiers_callableVisibility (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/callableVisibility.kt" -} - -task codegen_blackbox_reflection_modifiers_classes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/classes.kt" -} - -task codegen_blackbox_reflection_modifiers_classModality (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/classModality.kt" -} - -task codegen_blackbox_reflection_modifiers_classVisibility (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/classVisibility.kt" -} - -task codegen_blackbox_reflection_modifiers_functions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/functions.kt" -} - -task codegen_blackbox_reflection_modifiers_javaVisibility (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/javaVisibility.kt" -} - -task codegen_blackbox_reflection_modifiers_properties (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/properties.kt" -} - -task codegen_blackbox_reflection_modifiers_typeParameters (type: RunExternalTest) { - source = "codegen/blackbox/reflection/modifiers/typeParameters.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle deleted file mode 100644 index f9c644ec7ed..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_multifileClasses_callFunctionsInMultifileClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt" -} - -task codegen_blackbox_reflection_multifileClasses_callPropertiesInMultifileClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt" -} - -task codegen_blackbox_reflection_multifileClasses_javaFieldForVarAndConstVal (type: RunExternalTest) { - source = "codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle deleted file mode 100644 index 8cb65277838..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_noReflectAtRuntime_javaClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_primitiveJavaClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_propertyGetSetName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/propertyGetSetName.kt" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_propertyInstanceof (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/propertyInstanceof.kt" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_reifiedTypeJavaClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_simpleClassLiterals (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle deleted file mode 100644 index 8338cb4294d..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny_callableReferences (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny_classReference (type: RunExternalTest) { - source = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle deleted file mode 100644 index de46832937c..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_parameters_boundInnerClassConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt" -} - -task codegen_blackbox_reflection_parameters_boundObjectMemberReferences (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt" -} - -task codegen_blackbox_reflection_parameters_boundReferences (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/boundReferences.kt" -} - -task codegen_blackbox_reflection_parameters_findParameterByName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/findParameterByName.kt" -} - -task codegen_blackbox_reflection_parameters_functionParameterNameAndIndex (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt" -} - -task codegen_blackbox_reflection_parameters_instanceExtensionReceiverAndValueParameters (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt" -} - -task codegen_blackbox_reflection_parameters_isMarkedNullable (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/isMarkedNullable.kt" -} - -task codegen_blackbox_reflection_parameters_isOptional (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/isOptional.kt" -} - -task codegen_blackbox_reflection_parameters_javaAnnotationConstructor (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt" -} - -task codegen_blackbox_reflection_parameters_javaParametersHaveNoNames (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt" -} - -task codegen_blackbox_reflection_parameters_kinds (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/kinds.kt" -} - -task codegen_blackbox_reflection_parameters_propertySetter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/parameters/propertySetter.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle deleted file mode 100644 index dde631bd4ea..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_properties_accessors_accessorNames (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/accessors/accessorNames.kt" -} - -task codegen_blackbox_reflection_properties_accessors_extensionPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_properties_accessors_memberExtensions (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/accessors/memberExtensions.kt" -} - -task codegen_blackbox_reflection_properties_accessors_memberPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt" -} - -task codegen_blackbox_reflection_properties_accessors_topLevelPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle deleted file mode 100644 index bbcb11f7171..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/build-generated.gradle +++ /dev/null @@ -1,118 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_properties_allVsDeclared (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/allVsDeclared.kt" -} - -task codegen_blackbox_reflection_properties_callPrivatePropertyFromGetProperties (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt" -} - -task codegen_blackbox_reflection_properties_declaredVsInheritedProperties (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt" -} - -task codegen_blackbox_reflection_properties_fakeOverridesInSubclass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt" -} - -task codegen_blackbox_reflection_properties_genericClassLiteralPropertyReceiverIsStar (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt" -} - -task codegen_blackbox_reflection_properties_genericOverriddenProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/genericOverriddenProperty.kt" -} - -task codegen_blackbox_reflection_properties_genericProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/genericProperty.kt" -} - -task codegen_blackbox_reflection_properties_getExtensionPropertiesMutableVsReadonly (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt" -} - -task codegen_blackbox_reflection_properties_getPropertiesMutableVsReadonly (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt" -} - -task codegen_blackbox_reflection_properties_invokeKProperty (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/invokeKProperty.kt" -} - -task codegen_blackbox_reflection_properties_javaPropertyInheritedInKotlin (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt" -} - -task codegen_blackbox_reflection_properties_javaStaticField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/javaStaticField.kt" -} - -task codegen_blackbox_reflection_properties_kotlinPropertyInheritedInJava (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt" -} - -task codegen_blackbox_reflection_properties_memberAndMemberExtensionWithSameName (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt" -} - -task codegen_blackbox_reflection_properties_mutatePrivateJavaInstanceField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt" -} - -task codegen_blackbox_reflection_properties_mutatePrivateJavaStaticField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt" -} - -task codegen_blackbox_reflection_properties_noConflictOnKotlinGetterAndJavaField (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt" -} - -task codegen_blackbox_reflection_properties_overrideKotlinPropertyByJavaMethod (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt" -} - -task codegen_blackbox_reflection_properties_privateClassVal (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/privateClassVal.kt" -} - -task codegen_blackbox_reflection_properties_privateClassVar (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/privateClassVar.kt" -} - -task codegen_blackbox_reflection_properties_privateFakeOverrideFromSuperclass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt" -} - -task codegen_blackbox_reflection_properties_privateJvmStaticVarInObject (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt" -} - -task codegen_blackbox_reflection_properties_privatePropertyCallIsAccessibleOnAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt" -} - -task codegen_blackbox_reflection_properties_privateToThisAccessors (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/privateToThisAccessors.kt" -} - -task codegen_blackbox_reflection_properties_propertyOfNestedClassAndArrayType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt" -} - -task codegen_blackbox_reflection_properties_protectedClassVar (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/protectedClassVar.kt" -} - -task codegen_blackbox_reflection_properties_publicClassValAccessible (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/publicClassValAccessible.kt" -} - -task codegen_blackbox_reflection_properties_referenceToJavaFieldOfKotlinSubclass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt" -} - -task codegen_blackbox_reflection_properties_simpleGetProperties (type: RunExternalTest) { - source = "codegen/blackbox/reflection/properties/simpleGetProperties.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle deleted file mode 100644 index ec49f2310ce..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/build-generated.gradle +++ /dev/null @@ -1,6 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_specialBuiltIns_getMembersOfStandardJavaClasses (type: RunExternalTest) { - source = "codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle deleted file mode 100644 index ca70e787fae..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_supertypes_builtInClassSupertypes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt" -} - -task codegen_blackbox_reflection_supertypes_genericSubstitution (type: RunExternalTest) { - source = "codegen/blackbox/reflection/supertypes/genericSubstitution.kt" -} - -task codegen_blackbox_reflection_supertypes_isSubclassOfIsSuperclassOf (type: RunExternalTest) { - source = "codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt" -} - -task codegen_blackbox_reflection_supertypes_primitives (type: RunExternalTest) { - source = "codegen/blackbox/reflection/supertypes/primitives.kt" -} - -task codegen_blackbox_reflection_supertypes_simpleSupertypes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/supertypes/simpleSupertypes.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle deleted file mode 100644 index 90da2c7278f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_typeParameters_declarationSiteVariance (type: RunExternalTest) { - source = "codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt" -} - -task codegen_blackbox_reflection_typeParameters_typeParametersAndNames (type: RunExternalTest) { - source = "codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt" -} - -task codegen_blackbox_reflection_typeParameters_upperBounds (type: RunExternalTest) { - source = "codegen/blackbox/reflection/typeParameters/upperBounds.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle deleted file mode 100644 index 7731909e993..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_types_classifierIsClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/classifierIsClass.kt" -} - -task codegen_blackbox_reflection_types_classifierIsTypeParameter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/classifierIsTypeParameter.kt" -} - -task codegen_blackbox_reflection_types_classifiersOfBuiltInTypes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt" -} - -task codegen_blackbox_reflection_types_innerGenericArguments (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/innerGenericArguments.kt" -} - -task codegen_blackbox_reflection_types_jvmErasureOfClass (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/jvmErasureOfClass.kt" -} - -task codegen_blackbox_reflection_types_jvmErasureOfTypeParameter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt" -} - -task codegen_blackbox_reflection_types_platformTypeClassifier (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/platformTypeClassifier.kt" -} - -task codegen_blackbox_reflection_types_platformTypeNotEqualToKotlinType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt" -} - -task codegen_blackbox_reflection_types_platformTypeToString (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/platformTypeToString.kt" -} - -task codegen_blackbox_reflection_types_typeArguments (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/typeArguments.kt" -} - -task codegen_blackbox_reflection_types_useSiteVariance (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/useSiteVariance.kt" -} - -task codegen_blackbox_reflection_types_withNullability (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/withNullability.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle deleted file mode 100644 index c32f76c3997..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_types_createType_equality (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/createType/equality.kt" -} - -task codegen_blackbox_reflection_types_createType_innerGeneric (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/createType/innerGeneric.kt" -} - -task codegen_blackbox_reflection_types_createType_simpleCreateType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/createType/simpleCreateType.kt" -} - -task codegen_blackbox_reflection_types_createType_typeParameter (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/createType/typeParameter.kt" -} - -task codegen_blackbox_reflection_types_createType_wrongNumberOfArguments (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle deleted file mode 100644 index 6a6b28eda0a..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/build-generated.gradle +++ /dev/null @@ -1,18 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reflection_types_subtyping_platformType (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/subtyping/platformType.kt" -} - -task codegen_blackbox_reflection_types_subtyping_simpleGenericTypes (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt" -} - -task codegen_blackbox_reflection_types_subtyping_simpleSubtypeSupertype (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt" -} - -task codegen_blackbox_reflection_types_subtyping_typeProjection (type: RunExternalTest) { - source = "codegen/blackbox/reflection/types/subtyping/typeProjection.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle deleted file mode 100644 index 012df1c8eb9..00000000000 --- a/backend.native/tests/external/codegen/blackbox/regressions/build-generated.gradle +++ /dev/null @@ -1,278 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_regressions_arrayLengthNPE (type: RunExternalTest) { - source = "codegen/blackbox/regressions/arrayLengthNPE.kt" -} - -task codegen_blackbox_regressions_collections (type: RunExternalTest) { - source = "codegen/blackbox/regressions/collections.kt" -} - -task codegen_blackbox_regressions_commonSupertypeContravariant (type: RunExternalTest) { - source = "codegen/blackbox/regressions/commonSupertypeContravariant.kt" -} - -task codegen_blackbox_regressions_commonSupertypeContravariant2 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/commonSupertypeContravariant2.kt" -} - -task codegen_blackbox_regressions_doubleMerge (type: RunExternalTest) { - source = "codegen/blackbox/regressions/doubleMerge.kt" -} - -task codegen_blackbox_regressions_floatMerge (type: RunExternalTest) { - source = "codegen/blackbox/regressions/floatMerge.kt" -} - -task codegen_blackbox_regressions_generic (type: RunExternalTest) { - source = "codegen/blackbox/regressions/generic.kt" -} - -task codegen_blackbox_regressions_getGenericInterfaces (type: RunExternalTest) { - source = "codegen/blackbox/regressions/getGenericInterfaces.kt" -} - -task codegen_blackbox_regressions_hashCodeNPE (type: RunExternalTest) { - source = "codegen/blackbox/regressions/hashCodeNPE.kt" -} - -task codegen_blackbox_regressions_internalTopLevelOtherPackage (type: RunExternalTest) { - source = "codegen/blackbox/regressions/internalTopLevelOtherPackage.kt" -} - -task codegen_blackbox_regressions_kt10143 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt10143.kt" -} - -task codegen_blackbox_regressions_kt10934 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt10934.kt" -} - -task codegen_blackbox_regressions_Kt1149 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/Kt1149.kt" -} - -task codegen_blackbox_regressions_kt1172 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1172.kt" -} - -task codegen_blackbox_regressions_kt1202 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1202.kt" -} - -task codegen_blackbox_regressions_kt13381 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt13381.kt" -} - -task codegen_blackbox_regressions_kt1406 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1406.kt" -} - -task codegen_blackbox_regressions_kt14447 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt14447.kt" -} - -task codegen_blackbox_regressions_kt1515 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1515.kt" -} - -task codegen_blackbox_regressions_kt1528 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1528.kt" -} - -task codegen_blackbox_regressions_kt1568 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1568.kt" -} - -task codegen_blackbox_regressions_Kt1619Test (type: RunExternalTest) { - source = "codegen/blackbox/regressions/Kt1619Test.kt" -} - -task codegen_blackbox_regressions_kt1779 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1779.kt" -} - -task codegen_blackbox_regressions_kt1800 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1800.kt" -} - -task codegen_blackbox_regressions_kt1845 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1845.kt" -} - -task codegen_blackbox_regressions_kt1932 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt1932.kt" -} - -task codegen_blackbox_regressions_kt2017 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2017.kt" -} - -task codegen_blackbox_regressions_kt2060 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2060.kt" -} - -task codegen_blackbox_regressions_kt2210 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2210.kt" -} - -task codegen_blackbox_regressions_kt2246 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2246.kt" -} - -task codegen_blackbox_regressions_kt2318 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2318.kt" -} - -task codegen_blackbox_regressions_Kt2495Test (type: RunExternalTest) { - source = "codegen/blackbox/regressions/Kt2495Test.kt" -} - -task codegen_blackbox_regressions_kt2509 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2509.kt" -} - -task codegen_blackbox_regressions_kt2593 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt2593.kt" -} - -task codegen_blackbox_regressions_kt274 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt274.kt" -} - -task codegen_blackbox_regressions_kt3046 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3046.kt" -} - -task codegen_blackbox_regressions_kt3107 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3107.kt" -} - -task codegen_blackbox_regressions_kt3421 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3421.kt" -} - -task codegen_blackbox_regressions_kt344 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt344.kt" -} - -task codegen_blackbox_regressions_kt3442 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3442.kt" -} - -task codegen_blackbox_regressions_kt3587 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3587.kt" -} - -task codegen_blackbox_regressions_kt3850 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3850.kt" -} - -task codegen_blackbox_regressions_kt3903 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt3903.kt" -} - -task codegen_blackbox_regressions_kt4142 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt4142.kt" -} - -task codegen_blackbox_regressions_kt4259 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt4259.kt" -} - -task codegen_blackbox_regressions_kt4262 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt4262.kt" -} - -task codegen_blackbox_regressions_kt4281 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt4281.kt" -} - -task codegen_blackbox_regressions_kt5056 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt5056.kt" -} - -task codegen_blackbox_regressions_kt528 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt528.kt" -} - -task codegen_blackbox_regressions_kt529 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt529.kt" -} - -task codegen_blackbox_regressions_kt533 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt533.kt" -} - -task codegen_blackbox_regressions_kt5395 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt5395.kt" -} - -task codegen_blackbox_regressions_kt5445 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt5445.kt" -} - -task codegen_blackbox_regressions_kt5445_2 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt5445_2.kt" -} - -task codegen_blackbox_regressions_kt5786_privateWithDefault (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt5786_privateWithDefault.kt" -} - -task codegen_blackbox_regressions_kt5953 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt5953.kt" -} - -task codegen_blackbox_regressions_kt6153 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt6153.kt" -} - -task codegen_blackbox_regressions_kt6434 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt6434.kt" -} - -task codegen_blackbox_regressions_kt6434_2 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt6434_2.kt" -} - -task codegen_blackbox_regressions_kt6485 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt6485.kt" -} - -task codegen_blackbox_regressions_kt715 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt715.kt" -} - -task codegen_blackbox_regressions_kt7401 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt7401.kt" -} - -task codegen_blackbox_regressions_kt789 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt789.kt" -} - -task codegen_blackbox_regressions_kt864 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt864.kt" -} - -task codegen_blackbox_regressions_kt998 (type: RunExternalTest) { - source = "codegen/blackbox/regressions/kt998.kt" -} - -task codegen_blackbox_regressions_nestedIntersection (type: RunExternalTest) { - source = "codegen/blackbox/regressions/nestedIntersection.kt" -} - -task codegen_blackbox_regressions_objectCaptureOuterConstructorProperty (type: RunExternalTest) { - source = "codegen/blackbox/regressions/objectCaptureOuterConstructorProperty.kt" -} - -task codegen_blackbox_regressions_referenceToSelfInLocal (type: RunExternalTest) { - source = "codegen/blackbox/regressions/referenceToSelfInLocal.kt" -} - -task codegen_blackbox_regressions_typeCastException (type: RunExternalTest) { - source = "codegen/blackbox/regressions/typeCastException.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle deleted file mode 100644 index fc12b2daa93..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reified_arraysReification_instanceOf (type: RunExternalTest) { - source = "codegen/blackbox/reified/arraysReification/instanceOf.kt" -} - -task codegen_blackbox_reified_arraysReification_instanceOfArrays (type: RunExternalTest) { - source = "codegen/blackbox/reified/arraysReification/instanceOfArrays.kt" -} - -task codegen_blackbox_reified_arraysReification_jaggedArray (type: RunExternalTest) { - source = "codegen/blackbox/reified/arraysReification/jaggedArray.kt" -} - -task codegen_blackbox_reified_arraysReification_jaggedArrayOfNulls (type: RunExternalTest) { - source = "codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt" -} - -task codegen_blackbox_reified_arraysReification_jaggedDeep (type: RunExternalTest) { - source = "codegen/blackbox/reified/arraysReification/jaggedDeep.kt" -} - -task codegen_blackbox_reified_arraysReification_jClass (type: RunExternalTest) { - source = "codegen/blackbox/reified/arraysReification/jClass.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle deleted file mode 100644 index d40c3c81536..00000000000 --- a/backend.native/tests/external/codegen/blackbox/reified/build-generated.gradle +++ /dev/null @@ -1,118 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_reified_anonymousObject (type: RunExternalTest) { - source = "codegen/blackbox/reified/anonymousObject.kt" -} - -task codegen_blackbox_reified_anonymousObjectNoPropagate (type: RunExternalTest) { - source = "codegen/blackbox/reified/anonymousObjectNoPropagate.kt" -} - -task codegen_blackbox_reified_anonymousObjectReifiedSupertype (type: RunExternalTest) { - source = "codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt" -} - -task codegen_blackbox_reified_approximateCapturedTypes (type: RunExternalTest) { - source = "codegen/blackbox/reified/approximateCapturedTypes.kt" -} - -task codegen_blackbox_reified_asOnPlatformType (type: RunExternalTest) { - source = "codegen/blackbox/reified/asOnPlatformType.kt" -} - -task codegen_blackbox_reified_checkcast (type: RunExternalTest) { - source = "codegen/blackbox/reified/checkcast.kt" -} - -task codegen_blackbox_reified_copyToArray (type: RunExternalTest) { - source = "codegen/blackbox/reified/copyToArray.kt" -} - -task codegen_blackbox_reified_defaultJavaClass (type: RunExternalTest) { - source = "codegen/blackbox/reified/defaultJavaClass.kt" -} - -task codegen_blackbox_reified_DIExample (type: RunExternalTest) { - source = "codegen/blackbox/reified/DIExample.kt" -} - -task codegen_blackbox_reified_filterIsInstance (type: RunExternalTest) { - source = "codegen/blackbox/reified/filterIsInstance.kt" -} - -task codegen_blackbox_reified_innerAnonymousObject (type: RunExternalTest) { - source = "codegen/blackbox/reified/innerAnonymousObject.kt" -} - -task codegen_blackbox_reified_instanceof (type: RunExternalTest) { - source = "codegen/blackbox/reified/instanceof.kt" -} - -task codegen_blackbox_reified_isOnPlatformType (type: RunExternalTest) { - source = "codegen/blackbox/reified/isOnPlatformType.kt" -} - -task codegen_blackbox_reified_javaClass (type: RunExternalTest) { - source = "codegen/blackbox/reified/javaClass.kt" -} - -task codegen_blackbox_reified_nestedReified (type: RunExternalTest) { - source = "codegen/blackbox/reified/nestedReified.kt" -} - -task codegen_blackbox_reified_nestedReifiedSignature (type: RunExternalTest) { - source = "codegen/blackbox/reified/nestedReifiedSignature.kt" -} - -task codegen_blackbox_reified_newArrayInt (type: RunExternalTest) { - source = "codegen/blackbox/reified/newArrayInt.kt" -} - -task codegen_blackbox_reified_nonInlineableLambdaInReifiedFunction (type: RunExternalTest) { - source = "codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt" -} - -task codegen_blackbox_reified_recursiveInnerAnonymousObject (type: RunExternalTest) { - source = "codegen/blackbox/reified/recursiveInnerAnonymousObject.kt" -} - -task codegen_blackbox_reified_recursiveNewArray (type: RunExternalTest) { - source = "codegen/blackbox/reified/recursiveNewArray.kt" -} - -task codegen_blackbox_reified_recursiveNonInlineableLambda (type: RunExternalTest) { - source = "codegen/blackbox/reified/recursiveNonInlineableLambda.kt" -} - -task codegen_blackbox_reified_reifiedChain (type: RunExternalTest) { - source = "codegen/blackbox/reified/reifiedChain.kt" -} - -task codegen_blackbox_reified_reifiedInlineFunOfObject (type: RunExternalTest) { - source = "codegen/blackbox/reified/reifiedInlineFunOfObject.kt" -} - -task codegen_blackbox_reified_reifiedInlineFunOfObjectWithinReified (type: RunExternalTest) { - source = "codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt" -} - -task codegen_blackbox_reified_reifiedInlineIntoNonInlineableLambda (type: RunExternalTest) { - source = "codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt" -} - -task codegen_blackbox_reified_safecast (type: RunExternalTest) { - source = "codegen/blackbox/reified/safecast.kt" -} - -task codegen_blackbox_reified_sameIndexRecursive (type: RunExternalTest) { - source = "codegen/blackbox/reified/sameIndexRecursive.kt" -} - -task codegen_blackbox_reified_spreads (type: RunExternalTest) { - source = "codegen/blackbox/reified/spreads.kt" -} - -task codegen_blackbox_reified_varargs (type: RunExternalTest) { - source = "codegen/blackbox/reified/varargs.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle deleted file mode 100644 index 58006c71f27..00000000000 --- a/backend.native/tests/external/codegen/blackbox/safeCall/build-generated.gradle +++ /dev/null @@ -1,38 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_safeCall_genericNull (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/genericNull.kt" -} - -task codegen_blackbox_safeCall_kt1572 (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/kt1572.kt" -} - -task codegen_blackbox_safeCall_kt232 (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/kt232.kt" -} - -task codegen_blackbox_safeCall_kt245 (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/kt245.kt" -} - -task codegen_blackbox_safeCall_kt247 (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/kt247.kt" -} - -task codegen_blackbox_safeCall_kt3430 (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/kt3430.kt" -} - -task codegen_blackbox_safeCall_kt4733 (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/kt4733.kt" -} - -task codegen_blackbox_safeCall_primitive (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/primitive.kt" -} - -task codegen_blackbox_safeCall_safeCallOnLong (type: RunExternalTest) { - source = "codegen/blackbox/safeCall/safeCallOnLong.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle deleted file mode 100644 index dbd464d3952..00000000000 --- a/backend.native/tests/external/codegen/blackbox/sam/build-generated.gradle +++ /dev/null @@ -1,2 +0,0 @@ -import org.jetbrains.kotlin.* - diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle deleted file mode 100644 index f26f2c962c3..00000000000 --- a/backend.native/tests/external/codegen/blackbox/sam/constructors/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_sam_constructors_comparator (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/comparator.kt" -} - -task codegen_blackbox_sam_constructors_filenameFilter (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/filenameFilter.kt" -} - -task codegen_blackbox_sam_constructors_nonLiteralComparator (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/nonLiteralComparator.kt" -} - -task codegen_blackbox_sam_constructors_nonLiteralFilenameFilter (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt" -} - -task codegen_blackbox_sam_constructors_nonLiteralRunnable (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/nonLiteralRunnable.kt" -} - -task codegen_blackbox_sam_constructors_nonTrivialRunnable (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/nonTrivialRunnable.kt" -} - -task codegen_blackbox_sam_constructors_runnable (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/runnable.kt" -} - -task codegen_blackbox_sam_constructors_runnableAccessingClosure1 (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/runnableAccessingClosure1.kt" -} - -task codegen_blackbox_sam_constructors_runnableAccessingClosure2 (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/runnableAccessingClosure2.kt" -} - -task codegen_blackbox_sam_constructors_sameWrapperClass (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/sameWrapperClass.kt" -} - -task codegen_blackbox_sam_constructors_samWrappersDifferentFiles (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt" -} - -task codegen_blackbox_sam_constructors_syntheticVsReal (type: RunExternalTest) { - source = "codegen/blackbox/sam/constructors/syntheticVsReal.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle deleted file mode 100644 index 30d27028710..00000000000 --- a/backend.native/tests/external/codegen/blackbox/sealed/build-generated.gradle +++ /dev/null @@ -1,10 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_sealed_objects (type: RunExternalTest) { - source = "codegen/blackbox/sealed/objects.kt" -} - -task codegen_blackbox_sealed_simple (type: RunExternalTest) { - source = "codegen/blackbox/sealed/simple.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle deleted file mode 100644 index 094ad730caa..00000000000 --- a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/build-generated.gradle +++ /dev/null @@ -1,126 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_secondaryConstructors_accessToCompanion (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/accessToCompanion.kt" -} - -task codegen_blackbox_secondaryConstructors_accessToNestedObject (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/accessToNestedObject.kt" -} - -task codegen_blackbox_secondaryConstructors_basicNoPrimaryManySinks (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/basicNoPrimaryManySinks.kt" -} - -task codegen_blackbox_secondaryConstructors_basicNoPrimaryOneSink (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/basicNoPrimaryOneSink.kt" -} - -task codegen_blackbox_secondaryConstructors_basicPrimary (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/basicPrimary.kt" -} - -task codegen_blackbox_secondaryConstructors_callFromLocalSubClass (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/callFromLocalSubClass.kt" -} - -task codegen_blackbox_secondaryConstructors_callFromPrimaryWithNamedArgs (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/callFromPrimaryWithNamedArgs.kt" -} - -task codegen_blackbox_secondaryConstructors_callFromPrimaryWithOptionalArgs (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/callFromPrimaryWithOptionalArgs.kt" -} - -task codegen_blackbox_secondaryConstructors_callFromSubClass (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/callFromSubClass.kt" -} - -task codegen_blackbox_secondaryConstructors_clashingDefaultConstructors (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/clashingDefaultConstructors.kt" -} - -task codegen_blackbox_secondaryConstructors_dataClasses (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/dataClasses.kt" -} - -task codegen_blackbox_secondaryConstructors_defaultArgs (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/defaultArgs.kt" -} - -task codegen_blackbox_secondaryConstructors_defaultParametersNotDuplicated (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/defaultParametersNotDuplicated.kt" -} - -task codegen_blackbox_secondaryConstructors_delegatedThisWithLambda (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/delegatedThisWithLambda.kt" -} - -task codegen_blackbox_secondaryConstructors_delegateWithComplexExpression (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/delegateWithComplexExpression.kt" -} - -task codegen_blackbox_secondaryConstructors_delegationWithPrimary (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/delegationWithPrimary.kt" -} - -task codegen_blackbox_secondaryConstructors_enums (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/enums.kt" -} - -task codegen_blackbox_secondaryConstructors_generics (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/generics.kt" -} - -task codegen_blackbox_secondaryConstructors_innerClasses (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/innerClasses.kt" -} - -task codegen_blackbox_secondaryConstructors_innerClassesInheritance (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/innerClassesInheritance.kt" -} - -task codegen_blackbox_secondaryConstructors_localClasses (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/localClasses.kt" -} - -task codegen_blackbox_secondaryConstructors_superCallPrimary (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/superCallPrimary.kt" -} - -task codegen_blackbox_secondaryConstructors_superCallSecondary (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/superCallSecondary.kt" -} - -task codegen_blackbox_secondaryConstructors_varargs (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/varargs.kt" -} - -task codegen_blackbox_secondaryConstructors_withGenerics (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withGenerics.kt" -} - -task codegen_blackbox_secondaryConstructors_withNonLocalReturn (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt" -} - -task codegen_blackbox_secondaryConstructors_withoutPrimary (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withoutPrimary.kt" -} - -task codegen_blackbox_secondaryConstructors_withPrimary (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withPrimary.kt" -} - -task codegen_blackbox_secondaryConstructors_withReturn (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withReturn.kt" -} - -task codegen_blackbox_secondaryConstructors_withReturnUnit (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withReturnUnit.kt" -} - -task codegen_blackbox_secondaryConstructors_withVarargs (type: RunExternalTest) { - source = "codegen/blackbox/secondaryConstructors/withVarargs.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle deleted file mode 100644 index 29c412d7eb8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/smap/build-generated.gradle +++ /dev/null @@ -1,14 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_smap_chainCalls (type: RunExternalTest) { - source = "codegen/blackbox/smap/chainCalls.kt" -} - -task codegen_blackbox_smap_infixCalls (type: RunExternalTest) { - source = "codegen/blackbox/smap/infixCalls.kt" -} - -task codegen_blackbox_smap_simpleCallWithParams (type: RunExternalTest) { - source = "codegen/blackbox/smap/simpleCallWithParams.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle deleted file mode 100644 index 73856601045..00000000000 --- a/backend.native/tests/external/codegen/blackbox/smartCasts/build-generated.gradle +++ /dev/null @@ -1,50 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_smartCasts_falseSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/falseSmartCast.kt" -} - -task codegen_blackbox_smartCasts_genericIntersection (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/genericIntersection.kt" -} - -task codegen_blackbox_smartCasts_genericSet (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/genericSet.kt" -} - -task codegen_blackbox_smartCasts_implicitExtensionReceiver (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/implicitExtensionReceiver.kt" -} - -task codegen_blackbox_smartCasts_implicitMemberReceiver (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/implicitMemberReceiver.kt" -} - -task codegen_blackbox_smartCasts_implicitReceiver (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/implicitReceiver.kt" -} - -task codegen_blackbox_smartCasts_implicitReceiverInWhen (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/implicitReceiverInWhen.kt" -} - -task codegen_blackbox_smartCasts_implicitToGrandSon (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/implicitToGrandSon.kt" -} - -task codegen_blackbox_smartCasts_lambdaArgumentWithoutType (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt" -} - -task codegen_blackbox_smartCasts_nullSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/nullSmartCast.kt" -} - -task codegen_blackbox_smartCasts_smartCastInsideIf (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/smartCastInsideIf.kt" -} - -task codegen_blackbox_smartCasts_whenSmartCast (type: RunExternalTest) { - source = "codegen/blackbox/smartCasts/whenSmartCast.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle deleted file mode 100644 index c886a5ae13e..00000000000 --- a/backend.native/tests/external/codegen/blackbox/specialBuiltins/build-generated.gradle +++ /dev/null @@ -1,82 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_specialBuiltins_bridgeNotEmptyMap (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt" -} - -task codegen_blackbox_specialBuiltins_bridges (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/bridges.kt" -} - -task codegen_blackbox_specialBuiltins_collectionImpl (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/collectionImpl.kt" -} - -task codegen_blackbox_specialBuiltins_commonBridgesTarget (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/commonBridgesTarget.kt" -} - -task codegen_blackbox_specialBuiltins_emptyList (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/emptyList.kt" -} - -task codegen_blackbox_specialBuiltins_emptyMap (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/emptyMap.kt" -} - -task codegen_blackbox_specialBuiltins_emptyStringMap (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/emptyStringMap.kt" -} - -task codegen_blackbox_specialBuiltins_entrySetSOE (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/entrySetSOE.kt" -} - -task codegen_blackbox_specialBuiltins_enumAsOrdinaled (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/enumAsOrdinaled.kt" -} - -task codegen_blackbox_specialBuiltins_explicitSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/explicitSuperCall.kt" -} - -task codegen_blackbox_specialBuiltins_irrelevantRemoveAtOverride (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/irrelevantRemoveAtOverride.kt" -} - -task codegen_blackbox_specialBuiltins_maps (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/maps.kt" -} - -task codegen_blackbox_specialBuiltins_noSpecialBridgeInSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/noSpecialBridgeInSuperClass.kt" -} - -task codegen_blackbox_specialBuiltins_notEmptyListAny (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/notEmptyListAny.kt" -} - -task codegen_blackbox_specialBuiltins_notEmptyMap (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/notEmptyMap.kt" -} - -task codegen_blackbox_specialBuiltins_redundantStubForSize (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/redundantStubForSize.kt" -} - -task codegen_blackbox_specialBuiltins_removeAtTwoSpecialBridges (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/removeAtTwoSpecialBridges.kt" -} - -task codegen_blackbox_specialBuiltins_throwable (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/throwable.kt" -} - -task codegen_blackbox_specialBuiltins_throwableImpl (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/throwableImpl.kt" -} - -task codegen_blackbox_specialBuiltins_valuesInsideEnum (type: RunExternalTest) { - source = "codegen/blackbox/specialBuiltins/valuesInsideEnum.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle deleted file mode 100644 index 14d79c3bb27..00000000000 --- a/backend.native/tests/external/codegen/blackbox/statics/build-generated.gradle +++ /dev/null @@ -1,66 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_statics_anonymousInitializerInClassObject (type: RunExternalTest) { - source = "codegen/blackbox/statics/anonymousInitializerInClassObject.kt" -} - -task codegen_blackbox_statics_anonymousInitializerIObject (type: RunExternalTest) { - source = "codegen/blackbox/statics/anonymousInitializerIObject.kt" -} - -task codegen_blackbox_statics_fields (type: RunExternalTest) { - source = "codegen/blackbox/statics/fields.kt" -} - -task codegen_blackbox_statics_functions (type: RunExternalTest) { - source = "codegen/blackbox/statics/functions.kt" -} - -task codegen_blackbox_statics_hidePrivateByPublic (type: RunExternalTest) { - source = "codegen/blackbox/statics/hidePrivateByPublic.kt" -} - -task codegen_blackbox_statics_incInClassObject (type: RunExternalTest) { - source = "codegen/blackbox/statics/incInClassObject.kt" -} - -task codegen_blackbox_statics_incInObject (type: RunExternalTest) { - source = "codegen/blackbox/statics/incInObject.kt" -} - -task codegen_blackbox_statics_inheritedPropertyInClassObject (type: RunExternalTest) { - source = "codegen/blackbox/statics/inheritedPropertyInClassObject.kt" -} - -task codegen_blackbox_statics_inheritedPropertyInObject (type: RunExternalTest) { - source = "codegen/blackbox/statics/inheritedPropertyInObject.kt" -} - -task codegen_blackbox_statics_inlineCallsStaticMethod (type: RunExternalTest) { - source = "codegen/blackbox/statics/inlineCallsStaticMethod.kt" -} - -task codegen_blackbox_statics_kt8089 (type: RunExternalTest) { - source = "codegen/blackbox/statics/kt8089.kt" -} - -task codegen_blackbox_statics_protectedSamConstructor (type: RunExternalTest) { - source = "codegen/blackbox/statics/protectedSamConstructor.kt" -} - -task codegen_blackbox_statics_protectedStatic (type: RunExternalTest) { - source = "codegen/blackbox/statics/protectedStatic.kt" -} - -task codegen_blackbox_statics_protectedStatic2 (type: RunExternalTest) { - source = "codegen/blackbox/statics/protectedStatic2.kt" -} - -task codegen_blackbox_statics_protectedStaticAndInline (type: RunExternalTest) { - source = "codegen/blackbox/statics/protectedStaticAndInline.kt" -} - -task codegen_blackbox_statics_syntheticAccessor (type: RunExternalTest) { - source = "codegen/blackbox/statics/syntheticAccessor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle deleted file mode 100644 index 1b5e06c9838..00000000000 --- a/backend.native/tests/external/codegen/blackbox/storeStackBeforeInline/build-generated.gradle +++ /dev/null @@ -1,22 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_storeStackBeforeInline_differentTypes (type: RunExternalTest) { - source = "codegen/blackbox/storeStackBeforeInline/differentTypes.kt" -} - -task codegen_blackbox_storeStackBeforeInline_primitiveMerge (type: RunExternalTest) { - source = "codegen/blackbox/storeStackBeforeInline/primitiveMerge.kt" -} - -task codegen_blackbox_storeStackBeforeInline_simple (type: RunExternalTest) { - source = "codegen/blackbox/storeStackBeforeInline/simple.kt" -} - -task codegen_blackbox_storeStackBeforeInline_unreachableMarker (type: RunExternalTest) { - source = "codegen/blackbox/storeStackBeforeInline/unreachableMarker.kt" -} - -task codegen_blackbox_storeStackBeforeInline_withLambda (type: RunExternalTest) { - source = "codegen/blackbox/storeStackBeforeInline/withLambda.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle deleted file mode 100644 index 48e2f952d84..00000000000 --- a/backend.native/tests/external/codegen/blackbox/strings/build-generated.gradle +++ /dev/null @@ -1,66 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_strings_ea35743 (type: RunExternalTest) { - source = "codegen/blackbox/strings/ea35743.kt" -} - -task codegen_blackbox_strings_forInString (type: RunExternalTest) { - source = "codegen/blackbox/strings/forInString.kt" -} - -task codegen_blackbox_strings_interpolation (type: RunExternalTest) { - source = "codegen/blackbox/strings/interpolation.kt" -} - -task codegen_blackbox_strings_kt2592 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt2592.kt" -} - -task codegen_blackbox_strings_kt3571 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt3571.kt" -} - -task codegen_blackbox_strings_kt3652 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt3652.kt" -} - -task codegen_blackbox_strings_kt5389_stringBuilderGet (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt5389_stringBuilderGet.kt" -} - -task codegen_blackbox_strings_kt5956 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt5956.kt" -} - -task codegen_blackbox_strings_kt881 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt881.kt" -} - -task codegen_blackbox_strings_kt889 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt889.kt" -} - -task codegen_blackbox_strings_kt894 (type: RunExternalTest) { - source = "codegen/blackbox/strings/kt894.kt" -} - -task codegen_blackbox_strings_multilineStringsWithTemplates (type: RunExternalTest) { - source = "codegen/blackbox/strings/multilineStringsWithTemplates.kt" -} - -task codegen_blackbox_strings_rawStrings (type: RunExternalTest) { - source = "codegen/blackbox/strings/rawStrings.kt" -} - -task codegen_blackbox_strings_rawStringsWithManyQuotes (type: RunExternalTest) { - source = "codegen/blackbox/strings/rawStringsWithManyQuotes.kt" -} - -task codegen_blackbox_strings_stringBuilderAppend (type: RunExternalTest) { - source = "codegen/blackbox/strings/stringBuilderAppend.kt" -} - -task codegen_blackbox_strings_stringPlusOnlyWorksOnString (type: RunExternalTest) { - source = "codegen/blackbox/strings/stringPlusOnlyWorksOnString.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/super/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/super/build-generated.gradle deleted file mode 100644 index e3937c8ae5f..00000000000 --- a/backend.native/tests/external/codegen/blackbox/super/build-generated.gradle +++ /dev/null @@ -1,114 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_super_basicmethodSuperClass (type: RunExternalTest) { - source = "codegen/blackbox/super/basicmethodSuperClass.kt" -} - -task codegen_blackbox_super_basicmethodSuperTrait (type: RunExternalTest) { - source = "codegen/blackbox/super/basicmethodSuperTrait.kt" -} - -task codegen_blackbox_super_basicproperty (type: RunExternalTest) { - source = "codegen/blackbox/super/basicproperty.kt" -} - -task codegen_blackbox_super_enclosedFun (type: RunExternalTest) { - source = "codegen/blackbox/super/enclosedFun.kt" -} - -task codegen_blackbox_super_enclosedVar (type: RunExternalTest) { - source = "codegen/blackbox/super/enclosedVar.kt" -} - -task codegen_blackbox_super_innerClassLabeledSuper (type: RunExternalTest) { - source = "codegen/blackbox/super/innerClassLabeledSuper.kt" -} - -task codegen_blackbox_super_innerClassLabeledSuper2 (type: RunExternalTest) { - source = "codegen/blackbox/super/innerClassLabeledSuper2.kt" -} - -task codegen_blackbox_super_innerClassLabeledSuperProperty (type: RunExternalTest) { - source = "codegen/blackbox/super/innerClassLabeledSuperProperty.kt" -} - -task codegen_blackbox_super_innerClassLabeledSuperProperty2 (type: RunExternalTest) { - source = "codegen/blackbox/super/innerClassLabeledSuperProperty2.kt" -} - -task codegen_blackbox_super_innerClassQualifiedFunctionCall (type: RunExternalTest) { - source = "codegen/blackbox/super/innerClassQualifiedFunctionCall.kt" -} - -task codegen_blackbox_super_innerClassQualifiedPropertyAccess (type: RunExternalTest) { - source = "codegen/blackbox/super/innerClassQualifiedPropertyAccess.kt" -} - -task codegen_blackbox_super_kt14243 (type: RunExternalTest) { - source = "codegen/blackbox/super/kt14243.kt" -} - -task codegen_blackbox_super_kt14243_2 (type: RunExternalTest) { - source = "codegen/blackbox/super/kt14243_2.kt" -} - -task codegen_blackbox_super_kt14243_class (type: RunExternalTest) { - source = "codegen/blackbox/super/kt14243_class.kt" -} - -task codegen_blackbox_super_kt14243_prop (type: RunExternalTest) { - source = "codegen/blackbox/super/kt14243_prop.kt" -} - -task codegen_blackbox_super_kt3492ClassFun (type: RunExternalTest) { - source = "codegen/blackbox/super/kt3492ClassFun.kt" -} - -task codegen_blackbox_super_kt3492ClassProperty (type: RunExternalTest) { - source = "codegen/blackbox/super/kt3492ClassProperty.kt" -} - -task codegen_blackbox_super_kt3492TraitFun (type: RunExternalTest) { - source = "codegen/blackbox/super/kt3492TraitFun.kt" -} - -task codegen_blackbox_super_kt3492TraitProperty (type: RunExternalTest) { - source = "codegen/blackbox/super/kt3492TraitProperty.kt" -} - -task codegen_blackbox_super_kt4173 (type: RunExternalTest) { - source = "codegen/blackbox/super/kt4173.kt" -} - -task codegen_blackbox_super_kt4173_2 (type: RunExternalTest) { - source = "codegen/blackbox/super/kt4173_2.kt" -} - -task codegen_blackbox_super_kt4173_3 (type: RunExternalTest) { - source = "codegen/blackbox/super/kt4173_3.kt" -} - -task codegen_blackbox_super_kt4982 (type: RunExternalTest) { - source = "codegen/blackbox/super/kt4982.kt" -} - -task codegen_blackbox_super_multipleSuperTraits (type: RunExternalTest) { - source = "codegen/blackbox/super/multipleSuperTraits.kt" -} - -task codegen_blackbox_super_traitproperty (type: RunExternalTest) { - source = "codegen/blackbox/super/traitproperty.kt" -} - -task codegen_blackbox_super_unqualifiedSuper (type: RunExternalTest) { - source = "codegen/blackbox/super/unqualifiedSuper.kt" -} - -task codegen_blackbox_super_unqualifiedSuperWithDeeperHierarchies (type: RunExternalTest) { - source = "codegen/blackbox/super/unqualifiedSuperWithDeeperHierarchies.kt" -} - -task codegen_blackbox_super_unqualifiedSuperWithMethodsOfAny (type: RunExternalTest) { - source = "codegen/blackbox/super/unqualifiedSuperWithMethodsOfAny.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle deleted file mode 100644 index 35c72a8bc95..00000000000 --- a/backend.native/tests/external/codegen/blackbox/synchronized/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_synchronized_changeMonitor (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/changeMonitor.kt" -} - -task codegen_blackbox_synchronized_exceptionInMonitorExpression (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/exceptionInMonitorExpression.kt" -} - -task codegen_blackbox_synchronized_finally (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/finally.kt" -} - -task codegen_blackbox_synchronized_longValue (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/longValue.kt" -} - -task codegen_blackbox_synchronized_nestedDifferentObjects (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/nestedDifferentObjects.kt" -} - -task codegen_blackbox_synchronized_nestedSameObject (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/nestedSameObject.kt" -} - -task codegen_blackbox_synchronized_nonLocalReturn (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/nonLocalReturn.kt" -} - -task codegen_blackbox_synchronized_objectValue (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/objectValue.kt" -} - -task codegen_blackbox_synchronized_sync (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/sync.kt" -} - -task codegen_blackbox_synchronized_value (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/value.kt" -} - -task codegen_blackbox_synchronized_wait (type: RunExternalTest) { - source = "codegen/blackbox/synchronized/wait.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle deleted file mode 100644 index 3b3875883c9..00000000000 --- a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/build-generated.gradle +++ /dev/null @@ -1,38 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_syntheticAccessors_accessorForProtected (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/accessorForProtected.kt" -} - -task codegen_blackbox_syntheticAccessors_accessorForProtectedInvokeVirtual (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/accessorForProtectedInvokeVirtual.kt" -} - -task codegen_blackbox_syntheticAccessors_kt10047 (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/kt10047.kt" -} - -task codegen_blackbox_syntheticAccessors_kt9717 (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/kt9717.kt" -} - -task codegen_blackbox_syntheticAccessors_kt9717DifferentPackages (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/kt9717DifferentPackages.kt" -} - -task codegen_blackbox_syntheticAccessors_kt9958 (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/kt9958.kt" -} - -task codegen_blackbox_syntheticAccessors_kt9958Interface (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/kt9958Interface.kt" -} - -task codegen_blackbox_syntheticAccessors_protectedFromLambda (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/protectedFromLambda.kt" -} - -task codegen_blackbox_syntheticAccessors_syntheticAccessorNames (type: RunExternalTest) { - source = "codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle deleted file mode 100644 index 23a3b2e4bce..00000000000 --- a/backend.native/tests/external/codegen/blackbox/toArray/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_toArray_kt3177_toTypedArray (type: RunExternalTest) { - source = "codegen/blackbox/toArray/kt3177-toTypedArray.kt" -} - -task codegen_blackbox_toArray_returnToTypedArray (type: RunExternalTest) { - source = "codegen/blackbox/toArray/returnToTypedArray.kt" -} - -task codegen_blackbox_toArray_toArray (type: RunExternalTest) { - source = "codegen/blackbox/toArray/toArray.kt" -} - -task codegen_blackbox_toArray_toArrayAlreadyPresent (type: RunExternalTest) { - source = "codegen/blackbox/toArray/toArrayAlreadyPresent.kt" -} - -task codegen_blackbox_toArray_toArrayShouldBePublic (type: RunExternalTest) { - source = "codegen/blackbox/toArray/toArrayShouldBePublic.kt" -} - -task codegen_blackbox_toArray_toArrayShouldBePublicWithJava (type: RunExternalTest) { - source = "codegen/blackbox/toArray/toArrayShouldBePublicWithJava.kt" -} - -task codegen_blackbox_toArray_toTypedArray (type: RunExternalTest) { - source = "codegen/blackbox/toArray/toTypedArray.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle deleted file mode 100644 index 0f7c438b126..00000000000 --- a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_topLevelPrivate_noPrivateNoAccessorsInMultiFileFacade (type: RunExternalTest) { - source = "codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt" -} - -task codegen_blackbox_topLevelPrivate_noPrivateNoAccessorsInMultiFileFacade2 (type: RunExternalTest) { - source = "codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt" -} - -task codegen_blackbox_topLevelPrivate_privateInInlineNested (type: RunExternalTest) { - source = "codegen/blackbox/topLevelPrivate/privateInInlineNested.kt" -} - -task codegen_blackbox_topLevelPrivate_privateVisibility (type: RunExternalTest) { - source = "codegen/blackbox/topLevelPrivate/privateVisibility.kt" -} - -task codegen_blackbox_topLevelPrivate_syntheticAccessor (type: RunExternalTest) { - source = "codegen/blackbox/topLevelPrivate/syntheticAccessor.kt" -} - -task codegen_blackbox_topLevelPrivate_syntheticAccessorInMultiFile (type: RunExternalTest) { - source = "codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle deleted file mode 100644 index 18ebb040dab..00000000000 --- a/backend.native/tests/external/codegen/blackbox/traits/build-generated.gradle +++ /dev/null @@ -1,114 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_traits_abstractClassInheritsFromInterface (type: RunExternalTest) { - source = "codegen/blackbox/traits/abstractClassInheritsFromInterface.kt" -} - -task codegen_blackbox_traits_diamondPropertyAccessors (type: RunExternalTest) { - source = "codegen/blackbox/traits/diamondPropertyAccessors.kt" -} - -task codegen_blackbox_traits_genericMethod (type: RunExternalTest) { - source = "codegen/blackbox/traits/genericMethod.kt" -} - -task codegen_blackbox_traits_indirectlyInheritPropertyGetter (type: RunExternalTest) { - source = "codegen/blackbox/traits/indirectlyInheritPropertyGetter.kt" -} - -task codegen_blackbox_traits_inheritedFun (type: RunExternalTest) { - source = "codegen/blackbox/traits/inheritedFun.kt" -} - -task codegen_blackbox_traits_inheritedVar (type: RunExternalTest) { - source = "codegen/blackbox/traits/inheritedVar.kt" -} - -task codegen_blackbox_traits_inheritJavaInterface (type: RunExternalTest) { - source = "codegen/blackbox/traits/inheritJavaInterface.kt" -} - -task codegen_blackbox_traits_interfaceDefaultImpls (type: RunExternalTest) { - source = "codegen/blackbox/traits/interfaceDefaultImpls.kt" -} - -task codegen_blackbox_traits_kt1936 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt1936.kt" -} - -task codegen_blackbox_traits_kt1936_1 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt1936_1.kt" -} - -task codegen_blackbox_traits_kt2260 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt2260.kt" -} - -task codegen_blackbox_traits_kt2399 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt2399.kt" -} - -task codegen_blackbox_traits_kt2541 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt2541.kt" -} - -task codegen_blackbox_traits_kt3315 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt3315.kt" -} - -task codegen_blackbox_traits_kt3500 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt3500.kt" -} - -task codegen_blackbox_traits_kt3579 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt3579.kt" -} - -task codegen_blackbox_traits_kt3579_2 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt3579_2.kt" -} - -task codegen_blackbox_traits_kt5393 (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt5393.kt" -} - -task codegen_blackbox_traits_kt5393_property (type: RunExternalTest) { - source = "codegen/blackbox/traits/kt5393_property.kt" -} - -task codegen_blackbox_traits_multiple (type: RunExternalTest) { - source = "codegen/blackbox/traits/multiple.kt" -} - -task codegen_blackbox_traits_noPrivateDelegation (type: RunExternalTest) { - source = "codegen/blackbox/traits/noPrivateDelegation.kt" -} - -task codegen_blackbox_traits_syntheticAccessor (type: RunExternalTest) { - source = "codegen/blackbox/traits/syntheticAccessor.kt" -} - -task codegen_blackbox_traits_traitImplDelegationWithCovariantOverride (type: RunExternalTest) { - source = "codegen/blackbox/traits/traitImplDelegationWithCovariantOverride.kt" -} - -task codegen_blackbox_traits_traitImplDiamond (type: RunExternalTest) { - source = "codegen/blackbox/traits/traitImplDiamond.kt" -} - -task codegen_blackbox_traits_traitImplGenericDelegation (type: RunExternalTest) { - source = "codegen/blackbox/traits/traitImplGenericDelegation.kt" -} - -task codegen_blackbox_traits_traitWithPrivateExtension (type: RunExternalTest) { - source = "codegen/blackbox/traits/traitWithPrivateExtension.kt" -} - -task codegen_blackbox_traits_traitWithPrivateMember (type: RunExternalTest) { - source = "codegen/blackbox/traits/traitWithPrivateMember.kt" -} - -task codegen_blackbox_traits_traitWithPrivateMemberAccessFromLambda (type: RunExternalTest) { - source = "codegen/blackbox/traits/traitWithPrivateMemberAccessFromLambda.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle deleted file mode 100644 index 4db3a8aa7bd..00000000000 --- a/backend.native/tests/external/codegen/blackbox/typeInfo/build-generated.gradle +++ /dev/null @@ -1,30 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_typeInfo_asInLoop (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/asInLoop.kt" -} - -task codegen_blackbox_typeInfo_ifOrWhenSpecialCall (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/ifOrWhenSpecialCall.kt" -} - -task codegen_blackbox_typeInfo_implicitSmartCastThis (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/implicitSmartCastThis.kt" -} - -task codegen_blackbox_typeInfo_inheritance (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/inheritance.kt" -} - -task codegen_blackbox_typeInfo_kt2811 (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/kt2811.kt" -} - -task codegen_blackbox_typeInfo_primitiveTypeInfo (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/primitiveTypeInfo.kt" -} - -task codegen_blackbox_typeInfo_smartCastThis (type: RunExternalTest) { - source = "codegen/blackbox/typeInfo/smartCastThis.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle deleted file mode 100644 index a457d49aae8..00000000000 --- a/backend.native/tests/external/codegen/blackbox/typeMapping/build-generated.gradle +++ /dev/null @@ -1,42 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_typeMapping_enhancedPrimitives (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/enhancedPrimitives.kt" -} - -task codegen_blackbox_typeMapping_genericTypeWithNothing (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/genericTypeWithNothing.kt" -} - -task codegen_blackbox_typeMapping_kt2831 (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/kt2831.kt" -} - -task codegen_blackbox_typeMapping_kt309 (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/kt309.kt" -} - -task codegen_blackbox_typeMapping_kt3286 (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/kt3286.kt" -} - -task codegen_blackbox_typeMapping_kt3863 (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/kt3863.kt" -} - -task codegen_blackbox_typeMapping_kt3976 (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/kt3976.kt" -} - -task codegen_blackbox_typeMapping_nothing (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/nothing.kt" -} - -task codegen_blackbox_typeMapping_nullableNothing (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/nullableNothing.kt" -} - -task codegen_blackbox_typeMapping_typeParameterMultipleBounds (type: RunExternalTest) { - source = "codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle deleted file mode 100644 index c10a5c2d228..00000000000 --- a/backend.native/tests/external/codegen/blackbox/typealias/build-generated.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_typealias_genericTypeAliasConstructor (type: RunExternalTest) { - source = "codegen/blackbox/typealias/genericTypeAliasConstructor.kt" -} - -task codegen_blackbox_typealias_innerClassTypeAliasConstructor (type: RunExternalTest) { - source = "codegen/blackbox/typealias/innerClassTypeAliasConstructor.kt" -} - -task codegen_blackbox_typealias_innerClassTypeAliasConstructorInSupertypes (type: RunExternalTest) { - source = "codegen/blackbox/typealias/innerClassTypeAliasConstructorInSupertypes.kt" -} - -task codegen_blackbox_typealias_simple (type: RunExternalTest) { - source = "codegen/blackbox/typealias/simple.kt" -} - -task codegen_blackbox_typealias_typeAliasAsBareType (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasAsBareType.kt" -} - -task codegen_blackbox_typealias_typeAliasCompanion (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasCompanion.kt" -} - -task codegen_blackbox_typealias_typeAliasConstructor (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasConstructor.kt" -} - -task codegen_blackbox_typealias_typeAliasConstructorAccessor (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasConstructorAccessor.kt" -} - -task codegen_blackbox_typealias_typeAliasConstructorInSuperCall (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasConstructorInSuperCall.kt" -} - -task codegen_blackbox_typealias_typeAliasInAnonymousObjectType (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasInAnonymousObjectType.kt" -} - -task codegen_blackbox_typealias_typeAliasObject (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasObject.kt" -} - -task codegen_blackbox_typealias_typeAliasObjectCallable (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasObjectCallable.kt" -} - -task codegen_blackbox_typealias_typeAliasSecondaryConstructor (type: RunExternalTest) { - source = "codegen/blackbox/typealias/typeAliasSecondaryConstructor.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle deleted file mode 100644 index e48318287b6..00000000000 --- a/backend.native/tests/external/codegen/blackbox/unaryOp/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_unaryOp_call (type: RunExternalTest) { - source = "codegen/blackbox/unaryOp/call.kt" -} - -task codegen_blackbox_unaryOp_callNullable (type: RunExternalTest) { - source = "codegen/blackbox/unaryOp/callNullable.kt" -} - -task codegen_blackbox_unaryOp_callWithCommonType (type: RunExternalTest) { - source = "codegen/blackbox/unaryOp/callWithCommonType.kt" -} - -task codegen_blackbox_unaryOp_intrinsic (type: RunExternalTest) { - source = "codegen/blackbox/unaryOp/intrinsic.kt" -} - -task codegen_blackbox_unaryOp_intrinsicNullable (type: RunExternalTest) { - source = "codegen/blackbox/unaryOp/intrinsicNullable.kt" -} - -task codegen_blackbox_unaryOp_longOverflow (type: RunExternalTest) { - source = "codegen/blackbox/unaryOp/longOverflow.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle deleted file mode 100644 index 7e77246a989..00000000000 --- a/backend.native/tests/external/codegen/blackbox/unit/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_unit_closureReturnsNullableUnit (type: RunExternalTest) { - source = "codegen/blackbox/unit/closureReturnsNullableUnit.kt" -} - -task codegen_blackbox_unit_ifElse (type: RunExternalTest) { - source = "codegen/blackbox/unit/ifElse.kt" -} - -task codegen_blackbox_unit_kt3634 (type: RunExternalTest) { - source = "codegen/blackbox/unit/kt3634.kt" -} - -task codegen_blackbox_unit_kt4212 (type: RunExternalTest) { - source = "codegen/blackbox/unit/kt4212.kt" -} - -task codegen_blackbox_unit_kt4265 (type: RunExternalTest) { - source = "codegen/blackbox/unit/kt4265.kt" -} - -task codegen_blackbox_unit_nullableUnit (type: RunExternalTest) { - source = "codegen/blackbox/unit/nullableUnit.kt" -} - -task codegen_blackbox_unit_nullableUnitInWhen1 (type: RunExternalTest) { - source = "codegen/blackbox/unit/nullableUnitInWhen1.kt" -} - -task codegen_blackbox_unit_nullableUnitInWhen2 (type: RunExternalTest) { - source = "codegen/blackbox/unit/nullableUnitInWhen2.kt" -} - -task codegen_blackbox_unit_nullableUnitInWhen3 (type: RunExternalTest) { - source = "codegen/blackbox/unit/nullableUnitInWhen3.kt" -} - -task codegen_blackbox_unit_unitClassObject (type: RunExternalTest) { - source = "codegen/blackbox/unit/unitClassObject.kt" -} - -task codegen_blackbox_unit_UnitValue (type: RunExternalTest) { - source = "codegen/blackbox/unit/UnitValue.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle deleted file mode 100644 index da62f61c2dc..00000000000 --- a/backend.native/tests/external/codegen/blackbox/vararg/build-generated.gradle +++ /dev/null @@ -1,34 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_vararg_kt1978 (type: RunExternalTest) { - source = "codegen/blackbox/vararg/kt1978.kt" -} - -task codegen_blackbox_vararg_kt581 (type: RunExternalTest) { - source = "codegen/blackbox/vararg/kt581.kt" -} - -task codegen_blackbox_vararg_kt6192 (type: RunExternalTest) { - source = "codegen/blackbox/vararg/kt6192.kt" -} - -task codegen_blackbox_vararg_kt796_797 (type: RunExternalTest) { - source = "codegen/blackbox/vararg/kt796_797.kt" -} - -task codegen_blackbox_vararg_spreadCopiesArray (type: RunExternalTest) { - source = "codegen/blackbox/vararg/spreadCopiesArray.kt" -} - -task codegen_blackbox_vararg_varargInFunParam (type: RunExternalTest) { - source = "codegen/blackbox/vararg/varargInFunParam.kt" -} - -task codegen_blackbox_vararg_varargInJava (type: RunExternalTest) { - source = "codegen/blackbox/vararg/varargInJava.kt" -} - -task codegen_blackbox_vararg_varargsAndFunctionLiterals (type: RunExternalTest) { - source = "codegen/blackbox/vararg/varargsAndFunctionLiterals.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/when/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/when/build-generated.gradle deleted file mode 100644 index 772b1b6d6ab..00000000000 --- a/backend.native/tests/external/codegen/blackbox/when/build-generated.gradle +++ /dev/null @@ -1,134 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_when_callProperty (type: RunExternalTest) { - source = "codegen/blackbox/when/callProperty.kt" -} - -task codegen_blackbox_when_emptyWhen (type: RunExternalTest) { - source = "codegen/blackbox/when/emptyWhen.kt" -} - -task codegen_blackbox_when_exceptionOnNoMatch (type: RunExternalTest) { - source = "codegen/blackbox/when/exceptionOnNoMatch.kt" -} - -task codegen_blackbox_when_exhaustiveBoolean (type: RunExternalTest) { - source = "codegen/blackbox/when/exhaustiveBoolean.kt" -} - -task codegen_blackbox_when_exhaustiveBreakContinue (type: RunExternalTest) { - source = "codegen/blackbox/when/exhaustiveBreakContinue.kt" -} - -task codegen_blackbox_when_exhaustiveWhenInitialization (type: RunExternalTest) { - source = "codegen/blackbox/when/exhaustiveWhenInitialization.kt" -} - -task codegen_blackbox_when_exhaustiveWhenReturn (type: RunExternalTest) { - source = "codegen/blackbox/when/exhaustiveWhenReturn.kt" -} - -task codegen_blackbox_when_implicitExhaustiveAndReturn (type: RunExternalTest) { - source = "codegen/blackbox/when/implicitExhaustiveAndReturn.kt" -} - -task codegen_blackbox_when_integralWhenWithNoInlinedConstants (type: RunExternalTest) { - source = "codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt" -} - -task codegen_blackbox_when_is (type: RunExternalTest) { - source = "codegen/blackbox/when/is.kt" -} - -task codegen_blackbox_when_kt2457 (type: RunExternalTest) { - source = "codegen/blackbox/when/kt2457.kt" -} - -task codegen_blackbox_when_kt2466 (type: RunExternalTest) { - source = "codegen/blackbox/when/kt2466.kt" -} - -task codegen_blackbox_when_kt5307 (type: RunExternalTest) { - source = "codegen/blackbox/when/kt5307.kt" -} - -task codegen_blackbox_when_kt5448 (type: RunExternalTest) { - source = "codegen/blackbox/when/kt5448.kt" -} - -task codegen_blackbox_when_longInRange (type: RunExternalTest) { - source = "codegen/blackbox/when/longInRange.kt" -} - -task codegen_blackbox_when_matchNotNullAgainstNullable (type: RunExternalTest) { - source = "codegen/blackbox/when/matchNotNullAgainstNullable.kt" -} - -task codegen_blackbox_when_multipleEntries (type: RunExternalTest) { - source = "codegen/blackbox/when/multipleEntries.kt" -} - -task codegen_blackbox_when_noElseExhaustive (type: RunExternalTest) { - source = "codegen/blackbox/when/noElseExhaustive.kt" -} - -task codegen_blackbox_when_noElseExhaustiveStatement (type: RunExternalTest) { - source = "codegen/blackbox/when/noElseExhaustiveStatement.kt" -} - -task codegen_blackbox_when_noElseExhaustiveUnitExpected (type: RunExternalTest) { - source = "codegen/blackbox/when/noElseExhaustiveUnitExpected.kt" -} - -task codegen_blackbox_when_noElseInStatement (type: RunExternalTest) { - source = "codegen/blackbox/when/noElseInStatement.kt" -} - -task codegen_blackbox_when_noElseNoMatch (type: RunExternalTest) { - source = "codegen/blackbox/when/noElseNoMatch.kt" -} - -task codegen_blackbox_when_nullableWhen (type: RunExternalTest) { - source = "codegen/blackbox/when/nullableWhen.kt" -} - -task codegen_blackbox_when_range (type: RunExternalTest) { - source = "codegen/blackbox/when/range.kt" -} - -task codegen_blackbox_when_sealedWhenInitialization (type: RunExternalTest) { - source = "codegen/blackbox/when/sealedWhenInitialization.kt" -} - -task codegen_blackbox_when_switchOptimizationDense (type: RunExternalTest) { - source = "codegen/blackbox/when/switchOptimizationDense.kt" -} - -task codegen_blackbox_when_switchOptimizationMultipleConditions (type: RunExternalTest) { - source = "codegen/blackbox/when/switchOptimizationMultipleConditions.kt" -} - -task codegen_blackbox_when_switchOptimizationSparse (type: RunExternalTest) { - source = "codegen/blackbox/when/switchOptimizationSparse.kt" -} - -task codegen_blackbox_when_switchOptimizationStatement (type: RunExternalTest) { - source = "codegen/blackbox/when/switchOptimizationStatement.kt" -} - -task codegen_blackbox_when_switchOptimizationTypes (type: RunExternalTest) { - source = "codegen/blackbox/when/switchOptimizationTypes.kt" -} - -task codegen_blackbox_when_switchOptimizationUnordered (type: RunExternalTest) { - source = "codegen/blackbox/when/switchOptimizationUnordered.kt" -} - -task codegen_blackbox_when_typeDisjunction (type: RunExternalTest) { - source = "codegen/blackbox/when/typeDisjunction.kt" -} - -task codegen_blackbox_when_whenArgumentIsEvaluatedOnlyOnce (type: RunExternalTest) { - source = "codegen/blackbox/when/whenArgumentIsEvaluatedOnlyOnce.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle deleted file mode 100644 index c076e20a857..00000000000 --- a/backend.native/tests/external/codegen/blackbox/when/enumOptimization/build-generated.gradle +++ /dev/null @@ -1,46 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_when_enumOptimization_bigEnum (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/bigEnum.kt" -} - -task codegen_blackbox_when_enumOptimization_duplicatingItems (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/duplicatingItems.kt" -} - -task codegen_blackbox_when_enumOptimization_enumInsideClassObject (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/enumInsideClassObject.kt" -} - -task codegen_blackbox_when_enumOptimization_expression (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/expression.kt" -} - -task codegen_blackbox_when_enumOptimization_functionLiteralInTopLevel (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/functionLiteralInTopLevel.kt" -} - -task codegen_blackbox_when_enumOptimization_manyWhensWithinClass (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/manyWhensWithinClass.kt" -} - -task codegen_blackbox_when_enumOptimization_nonConstantEnum (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/nonConstantEnum.kt" -} - -task codegen_blackbox_when_enumOptimization_nullability (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/nullability.kt" -} - -task codegen_blackbox_when_enumOptimization_nullableEnum (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/nullableEnum.kt" -} - -task codegen_blackbox_when_enumOptimization_subjectAny (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/subjectAny.kt" -} - -task codegen_blackbox_when_enumOptimization_withoutElse (type: RunExternalTest) { - source = "codegen/blackbox/when/enumOptimization/withoutElse.kt" -} - diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle deleted file mode 100644 index b308611f137..00000000000 --- a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/build-generated.gradle +++ /dev/null @@ -1,26 +0,0 @@ -import org.jetbrains.kotlin.* - -task codegen_blackbox_when_stringOptimization_duplicatingItems (type: RunExternalTest) { - source = "codegen/blackbox/when/stringOptimization/duplicatingItems.kt" -} - -task codegen_blackbox_when_stringOptimization_duplicatingItemsSameHashCode (type: RunExternalTest) { - source = "codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt" -} - -task codegen_blackbox_when_stringOptimization_expression (type: RunExternalTest) { - source = "codegen/blackbox/when/stringOptimization/expression.kt" -} - -task codegen_blackbox_when_stringOptimization_nullability (type: RunExternalTest) { - source = "codegen/blackbox/when/stringOptimization/nullability.kt" -} - -task codegen_blackbox_when_stringOptimization_sameHashCode (type: RunExternalTest) { - source = "codegen/blackbox/when/stringOptimization/sameHashCode.kt" -} - -task codegen_blackbox_when_stringOptimization_statement (type: RunExternalTest) { - source = "codegen/blackbox/when/stringOptimization/statement.kt" -} - From 89a74c0591357c3df4f171ea6250e874200e190f Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 19 Jan 2017 12:40:58 +0300 Subject: [PATCH 16/86] backend/tests: Use IGNORE_BACKEND directive to exclude java-dependent tests --- .../org/jetbrains/kotlin/KonanTest.groovy | 73 ++++++++++++++----- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index f4f19a174eb..34275f57a6e 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -48,6 +48,7 @@ abstract class KonanTest extends DefaultTask { *filesToCompile, *moreArgs, *project.globalArgs) + } } @@ -73,6 +74,7 @@ abstract class KonanTest extends DefaultTask { println "execution :$exe" def out = null + //TODO Add test timeout project.exec { commandLine exe if (arguments != null) { @@ -85,6 +87,7 @@ abstract class KonanTest extends DefaultTask { out = new ByteArrayOutputStream() standardOutput = out } + } if (goldValue != null && goldValue != out.toString()) throw new RuntimeException("test failed.") @@ -117,8 +120,12 @@ class LinkKonanTest extends KonanTest { } } -class RunExternalTest extends RunKonanTest { +@ParallelizableTask +class RunExternalTestGroup extends RunKonanTest { + def groupDirectory = "." + def logFileName = "test-result.md" + String filter = project.findProperty("filter") String goldValue = "OK" String buildExePath() { @@ -183,13 +190,35 @@ class RunExternalTest extends RunKonanTest { void createFile(String file, String text) { project.file(file).write(text) } -} -@ParallelizableTask -class RunExternalTestGroup extends RunExternalTest { - def groupDirectory = "." - def logFileName = "test-result.md" - String filter = project.findProperty("filter") + List findLinesWithPrefixesRemoved(String text, String prefix) { + def result = [] + text.eachLine { + if (it.startsWith(prefix)) { + result.add(it - prefix) + } + } + return result + } + + boolean isEnabledForNativeBackend(String fileName) { + def text = project.file(fileName).text + def targetBackend = findLinesWithPrefixesRemoved(text, "// TARGET_BACKEND") + if (targetBackend.size() != 0) { + // There is some target backend. Check if it is NATIVE or not + for (String s : targetBackend) { + if (s.contains("NATIVE")){ return true } + } + return false + } else { + // No target backend. Check if NATIVE backend is ignored + def ignoredBackends = findLinesWithPrefixesRemoved(text, "// IGNORE_BACKEND: ") + for (String s : ignoredBackends) { + if (s.contains("NATIVE")) { return false } + } + return true + } + } @TaskAction @Override @@ -210,21 +239,29 @@ class RunExternalTestGroup extends RunExternalTest { } def current = 0 def passed = 0 + def skipped = 0 def total = ktFiles.size() + def status = null + def comment = null ktFiles.each { + current++ source = project.relativePath(it) - println("TEST: $it.name (${++current}/$total, passed: $passed)") - try { - super.executeTest() - logFile.append("\n|$it.name|PASSED||") - println("TEST PASSED\n") - passed++ - } catch (Exception ex) { - println("TEST FAILED\n") - logFile.append("\n|$it.name|FAILED|${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}|") + println("TEST: $it.name ($current/$total, passed: $passed, skipped: $skipped)") + if (isEnabledForNativeBackend(source)) { + try { + super.executeTest() + status = "PASSED"; comment = "" + passed++ + } catch (Exception ex) { + status = "FAILED"; comment = "Exception: ${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}" + } + } else { + status = "SKIPPED"; comment = "" + skipped++ } + println("TEST $status\n") + logFile.append("\n|$it.name|$status|$comment|") } - print("TOTAL PASSED: $passed/$total") + print("TOTAL PASSED: $passed/$current (SKIPPED: $skipped)") } } - From 2ef49da2fe76fa0e7433e55d7cef0dcf448540dd Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 19 Jan 2017 14:06:38 +0300 Subject: [PATCH 17/86] backend/tests: Ignore all tests with IGNORE_BACKEND: JS directive --- .../external/codegen/blackbox/annotations/annotatedEnumEntry.kt | 2 +- .../blackbox/annotations/annotatedLambda/funExpression.kt | 2 +- .../codegen/blackbox/annotations/annotatedLambda/lambda.kt | 2 +- .../blackbox/annotations/annotatedLambda/samFunExpression.kt | 2 +- .../codegen/blackbox/annotations/annotatedLambda/samLambda.kt | 2 +- .../codegen/blackbox/annotations/annotatedObjectLiteral.kt | 2 +- .../blackbox/annotations/annotationWithKotlinProperty.kt | 2 +- .../annotationWithKotlinPropertyFromInterfaceCompanion.kt | 2 +- .../codegen/blackbox/annotations/annotationsOnDefault.kt | 2 +- .../codegen/blackbox/annotations/annotationsOnTypeAliases.kt | 2 +- .../codegen/blackbox/annotations/defaultParameterValues.kt | 2 +- .../codegen/blackbox/annotations/delegatedPropertySetter.kt | 2 +- .../codegen/blackbox/annotations/fileClassWithFileAnnotation.kt | 2 +- .../external/codegen/blackbox/annotations/jvmAnnotationFlags.kt | 2 +- .../annotations/kotlinPropertyFromClassObjectAsParameter.kt | 2 +- .../blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt | 2 +- .../tests/external/codegen/blackbox/annotations/kt10136.kt | 2 +- .../blackbox/annotations/nestedClassPropertyAsParameter.kt | 2 +- .../codegen/blackbox/annotations/parameterWithPrimitiveType.kt | 2 +- .../annotations/propertyWithPropertyInInitializerAsParameter.kt | 2 +- .../codegen/blackbox/annotations/varargInAnnotationParameter.kt | 2 +- .../tests/external/codegen/blackbox/argumentOrder/arguments.kt | 2 +- .../tests/external/codegen/blackbox/argumentOrder/captured.kt | 2 +- .../codegen/blackbox/argumentOrder/capturedInExtension.kt | 2 +- .../tests/external/codegen/blackbox/argumentOrder/defaults.kt | 2 +- .../tests/external/codegen/blackbox/argumentOrder/extension.kt | 2 +- .../external/codegen/blackbox/argumentOrder/extensionInClass.kt | 2 +- .../tests/external/codegen/blackbox/argumentOrder/simple.kt | 2 +- .../external/codegen/blackbox/argumentOrder/simpleInClass.kt | 2 +- .../tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt | 2 +- .../external/codegen/blackbox/arrays/arraysAreCloneable.kt | 2 +- .../tests/external/codegen/blackbox/arrays/cloneArray.kt | 2 +- .../external/codegen/blackbox/arrays/clonePrimitiveArrays.kt | 2 +- .../codegen/blackbox/arrays/iteratorByteArrayNextByte.kt | 2 +- .../codegen/blackbox/arrays/iteratorLongArrayNextLong.kt | 2 +- backend.native/tests/external/codegen/blackbox/arrays/kt503.kt | 2 +- backend.native/tests/external/codegen/blackbox/arrays/kt602.kt | 2 +- backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt | 2 +- backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt | 2 +- .../codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt | 2 +- .../codegen/blackbox/binaryOp/compareWithBoxedDouble.kt | 2 +- .../external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt | 2 +- .../tests/external/codegen/blackbox/binaryOp/divisionByZero.kt | 2 +- .../blackbox/boxingOptimization/checkcastAndInstanceOf.kt | 2 +- .../external/codegen/blackbox/boxingOptimization/kt6047.kt | 2 +- .../external/codegen/blackbox/builtinStubMethods/Collection.kt | 2 +- .../external/codegen/blackbox/builtinStubMethods/Iterator.kt | 2 +- .../codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt | 2 +- .../tests/external/codegen/blackbox/builtinStubMethods/List.kt | 2 +- .../codegen/blackbox/builtinStubMethods/ListIterator.kt | 2 +- .../blackbox/builtinStubMethods/ListWithAllImplementations.kt | 2 +- .../builtinStubMethods/ListWithAllInheritedImplementations.kt | 2 +- .../tests/external/codegen/blackbox/builtinStubMethods/Map.kt | 2 +- .../external/codegen/blackbox/builtinStubMethods/MapEntry.kt | 2 +- .../codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt | 2 +- .../blackbox/builtinStubMethods/MapWithAllImplementations.kt | 2 +- .../codegen/blackbox/builtinStubMethods/SubstitutedList.kt | 2 +- .../codegen/blackbox/builtinStubMethods/abstractMember.kt | 2 +- .../codegen/blackbox/builtinStubMethods/immutableRemove.kt | 2 +- .../blackbox/builtinStubMethods/implementationInTrait.kt | 2 +- .../blackbox/builtinStubMethods/inheritedImplementations.kt | 2 +- .../blackbox/builtinStubMethods/nonTrivialSubstitution.kt | 2 +- .../codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt | 2 +- .../codegen/blackbox/builtinStubMethods/substitutedIterable.kt | 2 +- .../substitutedListWithExtraSuperInterface.kt | 2 +- .../codegen/blackbox/callableReference/bound/enumEntryMember.kt | 2 +- .../callableReference/bound/equals/nullableReceiverInEquals.kt | 2 +- .../callableReference/bound/equals/propertyAccessors.kt | 2 +- .../blackbox/callableReference/bound/equals/receiverInEquals.kt | 2 +- .../callableReference/bound/equals/reflectionReference.kt | 2 +- .../blackbox/callableReference/bound/kCallableNameIntrinsic.kt | 2 +- .../codegen/blackbox/callableReference/bound/kt12738.kt | 2 +- .../codegen/blackbox/callableReference/bound/kt15446.kt | 2 +- .../codegen/blackbox/callableReference/bound/simpleFunction.kt | 2 +- .../codegen/blackbox/callableReference/bound/simpleProperty.kt | 2 +- .../blackbox/callableReference/function/booleanNotIntrinsic.kt | 2 +- .../blackbox/callableReference/function/enumValueOfMethod.kt | 2 +- .../blackbox/callableReference/function/equalsIntrinsic.kt | 2 +- .../callableReference/function/getArityViaFunctionImpl.kt | 2 +- .../callableReference/function/javaCollectionsStaticMethod.kt | 2 +- .../callableReference/function/local/localFunctionName.kt | 2 +- .../codegen/blackbox/callableReference/function/newArray.kt | 2 +- .../blackbox/callableReference/function/overloadedFunVsVal.kt | 2 +- .../property/kt6870_privatePropertyReference.kt | 2 +- .../callableReference/property/listOfStringsMapLength.kt | 2 +- .../callableReference/property/privateSetterOutsideClass.kt | 2 +- backend.native/tests/external/codegen/blackbox/casts/as.kt | 2 +- .../tests/external/codegen/blackbox/casts/asForConstants.kt | 2 +- backend.native/tests/external/codegen/blackbox/casts/asSafe.kt | 2 +- .../tests/external/codegen/blackbox/casts/asSafeForConstants.kt | 2 +- .../tests/external/codegen/blackbox/casts/asWithGeneric.kt | 2 +- .../external/codegen/blackbox/casts/functions/asFunKBig.kt | 2 +- .../external/codegen/blackbox/casts/functions/asFunKSmall.kt | 2 +- .../external/codegen/blackbox/casts/functions/isFunKBig.kt | 2 +- .../external/codegen/blackbox/casts/functions/isFunKSmall.kt | 2 +- .../external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt | 2 +- .../codegen/blackbox/casts/functions/reifiedAsFunKBig.kt | 2 +- .../codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt | 2 +- .../codegen/blackbox/casts/functions/reifiedIsFunKBig.kt | 2 +- .../codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt | 2 +- .../codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt | 2 +- .../codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt | 2 +- .../external/codegen/blackbox/casts/functions/safeAsFunKBig.kt | 2 +- .../codegen/blackbox/casts/functions/safeAsFunKSmall.kt | 2 +- backend.native/tests/external/codegen/blackbox/casts/is.kt | 2 +- .../tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt | 2 +- .../casts/literalExpressionAsGenericArgument/javaBox.kt | 2 +- .../casts/mutableCollections/mutabilityMarkerInterfaces.kt | 2 +- .../blackbox/casts/mutableCollections/weirdMutableCasts.kt | 2 +- backend.native/tests/external/codegen/blackbox/casts/notIs.kt | 2 +- .../tests/external/codegen/blackbox/casts/unitAsAny.kt | 2 +- .../tests/external/codegen/blackbox/casts/unitAsInt.kt | 2 +- .../tests/external/codegen/blackbox/casts/unitAsSafeAny.kt | 2 +- .../blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt | 2 +- .../external/codegen/blackbox/classLiteral/bound/primitives.kt | 2 +- .../external/codegen/blackbox/classLiteral/bound/sideEffect.kt | 2 +- .../external/codegen/blackbox/classLiteral/bound/simple.kt | 2 +- .../tests/external/codegen/blackbox/classLiteral/java/java.kt | 2 +- .../codegen/blackbox/classLiteral/java/javaObjectType.kt | 2 +- .../codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt | 2 +- .../codegen/blackbox/classLiteral/java/javaPrimitiveType.kt | 2 +- .../blackbox/classLiteral/java/javaPrimitiveTypeReified.kt | 2 +- .../external/codegen/blackbox/classLiteral/java/javaReified.kt | 2 +- .../external/codegen/blackbox/classLiteral/java/kt11943.kt | 2 +- .../blackbox/classLiteral/java/objectSuperConstructorCall.kt | 2 +- .../codegen/blackbox/classLiteral/primitiveKClassEquality.kt | 2 +- .../external/codegen/blackbox/classes/classObjectToString.kt | 2 +- .../tests/external/codegen/blackbox/classes/delegationJava.kt | 2 +- .../tests/external/codegen/blackbox/classes/kt1120.kt | 2 +- .../tests/external/codegen/blackbox/classes/kt1134.kt | 2 +- .../tests/external/codegen/blackbox/classes/kt1535.kt | 2 +- .../tests/external/codegen/blackbox/classes/kt2288.kt | 2 +- backend.native/tests/external/codegen/blackbox/classes/kt508.kt | 2 +- backend.native/tests/external/codegen/blackbox/classes/kt707.kt | 2 +- .../external/codegen/blackbox/closures/closureOnTopLevel1.kt | 2 +- .../external/codegen/blackbox/closures/closureOnTopLevel2.kt | 2 +- .../tests/external/codegen/blackbox/closures/noRefToOuter.kt | 2 +- .../codegen/blackbox/collections/irrelevantImplCharSequence.kt | 2 +- .../blackbox/collections/irrelevantImplCharSequenceKotlin.kt | 2 +- .../blackbox/collections/irrelevantImplMutableListKotlin.kt | 2 +- .../codegen/blackbox/collections/noStubsInJavaSuperClass.kt | 2 +- .../external/codegen/blackbox/collections/toArrayInJavaClass.kt | 2 +- .../tests/external/codegen/blackbox/constants/kt9532.kt | 2 +- .../breakContinueInExpressions/breakFromOuter.kt | 2 +- .../blackbox/controlStructures/forLoopMemberExtensionNext.kt | 2 +- .../external/codegen/blackbox/controlStructures/forUserType.kt | 2 +- .../tests/external/codegen/blackbox/controlStructures/kt237.kt | 2 +- .../tests/external/codegen/blackbox/controlStructures/kt3574.kt | 2 +- .../tests/external/codegen/blackbox/controlStructures/kt769.kt | 2 +- .../tests/external/codegen/blackbox/controlStructures/kt8148.kt | 2 +- .../external/codegen/blackbox/controlStructures/kt8148_break.kt | 2 +- .../codegen/blackbox/controlStructures/kt8148_continue.kt | 2 +- .../external/codegen/blackbox/controlStructures/kt9022Return.kt | 2 +- .../external/codegen/blackbox/controlStructures/kt9022Throw.kt | 2 +- .../controlStructures/tryCatchInExpressions/differentTypes.kt | 2 +- .../blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt | 2 +- .../tests/external/codegen/blackbox/dataClasses/doubleParam.kt | 2 +- .../dataClasses/equals/alreadyDeclaredWrongSignature.kt | 2 +- .../tests/external/codegen/blackbox/dataClasses/floatParam.kt | 2 +- .../dataClasses/hashCode/alreadyDeclaredWrongSignature.kt | 2 +- .../external/codegen/blackbox/dataClasses/hashCode/array.kt | 2 +- .../tests/external/codegen/blackbox/dataClasses/kt5002.kt | 2 +- .../dataClasses/toString/alreadyDeclaredWrongSignature.kt | 2 +- .../codegen/blackbox/dataClasses/toString/arrayParams.kt | 2 +- .../constructor/checkIfConstructorIsSynthetic.kt | 2 +- .../codegen/blackbox/defaultArguments/constructor/manyArgs.kt | 2 +- .../codegen/blackbox/defaultArguments/superCallCheck.kt | 2 +- .../delegatedProperty/privateSetterKPropertyIsNotMutable.kt | 2 +- .../delegatedProperty/propertyMetadataShouldBeCached.kt | 2 +- .../delegatedProperty/provideDelegate/jvmStaticInObject.kt | 2 +- .../delegatedProperty/stackOverflowOnCallFromGetValue.kt | 2 +- .../blackbox/delegatedProperty/useReflectionOnKProperty.kt | 2 +- .../external/codegen/blackbox/delegation/delegationToVal.kt | 2 +- .../tests/external/codegen/blackbox/enum/classForEnumEntry.kt | 2 +- .../tests/external/codegen/blackbox/enum/emptyConstructor.kt | 2 +- backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt | 2 +- .../tests/external/codegen/blackbox/enum/modifierFlags.kt | 2 +- .../external/codegen/blackbox/enum/noClassForSimpleEnum.kt | 2 +- backend.native/tests/external/codegen/blackbox/evaluate/char.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/divide.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/intrinsics.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/maxValue.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/maxValueByte.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/maxValueInt.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/minus.kt | 2 +- backend.native/tests/external/codegen/blackbox/evaluate/mod.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/multiply.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/parenthesized.kt | 2 +- backend.native/tests/external/codegen/blackbox/evaluate/plus.kt | 2 +- .../external/codegen/blackbox/evaluate/simpleCallBinary.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/unaryMinus.kt | 2 +- .../tests/external/codegen/blackbox/evaluate/unaryPlus.kt | 2 +- .../external/codegen/blackbox/extensionFunctions/kt3646.kt | 2 +- .../tests/external/codegen/blackbox/extensionFunctions/kt606.kt | 2 +- .../external/codegen/blackbox/extensionFunctions/whenFail.kt | 2 +- .../extensionProperties/genericValMultipleUpperBounds.kt | 2 +- .../external/codegen/blackbox/external/jvmStaticExternal.kt | 2 +- .../codegen/blackbox/external/jvmStaticExternalPrivate.kt | 2 +- .../tests/external/codegen/blackbox/external/withDefaultArg.kt | 2 +- .../codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt | 2 +- .../external/codegen/blackbox/fullJdk/native/simpleNative.kt | 2 +- .../tests/external/codegen/blackbox/fullJdk/native/topLevel.kt | 2 +- .../external/codegen/blackbox/fullJdk/regressions/kt1770.kt | 2 +- .../external/codegen/blackbox/functions/dataLocalVariable.kt | 2 +- .../external/codegen/blackbox/functions/functionNtoString.kt | 2 +- .../codegen/blackbox/functions/functionNtoStringGeneric.kt | 2 +- .../codegen/blackbox/functions/functionNtoStringNoReflect.kt | 2 +- .../blackbox/functions/invoke/castFunctionToExtension.kt | 2 +- .../blackbox/functions/invoke/invokeOnSyntheticProperty.kt | 2 +- .../tests/external/codegen/blackbox/functions/invoke/kt3190.kt | 2 +- .../codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt | 2 +- .../tests/external/codegen/blackbox/functions/kt1199.kt | 2 +- .../tests/external/codegen/blackbox/functions/kt1739.kt | 2 +- .../codegen/blackbox/functions/localFunctions/kt4777.kt | 2 +- .../codegen/blackbox/functions/localFunctions/kt4989.kt | 2 +- .../tests/external/codegen/blackbox/hashPMap/empty.kt | 2 +- .../tests/external/codegen/blackbox/hashPMap/manyNumbers.kt | 2 +- .../external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt | 2 +- .../external/codegen/blackbox/hashPMap/rewriteWithEqual.kt | 2 +- .../tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt | 2 +- .../tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt | 2 +- .../external/codegen/blackbox/ieee754/comparableTypeCast.kt | 2 +- .../tests/external/codegen/blackbox/ieee754/dataClass.kt | 2 +- .../external/codegen/blackbox/ieee754/explicitCompareCall.kt | 2 +- .../external/codegen/blackbox/ieee754/explicitEqualsCall.kt | 2 +- .../tests/external/codegen/blackbox/ieee754/inline.kt | 2 +- .../tests/external/codegen/blackbox/ieee754/safeCall.kt | 2 +- .../codegen/blackbox/ieee754/smartCastToDifferentTypes.kt | 2 +- .../codegen/blackbox/intrinsics/defaultObjectMapping.kt | 2 +- .../tests/external/codegen/blackbox/intrinsics/kt10131.kt | 2 +- .../tests/external/codegen/blackbox/intrinsics/kt10131a.kt | 2 +- .../tests/external/codegen/blackbox/intrinsics/kt5937.kt | 2 +- .../tests/external/codegen/blackbox/intrinsics/throwable.kt | 2 +- .../codegen/blackbox/intrinsics/throwableCallableReference.kt | 2 +- .../external/codegen/blackbox/intrinsics/throwableParamOrder.kt | 2 +- .../tests/external/codegen/blackbox/intrinsics/tostring.kt | 2 +- .../blackbox/javaInterop/generics/allWildcardsOnClass.kt | 2 +- .../generics/covariantOverrideWithDeclarationSiteProjection.kt | 2 +- .../javaInterop/generics/invariantArgumentsNoWildcard.kt | 2 +- .../external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt | 2 +- .../javaInterop/notNullAssertions/extensionReceiverParameter.kt | 2 +- .../blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt | 2 +- .../blackbox/javaInterop/objectMethods/cloneCallsSuper.kt | 2 +- .../javaInterop/objectMethods/cloneCallsSuperAndModifies.kt | 2 +- .../javaInterop/objectMethods/cloneableClassWithoutClone.kt | 2 +- .../external/codegen/blackbox/jvmField/captureClassFields.kt | 2 +- .../external/codegen/blackbox/jvmField/capturePackageFields.kt | 2 +- .../external/codegen/blackbox/jvmField/checkNoAccessors.kt | 2 +- .../external/codegen/blackbox/jvmField/classFieldReference.kt | 2 +- .../external/codegen/blackbox/jvmField/classFieldReflection.kt | 2 +- .../external/codegen/blackbox/jvmField/constructorProperty.kt | 2 +- .../tests/external/codegen/blackbox/jvmField/publicField.kt | 2 +- .../external/codegen/blackbox/jvmField/simpleMemberProperty.kt | 2 +- .../tests/external/codegen/blackbox/jvmField/superCall.kt | 2 +- .../tests/external/codegen/blackbox/jvmField/superCall2.kt | 2 +- .../codegen/blackbox/jvmField/topLevelFieldReference.kt | 2 +- .../codegen/blackbox/jvmField/topLevelFieldReflection.kt | 2 +- .../tests/external/codegen/blackbox/jvmField/visibility.kt | 2 +- .../external/codegen/blackbox/jvmField/writeFieldReference.kt | 2 +- .../external/codegen/blackbox/jvmName/callableReference.kt | 2 +- .../tests/external/codegen/blackbox/jvmName/clashingErasure.kt | 2 +- .../tests/external/codegen/blackbox/jvmName/classMembers.kt | 2 +- .../external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt | 2 +- .../codegen/blackbox/jvmName/fileFacades/differentFiles.kt | 2 +- .../blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt | 2 +- .../external/codegen/blackbox/jvmName/fileFacades/simple.kt | 2 +- .../tests/external/codegen/blackbox/jvmName/functionName.kt | 2 +- .../tests/external/codegen/blackbox/jvmName/multifileClass.kt | 2 +- .../codegen/blackbox/jvmName/multifileClassWithLocalClass.kt | 2 +- .../codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt | 2 +- .../codegen/blackbox/jvmName/propertyAccessorsUseSite.kt | 2 +- .../tests/external/codegen/blackbox/jvmName/propertyName.kt | 2 +- .../tests/external/codegen/blackbox/jvmName/renamedFileClass.kt | 2 +- .../external/codegen/blackbox/jvmOverloads/companionObject.kt | 2 +- .../external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt | 2 +- .../external/codegen/blackbox/jvmOverloads/doubleParameters.kt | 2 +- .../external/codegen/blackbox/jvmOverloads/extensionMethod.kt | 2 +- .../tests/external/codegen/blackbox/jvmOverloads/generics.kt | 2 +- .../tests/external/codegen/blackbox/jvmOverloads/innerClass.kt | 2 +- .../codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt | 2 +- .../codegen/blackbox/jvmOverloads/nonDefaultParameter.kt | 2 +- .../codegen/blackbox/jvmOverloads/primaryConstructor.kt | 2 +- .../external/codegen/blackbox/jvmOverloads/privateClass.kt | 2 +- .../codegen/blackbox/jvmOverloads/secondaryConstructor.kt | 2 +- .../tests/external/codegen/blackbox/jvmOverloads/simple.kt | 2 +- .../external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt | 2 +- .../tests/external/codegen/blackbox/jvmOverloads/varargs.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/annotations.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/closure.kt | 2 +- .../external/codegen/blackbox/jvmStatic/companionObject.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/convention.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/default.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/explicitObject.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/funAccess.kt | 2 +- .../codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/inline.kt | 2 +- .../codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/object.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/postfixInc.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/prefixInc.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/privateMethod.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/privateSetter.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt | 2 +- .../codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt | 2 +- .../codegen/blackbox/jvmStatic/propertyAccessorsObject.kt | 2 +- .../external/codegen/blackbox/jvmStatic/propertyAsDefault.kt | 2 +- .../tests/external/codegen/blackbox/jvmStatic/simple.kt | 2 +- .../external/codegen/blackbox/jvmStatic/syntheticAccessor.kt | 2 +- .../tests/external/codegen/blackbox/mangling/field.kt | 2 +- backend.native/tests/external/codegen/blackbox/mangling/fun.kt | 2 +- .../external/codegen/blackbox/mangling/noOverrideWithJava.kt | 2 +- .../callMultifileClassMemberFromOtherPackage.kt | 2 +- .../multifileClasses/callsToMultifileClassFromOtherPackage.kt | 2 +- .../constPropertyReferenceFromMultifileClass.kt | 2 +- .../inlineMultifileClassMemberFromOtherPackage.kt | 2 +- .../multifileClasses/multifileClassPartsInitialization.kt | 2 +- .../blackbox/multifileClasses/multifileClassWith2Files.kt | 2 +- .../blackbox/multifileClasses/multifileClassWithCrossCall.kt | 2 +- .../blackbox/multifileClasses/multifileClassWithPrivate.kt | 2 +- .../blackbox/multifileClasses/optimized/callableRefToFun.kt | 2 +- .../optimized/callableRefToInternalValInline.kt | 2 +- .../multifileClasses/optimized/callableRefToPrivateVal.kt | 2 +- .../blackbox/multifileClasses/optimized/callableRefToVal.kt | 2 +- .../codegen/blackbox/multifileClasses/optimized/calls.kt | 2 +- .../multifileClasses/optimized/deferredStaticInitialization.kt | 2 +- .../codegen/blackbox/multifileClasses/optimized/delegatedVal.kt | 2 +- .../blackbox/multifileClasses/optimized/initializePrivateVal.kt | 2 +- .../blackbox/multifileClasses/optimized/initializePublicVal.kt | 2 +- .../blackbox/multifileClasses/optimized/overlappingFuns.kt | 2 +- .../blackbox/multifileClasses/optimized/overlappingVals.kt | 2 +- .../optimized/valAccessFromInlineFunCalledFromJava.kt | 2 +- .../optimized/valAccessFromInlinedToDifferentPackage.kt | 2 +- .../blackbox/multifileClasses/optimized/valWithAccessor.kt | 2 +- .../codegen/blackbox/multifileClasses/privateConstVal.kt | 2 +- .../blackbox/multifileClasses/samePartNameDifferentFacades.kt | 2 +- .../tests/external/codegen/blackbox/nonLocalReturns/use.kt | 2 +- .../codegen/blackbox/nonLocalReturns/useWithException.kt | 2 +- .../tests/external/codegen/blackbox/objects/kt1047.kt | 2 +- .../tests/external/codegen/blackbox/objects/kt1737.kt | 2 +- .../tests/external/codegen/blackbox/objects/kt2663_2.kt | 2 +- .../tests/external/codegen/blackbox/objects/kt3238.kt | 2 +- backend.native/tests/external/codegen/blackbox/objects/kt535.kt | 2 +- backend.native/tests/external/codegen/blackbox/objects/kt560.kt | 2 +- .../codegen/blackbox/operatorConventions/compareTo/boolean.kt | 2 +- .../external/codegen/blackbox/operatorConventions/kt4987.kt | 2 +- .../external/codegen/blackbox/package/initializationOrder.kt | 2 +- .../tests/external/codegen/blackbox/package/invokespecial.kt | 2 +- .../tests/external/codegen/blackbox/package/mainInFiles.kt | 2 +- .../codegen/blackbox/platformTypes/primitives/identityEquals.kt | 2 +- .../codegen/blackbox/primitiveTypes/comparisonWithNaN.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt243.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt684.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt752.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt753.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt756.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt757.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/kt935.kt | 2 +- .../tests/external/codegen/blackbox/primitiveTypes/number.kt | 2 +- .../codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt | 2 +- .../external/codegen/blackbox/privateConstructors/synthetic.kt | 2 +- .../codegen/blackbox/properties/accessToPrivateSetter.kt | 2 +- .../external/codegen/blackbox/properties/collectionSize.kt | 2 +- .../external/codegen/blackbox/properties/commonPropertiesKJK.kt | 2 +- .../codegen/blackbox/properties/companionObjectAccessor.kt | 2 +- .../blackbox/properties/companionObjectPropertiesFromJava.kt | 2 +- .../external/codegen/blackbox/properties/const/constFlags.kt | 2 +- .../blackbox/properties/const/constValInAnnotationDefault.kt | 2 +- .../codegen/blackbox/properties/const/interfaceCompanion.kt | 2 +- .../codegen/blackbox/properties/javaPropertyBoxedGetter.kt | 2 +- .../codegen/blackbox/properties/javaPropertyBoxedSetter.kt | 2 +- .../tests/external/codegen/blackbox/properties/kt1159.kt | 2 +- .../tests/external/codegen/blackbox/properties/kt12200.kt | 2 +- .../tests/external/codegen/blackbox/properties/kt1398.kt | 2 +- .../tests/external/codegen/blackbox/properties/kt1482_2279.kt | 2 +- .../tests/external/codegen/blackbox/properties/kt1714.kt | 2 +- .../tests/external/codegen/blackbox/properties/kt4383.kt | 2 +- .../codegen/blackbox/properties/lateinit/accessorException.kt | 2 +- .../codegen/blackbox/properties/lateinit/exceptionField.kt | 2 +- .../codegen/blackbox/properties/lateinit/exceptionGetter.kt | 2 +- .../codegen/blackbox/properties/lateinit/overrideException.kt | 2 +- .../external/codegen/blackbox/properties/lateinit/visibility.kt | 2 +- .../codegen/blackbox/properties/protectedJavaFieldInInline.kt | 2 +- .../codegen/blackbox/properties/protectedJavaProperty.kt | 2 +- .../blackbox/properties/protectedJavaPropertyInCompanion.kt | 2 +- .../codegen/blackbox/properties/substituteJavaSuperField.kt | 2 +- .../tests/external/codegen/blackbox/publishedApi/noMangling.kt | 2 +- .../codegen/blackbox/ranges/contains/inComparableRange.kt | 2 +- .../codegen/blackbox/ranges/contains/inExtensionRange.kt | 2 +- .../external/codegen/blackbox/ranges/contains/inIntRange.kt | 2 +- .../blackbox/ranges/contains/inOptimizableDoubleRange.kt | 2 +- .../codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt | 2 +- .../codegen/blackbox/ranges/contains/inOptimizableIntRange.kt | 2 +- .../codegen/blackbox/ranges/contains/inOptimizableLongRange.kt | 2 +- .../blackbox/ranges/contains/inRangeWithCustomContains.kt | 2 +- .../blackbox/ranges/contains/inRangeWithImplicitReceiver.kt | 2 +- .../blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt | 2 +- .../codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt | 2 +- .../codegen/blackbox/ranges/expression/inexactDownToMinValue.kt | 2 +- .../codegen/blackbox/ranges/expression/inexactToMaxValue.kt | 2 +- .../blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt | 2 +- .../codegen/blackbox/ranges/expression/maxValueToMaxValue.kt | 2 +- .../codegen/blackbox/ranges/expression/maxValueToMinValue.kt | 2 +- .../blackbox/ranges/expression/progressionDownToMinValue.kt | 2 +- .../ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt | 2 +- .../blackbox/ranges/expression/progressionMaxValueToMaxValue.kt | 2 +- .../blackbox/ranges/expression/progressionMaxValueToMinValue.kt | 2 +- .../blackbox/ranges/expression/progressionMinValueToMinValue.kt | 2 +- .../codegen/blackbox/ranges/forInIndices/kt13241_Array.kt | 2 +- .../codegen/blackbox/ranges/literal/inexactDownToMinValue.kt | 2 +- .../codegen/blackbox/ranges/literal/inexactToMaxValue.kt | 2 +- .../blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt | 2 +- .../codegen/blackbox/ranges/literal/maxValueToMaxValue.kt | 2 +- .../codegen/blackbox/ranges/literal/maxValueToMinValue.kt | 2 +- .../blackbox/ranges/literal/progressionDownToMinValue.kt | 2 +- .../ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt | 2 +- .../blackbox/ranges/literal/progressionMaxValueToMaxValue.kt | 2 +- .../blackbox/ranges/literal/progressionMaxValueToMinValue.kt | 2 +- .../blackbox/ranges/literal/progressionMinValueToMinValue.kt | 2 +- .../tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt | 2 +- .../reflection/annotations/annotationRetentionAnnotation.kt | 2 +- .../blackbox/reflection/annotations/annotationsOnJavaMembers.kt | 2 +- .../codegen/blackbox/reflection/annotations/findAnnotation.kt | 2 +- .../blackbox/reflection/annotations/propertyAccessors.kt | 2 +- .../reflection/annotations/propertyWithoutBackingField.kt | 2 +- .../codegen/blackbox/reflection/annotations/retentions.kt | 2 +- .../blackbox/reflection/annotations/simpleClassAnnotation.kt | 2 +- .../reflection/annotations/simpleConstructorAnnotation.kt | 2 +- .../blackbox/reflection/annotations/simpleFunAnnotation.kt | 2 +- .../blackbox/reflection/annotations/simpleParamAnnotation.kt | 2 +- .../blackbox/reflection/annotations/simpleValAnnotation.kt | 2 +- .../reflection/call/bound/companionObjectPropertyAccessors.kt | 2 +- .../codegen/blackbox/reflection/call/bound/extensionFunction.kt | 2 +- .../reflection/call/bound/extensionPropertyAccessors.kt | 2 +- .../blackbox/reflection/call/bound/innerClassConstructor.kt | 2 +- .../codegen/blackbox/reflection/call/bound/javaInstanceField.kt | 2 +- .../blackbox/reflection/call/bound/javaInstanceMethod.kt | 2 +- .../call/bound/jvmStaticCompanionObjectPropertyAccessors.kt | 2 +- .../blackbox/reflection/call/bound/jvmStaticObjectFunction.kt | 2 +- .../reflection/call/bound/jvmStaticObjectPropertyAccessors.kt | 2 +- .../codegen/blackbox/reflection/call/bound/memberFunction.kt | 2 +- .../blackbox/reflection/call/bound/memberPropertyAccessors.kt | 2 +- .../codegen/blackbox/reflection/call/bound/objectFunction.kt | 2 +- .../blackbox/reflection/call/bound/objectPropertyAccessors.kt | 2 +- .../codegen/blackbox/reflection/call/callInstanceJavaMethod.kt | 2 +- .../codegen/blackbox/reflection/call/callPrivateJavaMethod.kt | 2 +- .../codegen/blackbox/reflection/call/callStaticJavaMethod.kt | 2 +- .../blackbox/reflection/call/cannotCallEnumConstructor.kt | 2 +- .../reflection/call/disallowNullValueForNotNullField.kt | 2 +- .../codegen/blackbox/reflection/call/equalsHashCodeToString.kt | 2 +- .../codegen/blackbox/reflection/call/exceptionHappened.kt | 2 +- .../external/codegen/blackbox/reflection/call/fakeOverride.kt | 2 +- .../codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt | 2 +- .../blackbox/reflection/call/incorrectNumberOfArguments.kt | 2 +- .../codegen/blackbox/reflection/call/innerClassConstructor.kt | 2 +- .../external/codegen/blackbox/reflection/call/jvmStatic.kt | 2 +- .../reflection/call/jvmStaticInObjectIncorrectReceiver.kt | 2 +- .../codegen/blackbox/reflection/call/localClassMember.kt | 2 +- .../codegen/blackbox/reflection/call/memberOfGenericClass.kt | 2 +- .../codegen/blackbox/reflection/call/privateProperty.kt | 2 +- .../codegen/blackbox/reflection/call/propertyAccessors.kt | 2 +- .../call/propertyGetterAndGetFunctionDifferentReturnType.kt | 2 +- .../external/codegen/blackbox/reflection/call/returnUnit.kt | 2 +- .../codegen/blackbox/reflection/call/simpleConstructor.kt | 2 +- .../codegen/blackbox/reflection/call/simpleMemberFunction.kt | 2 +- .../codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt | 2 +- .../blackbox/reflection/callBy/boundExtensionFunction.kt | 2 +- .../blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt | 2 +- .../blackbox/reflection/callBy/boundJvmStaticInObject.kt | 2 +- .../codegen/blackbox/reflection/callBy/companionObject.kt | 2 +- .../reflection/callBy/defaultAndNonDefaultIntertwined.kt | 2 +- .../codegen/blackbox/reflection/callBy/extensionFunction.kt | 2 +- .../blackbox/reflection/callBy/jvmStaticInCompanionObject.kt | 2 +- .../codegen/blackbox/reflection/callBy/jvmStaticInObject.kt | 2 +- .../blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt | 2 +- .../codegen/blackbox/reflection/callBy/manyMaskArguments.kt | 2 +- .../blackbox/reflection/callBy/nonDefaultParameterOmitted.kt | 2 +- .../external/codegen/blackbox/reflection/callBy/nullValue.kt | 2 +- .../callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt | 2 +- .../blackbox/reflection/callBy/primitiveDefaultValues.kt | 2 +- .../codegen/blackbox/reflection/callBy/privateMemberFunction.kt | 2 +- .../codegen/blackbox/reflection/callBy/simpleConstructor.kt | 2 +- .../codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt | 2 +- .../blackbox/reflection/callBy/simpleTopLevelFunction.kt | 2 +- .../blackbox/reflection/classLiterals/annotationClassLiteral.kt | 2 +- .../codegen/blackbox/reflection/classLiterals/arrays.kt | 2 +- .../blackbox/reflection/classLiterals/builtinClassLiterals.kt | 2 +- .../codegen/blackbox/reflection/classLiterals/genericArrays.kt | 2 +- .../reflection/classLiterals/reifiedTypeClassLiteral.kt | 2 +- .../codegen/blackbox/reflection/classes/classSimpleName.kt | 2 +- .../codegen/blackbox/reflection/classes/companionObject.kt | 2 +- .../codegen/blackbox/reflection/classes/createInstance.kt | 2 +- .../codegen/blackbox/reflection/classes/declaredMembers.kt | 2 +- .../external/codegen/blackbox/reflection/classes/jvmName.kt | 2 +- .../codegen/blackbox/reflection/classes/nestedClasses.kt | 2 +- .../codegen/blackbox/reflection/classes/nestedClassesJava.kt | 2 +- .../codegen/blackbox/reflection/classes/objectInstance.kt | 2 +- .../blackbox/reflection/classes/primitiveKClassEquality.kt | 2 +- .../codegen/blackbox/reflection/classes/qualifiedName.kt | 2 +- .../codegen/blackbox/reflection/classes/starProjectedType.kt | 2 +- .../codegen/blackbox/reflection/constructors/annotationClass.kt | 2 +- .../reflection/constructors/classesWithoutConstructors.kt | 2 +- .../codegen/blackbox/reflection/constructors/constructorName.kt | 2 +- .../blackbox/reflection/constructors/primaryConstructor.kt | 2 +- .../blackbox/reflection/constructors/simpleGetConstructors.kt | 2 +- .../blackbox/reflection/createAnnotation/annotationType.kt | 2 +- .../blackbox/reflection/createAnnotation/arrayOfKClasses.kt | 2 +- .../codegen/blackbox/reflection/createAnnotation/callByJava.kt | 2 +- .../blackbox/reflection/createAnnotation/callByKotlin.kt | 2 +- .../codegen/blackbox/reflection/createAnnotation/callJava.kt | 2 +- .../codegen/blackbox/reflection/createAnnotation/callKotlin.kt | 2 +- .../reflection/createAnnotation/createJdkAnnotationInstance.kt | 2 +- .../reflection/createAnnotation/enumKClassAnnotation.kt | 2 +- .../reflection/createAnnotation/equalsHashCodeToString.kt | 2 +- .../reflection/createAnnotation/floatingPointParameters.kt | 2 +- .../reflection/createAnnotation/parameterNamedEquals.kt | 2 +- .../blackbox/reflection/createAnnotation/primitivesAndArrays.kt | 2 +- .../reflection/enclosing/anonymousObjectInInlinedLambda.kt | 2 +- .../codegen/blackbox/reflection/enclosing/classInLambda.kt | 2 +- .../reflection/enclosing/functionExpressionInProperty.kt | 2 +- .../external/codegen/blackbox/reflection/enclosing/kt11969.kt | 2 +- .../external/codegen/blackbox/reflection/enclosing/kt6368.kt | 2 +- .../reflection/enclosing/kt6691_lambdaInSamConstructor.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInClassObject.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInConstructor.kt | 2 +- .../codegen/blackbox/reflection/enclosing/lambdaInFunction.kt | 2 +- .../codegen/blackbox/reflection/enclosing/lambdaInLambda.kt | 2 +- .../reflection/enclosing/lambdaInLocalClassConstructor.kt | 2 +- .../reflection/enclosing/lambdaInLocalClassSuperCall.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInLocalFunction.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInMemberFunction.kt | 2 +- .../reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt | 2 +- .../reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInObjectExpression.kt | 2 +- .../reflection/enclosing/lambdaInObjectLiteralSuperCall.kt | 2 +- .../codegen/blackbox/reflection/enclosing/lambdaInPackage.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInPropertyGetter.kt | 2 +- .../blackbox/reflection/enclosing/lambdaInPropertySetter.kt | 2 +- .../reflection/enclosing/localClassInTopLevelFunction.kt | 2 +- .../codegen/blackbox/reflection/enclosing/objectInLambda.kt | 2 +- .../reflection/functions/declaredVsInheritedFunctions.kt | 2 +- .../codegen/blackbox/reflection/functions/functionFromStdlib.kt | 2 +- .../reflection/functions/functionReferenceErasedToKFunction.kt | 2 +- .../blackbox/reflection/functions/genericOverriddenFunction.kt | 2 +- .../codegen/blackbox/reflection/functions/instanceOfFunction.kt | 2 +- .../blackbox/reflection/functions/javaClassGetFunctions.kt | 2 +- .../codegen/blackbox/reflection/functions/platformName.kt | 2 +- .../blackbox/reflection/functions/privateMemberFunction.kt | 2 +- .../codegen/blackbox/reflection/functions/simpleGetFunctions.kt | 2 +- .../codegen/blackbox/reflection/functions/simpleNames.kt | 2 +- .../blackbox/reflection/genericSignature/covariantOverride.kt | 2 +- .../reflection/genericSignature/defaultImplsGenericSignature.kt | 2 +- .../genericSignature/functionLiteralGenericSignature.kt | 2 +- .../reflection/genericSignature/genericBackingFieldSignature.kt | 2 +- .../reflection/genericSignature/genericMethodSignature.kt | 2 +- .../codegen/blackbox/reflection/genericSignature/kt11121.kt | 2 +- .../codegen/blackbox/reflection/genericSignature/kt5112.kt | 2 +- .../codegen/blackbox/reflection/genericSignature/kt6106.kt | 2 +- .../blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt | 2 +- .../codegen/blackbox/reflection/kClassInAnnotation/array.kt | 2 +- .../blackbox/reflection/kClassInAnnotation/arrayInJava.kt | 2 +- .../codegen/blackbox/reflection/kClassInAnnotation/basic.kt | 2 +- .../blackbox/reflection/kClassInAnnotation/basicInJava.kt | 2 +- .../codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt | 2 +- .../codegen/blackbox/reflection/kClassInAnnotation/vararg.kt | 2 +- .../blackbox/reflection/kClassInAnnotation/varargInJava.kt | 2 +- .../reflection/lambdaClasses/parameterNamesAndNullability.kt | 2 +- .../external/codegen/blackbox/reflection/mapping/constructor.kt | 2 +- .../codegen/blackbox/reflection/mapping/extensionProperty.kt | 2 +- .../reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt | 2 +- .../blackbox/reflection/mapping/fakeOverrides/javaMethod.kt | 2 +- .../external/codegen/blackbox/reflection/mapping/functions.kt | 2 +- .../codegen/blackbox/reflection/mapping/inlineReifiedFun.kt | 2 +- .../reflection/mapping/jvmStatic/companionObjectFunction.kt | 2 +- .../blackbox/reflection/mapping/jvmStatic/objectFunction.kt | 2 +- .../reflection/mapping/mappedClassIsEqualToClassLiteral.kt | 2 +- .../codegen/blackbox/reflection/mapping/memberProperty.kt | 2 +- .../codegen/blackbox/reflection/mapping/propertyAccessors.kt | 2 +- .../blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt | 2 +- .../codegen/blackbox/reflection/mapping/syntheticFields.kt | 2 +- .../blackbox/reflection/mapping/topLevelFunctionOtherFile.kt | 2 +- .../codegen/blackbox/reflection/mapping/topLevelProperty.kt | 2 +- .../reflection/mapping/types/annotationConstructorParameters.kt | 2 +- .../external/codegen/blackbox/reflection/mapping/types/array.kt | 2 +- .../codegen/blackbox/reflection/mapping/types/constructors.kt | 2 +- .../reflection/mapping/types/genericArrayElementType.kt | 2 +- .../reflection/mapping/types/innerGenericTypeArgument.kt | 2 +- .../blackbox/reflection/mapping/types/memberFunctions.kt | 2 +- .../reflection/mapping/types/overrideAnyWithPrimitive.kt | 2 +- .../reflection/mapping/types/parameterizedTypeArgument.kt | 2 +- .../blackbox/reflection/mapping/types/parameterizedTypes.kt | 2 +- .../blackbox/reflection/mapping/types/propertyAccessors.kt | 2 +- .../codegen/blackbox/reflection/mapping/types/supertypes.kt | 2 +- .../blackbox/reflection/mapping/types/topLevelFunctions.kt | 2 +- .../codegen/blackbox/reflection/mapping/types/typeParameters.kt | 2 +- .../external/codegen/blackbox/reflection/mapping/types/unit.kt | 2 +- .../blackbox/reflection/mapping/types/withNullability.kt | 2 +- .../methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt | 2 +- .../codegen/blackbox/reflection/methodsFromAny/classToString.kt | 2 +- .../methodsFromAny/extensionPropertyReceiverToString.kt | 2 +- .../reflection/methodsFromAny/functionEqualsHashCode.kt | 2 +- .../blackbox/reflection/methodsFromAny/functionToString.kt | 2 +- .../reflection/methodsFromAny/memberExtensionToString.kt | 2 +- .../reflection/methodsFromAny/parametersEqualsHashCode.kt | 2 +- .../blackbox/reflection/methodsFromAny/parametersToString.kt | 2 +- .../reflection/methodsFromAny/propertyEqualsHashCode.kt | 2 +- .../blackbox/reflection/methodsFromAny/propertyToString.kt | 2 +- .../blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt | 2 +- .../reflection/methodsFromAny/typeParametersEqualsHashCode.kt | 2 +- .../reflection/methodsFromAny/typeParametersToString.kt | 2 +- .../codegen/blackbox/reflection/methodsFromAny/typeToString.kt | 2 +- .../reflection/methodsFromAny/typeToStringInnerGeneric.kt | 2 +- .../codegen/blackbox/reflection/modifiers/callableModality.kt | 2 +- .../codegen/blackbox/reflection/modifiers/callableVisibility.kt | 2 +- .../codegen/blackbox/reflection/modifiers/classModality.kt | 2 +- .../codegen/blackbox/reflection/modifiers/classVisibility.kt | 2 +- .../external/codegen/blackbox/reflection/modifiers/classes.kt | 2 +- .../external/codegen/blackbox/reflection/modifiers/functions.kt | 2 +- .../codegen/blackbox/reflection/modifiers/javaVisibility.kt | 2 +- .../codegen/blackbox/reflection/modifiers/properties.kt | 2 +- .../codegen/blackbox/reflection/modifiers/typeParameters.kt | 2 +- .../multifileClasses/callFunctionsInMultifileClass.kt | 2 +- .../multifileClasses/callPropertiesInMultifileClass.kt | 2 +- .../reflection/multifileClasses/javaFieldForVarAndConstVal.kt | 2 +- .../codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt | 2 +- .../noReflectAtRuntime/methodsFromAny/callableReferences.kt | 2 +- .../noReflectAtRuntime/methodsFromAny/classReference.kt | 2 +- .../reflection/noReflectAtRuntime/primitiveJavaClass.kt | 2 +- .../reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt | 2 +- .../reflection/noReflectAtRuntime/simpleClassLiterals.kt | 2 +- .../reflection/parameters/boundInnerClassConstructor.kt | 2 +- .../reflection/parameters/boundObjectMemberReferences.kt | 2 +- .../codegen/blackbox/reflection/parameters/boundReferences.kt | 2 +- .../blackbox/reflection/parameters/findParameterByName.kt | 2 +- .../reflection/parameters/functionParameterNameAndIndex.kt | 2 +- .../parameters/instanceExtensionReceiverAndValueParameters.kt | 2 +- .../codegen/blackbox/reflection/parameters/isMarkedNullable.kt | 2 +- .../codegen/blackbox/reflection/parameters/isOptional.kt | 2 +- .../blackbox/reflection/parameters/javaAnnotationConstructor.kt | 2 +- .../blackbox/reflection/parameters/javaParametersHaveNoNames.kt | 2 +- .../external/codegen/blackbox/reflection/parameters/kinds.kt | 2 +- .../codegen/blackbox/reflection/parameters/propertySetter.kt | 2 +- .../blackbox/reflection/properties/accessors/accessorNames.kt | 2 +- .../properties/accessors/extensionPropertyAccessors.kt | 2 +- .../reflection/properties/accessors/memberExtensions.kt | 2 +- .../reflection/properties/accessors/memberPropertyAccessors.kt | 2 +- .../properties/accessors/topLevelPropertyAccessors.kt | 2 +- .../codegen/blackbox/reflection/properties/allVsDeclared.kt | 2 +- .../properties/callPrivatePropertyFromGetProperties.kt | 2 +- .../reflection/properties/declaredVsInheritedProperties.kt | 2 +- .../blackbox/reflection/properties/fakeOverridesInSubclass.kt | 2 +- .../properties/genericClassLiteralPropertyReceiverIsStar.kt | 2 +- .../blackbox/reflection/properties/genericOverriddenProperty.kt | 2 +- .../codegen/blackbox/reflection/properties/genericProperty.kt | 2 +- .../properties/getExtensionPropertiesMutableVsReadonly.kt | 2 +- .../reflection/properties/getPropertiesMutableVsReadonly.kt | 2 +- .../codegen/blackbox/reflection/properties/invokeKProperty.kt | 2 +- .../reflection/properties/javaPropertyInheritedInKotlin.kt | 2 +- .../codegen/blackbox/reflection/properties/javaStaticField.kt | 2 +- .../reflection/properties/kotlinPropertyInheritedInJava.kt | 2 +- .../properties/memberAndMemberExtensionWithSameName.kt | 2 +- .../reflection/properties/mutatePrivateJavaInstanceField.kt | 2 +- .../reflection/properties/mutatePrivateJavaStaticField.kt | 2 +- .../properties/noConflictOnKotlinGetterAndJavaField.kt | 2 +- .../reflection/properties/overrideKotlinPropertyByJavaMethod.kt | 2 +- .../codegen/blackbox/reflection/properties/privateClassVal.kt | 2 +- .../codegen/blackbox/reflection/properties/privateClassVar.kt | 2 +- .../reflection/properties/privateFakeOverrideFromSuperclass.kt | 2 +- .../reflection/properties/privateJvmStaticVarInObject.kt | 2 +- .../properties/privatePropertyCallIsAccessibleOnAccessors.kt | 2 +- .../blackbox/reflection/properties/privateToThisAccessors.kt | 2 +- .../reflection/properties/propertyOfNestedClassAndArrayType.kt | 2 +- .../codegen/blackbox/reflection/properties/protectedClassVar.kt | 2 +- .../blackbox/reflection/properties/publicClassValAccessible.kt | 2 +- .../properties/referenceToJavaFieldOfKotlinSubclass.kt | 2 +- .../blackbox/reflection/properties/simpleGetProperties.kt | 2 +- .../specialBuiltIns/getMembersOfStandardJavaClasses.kt | 2 +- .../blackbox/reflection/supertypes/builtInClassSupertypes.kt | 2 +- .../blackbox/reflection/supertypes/genericSubstitution.kt | 2 +- .../reflection/supertypes/isSubclassOfIsSuperclassOf.kt | 2 +- .../codegen/blackbox/reflection/supertypes/primitives.kt | 2 +- .../codegen/blackbox/reflection/supertypes/simpleSupertypes.kt | 2 +- .../reflection/typeParameters/declarationSiteVariance.kt | 2 +- .../reflection/typeParameters/typeParametersAndNames.kt | 2 +- .../codegen/blackbox/reflection/typeParameters/upperBounds.kt | 2 +- .../codegen/blackbox/reflection/types/classifierIsClass.kt | 2 +- .../blackbox/reflection/types/classifierIsTypeParameter.kt | 2 +- .../blackbox/reflection/types/classifiersOfBuiltInTypes.kt | 2 +- .../codegen/blackbox/reflection/types/createType/equality.kt | 2 +- .../blackbox/reflection/types/createType/innerGeneric.kt | 2 +- .../blackbox/reflection/types/createType/simpleCreateType.kt | 2 +- .../blackbox/reflection/types/createType/typeParameter.kt | 2 +- .../reflection/types/createType/wrongNumberOfArguments.kt | 2 +- .../codegen/blackbox/reflection/types/innerGenericArguments.kt | 2 +- .../codegen/blackbox/reflection/types/jvmErasureOfClass.kt | 2 +- .../blackbox/reflection/types/jvmErasureOfTypeParameter.kt | 2 +- .../reflection/types/platformTypeNotEqualToKotlinType.kt | 2 +- .../codegen/blackbox/reflection/types/subtyping/platformType.kt | 2 +- .../blackbox/reflection/types/subtyping/simpleGenericTypes.kt | 2 +- .../reflection/types/subtyping/simpleSubtypeSupertype.kt | 2 +- .../blackbox/reflection/types/subtyping/typeProjection.kt | 2 +- .../external/codegen/blackbox/reflection/types/typeArguments.kt | 2 +- .../codegen/blackbox/reflection/types/useSiteVariance.kt | 2 +- .../codegen/blackbox/reflection/types/withNullability.kt | 2 +- .../tests/external/codegen/blackbox/regressions/collections.kt | 2 +- .../codegen/blackbox/regressions/getGenericInterfaces.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt1172.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt1515.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt1568.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt1932.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt2246.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt2318.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt2593.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt274.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt3046.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt344.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt4259.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt4262.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt528.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt529.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt533.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt5445.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt5445_2.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt6434.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt6485.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt715.kt | 2 +- .../tests/external/codegen/blackbox/regressions/kt864.kt | 2 +- .../external/codegen/blackbox/regressions/nestedIntersection.kt | 2 +- .../codegen/blackbox/regressions/referenceToSelfInLocal.kt | 2 +- .../external/codegen/blackbox/regressions/typeCastException.kt | 2 +- .../tests/external/codegen/blackbox/reified/DIExample.kt | 2 +- .../tests/external/codegen/blackbox/reified/anonymousObject.kt | 2 +- .../codegen/blackbox/reified/anonymousObjectNoPropagate.kt | 2 +- .../codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt | 2 +- .../codegen/blackbox/reified/approximateCapturedTypes.kt | 2 +- .../codegen/blackbox/reified/arraysReification/instanceOf.kt | 2 +- .../blackbox/reified/arraysReification/instanceOfArrays.kt | 2 +- .../codegen/blackbox/reified/arraysReification/jClass.kt | 2 +- .../blackbox/reified/arraysReification/jaggedArrayOfNulls.kt | 2 +- .../tests/external/codegen/blackbox/reified/asOnPlatformType.kt | 2 +- .../tests/external/codegen/blackbox/reified/defaultJavaClass.kt | 2 +- .../tests/external/codegen/blackbox/reified/filterIsInstance.kt | 2 +- .../external/codegen/blackbox/reified/innerAnonymousObject.kt | 2 +- .../tests/external/codegen/blackbox/reified/instanceof.kt | 2 +- .../tests/external/codegen/blackbox/reified/isOnPlatformType.kt | 2 +- .../tests/external/codegen/blackbox/reified/javaClass.kt | 2 +- .../tests/external/codegen/blackbox/reified/nestedReified.kt | 2 +- .../external/codegen/blackbox/reified/nestedReifiedSignature.kt | 2 +- .../tests/external/codegen/blackbox/reified/newArrayInt.kt | 2 +- .../blackbox/reified/nonInlineableLambdaInReifiedFunction.kt | 2 +- .../codegen/blackbox/reified/recursiveInnerAnonymousObject.kt | 2 +- .../external/codegen/blackbox/reified/recursiveNewArray.kt | 2 +- .../codegen/blackbox/reified/recursiveNonInlineableLambda.kt | 2 +- .../codegen/blackbox/reified/reifiedInlineFunOfObject.kt | 2 +- .../blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt | 2 +- .../blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt | 2 +- .../external/codegen/blackbox/reified/sameIndexRecursive.kt | 2 +- .../tests/external/codegen/blackbox/safeCall/kt232.kt | 2 +- .../codegen/blackbox/sam/constructors/filenameFilter.kt | 2 +- .../blackbox/sam/constructors/nonLiteralFilenameFilter.kt | 2 +- .../blackbox/sam/constructors/samWrappersDifferentFiles.kt | 2 +- .../codegen/blackbox/sam/constructors/sameWrapperClass.kt | 2 +- .../blackbox/secondaryConstructors/withNonLocalReturn.kt | 2 +- .../codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt | 2 +- .../codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt | 2 +- .../external/codegen/blackbox/specialBuiltins/collectionImpl.kt | 2 +- .../external/codegen/blackbox/specialBuiltins/emptyList.kt | 2 +- .../codegen/blackbox/specialBuiltins/notEmptyListAny.kt | 2 +- .../external/codegen/blackbox/specialBuiltins/notEmptyMap.kt | 2 +- .../tests/external/codegen/blackbox/statics/fields.kt | 2 +- .../tests/external/codegen/blackbox/statics/functions.kt | 2 +- .../external/codegen/blackbox/statics/hidePrivateByPublic.kt | 2 +- .../codegen/blackbox/statics/inlineCallsStaticMethod.kt | 2 +- .../codegen/blackbox/statics/protectedSamConstructor.kt | 2 +- .../tests/external/codegen/blackbox/statics/protectedStatic.kt | 2 +- .../tests/external/codegen/blackbox/statics/protectedStatic2.kt | 2 +- .../codegen/blackbox/statics/protectedStaticAndInline.kt | 2 +- .../tests/external/codegen/blackbox/strings/kt2592.kt | 2 +- backend.native/tests/external/codegen/blackbox/strings/kt889.kt | 2 +- backend.native/tests/external/codegen/blackbox/strings/kt894.kt | 2 +- .../external/codegen/blackbox/strings/stringBuilderAppend.kt | 2 +- .../external/codegen/blackbox/synchronized/changeMonitor.kt | 2 +- .../blackbox/synchronized/exceptionInMonitorExpression.kt | 2 +- .../tests/external/codegen/blackbox/synchronized/finally.kt | 2 +- .../tests/external/codegen/blackbox/synchronized/longValue.kt | 2 +- .../codegen/blackbox/synchronized/nestedDifferentObjects.kt | 2 +- .../external/codegen/blackbox/synchronized/nestedSameObject.kt | 2 +- .../external/codegen/blackbox/synchronized/nonLocalReturn.kt | 2 +- .../tests/external/codegen/blackbox/synchronized/objectValue.kt | 2 +- .../tests/external/codegen/blackbox/synchronized/sync.kt | 2 +- .../tests/external/codegen/blackbox/synchronized/value.kt | 2 +- .../tests/external/codegen/blackbox/synchronized/wait.kt | 2 +- .../blackbox/syntheticAccessors/syntheticAccessorNames.kt | 2 +- .../tests/external/codegen/blackbox/toArray/toTypedArray.kt | 2 +- .../topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt | 2 +- .../topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt | 2 +- .../codegen/blackbox/topLevelPrivate/privateVisibility.kt | 2 +- .../blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt | 2 +- .../blackbox/traits/abstractClassInheritsFromInterface.kt | 2 +- .../codegen/blackbox/traits/diamondPropertyAccessors.kt | 2 +- .../external/codegen/blackbox/traits/inheritJavaInterface.kt | 2 +- .../external/codegen/blackbox/traits/interfaceDefaultImpls.kt | 2 +- backend.native/tests/external/codegen/blackbox/traits/kt2399.kt | 2 +- backend.native/tests/external/codegen/blackbox/traits/kt3500.kt | 2 +- .../external/codegen/blackbox/traits/noPrivateDelegation.kt | 2 +- .../tests/external/codegen/blackbox/traits/traitImplDiamond.kt | 2 +- .../tests/external/codegen/blackbox/typeInfo/asInLoop.kt | 2 +- .../external/codegen/blackbox/typeMapping/enhancedPrimitives.kt | 2 +- .../codegen/blackbox/typeMapping/genericTypeWithNothing.kt | 2 +- .../tests/external/codegen/blackbox/typeMapping/kt309.kt | 2 +- .../codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt | 2 +- .../tests/external/codegen/blackbox/unit/UnitValue.kt | 2 +- backend.native/tests/external/codegen/blackbox/unit/kt4212.kt | 2 +- .../tests/external/codegen/blackbox/vararg/varargInJava.kt | 2 +- .../codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt | 2 +- .../when/stringOptimization/duplicatingItemsSameHashCode.kt | 2 +- .../codegen/blackbox/when/stringOptimization/sameHashCode.kt | 2 +- 819 files changed, 819 insertions(+), 819 deletions(-) diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt index 94de7d80a76..37f0de4e7c2 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedEnumEntry.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KT-5665 diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt index 2371d050fbe..d8f6b4fce94 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/funExpression.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt index deb25de9a0c..67bea1e84ea 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/lambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt index 01fc57353ce..0e03694d6a9 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samFunExpression.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt index 10f0a77f6b5..382c6902ce9 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedLambda/samLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt index 1330899c02c..0fba694eb67 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotatedObjectLiteral.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt index 446a67e91ff..5f01b7eb25d 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt index 800662eb8af..74c8a7cbfff 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationWithKotlinPropertyFromInterfaceCompanion.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt index af44539ed67..d9f682c8a55 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnDefault.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt index 3e49c7af76d..497fa723e09 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/annotationsOnTypeAliases.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt b/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt index fca68cd7665..6987d370f5d 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/defaultParameterValues.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt b/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt index 8b2ccb17d17..1abfbda2f9f 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/delegatedPropertySetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt b/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt index d975f9cf8c1..c33bb1b4c8d 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/fileClassWithFileAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt b/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt index 91dc2705c9d..fb5282b64df 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/jvmAnnotationFlags.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt index 2aa20e7956e..1d2eb2eec5c 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/kotlinPropertyFromClassObjectAsParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt index fbd36775d01..4a2fda75c19 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/kotlinTopLevelPropertyAsParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt b/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt index 79e06313c63..c0481095c75 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/kt10136.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt index 72369ea0378..20ce394faf4 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/nestedClassPropertyAsParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt b/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt index f3a8d612cb5..ac5be1259a4 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/parameterWithPrimitiveType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt index af730102904..167f2774238 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/propertyWithPropertyInInitializerAsParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt b/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt index 405deb725a9..2c21161ee08 100644 --- a/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/annotations/varargInAnnotationParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt index 11146076909..d686101b1c7 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/arguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun test(a: String, b: String): String { diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt index 35d8c0e02b7..99792dc416c 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/captured.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var invokeOrder = ""; diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt index dd65cd1c28f..72ed6b1c2bc 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/capturedInExtension.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var invokeOrder = ""; diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt index 17a94380c82..7498df2eefc 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/defaults.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE var invokeOrder: String = "" diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt index c298929042c..c95a3b491c1 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/extension.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var invokeOrder = ""; diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt index 98e666e8c79..01b3a736735 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/extensionInClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { return Z().test() diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt index 60f7f292cbf..101a18974ca 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/simple.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var res = ""; diff --git a/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt b/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt index faa071bc275..9bd916da6e0 100644 --- a/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt +++ b/backend.native/tests/external/codegen/blackbox/argumentOrder/simpleInClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var res = ""; diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt b/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt index d5323fbbdbb..67206754e5a 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/arrayInstanceOf.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE //test [], get and iterator calls fun test(createIntNotLong: Boolean): String { diff --git a/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt b/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt index 52075d459d7..f0860dadc0a 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/arraysAreCloneable.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(x: Cloneable) = x diff --git a/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt b/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt index 8e29271c7d7..fe7ae5ff309 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/cloneArray.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt b/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt index dc6646587d6..578c79c0d3c 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/clonePrimitiveArrays.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt index 19bf8463026..4970504900c 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorByteArrayNextByte.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val a = ByteArray(5) diff --git a/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt b/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt index 74bf8c9f4a4..ef44f5426d0 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/iteratorLongArrayNextLong.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val a = LongArray(5) diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt index bdad1a98add..d42e3e112a3 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt503.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun iarr(vararg a : Int) = a fun array(vararg a : T) = a diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt index 6fa4cf73905..471a56cc117 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt602.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt index 80d330ecd09..80060cd39f8 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt7288.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun test(b: Boolean): String { val a = if (b) IntArray(5) else LongArray(5) diff --git a/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt b/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt index 48e9b499598..848764b3f57 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/kt7338.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt b/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt index 350d4cfe176..6c9158aa1a5 100644 --- a/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/arrays/nonLocalReturnArrayConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun testArray() { Array(5) { i -> diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt index bdcbe98664d..c30db01e13f 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // reason - multifile tests are not supported in JS tests //FILE: Holder.java diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt index 14a07fe1eb3..68260ff21f4 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // reason - multifile tests are not supported in JS tests //FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt index 1daa188f030..328e6785b0c 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // reason - no ArithmeticException in JS fun box(): String { val a1 = 0 diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt index 0bbf5986f68..86e8dc6bec7 100644 --- a/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/checkcastAndInstanceOf.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt index 75714bc8a03..a397903567e 100644 --- a/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt +++ b/backend.native/tests/external/codegen/blackbox/boxingOptimization/kt6047.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt index b141ba2bfbd..26a74d507bc 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Collection.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyCollection: Collection { override val size: Int get() = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt index 043c32631f3..ad0fc09d46c 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Iterator.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyIterator(val v: T): Iterator { override fun next(): T = v diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt index e77840dbd06..5958c38ca05 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/IteratorWithRemove.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyIterator(val v: T): Iterator { override fun next(): T = v diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt index 317037880e3..7674d221a35 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/List.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyList: List { override val size: Int get() = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt index 4296d8ee05c..d5a829d7566 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListIterator.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyListIterator : ListIterator { override fun next(): T = null!! diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt index 01b5c4b66b2..9b6a2d02310 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllImplementations.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyList(val v: T): List { override val size: Int get() = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt index 478f2679577..0931a43f501 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/ListWithAllInheritedImplementations.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE open class Super(val v: T) { public fun add(e: T): Boolean = true diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt index e97a5fcda49..c8438bb3d13 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/Map.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyMap: Map { override val size: Int get() = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt index 8b222a91b09..33a83a55ec8 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntry.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyMapEntry: Map.Entry { override fun hashCode(): Int = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt index 72c60f1c053..ce8eaaf6886 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapEntryWithSetValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyMapEntry: Map.Entry { override fun hashCode(): Int = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt index 9d0a4031f1a..d84d89369d3 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/MapWithAllImplementations.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyMap: Map { override val size: Int get() = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt index b075bb7517d..6656b7d769b 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/SubstitutedList.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyList: List { override val size: Int get() = 0 diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt index 14b71a4a95f..100748198dc 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/abstractMember.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE abstract class A : Iterator { abstract fun remove(): Unit diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt index fef74374fe2..2710f121246 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/immutableRemove.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FULL_JDK // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt index bdd27bfad0a..b82febc0667 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/implementationInTrait.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface Addable { fun add(s: String): Boolean = true diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt index dd6e2cf5d27..606144d696d 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/inheritedImplementations.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE open class SetStringImpl { fun add(s: String): Boolean = false diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt index 84e3b531630..d7671b38bd2 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialSubstitution.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyCollection : Collection>> { override fun iterator() = null!! diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt index bcc79196920..71c6e0e60b7 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/nonTrivialUpperBound.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class MyIterator : Iterator { override fun next() = null!! diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt index 278f819cfe0..460328ffe0f 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedIterable.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt index 512a411496e..e34741934e7 100644 --- a/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt +++ b/backend.native/tests/external/codegen/blackbox/builtinStubMethods/substitutedListWithExtraSuperInterface.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt index ce40fb403cf..b62135e87bb 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/enumEntryMember.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE enum class E { A, B; diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt index e0479cd1db4..1ecf9a29e7e 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/nullableReceiverInEquals.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // See https://youtrack.jetbrains.com/issue/KT-14938 // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt index 070cde155b8..46848672257 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/propertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt index fd21eac125b..18bc635d01c 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/receiverInEquals.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package test diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt index d29849655df..bd6ca854d2c 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/equals/reflectionReference.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt index 3dcd0359a85..a289ba275c4 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kCallableNameIntrinsic.kt @@ -1,5 +1,5 @@ // Enable when callable references to builtin members is supported -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var state = 0 val name = (state++)::toString.name diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt index 668798431de..fa76e62abbb 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt12738.kt @@ -1,5 +1,5 @@ // Enable when callable references to builtin members is supported -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun get(t: T): () -> String { return t::toString } diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt index 967150ab7cb..e0c0f55139f 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/kt15446.kt @@ -1,5 +1,5 @@ //WITH_RUNTIME -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val a = intArrayOf(1, 2) val b = arrayOf("OK") diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt index 327c73d5914..7d19c68d0d1 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleFunction.kt @@ -1,5 +1,5 @@ // Enable when callable references to builtin members is supported -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val f = "KOTLIN"::get return "${f(1)}${f(0)}" diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt index 533c75f6bf7..8da5393394f 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/bound/simpleProperty.kt @@ -1,5 +1,5 @@ // Enable when callable references to builtin members are supported. -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val f = "kotlin"::length diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt index ece7520df91..09937cd3c5f 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/booleanNotIntrinsic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { if ((Boolean::not)(true) != false) return "Fail 1" diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt index 8a7187958d6..b2f09fae21b 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/enumValueOfMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE enum class E { ENTRY diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt index 0f007abd864..742fceab72b 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/equalsIntrinsic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt index 468034d992a..eb0d1f31f6f 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/getArityViaFunctionImpl.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt index 25f2a594300..5dc1ab5fe50 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/javaCollectionsStaticMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // KT-5123 diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt index f4ad0ac77f9..8575e9707a9 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/local/localFunctionName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { fun OK() {} diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt index 533e8395616..f1666e82235 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/newArray.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE private fun upcast(value: T): T = value diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt b/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt index 5dec6776f45..c5a99e074bd 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/function/overloadedFunVsVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import kotlin.reflect.* diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt index 9f5b0c55d60..4d5560c98af 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/kt6870_privatePropertyReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class Test { private var iv = 1 diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt index 2ef9208075f..c7c78a24c9e 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/listOfStringsMapLength.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt b/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt index de11060a95d..39ea508e9ba 100644 --- a/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt +++ b/backend.native/tests/external/codegen/blackbox/callableReference/property/privateSetterOutsideClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // See KT-12337 Reference to property with invisible setter should not be a KMutableProperty diff --git a/backend.native/tests/external/codegen/blackbox/casts/as.kt b/backend.native/tests/external/codegen/blackbox/casts/as.kt index 23ae5313ac2..6b78d69af24 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/as.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/as.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(x: Any) = x as Runnable diff --git a/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt b/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt index 43aa798276f..4d0c62414d8 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/asForConstants.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { if (check(1, { it as Int }) == "OK") return "fail 1" diff --git a/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt b/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt index 94c62111e02..3e86a808c45 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/asSafe.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(x: Any) = x as? Runnable diff --git a/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt b/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt index be3fbff1dc4..bc7a063340f 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/asSafeForConstants.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { if ((1 as? Int) == null) return "fail 1" diff --git a/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt b/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt index 9760295a6dc..b8d44d6a517 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/asWithGeneric.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt index 43df48d37b6..e6b457326ed 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKBig.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // This is a big, ugly, semi-auto generated test. diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt index 6ce2082e748..c4632210b28 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/asFunKSmall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun fn0() {} fun fn1(x: Any) {} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt index 1985402f6bc..35d1bfe131e 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKBig.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // This is a big, ugly, semi-auto generated test. diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt index 90f81d82a3a..540798009ff 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/isFunKSmall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt index 9d0bdedc3fc..ec1c3c21eb6 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/javaTypeIsFunK.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JFun.java diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt index d853a01bb9d..af43807ed25 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKBig.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // This is a big, ugly, semi-auto generated test. diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt index 100350d53da..217b36c6597 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedAsFunKSmall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun fn0() {} fun fn1(x: Any) {} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt index 40bc0a05f1f..369c215ffa5 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKBig.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // This is a big, ugly, semi-auto generated test. diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt index 71436394ae7..0850527e1c6 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedIsFunKSmall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt index a5844221cb4..a4664ba6126 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKBig.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // This is a big, ugly, semi-auto generated test. // Use corresponding 'Small' test for debug. diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt index a3d4c0fcb27..5ba0c0d6b2c 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/reifiedSafeAsFunKSmall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun fn0() {} fun fn1(x: Any) {} diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt index 4cbc23a639d..3bcde42c159 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKBig.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // This is a big, ugly, semi-auto generated test. diff --git a/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt index 0628070f83f..d413300c13e 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/functions/safeAsFunKSmall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/casts/is.kt b/backend.native/tests/external/codegen/blackbox/casts/is.kt index d10f77a86ef..19a3e284e5c 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/is.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/is.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(x: Any) = x is Runnable diff --git a/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt b/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt index 42a86dcbb07..29b1ec1cc04 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/lambdaToUnitCast.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // JS backend does not support Unit well. See KT-13932 val foo: () -> Unit = {} diff --git a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt index 33b0eaec597..16a7d407e12 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/literalExpressionAsGenericArgument/javaBox.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Box.java diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt index 8383b28f850..5aa856a189a 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/mutabilityMarkerInterfaces.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt index 19300961dac..137035866b1 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/mutableCollections/weirdMutableCasts.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/casts/notIs.kt b/backend.native/tests/external/codegen/blackbox/casts/notIs.kt index 262d2db9b5a..5e784474bb9 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/notIs.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/notIs.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(x: Any) = x !is Runnable diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt b/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt index d05da99581f..da598959fe0 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/unitAsAny.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun println(s: String) { } diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt b/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt index a57a1d0a945..5e0ab81ea20 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/unitAsInt.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt b/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt index 6412c65526f..228e5aeaba9 100644 --- a/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt +++ b/backend.native/tests/external/codegen/blackbox/casts/unitAsSafeAny.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun println(s: String) { } diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt index 6731a8236b2..52190d0f390 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/javaIntrinsicWithSideEffect.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt index 54c6b5b02a8..16739b170fe 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/primitives.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt index 0f488002377..a1fee693ce7 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/sideEffect.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var x = 42 diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt index 0524e9ebf77..f6de756700b 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/bound/simple.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val x: CharSequence = "" diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt index 3ae1f3762ce..64f95e8ad6d 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/java.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt index ed794ffc106..b64ff4634f6 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt index c03c33ba8ca..02fc734f52a 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaObjectTypeReified.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt index 0236f652948..c413aee39c2 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt index ebe15afe3b1..c9b71561637 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaPrimitiveTypeReified.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt index 90cf2d94df7..e6e4821d9aa 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/javaReified.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt index 6271b906152..31b37df66c9 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/kt11943.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt index 30c16850f62..cfbf4d7f08b 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/java/objectSuperConstructorCall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt b/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt index 2fb23528510..53d9f7d980b 100644 --- a/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt +++ b/backend.native/tests/external/codegen/blackbox/classLiteral/primitiveKClassEquality.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt b/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt index dd2744181c2..901b77a1bad 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/classObjectToString.kt @@ -1,5 +1,5 @@ // TODO: Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class SomeClass { companion object } fun box() = diff --git a/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt b/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt index 10f75e260bd..f4ad18d3b22 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/delegationJava.kt @@ -1,5 +1,5 @@ // Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class TestJava(r : Runnable) : Runnable by r {} class TestRunnable() : Runnable { diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt index 43b08faa8b8..69a428951cd 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1120.kt @@ -1,6 +1,6 @@ // Won't ever work with JS backend. // TODO: Consider rewriting this test without using threads, since the issue is not about threads at all. -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE object RefreshQueue { val any = Any() diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt index e6028e21e95..cbe62018fd4 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1134.kt @@ -1,5 +1,5 @@ // TODO: Enable when JS backend supports Java class library -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE public class SomeClass() : java.lang.Object() { } diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt b/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt index f1efa2d6b2c..d26691e4446 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/kt1535.kt @@ -1,5 +1,5 @@ // TODO: Enable when JS backend supports Java class library, since FunctionX are required for interoperation -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class Works() : Function0 { public override fun invoke():Any { return "Works" as Any diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt b/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt index 68886dd5532..773d737f06a 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/kt2288.kt @@ -1,5 +1,5 @@ // TODO: Enable when JS backend supports Java class library -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE public open class Test(): java.util.RandomAccess, Cloneable, java.io.Serializable { public override fun clone(): Test = Test() // Override 'clone()' with more precise type 'Test' diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt508.kt b/backend.native/tests/external/codegen/blackbox/classes/kt508.kt index d26dfafd6c0..29d4283a7be 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/kt508.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/kt508.kt @@ -1,5 +1,5 @@ // TODO: Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // fails on JS with TypeError: imported$plus is not a function, it is undefined. operator fun MutableMap.set(key : K, value : V) = put(key, value) diff --git a/backend.native/tests/external/codegen/blackbox/classes/kt707.kt b/backend.native/tests/external/codegen/blackbox/classes/kt707.kt index 8accf81be9a..a1cb2833e5d 100644 --- a/backend.native/tests/external/codegen/blackbox/classes/kt707.kt +++ b/backend.native/tests/external/codegen/blackbox/classes/kt707.kt @@ -1,5 +1,5 @@ // TODO: Enable for JS when it supports Java class library. -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class List(val head: T, val tail: List? = null) fun List.mapHead(f: (T)-> T): List = List(f(head), null) diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt index b0dd8df8d31..cc50b43b4a2 100644 --- a/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt +++ b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel1.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package test diff --git a/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt index 2f161ffc47c..145e9c41fca 100644 --- a/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt +++ b/backend.native/tests/external/codegen/blackbox/closures/closureOnTopLevel2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE val p = { "OK" }() diff --git a/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt b/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt index 84b5b7ddea8..366bfc3f5cc 100644 --- a/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt +++ b/backend.native/tests/external/codegen/blackbox/closures/noRefToOuter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt index cb7912f6b6d..ebabbd76ec2 100644 --- a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequence.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt index 61c67c7cf22..83900da8bf0 100644 --- a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplCharSequenceKotlin.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt index c697f96206a..d99b4ea8ec1 100644 --- a/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt +++ b/backend.native/tests/external/codegen/blackbox/collections/irrelevantImplMutableListKotlin.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: A.java diff --git a/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt b/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt index be1c06ad236..c884c5cdeb3 100644 --- a/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt +++ b/backend.native/tests/external/codegen/blackbox/collections/noStubsInJavaSuperClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: B.java public abstract class B extends A implements L { diff --git a/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt b/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt index 2f4e6f41896..ac984435cda 100644 --- a/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt +++ b/backend.native/tests/external/codegen/blackbox/collections/toArrayInJavaClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: B.java diff --git a/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt b/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt index 0073c9670b5..e600cc309c1 100644 --- a/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt +++ b/backend.native/tests/external/codegen/blackbox/constants/kt9532.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE object A { const val a: String = "$" diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt index af81659efc5..4890505afd0 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/breakContinueInExpressions/breakFromOuter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { OUTER@while (true) { diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt index bfc79302ec1..e5a78d84cde 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionNext.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class It { var hasNext = true diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt index cd714a0de1f..6dfbdbd00d7 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/forUserType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box() : String { var sum : Int = 0 diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt index d236a3f9ff9..dbf2075ffe8 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt237.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun main(args: Array?) { val y: Unit = Unit //do not compile diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt index 9efb57c0b2b..3b2fb00695b 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt3574.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun nil() = null diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt index c565d684ab1..af1d3682358 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt769.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package w_range diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt index 9b2c97df507..39a1846ee54 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A(var value: String) diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt index 6815b647c67..916af6bc06c 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_break.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A(var value: String) diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt index 780bab67ce5..2cf60fb734e 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt8148_continue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A(var value: String) diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt index 99f0849c513..66ccf4bdadf 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Return.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun testOr(b: Boolean): Boolean { return b || return !b; diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt index f7ee695a931..adb3fab9356 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/kt9022Throw.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { var cycle = true; diff --git a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt index 645de5f06e1..99d56fa995f 100644 --- a/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt +++ b/backend.native/tests/external/codegen/blackbox/controlStructures/tryCatchInExpressions/differentTypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(b: Byte, s: String, i: Int, d: Double, li: Long): String = "$b $s $i $d $li" diff --git a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt index f0d6919046e..965a1f6db93 100644 --- a/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt +++ b/backend.native/tests/external/codegen/blackbox/coroutines/unitTypeReturn/suspendNonLocalReturn.kt @@ -1,6 +1,6 @@ // WITH_RUNTIME // WITH_COROUTINES -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import kotlin.coroutines.* var result = "0" diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt index 7c4f6be1a75..50a6d8e2755 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/doubleParam.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE val NAN = Double.NaN diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt index 9727d31a9ba..8fc5ee1e118 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/equals/alreadyDeclaredWrongSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt index aaa8f2b5e2f..f6e2224ba71 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/floatParam.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE val NAN = Float.NaN diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt index 612e0df4fbb..254e1b93220 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/alreadyDeclaredWrongSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt index e001c48a2a6..083fde96ce0 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/hashCode/array.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class A(val a: IntArray, var b: Array) diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt index 763ddc8909c..d624ca5b93c 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/kt5002.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.io.Serializable diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt index d8521815442..e343bb06260 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/alreadyDeclaredWrongSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt index c195530bf54..9292bc9341b 100644 --- a/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt +++ b/backend.native/tests/external/codegen/blackbox/dataClasses/toString/arrayParams.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class A(val x: Array?, val y: IntArray?) diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt index 51b4d127934..cfd12c58f64 100644 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/checkIfConstructorIsSynthetic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt index f291406389e..ac3eab5136f 100644 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/constructor/manyArgs.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt b/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt index 0d939974c2a..918a68ed0d8 100644 --- a/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt +++ b/backend.native/tests/external/codegen/blackbox/defaultArguments/superCallCheck.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt index 68784f3f8fb..24c0e05c6c2 100644 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/privateSetterKPropertyIsNotMutable.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt index b1c8e42f488..e6a328dd6a8 100644 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/propertyMetadataShouldBeCached.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.util.IdentityHashMap import kotlin.reflect.KProperty diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt index c16dcdc2615..4ed34e5382c 100644 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/provideDelegate/jvmStaticInObject.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import kotlin.test.* diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt index 9f06958fede..6e1dd50372e 100644 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/stackOverflowOnCallFromGetValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt b/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt index 6e614eec0dd..ac69d29fe35 100644 --- a/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/delegatedProperty/useReflectionOnKProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt b/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt index f8ae3d3a78a..4abbca2775a 100644 --- a/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt +++ b/backend.native/tests/external/codegen/blackbox/delegation/delegationToVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt b/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt index f3a6de3c5dc..b82f41487f8 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/classForEnumEntry.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt b/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt index 412cf9a2801..df1c476bfb0 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package test diff --git a/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt b/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt index 8642ed92784..c16ffd7ae3c 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE enum class IssueState { diff --git a/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt b/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt index f9b1f65dad3..180aaf96346 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/modifierFlags.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt b/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt index 2821b7cf1a1..03384f24b5b 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/noClassForSimpleEnum.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/char.kt b/backend.native/tests/external/codegen/blackbox/evaluate/char.kt index de1f18f18e2..06d5b9d24d7 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/char.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/char.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt b/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt index 3a8bdf88bbc..38dcc8cb811 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/divide.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt b/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt index e754ece6e3e..44599301319 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/intrinsics.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt b/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt index af59932d9a0..a1f919bb03f 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/maxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt index 18c097da59c..82cd51d0364 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueByte.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt index 333f5cb2156..177fd8cb2c8 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/maxValueInt.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt index 1adaea6b353..d0892dadd08 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/minus.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt b/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt index 50598ecd1f0..dbfe458a3ce 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/mod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt b/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt index 530fa00d3b5..8dfd50cd2d2 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/multiply.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt b/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt index 5bdbdd66d8f..417358d64e0 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/parenthesized.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt index 09cea81112c..622a3728343 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/plus.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt b/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt index 4f50749291f..b141e7002cb 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/simpleCallBinary.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt index 8390883c3e4..7d3e5bdcaed 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/unaryMinus.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt b/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt index f2cfb2ea80e..2ab595d7f83 100644 --- a/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt +++ b/backend.native/tests/external/codegen/blackbox/evaluate/unaryPlus.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt index c1ddef88264..119436fa248 100644 --- a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt3646.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun test(cl: Int.() -> Int):Int = 11.cl() diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt index 3596dfd5378..c2199521e9e 100644 --- a/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/kt606.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package kt606 diff --git a/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt b/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt index 80f001027b1..2439ddcc2b9 100644 --- a/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt +++ b/backend.native/tests/external/codegen/blackbox/extensionFunctions/whenFail.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun StringBuilder.takeFirst(): Char { if (this.length == 0) return 0.toChar() diff --git a/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt index 3b76322ec67..3f338755bd8 100644 --- a/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt +++ b/backend.native/tests/external/codegen/blackbox/extensionProperties/genericValMultipleUpperBounds.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.io.Serializable diff --git a/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt index 3e9f2809d2a..6fbc3f124df 100644 --- a/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt +++ b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt index e29f625e0f9..125d7eb8ed2 100644 --- a/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt +++ b/backend.native/tests/external/codegen/blackbox/external/jvmStaticExternalPrivate.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt b/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt index 7d2baed13fd..5cda0c9c789 100644 --- a/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt +++ b/backend.native/tests/external/codegen/blackbox/external/withDefaultArg.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt index 2a08c9eff57..56140cace52 100644 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/nativePropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt index 08679b45376..94b2a5e8e52 100644 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/simpleNative.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt index 2a168c7d954..aa675eef76c 100644 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/native/topLevel.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt index 78b256c5c95..aceeec091bb 100644 --- a/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt +++ b/backend.native/tests/external/codegen/blackbox/fullJdk/regressions/kt1770.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt b/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt index 5fc534c6a91..4d3c84e1085 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/dataLocalVariable.kt @@ -1,5 +1,5 @@ // TODO: Enable when JS backend gets support of Java class library -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun ok(b: Boolean) = if (b) "OK" else "Fail" fun box(): String { diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt b/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt index 543a11e2632..f8c9317abcd 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/functionNtoString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt index 42b51515588..0b31b944bf8 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringGeneric.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt index 8788a8c350c..86b6223c050 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/functionNtoStringNoReflect.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun check(expected: String, obj: Any?) { val actual = obj.toString() diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt index aa27b96d877..34e0860840b 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/castFunctionToExtension.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val f = fun (s: String): String = s diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt index 5c28b925d97..f96125385a1 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/invokeOnSyntheticProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt index e5191fff338..5932544102d 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3190.kt @@ -1,5 +1,5 @@ //KT-3190 Compiler crash if function called 'invoke' calls a closure -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // JS backend does not allow to implement Function{N} interfaces fun box(): String { diff --git a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt index 7d8bb7ef55c..531f9f79450 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/invoke/kt3822invokeOnThis.kt @@ -1,5 +1,5 @@ //KT-3822 Compiler crashes when use invoke convention with `this` in class which extends Function0 -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // JS backend does not allow to implement Function{N} interfaces class B() : Function0 { diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt index 8db9c5299b9..6560f431d58 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1199.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface MyIterator { diff --git a/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt b/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt index ee3811c3548..a990645b61a 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/kt1739.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE public class RunnableFunctionWrapper(val f : () -> Unit) : Runnable { public override fun run() { diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt index 22c5f2595ec..27e83c06c12 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4777.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE var result = "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt index d42b8a0b6b0..87767469738 100644 --- a/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt +++ b/backend.native/tests/external/codegen/blackbox/functions/localFunctions/kt4989.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class It(val id: String) diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt index 0cabc78122d..a7061b676d1 100644 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/empty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt index 14e802cfbaf..21efec77fa0 100644 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/manyNumbers.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt index 9d7cc805597..741a3024365 100644 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithDifferent.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt index cd530ba7d6b..eb3642c5422 100644 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/rewriteWithEqual.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt index 737e202ed45..81a2aaceb34 100644 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusGet.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt index ce5d691c41b..2830c5d3122 100644 --- a/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt +++ b/backend.native/tests/external/codegen/blackbox/hashPMap/simplePlusMinus.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt b/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt index a4298207118..4f941c7fcb6 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/comparableTypeCast.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { if ((-0.0 as Comparable) >= 0.0) return "fail 0" if ((-0.0F as Comparable) >= 0.0F) return "fail 1" diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt b/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt index 415c6814408..d4b647a1522 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/dataClass.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class Test(val z1: Double, val z2: Double?) fun box(): String { diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt b/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt index 40409e20e4c..cfb9877257a 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/explicitCompareCall.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun less1(a: Double, b: Double) = a.compareTo(b) == -1 fun less2(a: Double?, b: Double?) = a!!.compareTo(b!!) == -1 diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt b/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt index 4a6f495d576..d9003f38af2 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/explicitEqualsCall.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun equals1(a: Double, b: Double) = a.equals(b) diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt b/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt index 58a844412bc..8238f6242ac 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/inline.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE inline fun less(a: Comparable, b: Double): Boolean { return a < b diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt b/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt index 06160ead6c5..4c30f69761b 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/safeCall.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val plusZero: Double? = 0.0 val minusZero: Double = -0.0 diff --git a/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt b/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt index e3a06426db3..98b087e66e0 100644 --- a/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt +++ b/backend.native/tests/external/codegen/blackbox/ieee754/smartCastToDifferentTypes.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val zero: Any = 0.0 val floatZero: Any = -0.0F diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt index 66c9787e1d5..93684dbed0d 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/defaultObjectMapping.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt index 93723cd3ebe..0977be5cb27 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt index d6dab66f544..47eb9d0c65d 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt10131a.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt index 07d3a22902f..e83cc48c5c3 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/kt5937.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt index cda62bbc05f..bd9e5c754f1 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/throwable.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val s: String? = "OK" diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt index a16dd9ea5a2..90f3105d6d2 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableCallableReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import kotlin.reflect.KFunction2 import kotlin.reflect.KFunction1 diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt index 04ce96e10ae..351f483c5c6 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/throwableParamOrder.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE var res = "" diff --git a/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt b/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt index 27f9f1a11a0..4e40b40c9b1 100644 --- a/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt +++ b/backend.native/tests/external/codegen/blackbox/intrinsics/tostring.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { if (239.toByte().toString() != (239.toByte() as Byte?).toString()) return "byte failed" diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt index 94a095f4ca6..5cba4e58400 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/allWildcardsOnClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt index 649b6570102..fb068efe1dc 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/covariantOverrideWithDeclarationSiteProjection.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt index e0afa4a629c..56b2c68c129 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/generics/invariantArgumentsNoWildcard.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt index 4b1bab613c4..8c3764889d3 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/lambdaInstanceOf.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt index 070e7d9859c..344982316f4 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/notNullAssertions/extensionReceiverParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt index 4291d2aadc7..6780c6842f8 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class A(var x: Int) : Cloneable { public override fun clone(): A = A(x) diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt index f55312285c7..1c2faac7156 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuper.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class A(var x: Int) : Cloneable { public override fun clone(): A = super.clone() as A diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt index da7a8ffbfbf..5671e47cb2b 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneCallsSuperAndModifies.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class A(var x: Int) : Cloneable { public override fun clone(): A { diff --git a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt index c8ee5af7a71..f15c2078344 100644 --- a/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt +++ b/backend.native/tests/external/codegen/blackbox/javaInterop/objectMethods/cloneableClassWithoutClone.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE data class A(val s: String) : Cloneable { fun externalClone(): A = clone() as A diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt b/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt index fe51488d07a..be741722d3c 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/captureClassFields.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt b/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt index ce336100876..17d926d01f8 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/capturePackageFields.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt b/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt index b560f9b1a9b..c171a31d0b4 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/checkNoAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt index b606ba10089..9a988fb6917 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt index 912ce6a6d34..40afbaf376d 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/classFieldReflection.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt b/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt index 2d4740950c8..66d5f918c98 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/constructorProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt b/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt index 7b7c0929e52..ae82c73bf6c 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/publicField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt b/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt index 89fbbbcf73f..1adf5cf3d1e 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/simpleMemberProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt b/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt index f254d7ce6c9..e40059bd228 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/superCall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt b/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt index e424074ca45..184cd974061 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/superCall2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt index bf7521718ba..2977f5ec59f 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt index 731f7049236..c6edb440ee0 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/topLevelFieldReflection.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt b/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt index 11f47596037..7313703b023 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/visibility.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt b/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt index 77a38072cb8..651cccee665 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmField/writeFieldReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt b/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt index 9c315bae926..c53653a6686 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/callableReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt b/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt index 74234f87391..7605893e6b3 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/clashingErasure.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt b/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt index 5503a586e42..924e913db4b 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/classMembers.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // See: diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt index e174ddeaf27..cb01a158914 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fakeJvmNameInJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: FakePlatformName.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt index 556e261147a..2c8052a7515 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/differentFiles.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Baz.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt index a245616bec7..1129e381e0c 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/javaAnnotationOnFileFacade.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: StringHolder.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt index fcc261b3912..b13c563bb7e 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/fileFacades/simple.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Bar.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt b/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt index a8d040d104c..931c86664a2 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/functionName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt index 43e1c9e3b28..166e221662c 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt index 2ce0fe101a2..bab369e1ca6 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt index 4438b665563..1bed0ec5cc0 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/multifileClassWithLocalGeneric.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt b/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt index a47adf26e69..18f7752943b 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/propertyAccessorsUseSite.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt b/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt index 2aa47694759..a0285a5ac09 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/propertyName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt b/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt index 2c2dfd58d11..d40e19ee331 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmName/renamedFileClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt index cf703761cf0..842a2deff08 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/companionObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt index a62e537a2b9..b5643b1daab 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/defaultsNotAtEnd.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt index 3ff238d0cd1..7544f76c9f1 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/doubleParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt index 0aae67954a3..14c8658c299 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/extensionMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt index 09ebb5a0393..88f6cc90649 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/generics.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt index 91a9b505ce7..22e736d4d58 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/innerClass.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt index 98cfcee8cb9..6d3c1f720e6 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/multipleDefaultParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt index ab05e21ca6c..11f3d564674 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/nonDefaultParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt index d045299c61d..cc74a22f3bd 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/primaryConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt index cb324957d9a..2c473204597 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/privateClass.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt index c07b24be0a6..28461330abb 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/secondaryConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt index 6923ae42615..b11dc787dd7 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simple.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt index 8cc52c85c91..cf7edad65ac 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/simpleJavaCall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt b/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt index 38ad4a6fec7..1ca99e71284 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmOverloads/varargs.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt index 96b60efbbcb..3fe90d7a0e2 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/annotations.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt index 35396139dc0..05998f701a7 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/closure.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt index e0ecfa7107a..d5bd0c41445 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/companionObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt index 4e04db4e5f9..f586013cf39 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/convention.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt index b89aae3f56f..3e2b82f62a7 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/default.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt index 13b63e6c492..9c635ea32f8 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/enumCompanion.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt index e9608a14a81..641dfc80e98 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/explicitObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt index 00e8b82009f..7601d2da506 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/funAccess.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt index 3bceee477eb..7311331ef0f 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/importStaticMemberFromObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt index 59612f27bd9..4977ac1fdca 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/inline.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt index 899dbd7a5ba..b4c219999f6 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/inlinePropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt index c8b4b060d4d..a3ca2723748 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/kt9897_static.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt index 59765168dba..98ce03c845a 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/object.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt index fb3f7f80d7f..202cd0b0d06 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/postfixInc.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt index 49c8691a0ed..f81a1467b48 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/prefixInc.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt index a1368cbe344..a993a425f4a 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt index 9ffb0728200..50c6d83a13e 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/privateSetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt index 2c993d1070a..3ccb556b423 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccess.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt index a086272c31a..9ce9cd9e1fb 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsCompanion.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt index 29ba5a9ce4d..6e3df7272ed 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAccessorsObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt index 36f323850ea..123d32ff19d 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/propertyAsDefault.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt index 62123966275..535955271a5 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/simple.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt b/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt index b43ac7ecd6d..76e27b7f63f 100644 --- a/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt +++ b/backend.native/tests/external/codegen/blackbox/jvmStatic/syntheticAccessor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/mangling/field.kt b/backend.native/tests/external/codegen/blackbox/mangling/field.kt index 389a0e00412..d4805116073 100644 --- a/backend.native/tests/external/codegen/blackbox/mangling/field.kt +++ b/backend.native/tests/external/codegen/blackbox/mangling/field.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/mangling/fun.kt b/backend.native/tests/external/codegen/blackbox/mangling/fun.kt index a60718ec110..648f8620f80 100644 --- a/backend.native/tests/external/codegen/blackbox/mangling/fun.kt +++ b/backend.native/tests/external/codegen/blackbox/mangling/fun.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt b/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt index a4c370be34f..0e5a23013c9 100644 --- a/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt +++ b/backend.native/tests/external/codegen/blackbox/mangling/noOverrideWithJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt index 15f84a670f7..7cd4b20c224 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/callMultifileClassMemberFromOtherPackage.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: box.kt diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt index b3a4e722da9..ab7a0ca4c7b 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/callsToMultifileClassFromOtherPackage.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1.kt diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt index 8321c2fa48e..42325c35b6b 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/constPropertyReferenceFromMultifileClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: 1.kt diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt index f73279c3667..9c4f2986c24 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/inlineMultifileClassMemberFromOtherPackage.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: box.kt diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt index 100835833e6..9330fc66d66 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassPartsInitialization.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: box.kt diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt index 91f6d1df1d5..0f37394e747 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWith2Files.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Baz.java diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt index d94dcffa63e..97c9fc9e7c5 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithCrossCall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Baz.java diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt index 13257d5f58b..2031d15fa4e 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/multifileClassWithPrivate.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Baz.java diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt index 0d13be7ca55..02986a391d6 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToFun.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt index ca6fc4d1684..5dcf224f877 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToInternalValInline.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt index 7a27fc8cdb0..90d6548b41a 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToPrivateVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt index aaa7a4166d6..957059f5e0c 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/callableRefToVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt index bdee592eae1..3aa873305fe 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/calls.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt index b629685d651..f337388e48f 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/deferredStaticInitialization.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt index 4027459bad3..c5f8e05ae05 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/delegatedVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt index c3a023375e5..3e6fc5d5367 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePrivateVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt index c8107509fde..4eea8f704f6 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/initializePublicVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt index 3d163158d70..8c37f0c014c 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingFuns.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt index dfd668b8539..40a4f14a0c4 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/overlappingVals.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt index d580bddf00a..4720dcc5287 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlineFunCalledFromJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt index 27d37a53101..8946cb730ba 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valAccessFromInlinedToDifferentPackage.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt index 7560746a303..8be860d7253 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/optimized/valWithAccessor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: +JVM.INHERIT_MULTIFILE_PARTS diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt index 3915ab9f80c..141fdc945f5 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/privateConstVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: foo.kt diff --git a/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt b/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt index 21d03a144af..73abfb3602b 100644 --- a/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt +++ b/backend.native/tests/external/codegen/blackbox/multifileClasses/samePartNameDifferentFacades.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1/part.kt diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt index cf3088cc0dc..4c6934a5ebf 100644 --- a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/use.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt index 531a91db81f..f3bb63dc008 100644 --- a/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt +++ b/backend.native/tests/external/codegen/blackbox/nonLocalReturns/useWithException.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt index b4885512f5e..cc10922307f 100644 --- a/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1047.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE public open class Test() { open public fun test() : Unit { diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt b/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt index 933f3aef48c..583cac8e39d 100644 --- a/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt +++ b/backend.native/tests/external/codegen/blackbox/objects/kt1737.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { return object { diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt b/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt index 041a1970cb9..01007832059 100644 --- a/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt +++ b/backend.native/tests/external/codegen/blackbox/objects/kt2663_2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box() : String { var a = 1 diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt b/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt index 1e2c249fd67..b1adf30137b 100644 --- a/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt +++ b/backend.native/tests/external/codegen/blackbox/objects/kt3238.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE object Obj { class Inner() { diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt535.kt b/backend.native/tests/external/codegen/blackbox/objects/kt535.kt index 5b5a9c22168..3821753c731 100644 --- a/backend.native/tests/external/codegen/blackbox/objects/kt535.kt +++ b/backend.native/tests/external/codegen/blackbox/objects/kt535.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class Identifier(t : T?, myHasDollar : Boolean) { private val myT : T? diff --git a/backend.native/tests/external/codegen/blackbox/objects/kt560.kt b/backend.native/tests/external/codegen/blackbox/objects/kt560.kt index 74599a372ae..a641c825feb 100644 --- a/backend.native/tests/external/codegen/blackbox/objects/kt560.kt +++ b/backend.native/tests/external/codegen/blackbox/objects/kt560.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package while_bug_1 diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt index a8a367c3354..3e347de0eef 100644 --- a/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/compareTo/boolean.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun checkLess(x: Boolean, y: Boolean) = when { x >= y -> "Fail $x >= $y" diff --git a/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt index ece3a7822ba..a95cdb8b491 100644 --- a/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt +++ b/backend.native/tests/external/codegen/blackbox/operatorConventions/kt4987.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { operator fun Int?.inc() = (this ?: 0) + 1 diff --git a/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt b/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt index 86f2ee7c61f..99dc990860d 100644 --- a/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt +++ b/backend.native/tests/external/codegen/blackbox/package/initializationOrder.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String? { val log = System.getProperty("boxtest.log") diff --git a/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt b/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt index b0dfae5ae86..fd15e17ff4d 100644 --- a/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt +++ b/backend.native/tests/external/codegen/blackbox/package/invokespecial.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // KT-2202 Wrong instruction for invoke private setter diff --git a/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt b/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt index f6fb183f274..b4cf8c0b19b 100644 --- a/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt +++ b/backend.native/tests/external/codegen/blackbox/package/mainInFiles.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1.kt diff --git a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt index e47f119d4ef..495dace669b 100644 --- a/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt +++ b/backend.native/tests/external/codegen/blackbox/platformTypes/primitives/identityEquals.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val l = java.util.ArrayList() diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt index 46a6fed2e53..2f1186ca3bf 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/comparisonWithNaN.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // This test checks that our bytecode is consistent with javac bytecode diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt index 732c92f87ab..41c93f54971 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt243.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box() : String { val t = java.lang.String.copyValueOf(java.lang.String("s").toCharArray()) diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt index 8f2247c860f..5441850af87 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt684.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun escapeChar(c : Char) : String? = when (c) { '\\' -> "\\\\" diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt index 272785c4b6f..a62581eefb7 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt752.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package demo_range diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt index 834c75863cc..f66201f9927 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt753.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package bitwise_demo diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt index b23412aba94..6d65494990b 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt756.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package demo_range diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt index 0e546d0a21d..39bc99d7d8f 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt757.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package demo_long diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt index 20643927da8..92674333923 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/kt935.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE package bottles diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt index 793b5d22f11..faefeadd942 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/number.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: FortyTwoExtractor.java diff --git a/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt b/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt index 2d708f05c2d..6b32d00e18e 100644 --- a/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt +++ b/backend.native/tests/external/codegen/blackbox/primitiveTypes/substituteIntForGeneric.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class L(var a: T) {} diff --git a/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt b/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt index 94aec529b5e..5b00a7166da 100644 --- a/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt +++ b/backend.native/tests/external/codegen/blackbox/privateConstructors/synthetic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt b/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt index 881f5eae288..adffd830622 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/accessToPrivateSetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class D { var foo = 1 diff --git a/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt b/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt index aeabb33ec7a..6a296b7fd69 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/collectionSize.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt b/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt index ed6b0fff889..264d2ffbdfc 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/commonPropertiesKJK.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt b/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt index 5b6d2431ba0..85f734aa294 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/companionObjectAccessor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt b/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt index e70f5eb112c..6ae3b092564 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/companionObjectPropertiesFromJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt b/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt index 79a9bcacf1e..a031c4d0341 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/const/constFlags.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt b/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt index dd04bc2736e..f02f2bd6ca7 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/const/constValInAnnotationDefault.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt b/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt index 1f9f1e9d830..afa9670a227 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/const/interfaceCompanion.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt index 71177571d18..88f00bb32e3 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedGetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt index c746a8a07e2..35dca43aa8d 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/javaPropertyBoxedSetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt index 20a19efbd94..66b07250a72 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1159.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE public object RefreshQueue { diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt b/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt index 457f2f6d0fd..8d27165bb25 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/kt12200.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE //WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt index 493728dd71f..b3b3f69c1ca 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1398.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE open class Base(val bar: String) diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt index d74107dd2b0..5ea5c172005 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1482_2279.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE abstract class ClassValAbstract { abstract var a: Int diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt b/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt index 851b0c61429..9425908610e 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/kt1714.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface A { val method : (() -> Unit )? diff --git a/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt b/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt index 4b26b927544..fb6d0a2465f 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/kt4383.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import kotlin.reflect.KProperty diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt index eb0db631364..d8022a1a2e9 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/accessorException.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE public class A { diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt index 0c8a8eafe47..7f334665513 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A { private lateinit var str: String diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt index ca12a2442db..256d16b48fa 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/exceptionGetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A { public lateinit var str: String diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt index 9b9ce777d53..8a5f29fcff5 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/overrideException.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface Intf { val str: String diff --git a/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt b/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt index 5408bc46913..e2ae4d9dc1e 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/lateinit/visibility.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt index bfda7a40b04..deec2e94003 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaFieldInInline.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt index f03b492759c..356a55f75d0 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: JavaBaseClass.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt index 81efe8b5294..242ce0f8006 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/protectedJavaPropertyInCompanion.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: JavaBaseClass.java diff --git a/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt b/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt index b9ddfd8776d..03c3ff2b6cf 100644 --- a/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt +++ b/backend.native/tests/external/codegen/blackbox/properties/substituteJavaSuperField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt b/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt index bc4b0b5a388..deeb37b9064 100644 --- a/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt +++ b/backend.native/tests/external/codegen/blackbox/publishedApi/noMangling.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE //WITH_REFLECT class A { @PublishedApi diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt index 71b784e107f..9f3c461c773 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inComparableRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt index 53a4b73663e..b216292520a 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inExtensionRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt index 59a939acf24..cf82a3033c8 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inIntRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt index f7aa5bf5729..049667b8d18 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableDoubleRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt index 8b21a83ad34..c58a00c6b20 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableFloatRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt index 9f4a914c9d1..969571dcafb 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableIntRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt index 8bf77137b1a..61e9bf4c898 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inOptimizableLongRange.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt index 277550e0034..0071b2d423a 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithCustomContains.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt index 8c39def7709..d5bb738d866 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithImplicitReceiver.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt index 0b8e25beb45..23219eac00f 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithNonmatchingArguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt index 46c3a39bbc7..1c314ffa31f 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/contains/inRangeWithSmartCast.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt index 1f559bd7c76..e0fd14c2983 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactDownToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt index 76cd7241cbf..74712e4df72 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/inexactToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt index a521436c2c4..0cc89f13224 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueMinusTwoToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt index a9189c72494..c60b83b3d93 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt index 43002d06489..d7e7f98a24a 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/maxValueToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt index 4540e7fe94f..20ef6402572 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionDownToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt index d0476a557a1..cd579903938 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueMinusTwoToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt index 47264e0a172..691b83d6f48 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt index 6e876bf9329..1083ef991a2 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMaxValueToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt index 86ee02ba72c..c85495c3743 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/expression/progressionMinValueToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt index 59eef6ee1e6..0f73b57e33c 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/forInIndices/kt13241_Array.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt index 558a57f9399..a66daa50878 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactDownToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt index dfa5ea20c32..a55c76920aa 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/inexactToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt index ce83c868428..1c76fabe3cc 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueMinusTwoToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt index 90ccadc9f38..cdedbbb8c7b 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt index 251774b7a0d..2439eab980c 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/maxValueToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt index 8ce7d3333df..fccb2044c9f 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionDownToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt index d04d79446d7..7c81034ef7a 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueMinusTwoToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt index c8ad40c7bd1..4c4555326fc 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMaxValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt index 0ed56310b44..cd29a83cb6f 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMaxValueToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt index 24afb460106..f0b5a5a9041 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/literal/progressionMinValueToMinValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // Auto-generated by org.jetbrains.kotlin.generators.tests.GenerateRangesCodegenTestData. DO NOT EDIT! // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt b/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt index 0d277d3c2bb..e1eb200a582 100644 --- a/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt +++ b/backend.native/tests/external/codegen/blackbox/ranges/safeCallRangeTo.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt index 27885b8bc64..c92c6a0cdd0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationRetentionAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt index dafe25a022e..70c1720d4fc 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/annotationsOnJavaMembers.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt index 38db10486b4..b008bd65937 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/findAnnotation.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT import kotlin.reflect.findAnnotation diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt index 3b4047a9349..6817dd64513 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt index 1e78aaadbe2..3a072a5d11e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/propertyWithoutBackingField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt index 9d3a3b87c6e..200c0e1aef0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/retentions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt index ab2f65bab77..5da18e3627b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleClassAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt index 70e1e19e147..2d7a036b18c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleConstructorAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt index 7eabe205f37..041cc3f2e6f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleFunAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt index c5e6cd2fe47..1d45a826b86 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleParamAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt index 0913732168a..216ba88b987 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/annotations/simpleValAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt index 7bc2f35ee6f..d3fe286da02 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/companionObjectPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt index 85043fc9d64..cd0c53f8123 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionFunction.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt index 233f9b5b37f..449d73d064b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/extensionPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt index 69f0e53c2a5..c84e7893a23 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/innerClassConstructor.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt index 19212abf35a..9078fc60f7b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceField.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt index 0742577fcc4..062ef47a0d1 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/javaInstanceMethod.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt index dd7311f95f4..aacb455eeaf 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticCompanionObjectPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt index 1169f50791e..ba51aa848b6 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectFunction.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt index 3c6e3854f1c..9f06a8cb7fa 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/jvmStaticObjectPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt index 34f6aa7ecb1..08854e132cf 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberFunction.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt index 0502c2a573d..7b1d165061e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/memberPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt index 81195ecda26..ba2c7788999 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectFunction.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt index 2fb29097eb6..89062735df3 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/bound/objectPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt index 8f87d022f96..8227fee6f6a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/callInstanceJavaMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt index 9d585af73b1..1d2c454b234 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/callPrivateJavaMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt index 302c20d1c9a..db9248b3f9a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/callStaticJavaMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt index 6db9e7b6249..16d57842386 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/cannotCallEnumConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt index 36f3ce642e8..3463a49c85a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/disallowNullValueForNotNullField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt index 21908f9318b..9885d12c3c0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/equalsHashCodeToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt index 17e9d699a59..3cd7d8f73fe 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/exceptionHappened.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt index 5b881d33612..39210c68142 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverride.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt index 50047c43a7f..d98c38cd636 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/fakeOverrideSubstituted.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt index 956544ac4cb..e08b3df5305 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/incorrectNumberOfArguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt index 7b13dcfb2ee..60aca8cd5cd 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/innerClassConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt index 16d438bf1e8..94ea4ffcf51 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStatic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt index f94ce085bf1..34802763740 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/jvmStaticInObjectIncorrectReceiver.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt index 494c79c6f0c..3651f0ed3d9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/localClassMember.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt index 82fd1e055ef..e01db003dc0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/memberOfGenericClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt index 1ee9c138de4..f53b15d43d2 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/privateProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt index 587a262a1c6..3fd5a3d25e0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt index e9aca58f108..3e8a009e650 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/propertyGetterAndGetFunctionDifferentReturnType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt index 0869650c488..d7bc48f26c0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/returnUnit.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt index 108e38c15b6..6a71248b113 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt index f1db9dfba04..52edb5a0b8e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleMemberFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt index dcd5328fef7..ea29b5e704d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/call/simpleTopLevelFunctions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt index 0632f21ab4e..906dcb9d4fb 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt index a6933bfecca..1cd1409ca0d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundExtensionPropertyAcessor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt index 406b38ba1b2..47ffa196b2c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/boundJvmStaticInObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt index ced45716d15..5f7e2e56051 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/companionObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt index 8b3aa1902cd..c75b0793f1b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/defaultAndNonDefaultIntertwined.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt index b37767f9bd2..b444a3c9358 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/extensionFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt index 3c726db6a38..f4c70d27d38 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInCompanionObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt index 5b771b80caf..83a1120e2c8 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/jvmStaticInObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt index 978877391e9..8f9a92519fd 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyArgumentsOnlyOneDefault.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt index 16d765e8675..002da4ac148 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/manyMaskArguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt index 028454b5880..fb25dac5f87 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nonDefaultParameterOmitted.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt index 386a6a768f9..289b8a26de6 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/nullValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt index c80f255e52c..71468dcc19f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/ordinaryMethodIsInvokedWhenNoDefaultValuesAreUsed.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt index a566381fe8b..9e1ba89d17d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/primitiveDefaultValues.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt index c2d4593dca2..5c089543230 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/privateMemberFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt index d77a5fed678..e8739d2b0ec 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt index fdd597bb629..afef083b80a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleMemberFunciton.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt index 6cbadf84891..4d7e1bab754 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/callBy/simpleTopLevelFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt index e3f7bdd7b72..28d5dd9a046 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/annotationClassLiteral.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt index 9f9e4546d62..89f972009a0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/arrays.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt index 3189b534969..84579d3b5e2 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/builtinClassLiterals.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt index 8433e8ff36f..60ad96ec239 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/genericArrays.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt index 155e6db10d9..634efba9520 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classLiterals/reifiedTypeClassLiteral.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt index b033ae9d1d2..fc355592cfa 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/classSimpleName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt index 9f599996241..a3f3b46210f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/companionObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt index eb9735b9859..439de318d50 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/createInstance.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt index b28ab68a537..5902aafbae9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/declaredMembers.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: I.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt index 6ad4e01ba7b..36f86129b84 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/jvmName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt index 21cd7aaefbc..ee73af820f8 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClasses.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt index f7fde340961..1758075a74b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/nestedClassesJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt index e9dedfaab85..91b4da09e92 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/objectInstance.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt index ebc3db577b0..23f86775d68 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/primitiveKClassEquality.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt index 6e978c95b79..824214142a5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/qualifiedName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt b/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt index 7be7d8ba0ec..2acc65853e5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/classes/starProjectedType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt index 963635d96ad..2975eaefe18 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/annotationClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt index ebc2986aeba..5f78791ff90 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/classesWithoutConstructors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt index fcb9d9cd6a7..2b1ddf08566 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/constructorName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt index a9eea1ba51a..2647d082f2c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/primaryConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt b/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt index 5616aa8136a..0d50c329b73 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/constructors/simpleGetConstructors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt index 199834e9c70..ca87362f349 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/annotationType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt index 054ea5fc4cf..b4f2c301ffd 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/arrayOfKClasses.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt index 3f0259d7088..e1410183b37 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt index f1c1934d25b..7b2db38d382 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callByKotlin.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt index 5959c1e2402..48adf7d623c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt index b4c197f4abd..d89d316c6a6 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/callKotlin.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt index 829b85ef26d..14441c3449b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/createJdkAnnotationInstance.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt index a5c565c813d..7dcb9223716 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/enumKClassAnnotation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt index 3a12d56a3e4..7ffbee7dfb3 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/equalsHashCodeToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt index 75065734926..a3fff2faa64 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/floatingPointParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt index e47eca36fb8..3058ac7238b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/parameterNamedEquals.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt index 89ece702c25..b33fcee14a2 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/createAnnotation/primitivesAndArrays.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt index b39fb848952..c94bfe8536b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/anonymousObjectInInlinedLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt index 847f8f8c162..aebe9683946 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/classInLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt index d296111afad..78fe21efa72 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/functionExpressionInProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt index 420b28cedc5..25c55218a4f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt11969.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface Z { private fun privateFun() = { "OK" } diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt index 8bf1ff75098..8d98e81d56c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6368.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt index 9be072952c5..a7192acd479 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/kt6691_lambdaInSamConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt index 45a65f1c08f..1fd22c3f3a0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInClassObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt index 509a098c7ab..9743cdf3e41 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt index 4c5c1d9d73c..f04e3e95611 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt index 2a459cd7720..b6fb1f42c0f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt index e28bc3c45b0..1a38dfda515 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt index f4c4c0c3039..78aa1870a79 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalClassSuperCall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt index 586ecced0fc..04109f92754 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInLocalFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt index 192c1feed1c..91d1cee05d2 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt index acfbc2d5594..883f10ba9a8 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt index 49eb272c040..caa749c8d3a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInMemberFunctionInNestedClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt index 3aa459e32b1..de061c4090a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectDeclaration.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt index 87c3aa5e21c..16dd43b0f6f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectExpression.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt index bdced626e98..1d9a7c51dae 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt index 745933c44a1..5997c2f1103 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPackage.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt index e4f9262ebb4..b31664eaa62 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertyGetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt index 622ebcddba1..fc0f7032d01 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/lambdaInPropertySetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt index 7930d5151b6..c89a0eb159f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/localClassInTopLevelFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // KT-4234 diff --git a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt index 98c8628f230..d75d2aff8c8 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/enclosing/objectInLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt index f0ab70f6490..ffac5fb4245 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/declaredVsInheritedFunctions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt index a6200e2c7ef..fa08ad98955 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionFromStdlib.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt index 152bc0ee53a..ec5fbcf7a32 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/functionReferenceErasedToKFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt index 60cdd3f2b01..983a28a487d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/genericOverriddenFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt index 8743a8d55f1..8f8c97a9d59 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/instanceOfFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: FromJava.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt index 28537bf438e..c4ab712c90f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/javaClassGetFunctions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt index 5179459a719..8968a5b1a51 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/platformName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt index 0bdd870b48d..dd5f92d8869 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/privateMemberFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt index 840481d7613..944ad192e54 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleGetFunctions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt index 46ce3d981ad..25b3865ae44 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/functions/simpleNames.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt index e42d6a4e71f..ba746a3107a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/covariantOverride.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt index 38b8c0a9cf9..5a32312795a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/defaultImplsGenericSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt index ff3039e4658..419f423375e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/functionLiteralGenericSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.util.Date diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt index 2ad596b297f..aabad1225b1 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericBackingFieldSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT //test for KT-3722 Write correct generic type information for generated fields diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt index 8cda6593651..14457a3adef 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/genericMethodSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt index 679c4a054b0..5df300b174d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt11121.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt index 50c4b168122..9c8184c2f67 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt5112.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt index da05fc1b2fc..bac5e9c08a8 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/genericSignature/kt6106.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt index 0692b7d19e0..3df1d699d1e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/isInstance/isInstanceCastAndSafeCast.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt index 029e8ddf66a..3656f3780c5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/array.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt index c9fbb1df645..7fd8ce000ef 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/arrayInJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt index e62730f62d2..1b65dbb8618 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt index 22cf93d2986..c44cc614bf0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/basicInJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt index 55b869ca26c..9e10e8386a9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/checkcast.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt index 5db5781f6c1..95cfd6a34ac 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/vararg.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt index d5f37707737..9756184f351 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/kClassInAnnotation/varargInJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt index 86e39ed8e72..f5fe5282c06 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/lambdaClasses/parameterNamesAndNullability.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt index 4d918da5108..dd319ae2ff9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/constructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt index 9a6abd37294..6af2c80d95c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/extensionProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt index 2f6137a493e..77067c44a87 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaFieldGetterSetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // KT-8131 Cannot find backing field in ancestor class via reflection diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt index eeeb80dab83..04a4aab055f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/fakeOverrides/javaMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt index 9a556b2c19f..c74a643244d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/functions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt index b1ca36b546e..09060b1be71 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/inlineReifiedFun.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT import kotlin.reflect.* diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt index f3711f43b47..ea9f9deac27 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/companionObjectFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt index db97b6b6af4..7e9f2408065 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/jvmStatic/objectFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt index 4bd2ad46c9c..8b701470811 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/mappedClassIsEqualToClassLiteral.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt index a1f3b810225..dd2063422df 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/memberProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt index d4d245b0c98..6a6c5002b55 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt index 75aa220c791..6fe9db0471e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/propertyAccessorsWithJvmName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt index 953ce19205b..fc43888da85 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/syntheticFields.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt index 8eba3712688..a7dfc1caab1 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelFunctionOtherFile.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: test.kt diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt index 053e1c0d413..9acdafea053 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/topLevelProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt index 7df0d3bfd6f..9a7d17c593c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/annotationConstructorParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt index 9baa4f9a039..a977b6b1eea 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/array.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt index 80edeaf5228..086b5396745 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/constructors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt index 90302aa85a3..98550ab6684 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/genericArrayElementType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt index 169af37d333..70cd78b671f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/innerGenericTypeArgument.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt index ff249f0eeee..ed54958ed69 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/memberFunctions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt index ebf7691bdd6..e8c9abf1f09 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/overrideAnyWithPrimitive.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt index 2027af5bc87..e8fbcd5ecd5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypeArgument.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt index 615ee14bd04..73eb30e1239 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/parameterizedTypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt index 2eae6cf6466..b99ffe69cd3 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/propertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt index f4b75b3615c..89e71b9389e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/supertypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt index 6ceaa62c0f2..fe4dbc71e2b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/topLevelFunctions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt index 9998a169b46..7ca39047f7c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/typeParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt index 2585d8d7c1a..2b4d8327986 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/unit.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt index 4cac34036ee..a51b0843471 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/mapping/types/withNullability.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt index 134d4f4bcee..6aed0593328 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/callableReferencesEqualToCallablesFromAPI.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt index 2fa12531a70..3dce944568e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/classToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt index 0e1aaec84c9..c7d0be37e3b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/extensionPropertyReceiverToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt index 1879444874b..72b169fe9fb 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionEqualsHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt index cb18362790f..dec835773dc 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/functionToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt index 560d3098d45..1fe66891efa 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/memberExtensionToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt index 30f80286b93..79ea783e548 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersEqualsHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt index e184ff0f948..fa186eef7b5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/parametersToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt index 4a7f72c882b..4d2affbd96b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyEqualsHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt index 2db5df8c71a..4290f008a42 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/propertyToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt index 04f1bea016c..34d8104179e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeEqualsHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt index 240a36fcf7c..5c8207fe492 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersEqualsHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt index 8cfb7d03a3f..69adf928177 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeParametersToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt index b41a7dcbeda..805f4d8438b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToString.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt index a0b1a002084..da6d846e8f5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/methodsFromAny/typeToStringInnerGeneric.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt index 36293408282..e75ac5d3149 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableModality.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt index a122b6031c2..40dd01f4b03 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/callableVisibility.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt index 5e25940cb26..d3e2dd721dd 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classModality.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt index 4999e740d0e..661d5081478 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classVisibility.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt index 9fb67afb44d..1febcc0ce33 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/classes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt index b6e3c43a230..8a9372217f5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/functions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt index 3376fd86266..d0508d4d841 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/javaVisibility.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt index f571ca2eabd..24711c80d9a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/properties.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt index 1e9003f822a..486fed08f81 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/modifiers/typeParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt index a3f57e30b09..682f33e92f1 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callFunctionsInMultifileClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: Test1.kt diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt index 8939a169de1..44e0b439f7f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/callPropertiesInMultifileClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // KT-11447 Multifile declaration causes IAE: Method can not access a member of class // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt index 81d5b406ced..b992742377c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/multifileClasses/javaFieldForVarAndConstVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt index 456830c2cd9..6284db2f30f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/javaClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt index 83fb877637c..b11712c344a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/callableReferences.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt index b6a963f9ab9..4ed13798050 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt index e65c322986e..bf9dcabbfbb 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/primitiveJavaClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt index f8c7514c81f..67e138a1036 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/reifiedTypeJavaClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt index 202059e4942..406b86f608d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/noReflectAtRuntime/simpleClassLiterals.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt index 69aea956d07..03cd195f1cc 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundInnerClassConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT import kotlin.reflect.KParameter diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt index 646eed1de73..7a98551c5da 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundObjectMemberReferences.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt index 0b47967fd42..bbea4bf670b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/boundReferences.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt index 808f3dc072b..f2f150edf7a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/findParameterByName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt index 853b6d017c8..3e1e388b3ee 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/functionParameterNameAndIndex.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt index c44fd9c4b66..5965ee88ef4 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/instanceExtensionReceiverAndValueParameters.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt index e44112a1410..710974e28b1 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isMarkedNullable.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt index faf6aedb1a6..d3cf38ffc2c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/isOptional.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt index 69e4078006d..99446536ed4 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaAnnotationConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt index 81c55e79d58..0ae71fbf586 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/javaParametersHaveNoNames.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt index 31311ea8beb..9e8281631ce 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/kinds.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt b/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt index b3aa00ed4e1..9b50df6eb51 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/parameters/propertySetter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt index 234964d8f6e..9750f307a4f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/accessorNames.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt index 1640522f1af..db64040fe10 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/extensionPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt index 7d5020c49f8..afcf1c0eb57 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberExtensions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt index c96895ab6fd..9a3d6d97b39 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/memberPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt index 73d72347c5b..c896fe0882c 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/accessors/topLevelPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt index df4ec4fb96a..58970f582d8 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/allVsDeclared.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt index e0c673ace25..0006b5c4efe 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/callPrivatePropertyFromGetProperties.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt index cbcf79d07cd..53e5eaf3aca 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/declaredVsInheritedProperties.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt index 277f3d15473..abeae583ff4 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/fakeOverridesInSubclass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt index 72746db555e..c662235809e 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericClassLiteralPropertyReceiverIsStar.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt index e5f16577086..5f31f518c65 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericOverriddenProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // KT-13700 Exception obtaining descriptor for property reference diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt index d4f14856955..e50b948af6f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/genericProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt index 50c9df2be44..13b0c3fbec9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/getExtensionPropertiesMutableVsReadonly.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt index e87e566dec5..736d0a33b91 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/getPropertiesMutableVsReadonly.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt index 5f5904536c2..4b1709d8116 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/invokeKProperty.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt index aee681049dd..2c246b57836 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaPropertyInheritedInKotlin.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt index c4a7e21464d..77e92fbb187 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/javaStaticField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt index c1e4cb4f6f5..20166493f5a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/kotlinPropertyInheritedInJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt index c8542b602fb..1078c0380f9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/memberAndMemberExtensionWithSameName.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt index 38e4da13923..9522b302d13 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaInstanceField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt index 720556a2d19..541df83fb82 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/mutatePrivateJavaStaticField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt index 2780e258503..09a15935bc9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt index a876ff69c9e..ea3b816568d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/overrideKotlinPropertyByJavaMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt index c580f4aef8d..6e4e20f4f72 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt index 75c5ca55e4e..be1cf290bcd 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateClassVar.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt index f88544b28c4..0ac136eed17 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateFakeOverrideFromSuperclass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt index 398d7666db1..9aabee699a0 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateJvmStaticVarInObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt index c97d2dcddac..d15f8b9e09f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privatePropertyCallIsAccessibleOnAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt index d2ee9281c69..0abecc51601 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/privateToThisAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt index 4755576f096..cca3ef60307 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/propertyOfNestedClassAndArrayType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt index 783c69dd6d4..7c915af12df 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/protectedClassVar.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt index 4be1ab8df8c..1e2837c17ef 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/publicClassValAccessible.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt index 3762436a664..f634dab9d71 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/referenceToJavaFieldOfKotlinSubclass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt b/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt index bb19ac504ac..f14387359b6 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/properties/simpleGetProperties.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt index ceb08f00bd1..d1ae9ba0f8d 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/specialBuiltIns/getMembersOfStandardJavaClasses.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt index 0aed2bbd5d4..0fe836de76b 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/builtInClassSupertypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt index d3f609e4bb0..618ac48b2f3 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/genericSubstitution.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt index fec97be73d4..efbc87e30e5 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/isSubclassOfIsSuperclassOf.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt index ccbafb2e66e..9cf5410c504 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/primitives.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt index d9189c68722..c17e7ce9529 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/supertypes/simpleSupertypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt index d91f297aab5..51262ffdbad 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/declarationSiteVariance.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt index d864a4bce9a..2ad93a4d12a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/typeParametersAndNames.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt index 2cd803757e3..37f2c4ae2a4 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/typeParameters/upperBounds.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt index 5423e934e13..13f0031e6aa 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt index b92b6f82870..03f3fc828e1 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/classifierIsTypeParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt index 27df7ab2269..e05bd80dc9f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/classifiersOfBuiltInTypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt index b164b459a24..b2ed998ab0a 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/equality.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt index a1e75cb8349..3ec4b16ca33 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/innerGeneric.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt index fb1189f49d6..a31ee1d2f9f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/simpleCreateType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt index 25e837694a5..db0fc185655 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/typeParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt index 73c044da3ad..834f04c1bdf 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/createType/wrongNumberOfArguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt index 11a6e3d3f71..66f84b13eae 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/innerGenericArguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt index 8c3acb125a3..87c35586db6 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt index 5b3f4f4daa2..5112e8e0b6f 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/jvmErasureOfTypeParameter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt index f7ac0e77e93..556607a12de 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/platformTypeNotEqualToKotlinType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt index 0901242ee2a..0242d6febfd 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/platformType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt index 0a9f07aa0a1..ff0e3b290d6 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleGenericTypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt index 3b2032ddccc..ac0b42bd669 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/simpleSubtypeSupertype.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt index 4cae206d8d6..586b6d6b036 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/subtyping/typeProjection.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt index 2f5507f331a..c07bd52d723 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/typeArguments.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt index 6be21fb92c8..be511cd44db 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/useSiteVariance.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt b/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt index 2bf550e7aa9..34cd04295a9 100644 --- a/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt +++ b/backend.native/tests/external/codegen/blackbox/reflection/types/withNullability.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_REFLECT // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/regressions/collections.kt b/backend.native/tests/external/codegen/blackbox/regressions/collections.kt index aef72483d91..91779c31220 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/collections.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/collections.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt b/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt index 964220090d8..a0c9fe398e7 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/getGenericInterfaces.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt index b4fa90465a2..feaa0290dad 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1172.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // not sure if it's ok to change Object to Any // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt index 38e00ad6b56..038e7120483 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1515.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1.kt diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt index fb6770e9da0..e9f44796815 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1568.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt index df7e3fe3fa0..1404fde6962 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt1932.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt index 28bbc2321b2..e03cc3155fc 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2246.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt index a124aa15eb6..21d87c5e022 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2318.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt index 093a1d01116..cee437b0d37 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt2593.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt index d49c14e826a..d6393b5578a 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt274.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt index 1b71da1475c..ffdc39f27de 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt3046.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt index 948f5d26daa..196a5f38daf 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt344.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt index 3803247c36d..2f5ff42b84a 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt4259.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt index c34c88f35e3..d170254879f 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt4262.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt index 60c5361a14a..cf19709bf50 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt528.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt index b22b0ab3edb..ca20d00ea2a 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt529.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt index 6b38479569d..8a728eae40b 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt533.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt index 87a23405c7d..808a90f35e6 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5445.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1.kt diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt index fb0b45ec62f..97b4274cab5 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt5445_2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1.kt diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt index 8cb94c7a42a..49036644c7a 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt6434.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt index 1e609a5645e..01977c6cf72 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt6485.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt index 86006fdcd54..63e80a20157 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt715.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt b/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt index b6e32417942..df346f2cc36 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/kt864.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt b/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt index 9be19247af8..fa19aa885e7 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/nestedIntersection.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt b/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt index 5761d0d00a4..bdda90a6e92 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/referenceToSelfInLocal.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // KT-4351 Cannot resolve reference to self in init of class local to function diff --git a/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt b/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt index 99500695485..669cfc04943 100644 --- a/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt +++ b/backend.native/tests/external/codegen/blackbox/regressions/typeCastException.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt b/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt index 5b8db46d8b5..9ec149f89f2 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/DIExample.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt b/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt index 612ba58f353..2517f1cc929 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/anonymousObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt index 06934dfa3f0..24ef70e04eb 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectNoPropagate.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt index f26aadf0efd..8c173baea8c 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/anonymousObjectReifiedSupertype.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt b/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt index 7febb78913a..a270f4f0d7e 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/approximateCapturedTypes.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // Basically this test checks that no captured type used as argument for signature mapping diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt index b3db2462a04..eb8f592b691 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOf.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt index 0557c36171b..1ea7f096e4b 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/instanceOfArrays.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt index eafc6ba8149..08514a0359d 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt index 8d4bc476108..07143130bfe 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/arraysReification/jaggedArrayOfNulls.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt b/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt index 781ca4d0e29..1a3964f06a7 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/asOnPlatformType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt b/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt index d67c688ccef..ff05c5b2551 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/defaultJavaClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt b/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt index f346e09fb54..489c8b6bcc0 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/filterIsInstance.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt b/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt index c1aa86e0bdc..c6c995c85a2 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/innerAnonymousObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt b/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt index e3b8f5ce6c8..3d56c9f4771 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/instanceof.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt b/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt index 9145708f32f..a60989dd637 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/isOnPlatformType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt b/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt index a802437479f..2e7559b4e78 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/javaClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt b/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt index 3541986ec12..6787fb86885 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/nestedReified.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt b/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt index f019235be48..ea4fe763e54 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/nestedReifiedSignature.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt b/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt index b1d92cfbef9..74ea8b366f7 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/newArrayInt.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt b/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt index d970d16e2a5..c243cb1206b 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/nonInlineableLambdaInReifiedFunction.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt b/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt index c93adf8e1ae..e75f5c80b5e 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/recursiveInnerAnonymousObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt b/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt index edd797547fd..7925668cc22 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/recursiveNewArray.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt b/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt index 93f46742359..364262bcee2 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/recursiveNonInlineableLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt index effbdc75764..75387478a8a 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt index 690848b3cbb..e211f6e52b8 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineFunOfObjectWithinReified.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt index 19ca4d92125..6636a564543 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/reifiedInlineIntoNonInlineableLambda.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt b/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt index 0b5bde0eaef..b5fc6022839 100644 --- a/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt +++ b/backend.native/tests/external/codegen/blackbox/reified/sameIndexRecursive.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt b/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt index 49a35fc9975..f23e75dbce1 100644 --- a/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt +++ b/backend.native/tests/external/codegen/blackbox/safeCall/kt232.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A() { fun foo() { diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt index 7aa5936902c..a6651307bed 100644 --- a/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/filenameFilter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.io.* diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt index 1a94108f7c6..d6672316a1c 100644 --- a/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/nonLiteralFilenameFilter.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.io.* diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt index fd05985efc8..3b1cfbc0298 100644 --- a/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/samWrappersDifferentFiles.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FILE: 1/wrapped.kt diff --git a/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt b/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt index 48eb26fc748..ee39d412a0c 100644 --- a/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt +++ b/backend.native/tests/external/codegen/blackbox/sam/constructors/sameWrapperClass.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { val f = { } diff --git a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt index 2e56fdc0e88..97e4d24e68a 100644 --- a/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt +++ b/backend.native/tests/external/codegen/blackbox/secondaryConstructors/withNonLocalReturn.kt @@ -1,5 +1,5 @@ // TODO enable for JS backend too when KT-14549 will be fixed -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE inline fun run(block: () -> Unit) = block() diff --git a/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt b/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt index a5e38e427a0..b385b115457 100644 --- a/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt +++ b/backend.native/tests/external/codegen/blackbox/smartCasts/lambdaArgumentWithoutType.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class Foo(val s: String) fun foo(): Foo? = Foo("OK") diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt index 1b1d43a9c20..bdc90a71a2c 100644 --- a/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/bridgeNotEmptyMap.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE private object NotEmptyMap : MutableMap { override fun containsKey(key: Any): Boolean = true diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt index 4ab3890681f..0e145b90460 100644 --- a/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/collectionImpl.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A1 : MutableCollection { override val size: Int diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt index 51ff7cd35e7..d7c4c262b7e 100644 --- a/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/emptyList.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE private object EmptyList : List { override fun contains(element: Nothing): Boolean = false diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt index e289d230889..7bb922953d7 100644 --- a/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyListAny.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE private object NotEmptyList : MutableList { override fun contains(element: Any): Boolean = true diff --git a/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt index 3e19df62282..875c615b4ca 100644 --- a/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt +++ b/backend.native/tests/external/codegen/blackbox/specialBuiltins/notEmptyMap.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE private object NotEmptyMap : MutableMap { override fun containsKey(key: Any): Boolean = true diff --git a/backend.native/tests/external/codegen/blackbox/statics/fields.kt b/backend.native/tests/external/codegen/blackbox/statics/fields.kt index 20cd4ddb815..a32fda1f232 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/fields.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/fields.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Child.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/functions.kt b/backend.native/tests/external/codegen/blackbox/statics/functions.kt index f06f8aba581..0a2e6767fdb 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/functions.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/functions.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Child.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt b/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt index ffe8b37d042..6b6e3642663 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/hidePrivateByPublic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Child.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt b/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt index 80224d8ba56..3e0b726b9ad 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/inlineCallsStaticMethod.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Test.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt index 7026016840e..41be4ad28c8 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedSamConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt index 61f8e3ab8cc..c8fe82f334d 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: First.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt index a6bbeee7730..931b1eace43 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedStatic2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: Base.java diff --git a/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt b/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt index c5b96ca260c..738e874d2e4 100644 --- a/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt +++ b/backend.native/tests/external/codegen/blackbox/statics/protectedStaticAndInline.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: First.java diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt b/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt index 32134689f31..589d5ab8586 100644 --- a/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt +++ b/backend.native/tests/external/codegen/blackbox/strings/kt2592.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun box(): String { String() diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt889.kt b/backend.native/tests/external/codegen/blackbox/strings/kt889.kt index 99c32c3fa54..c09089eefec 100644 --- a/backend.native/tests/external/codegen/blackbox/strings/kt889.kt +++ b/backend.native/tests/external/codegen/blackbox/strings/kt889.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE operator fun Int.plus(s: String) : String { System.out?.println("Int.plus(s: String) called") diff --git a/backend.native/tests/external/codegen/blackbox/strings/kt894.kt b/backend.native/tests/external/codegen/blackbox/strings/kt894.kt index d822bcd3456..f8e9620a8fc 100644 --- a/backend.native/tests/external/codegen/blackbox/strings/kt894.kt +++ b/backend.native/tests/external/codegen/blackbox/strings/kt894.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun stringConcat(n : Int) : String? { var string : String? = "" diff --git a/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt b/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt index c994f4c4a0a..e11087ddfd5 100644 --- a/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt +++ b/backend.native/tests/external/codegen/blackbox/strings/stringBuilderAppend.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE class A() { diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt b/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt index 4db88b8f3f7..effbf887c33 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/changeMonitor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt b/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt index 5df4f84c98f..e0180c1e7a3 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/exceptionInMonitorExpression.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt b/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt index 289040bf9d6..0cae07f34f0 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/finally.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt b/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt index 107d028ffe6..c06a4efd2a1 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/longValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt b/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt index ccfa71d2c35..369f1266120 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/nestedDifferentObjects.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt b/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt index c48210df13f..8f451dfd855 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/nestedSameObject.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt b/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt index 90beb6d7110..de47313baa5 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/nonLocalReturn.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt b/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt index e6424739f77..d1d2acd2e88 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/objectValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt b/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt index f2462277a80..e08ad511b68 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/sync.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/value.kt b/backend.native/tests/external/codegen/blackbox/synchronized/value.kt index 15d2d9cad94..1f04c749df4 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/value.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/value.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt b/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt index 3ec5edd2c85..64b788e3593 100644 --- a/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt +++ b/backend.native/tests/external/codegen/blackbox/synchronized/wait.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // FULL_JDK diff --git a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt index 4e270a36f04..7f90fb35831 100644 --- a/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt +++ b/backend.native/tests/external/codegen/blackbox/syntheticAccessors/syntheticAccessorNames.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME // This test checks that synthetic accessors generated by Kotlin compiler have names starting with "access$" diff --git a/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt b/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt index 694f4905d8b..4a98b0cf943 100644 --- a/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt +++ b/backend.native/tests/external/codegen/blackbox/toArray/toTypedArray.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // missing isArrayOf on JS // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt index ab8972bd862..e464f276b32 100644 --- a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt index 7376c2e0314..a0a275444d4 100644 --- a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/noPrivateNoAccessorsInMultiFileFacade2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt index 484cd832104..b8fde078208 100644 --- a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/privateVisibility.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FULL_JDK package test diff --git a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt index 83f8ffc997d..65ed58cc260 100644 --- a/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt +++ b/backend.native/tests/external/codegen/blackbox/topLevelPrivate/syntheticAccessorInMultiFile.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt b/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt index 7e83b204b77..627b60834d9 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/abstractClassInheritsFromInterface.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: ExtendsKCWithT.java diff --git a/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt b/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt index ce344d9014f..a0eede09d5a 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/diamondPropertyAccessors.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface A { var bar: Boolean diff --git a/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt b/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt index 7efb7336918..44f9fac7be5 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/inheritJavaInterface.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: MyInt.java diff --git a/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt b/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt index cd164825f4f..65727b9bdd5 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/interfaceDefaultImpls.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: B.java diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt b/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt index 9b59cb8cab1..54dbd833474 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/kt2399.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // on JS Parser.parse and MultiParser.parse clash in ProjectInfoJsonParser class JsonObject { diff --git a/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt b/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt index 92954f58c8d..94cf3925737 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/kt3500.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface BK { fun foo(): String = 10.toString() diff --git a/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt b/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt index 7f1dc62d68c..d1c3bd777bf 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/noPrivateDelegation.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface Z{ diff --git a/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt b/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt index 7c0a3eaa1ad..1fe1ebfad15 100644 --- a/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt +++ b/backend.native/tests/external/codegen/blackbox/traits/traitImplDiamond.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE interface A { fun foo() = "Fail" diff --git a/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt b/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt index a256df47b85..5c10094c85d 100644 --- a/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt +++ b/backend.native/tests/external/codegen/blackbox/typeInfo/asInLoop.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE import java.io.* diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt index 03c6034cde6..b94098789db 100644 --- a/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/enhancedPrimitives.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: J.java diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt index a06f6791d6b..8f6c732f1ef 100644 --- a/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/genericTypeWithNothing.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt index 3717841f2ed..873343a37ba 100644 --- a/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/kt309.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt b/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt index 6c5ba217659..138c2d51355 100644 --- a/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt +++ b/backend.native/tests/external/codegen/blackbox/typeMapping/typeParameterMultipleBounds.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt b/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt index 1fef505f0af..8b5744d17db 100644 --- a/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt +++ b/backend.native/tests/external/codegen/blackbox/unit/UnitValue.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo() {} diff --git a/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt b/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt index e0c04071aca..6db8f894a26 100644 --- a/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt +++ b/backend.native/tests/external/codegen/blackbox/unit/kt4212.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE fun foo(): Any? = bar() diff --git a/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt b/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt index 36745b853a3..89e7e8004e6 100644 --- a/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt +++ b/backend.native/tests/external/codegen/blackbox/vararg/varargInJava.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // FILE: A.java diff --git a/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt b/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt index 1d07419974a..4b58f875147 100644 --- a/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt +++ b/backend.native/tests/external/codegen/blackbox/when/integralWhenWithNoInlinedConstants.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt index 00ff2e6812e..53f6754fb71 100644 --- a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/duplicatingItemsSameHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME diff --git a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt index 2114ac50d26..fd4d11e6b65 100644 --- a/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt +++ b/backend.native/tests/external/codegen/blackbox/when/stringOptimization/sameHashCode.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME From 8ec33334a43a537291432f0cb786629daedda2b9 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 19 Jan 2017 15:44:38 +0300 Subject: [PATCH 18/86] backend/tests: Enable some tests in the binaryOp group --- .../codegen/blackbox/binaryOp/compareWithBoxedDouble.kt | 7 +++++-- .../codegen/blackbox/binaryOp/compareWithBoxedLong.kt | 2 +- .../external/codegen/blackbox/binaryOp/divisionByZero.kt | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt index c30db01e13f..553773be648 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt @@ -1,6 +1,9 @@ -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS // reason - multifile tests are not supported in JS tests -//FILE: Holder.java +// IGNORE_BACKEND: NATIVE +// reason - no java interop. Consider testing by another way + +//FILE: Holder.kt class Holder { public Double value; diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt index 68260ff21f4..14a07fe1eb3 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS // reason - multifile tests are not supported in JS tests //FILE: JavaClass.java diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt index 328e6785b0c..1daa188f030 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/divisionByZero.kt @@ -1,4 +1,4 @@ -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS // reason - no ArithmeticException in JS fun box(): String { val a1 = 0 From 6efe2b6d31a21578ffc3c2fe2b26826a56423f68 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Jan 2017 10:16:16 +0300 Subject: [PATCH 19/86] backend/tests: Add compilation logging --- .../org/jetbrains/kotlin/KonanTest.groovy | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 34275f57a6e..a1307b6073a 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -38,17 +38,25 @@ abstract class KonanTest extends DefaultTask { abstract void compileTest(List filesToCompile, String exe) protected void runCompiler(List filesToCompile, String output, List moreArgs) { - project.javaexec { - main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' - classpath = project.configurations.cli_bc - jvmArgs "-ea", - "-Dkonan.home=${dist.canonicalPath}", - "-Djava.library.path=${dist.canonicalPath}/konan/nativelib" - args("-output", output, - *filesToCompile, - *moreArgs, - *project.globalArgs) - + def log = new ByteArrayOutputStream() + try { + project.javaexec { + main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' + classpath = project.configurations.cli_bc + jvmArgs "-ea", + "-Dkonan.home=${dist.canonicalPath}", + "-Djava.library.path=${dist.canonicalPath}/konan/nativelib" + args("-output", output, + *filesToCompile, + *moreArgs, + *project.globalArgs) + standardOutput = log + errorOutput = log + } + } finally { + def logString = log.toString() + project.file("${output}.compilation.log").write(logString) + println(logString) } } @@ -128,12 +136,6 @@ class RunExternalTestGroup extends RunKonanTest { String filter = project.findProperty("filter") String goldValue = "OK" - String buildExePath() { - def exeName = "${name}.kt.exe" - def tempDir = temporaryDir.absolutePath - return "$tempDir/$exeName" - } - // TODO refactor List buildCompileList() { def result = [] From d18219c383d4b7c8f6470ec3b0ce0c1030182292 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Jan 2017 12:13:37 +0300 Subject: [PATCH 20/86] backend/tests: Fixes in regenerate_external_tests task --- backend.native/tests/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 3fe46205a39..700e08bd8d5 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -29,13 +29,13 @@ task regenerate_external_tests() { "}\n\n") externalTestsDir.eachDirRecurse { - // Skip build directory and directories without *.kt files - if (it.name == "build" || it.listFiles().findAll { it.name.endsWith(".kt") }.isEmpty()) { + // Skip build directory and directories without *.kt files. + if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt")} == 0) { return } def taskDirectory = externalTestsProject.relativePath(it) - def taskName = taskDirectory.replace('/', '_').replace('-', '_') + def taskName = taskDirectory.replaceAll("/-", '_') gradleGenerated.append( "task $taskName (type: RunExternalTestGroup) {\n" + From 48122c8a033b5a4df188a9ea44a45a260f6ec004 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Jan 2017 13:46:11 +0300 Subject: [PATCH 21/86] backend/tests: Add test result reporting to run_external task. + regenerate external tests. --- backend.native/tests/build.gradle | 53 +- backend.native/tests/external/build.gradle | 1005 ++++++++++------- .../org/jetbrains/kotlin/KonanTest.groovy | 7 +- 3 files changed, 650 insertions(+), 415 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 700e08bd8d5..1ee692920fa 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -13,21 +13,34 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } +def logFileName = "test-result.md" + task regenerate_external_tests() { doLast { def externalTestsProject = childProjects["external"] def gradleGenerated = externalTestsProject.file("build.gradle") def externalTestsDir = externalTestsProject.file("codegen/blackbox") - gradleGenerated.write("import org.jetbrains.kotlin.*\n\n") + gradleGenerated.write("import org.jetbrains.kotlin.*\n") gradleGenerated.append( - "configurations {\n" + - " cli_bc\n" + - "}\n" + - "\n" + - "dependencies {\n" + - " cli_bc project(path: ':backend.native', configuration: 'cli_bc')\n" + - "}\n\n") +""" +configurations { + cli_bc +} +dependencies { + cli_bc project(path: ':backend.native', configuration: 'cli_bc') +} +""" + ) + gradleGenerated.append( +""" +task createLogFile() { + doLast { + project.file("$logFileName").write("") + } +} +""" + ) externalTestsDir.eachDirRecurse { // Skip build directory and directories without *.kt files. if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt")} == 0) { @@ -35,18 +48,18 @@ task regenerate_external_tests() { } def taskDirectory = externalTestsProject.relativePath(it) - def taskName = taskDirectory.replaceAll("/-", '_') + def taskName = taskDirectory.replaceAll("[-/]", '_') gradleGenerated.append( "task $taskName (type: RunExternalTestGroup) {\n" + - " groupDirectory = \"$taskDirectory\"\n" + - " logFileName = \"$taskDirectory/test-result.md\"\n" + + " dependsOn(createLogFile)\n" + + " groupDirectory = \"$taskDirectory\"\n" + + " logFileName = \"$logFileName\"\n" + "}\n\n") } } } - task run() { dependsOn(tasks.withType(KonanTest).matching { it.enabled }) } @@ -55,6 +68,22 @@ task run_external () { project.subprojects { dependsOn(it.tasks.withType(RunExternalTestGroup).matching { it.enabled }) } + doLast { + def logFile = childProjects["external"].file(logFileName) + def logText = logFile.text + + def passed = logText.count("|PASSED|") + def failed = logText.count("|FAILED|") + def skipped = logText.count("|SKIPPED|") + + def report = "\nDONE.\n\n" + + "PASSED: $passed\n" + + "FAILED: $failed\n" + + "TOTAL (FAILED + PASSED): ${passed + failed}\n" + + "SKIPPED : $skipped" + logFile.append(report) + println(report) + } } task sum (type:RunKonanTest) { diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle index 27965d406d2..38639043b64 100644 --- a/backend.native/tests/external/build.gradle +++ b/backend.native/tests/external/build.gradle @@ -8,1003 +8,1208 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } +task createLogFile() { + doLast { + project.file("test-result.md").write("") + } +} task codegen_blackbox_annotations (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/annotations" - logFileName = "codegen/blackbox/annotations/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/annotations" + logFileName = "test-result.md" } task codegen_blackbox_annotations_annotatedLambda (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/annotations/annotatedLambda" - logFileName = "codegen/blackbox/annotations/annotatedLambda/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/annotations/annotatedLambda" + logFileName = "test-result.md" } task codegen_blackbox_argumentOrder (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/argumentOrder" - logFileName = "codegen/blackbox/argumentOrder/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/argumentOrder" + logFileName = "test-result.md" } task codegen_blackbox_arrays (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays" - logFileName = "codegen/blackbox/arrays/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/arrays" + logFileName = "test-result.md" } task codegen_blackbox_arrays_multiDecl (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays/multiDecl" - logFileName = "codegen/blackbox/arrays/multiDecl/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/arrays/multiDecl" + logFileName = "test-result.md" } task codegen_blackbox_arrays_multiDecl_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays/multiDecl/int" - logFileName = "codegen/blackbox/arrays/multiDecl/int/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/arrays/multiDecl/int" + logFileName = "test-result.md" } task codegen_blackbox_arrays_multiDecl_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays/multiDecl/long" - logFileName = "codegen/blackbox/arrays/multiDecl/long/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/arrays/multiDecl/long" + logFileName = "test-result.md" } task codegen_blackbox_binaryOp (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/binaryOp" - logFileName = "codegen/blackbox/binaryOp/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/binaryOp" + logFileName = "test-result.md" } task codegen_blackbox_boxingOptimization (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/boxingOptimization" - logFileName = "codegen/blackbox/boxingOptimization/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/boxingOptimization" + logFileName = "test-result.md" } task codegen_blackbox_bridges (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/bridges" - logFileName = "codegen/blackbox/bridges/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/bridges" + logFileName = "test-result.md" } task codegen_blackbox_bridges_substitutionInSuperClass (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/bridges/substitutionInSuperClass" - logFileName = "codegen/blackbox/bridges/substitutionInSuperClass/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/bridges/substitutionInSuperClass" + logFileName = "test-result.md" } task codegen_blackbox_builtinStubMethods (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/builtinStubMethods" - logFileName = "codegen/blackbox/builtinStubMethods/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/builtinStubMethods" + logFileName = "test-result.md" } task codegen_blackbox_builtinStubMethods_extendJavaCollections (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/builtinStubMethods/extendJavaCollections" - logFileName = "codegen/blackbox/builtinStubMethods/extendJavaCollections/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/builtinStubMethods/extendJavaCollections" + logFileName = "test-result.md" } task codegen_blackbox_callableReference_bound (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/bound" - logFileName = "codegen/blackbox/callableReference/bound/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/callableReference/bound" + logFileName = "test-result.md" } task codegen_blackbox_callableReference_bound_equals (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/bound/equals" - logFileName = "codegen/blackbox/callableReference/bound/equals/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/callableReference/bound/equals" + logFileName = "test-result.md" } task codegen_blackbox_callableReference_bound_inline (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/bound/inline" - logFileName = "codegen/blackbox/callableReference/bound/inline/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/callableReference/bound/inline" + logFileName = "test-result.md" } task codegen_blackbox_callableReference_function (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/function" - logFileName = "codegen/blackbox/callableReference/function/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/callableReference/function" + logFileName = "test-result.md" } task codegen_blackbox_callableReference_function_local (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/function/local" - logFileName = "codegen/blackbox/callableReference/function/local/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/callableReference/function/local" + logFileName = "test-result.md" } task codegen_blackbox_callableReference_property (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/property" - logFileName = "codegen/blackbox/callableReference/property/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/callableReference/property" + logFileName = "test-result.md" } task codegen_blackbox_casts (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts" - logFileName = "codegen/blackbox/casts/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/casts" + logFileName = "test-result.md" } task codegen_blackbox_casts_functions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts/functions" - logFileName = "codegen/blackbox/casts/functions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/casts/functions" + logFileName = "test-result.md" } task codegen_blackbox_casts_literalExpressionAsGenericArgument (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts/literalExpressionAsGenericArgument" - logFileName = "codegen/blackbox/casts/literalExpressionAsGenericArgument/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/casts/literalExpressionAsGenericArgument" + logFileName = "test-result.md" } task codegen_blackbox_casts_mutableCollections (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts/mutableCollections" - logFileName = "codegen/blackbox/casts/mutableCollections/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/casts/mutableCollections" + logFileName = "test-result.md" } task codegen_blackbox_classes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classes" - logFileName = "codegen/blackbox/classes/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/classes" + logFileName = "test-result.md" } task codegen_blackbox_classes_inner (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classes/inner" - logFileName = "codegen/blackbox/classes/inner/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/classes/inner" + logFileName = "test-result.md" } task codegen_blackbox_classLiteral (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classLiteral" - logFileName = "codegen/blackbox/classLiteral/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/classLiteral" + logFileName = "test-result.md" } task codegen_blackbox_classLiteral_bound (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classLiteral/bound" - logFileName = "codegen/blackbox/classLiteral/bound/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/classLiteral/bound" + logFileName = "test-result.md" } task codegen_blackbox_classLiteral_java (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classLiteral/java" - logFileName = "codegen/blackbox/classLiteral/java/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/classLiteral/java" + logFileName = "test-result.md" } task codegen_blackbox_closures (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/closures" - logFileName = "codegen/blackbox/closures/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/closures" + logFileName = "test-result.md" } task codegen_blackbox_closures_captureOuterProperty (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/closures/captureOuterProperty" - logFileName = "codegen/blackbox/closures/captureOuterProperty/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/closures/captureOuterProperty" + logFileName = "test-result.md" } task codegen_blackbox_closures_closureInsideClosure (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/closures/closureInsideClosure" - logFileName = "codegen/blackbox/closures/closureInsideClosure/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/closures/closureInsideClosure" + logFileName = "test-result.md" } task codegen_blackbox_collections (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/collections" - logFileName = "codegen/blackbox/collections/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/collections" + logFileName = "test-result.md" } task codegen_blackbox_compatibility (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/compatibility" - logFileName = "codegen/blackbox/compatibility/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/compatibility" + logFileName = "test-result.md" } task codegen_blackbox_constants (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/constants" - logFileName = "codegen/blackbox/constants/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/constants" + logFileName = "test-result.md" } task codegen_blackbox_controlStructures (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures" - logFileName = "codegen/blackbox/controlStructures/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/controlStructures" + logFileName = "test-result.md" } task codegen_blackbox_controlStructures_breakContinueInExpressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures/breakContinueInExpressions" - logFileName = "codegen/blackbox/controlStructures/breakContinueInExpressions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/controlStructures/breakContinueInExpressions" + logFileName = "test-result.md" } task codegen_blackbox_controlStructures_returnsNothing (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures/returnsNothing" - logFileName = "codegen/blackbox/controlStructures/returnsNothing/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/controlStructures/returnsNothing" + logFileName = "test-result.md" } task codegen_blackbox_controlStructures_tryCatchInExpressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures/tryCatchInExpressions" - logFileName = "codegen/blackbox/controlStructures/tryCatchInExpressions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/controlStructures/tryCatchInExpressions" + logFileName = "test-result.md" } task codegen_blackbox_coroutines (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines" - logFileName = "codegen/blackbox/coroutines/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines" + logFileName = "test-result.md" } task codegen_blackbox_coroutines_controlFlow (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/controlFlow" - logFileName = "codegen/blackbox/coroutines/controlFlow/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines/controlFlow" + logFileName = "test-result.md" } task codegen_blackbox_coroutines_intLikeVarSpilling (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/intLikeVarSpilling" - logFileName = "codegen/blackbox/coroutines/intLikeVarSpilling/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines/intLikeVarSpilling" + logFileName = "test-result.md" } task codegen_blackbox_coroutines_multiModule (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/multiModule" - logFileName = "codegen/blackbox/coroutines/multiModule/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines/multiModule" + logFileName = "test-result.md" } task codegen_blackbox_coroutines_stackUnwinding (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/stackUnwinding" - logFileName = "codegen/blackbox/coroutines/stackUnwinding/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines/stackUnwinding" + logFileName = "test-result.md" } task codegen_blackbox_coroutines_suspendFunctionTypeCall (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/suspendFunctionTypeCall" - logFileName = "codegen/blackbox/coroutines/suspendFunctionTypeCall/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines/suspendFunctionTypeCall" + logFileName = "test-result.md" } task codegen_blackbox_coroutines_unitTypeReturn (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/unitTypeReturn" - logFileName = "codegen/blackbox/coroutines/unitTypeReturn/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/coroutines/unitTypeReturn" + logFileName = "test-result.md" } task codegen_blackbox_dataClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses" - logFileName = "codegen/blackbox/dataClasses/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/dataClasses" + logFileName = "test-result.md" } task codegen_blackbox_dataClasses_copy (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/copy" - logFileName = "codegen/blackbox/dataClasses/copy/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/dataClasses/copy" + logFileName = "test-result.md" } task codegen_blackbox_dataClasses_equals (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/equals" - logFileName = "codegen/blackbox/dataClasses/equals/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/dataClasses/equals" + logFileName = "test-result.md" } task codegen_blackbox_dataClasses_hashCode (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/hashCode" - logFileName = "codegen/blackbox/dataClasses/hashCode/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/dataClasses/hashCode" + logFileName = "test-result.md" } task codegen_blackbox_dataClasses_toString (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/toString" - logFileName = "codegen/blackbox/dataClasses/toString/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/dataClasses/toString" + logFileName = "test-result.md" } task codegen_blackbox_deadCodeElimination (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/deadCodeElimination" - logFileName = "codegen/blackbox/deadCodeElimination/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/deadCodeElimination" + logFileName = "test-result.md" } task codegen_blackbox_defaultArguments (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments" - logFileName = "codegen/blackbox/defaultArguments/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/defaultArguments" + logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_constructor (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/constructor" - logFileName = "codegen/blackbox/defaultArguments/constructor/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/defaultArguments/constructor" + logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_convention (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/convention" - logFileName = "codegen/blackbox/defaultArguments/convention/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/defaultArguments/convention" + logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_function (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/function" - logFileName = "codegen/blackbox/defaultArguments/function/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/defaultArguments/function" + logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_private (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/private" - logFileName = "codegen/blackbox/defaultArguments/private/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/defaultArguments/private" + logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_signature (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/signature" - logFileName = "codegen/blackbox/defaultArguments/signature/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/defaultArguments/signature" + logFileName = "test-result.md" } task codegen_blackbox_delegatedProperty (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegatedProperty" - logFileName = "codegen/blackbox/delegatedProperty/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/delegatedProperty" + logFileName = "test-result.md" } task codegen_blackbox_delegatedProperty_local (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegatedProperty/local" - logFileName = "codegen/blackbox/delegatedProperty/local/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/delegatedProperty/local" + logFileName = "test-result.md" } task codegen_blackbox_delegatedProperty_provideDelegate (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegatedProperty/provideDelegate" - logFileName = "codegen/blackbox/delegatedProperty/provideDelegate/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/delegatedProperty/provideDelegate" + logFileName = "test-result.md" } task codegen_blackbox_delegation (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegation" - logFileName = "codegen/blackbox/delegation/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/delegation" + logFileName = "test-result.md" } task codegen_blackbox_destructuringDeclInLambdaParam (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/destructuringDeclInLambdaParam" - logFileName = "codegen/blackbox/destructuringDeclInLambdaParam/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/destructuringDeclInLambdaParam" + logFileName = "test-result.md" } task codegen_blackbox_diagnostics_functions_inference (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/functions/inference" - logFileName = "codegen/blackbox/diagnostics/functions/inference/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/diagnostics/functions/inference" + logFileName = "test-result.md" } task codegen_blackbox_diagnostics_functions_invoke_onObjects (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/functions/invoke/onObjects" - logFileName = "codegen/blackbox/diagnostics/functions/invoke/onObjects/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/diagnostics/functions/invoke/onObjects" + logFileName = "test-result.md" } task codegen_blackbox_diagnostics_functions_tailRecursion (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/functions/tailRecursion" - logFileName = "codegen/blackbox/diagnostics/functions/tailRecursion/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/diagnostics/functions/tailRecursion" + logFileName = "test-result.md" } task codegen_blackbox_diagnostics_vararg (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/vararg" - logFileName = "codegen/blackbox/diagnostics/vararg/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/diagnostics/vararg" + logFileName = "test-result.md" } task codegen_blackbox_elvis (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/elvis" - logFileName = "codegen/blackbox/elvis/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/elvis" + logFileName = "test-result.md" } task codegen_blackbox_enum (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/enum" - logFileName = "codegen/blackbox/enum/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/enum" + logFileName = "test-result.md" } task codegen_blackbox_evaluate (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/evaluate" - logFileName = "codegen/blackbox/evaluate/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/evaluate" + logFileName = "test-result.md" } task codegen_blackbox_exclExcl (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/exclExcl" - logFileName = "codegen/blackbox/exclExcl/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/exclExcl" + logFileName = "test-result.md" } task codegen_blackbox_extensionFunctions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/extensionFunctions" - logFileName = "codegen/blackbox/extensionFunctions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/extensionFunctions" + logFileName = "test-result.md" } task codegen_blackbox_extensionProperties (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/extensionProperties" - logFileName = "codegen/blackbox/extensionProperties/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/extensionProperties" + logFileName = "test-result.md" } task codegen_blackbox_external (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/external" - logFileName = "codegen/blackbox/external/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/external" + logFileName = "test-result.md" } task codegen_blackbox_fakeOverride (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fakeOverride" - logFileName = "codegen/blackbox/fakeOverride/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/fakeOverride" + logFileName = "test-result.md" } task codegen_blackbox_fieldRename (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fieldRename" - logFileName = "codegen/blackbox/fieldRename/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/fieldRename" + logFileName = "test-result.md" } task codegen_blackbox_finally (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/finally" - logFileName = "codegen/blackbox/finally/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/finally" + logFileName = "test-result.md" } task codegen_blackbox_fullJdk (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fullJdk" - logFileName = "codegen/blackbox/fullJdk/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/fullJdk" + logFileName = "test-result.md" } task codegen_blackbox_fullJdk_native (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fullJdk/native" - logFileName = "codegen/blackbox/fullJdk/native/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/fullJdk/native" + logFileName = "test-result.md" } task codegen_blackbox_fullJdk_regressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fullJdk/regressions" - logFileName = "codegen/blackbox/fullJdk/regressions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/fullJdk/regressions" + logFileName = "test-result.md" } task codegen_blackbox_functions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions" - logFileName = "codegen/blackbox/functions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/functions" + logFileName = "test-result.md" } task codegen_blackbox_functions_functionExpression (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions/functionExpression" - logFileName = "codegen/blackbox/functions/functionExpression/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/functions/functionExpression" + logFileName = "test-result.md" } task codegen_blackbox_functions_invoke (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions/invoke" - logFileName = "codegen/blackbox/functions/invoke/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/functions/invoke" + logFileName = "test-result.md" } task codegen_blackbox_functions_localFunctions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions/localFunctions" - logFileName = "codegen/blackbox/functions/localFunctions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/functions/localFunctions" + logFileName = "test-result.md" } task codegen_blackbox_hashPMap (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/hashPMap" - logFileName = "codegen/blackbox/hashPMap/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/hashPMap" + logFileName = "test-result.md" } task codegen_blackbox_ieee754 (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ieee754" - logFileName = "codegen/blackbox/ieee754/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ieee754" + logFileName = "test-result.md" } task codegen_blackbox_increment (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/increment" - logFileName = "codegen/blackbox/increment/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/increment" + logFileName = "test-result.md" } task codegen_blackbox_innerNested (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/innerNested" - logFileName = "codegen/blackbox/innerNested/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/innerNested" + logFileName = "test-result.md" } task codegen_blackbox_innerNested_superConstructorCall (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/innerNested/superConstructorCall" - logFileName = "codegen/blackbox/innerNested/superConstructorCall/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/innerNested/superConstructorCall" + logFileName = "test-result.md" } task codegen_blackbox_instructions_swap (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/instructions/swap" - logFileName = "codegen/blackbox/instructions/swap/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/instructions/swap" + logFileName = "test-result.md" } task codegen_blackbox_intrinsics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/intrinsics" - logFileName = "codegen/blackbox/intrinsics/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/intrinsics" + logFileName = "test-result.md" } task codegen_blackbox_javaInterop (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop" - logFileName = "codegen/blackbox/javaInterop/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/javaInterop" + logFileName = "test-result.md" } task codegen_blackbox_javaInterop_generics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop/generics" - logFileName = "codegen/blackbox/javaInterop/generics/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/javaInterop/generics" + logFileName = "test-result.md" } task codegen_blackbox_javaInterop_notNullAssertions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop/notNullAssertions" - logFileName = "codegen/blackbox/javaInterop/notNullAssertions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/javaInterop/notNullAssertions" + logFileName = "test-result.md" } task codegen_blackbox_javaInterop_objectMethods (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop/objectMethods" - logFileName = "codegen/blackbox/javaInterop/objectMethods/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/javaInterop/objectMethods" + logFileName = "test-result.md" } task codegen_blackbox_jdk (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jdk" - logFileName = "codegen/blackbox/jdk/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/jdk" + logFileName = "test-result.md" } task codegen_blackbox_jvmField (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmField" - logFileName = "codegen/blackbox/jvmField/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/jvmField" + logFileName = "test-result.md" } task codegen_blackbox_jvmName (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmName" - logFileName = "codegen/blackbox/jvmName/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/jvmName" + logFileName = "test-result.md" } task codegen_blackbox_jvmName_fileFacades (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmName/fileFacades" - logFileName = "codegen/blackbox/jvmName/fileFacades/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/jvmName/fileFacades" + logFileName = "test-result.md" } task codegen_blackbox_jvmOverloads (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmOverloads" - logFileName = "codegen/blackbox/jvmOverloads/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/jvmOverloads" + logFileName = "test-result.md" } task codegen_blackbox_jvmStatic (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmStatic" - logFileName = "codegen/blackbox/jvmStatic/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/jvmStatic" + logFileName = "test-result.md" } task codegen_blackbox_labels (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/labels" - logFileName = "codegen/blackbox/labels/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/labels" + logFileName = "test-result.md" } task codegen_blackbox_lazyCodegen (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/lazyCodegen" - logFileName = "codegen/blackbox/lazyCodegen/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/lazyCodegen" + logFileName = "test-result.md" } task codegen_blackbox_lazyCodegen_optimizations (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/lazyCodegen/optimizations" - logFileName = "codegen/blackbox/lazyCodegen/optimizations/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/lazyCodegen/optimizations" + logFileName = "test-result.md" } task codegen_blackbox_localClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/localClasses" - logFileName = "codegen/blackbox/localClasses/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/localClasses" + logFileName = "test-result.md" } task codegen_blackbox_mangling (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/mangling" - logFileName = "codegen/blackbox/mangling/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/mangling" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl" - logFileName = "codegen/blackbox/multiDecl/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forIterator (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forIterator" - logFileName = "codegen/blackbox/multiDecl/forIterator/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forIterator" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forIterator_longIterator (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forIterator/longIterator" - logFileName = "codegen/blackbox/multiDecl/forIterator/longIterator/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forIterator/longIterator" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange" - logFileName = "codegen/blackbox/multiDecl/forRange/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeTo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo" - logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int" - logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long" - logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot" - logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int" - logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long" - logFileName = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/int" - logFileName = "codegen/blackbox/multiDecl/forRange/int/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/int" + logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/long" - logFileName = "codegen/blackbox/multiDecl/forRange/long/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multiDecl/forRange/long" + logFileName = "test-result.md" } task codegen_blackbox_multifileClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multifileClasses" - logFileName = "codegen/blackbox/multifileClasses/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multifileClasses" + logFileName = "test-result.md" } task codegen_blackbox_multifileClasses_optimized (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multifileClasses/optimized" - logFileName = "codegen/blackbox/multifileClasses/optimized/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/multifileClasses/optimized" + logFileName = "test-result.md" } task codegen_blackbox_nonLocalReturns (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/nonLocalReturns" - logFileName = "codegen/blackbox/nonLocalReturns/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/nonLocalReturns" + logFileName = "test-result.md" } task codegen_blackbox_objectIntrinsics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/objectIntrinsics" - logFileName = "codegen/blackbox/objectIntrinsics/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/objectIntrinsics" + logFileName = "test-result.md" } task codegen_blackbox_objects (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/objects" - logFileName = "codegen/blackbox/objects/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/objects" + logFileName = "test-result.md" } task codegen_blackbox_operatorConventions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/operatorConventions" - logFileName = "codegen/blackbox/operatorConventions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/operatorConventions" + logFileName = "test-result.md" } task codegen_blackbox_operatorConventions_compareTo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/operatorConventions/compareTo" - logFileName = "codegen/blackbox/operatorConventions/compareTo/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/operatorConventions/compareTo" + logFileName = "test-result.md" } task codegen_blackbox_package (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/package" - logFileName = "codegen/blackbox/package/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/package" + logFileName = "test-result.md" } task codegen_blackbox_platformTypes_primitives (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/platformTypes/primitives" - logFileName = "codegen/blackbox/platformTypes/primitives/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/platformTypes/primitives" + logFileName = "test-result.md" } task codegen_blackbox_primitiveTypes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/primitiveTypes" - logFileName = "codegen/blackbox/primitiveTypes/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/primitiveTypes" + logFileName = "test-result.md" } task codegen_blackbox_private (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/private" - logFileName = "codegen/blackbox/private/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/private" + logFileName = "test-result.md" } task codegen_blackbox_privateConstructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/privateConstructors" - logFileName = "codegen/blackbox/privateConstructors/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/privateConstructors" + logFileName = "test-result.md" } task codegen_blackbox_properties (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/properties" - logFileName = "codegen/blackbox/properties/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/properties" + logFileName = "test-result.md" } task codegen_blackbox_properties_const (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/properties/const" - logFileName = "codegen/blackbox/properties/const/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/properties/const" + logFileName = "test-result.md" } task codegen_blackbox_properties_lateinit (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/properties/lateinit" - logFileName = "codegen/blackbox/properties/lateinit/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/properties/lateinit" + logFileName = "test-result.md" } task codegen_blackbox_publishedApi (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/publishedApi" - logFileName = "codegen/blackbox/publishedApi/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/publishedApi" + logFileName = "test-result.md" } task codegen_blackbox_ranges (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges" - logFileName = "codegen/blackbox/ranges/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges" + logFileName = "test-result.md" } task codegen_blackbox_ranges_contains (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/contains" - logFileName = "codegen/blackbox/ranges/contains/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges/contains" + logFileName = "test-result.md" } task codegen_blackbox_ranges_expression (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/expression" - logFileName = "codegen/blackbox/ranges/expression/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges/expression" + logFileName = "test-result.md" } task codegen_blackbox_ranges_forInDownTo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/forInDownTo" - logFileName = "codegen/blackbox/ranges/forInDownTo/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges/forInDownTo" + logFileName = "test-result.md" } task codegen_blackbox_ranges_forInIndices (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/forInIndices" - logFileName = "codegen/blackbox/ranges/forInIndices/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges/forInIndices" + logFileName = "test-result.md" } task codegen_blackbox_ranges_literal (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/literal" - logFileName = "codegen/blackbox/ranges/literal/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges/literal" + logFileName = "test-result.md" } task codegen_blackbox_ranges_nullableLoopParameter (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/nullableLoopParameter" - logFileName = "codegen/blackbox/ranges/nullableLoopParameter/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/ranges/nullableLoopParameter" + logFileName = "test-result.md" } task codegen_blackbox_reflection_annotations (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/annotations" - logFileName = "codegen/blackbox/reflection/annotations/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/annotations" + logFileName = "test-result.md" } task codegen_blackbox_reflection_call (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/call" - logFileName = "codegen/blackbox/reflection/call/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/call" + logFileName = "test-result.md" } task codegen_blackbox_reflection_call_bound (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/call/bound" - logFileName = "codegen/blackbox/reflection/call/bound/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/call/bound" + logFileName = "test-result.md" } task codegen_blackbox_reflection_callBy (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/callBy" - logFileName = "codegen/blackbox/reflection/callBy/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/callBy" + logFileName = "test-result.md" } task codegen_blackbox_reflection_classes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/classes" - logFileName = "codegen/blackbox/reflection/classes/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/classes" + logFileName = "test-result.md" } task codegen_blackbox_reflection_classLiterals (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/classLiterals" - logFileName = "codegen/blackbox/reflection/classLiterals/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/classLiterals" + logFileName = "test-result.md" } task codegen_blackbox_reflection_constructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/constructors" - logFileName = "codegen/blackbox/reflection/constructors/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/constructors" + logFileName = "test-result.md" } task codegen_blackbox_reflection_createAnnotation (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/createAnnotation" - logFileName = "codegen/blackbox/reflection/createAnnotation/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/createAnnotation" + logFileName = "test-result.md" } task codegen_blackbox_reflection_enclosing (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/enclosing" - logFileName = "codegen/blackbox/reflection/enclosing/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/enclosing" + logFileName = "test-result.md" } task codegen_blackbox_reflection_functions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/functions" - logFileName = "codegen/blackbox/reflection/functions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/functions" + logFileName = "test-result.md" } task codegen_blackbox_reflection_genericSignature (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/genericSignature" - logFileName = "codegen/blackbox/reflection/genericSignature/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/genericSignature" + logFileName = "test-result.md" } task codegen_blackbox_reflection_isInstance (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/isInstance" - logFileName = "codegen/blackbox/reflection/isInstance/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/isInstance" + logFileName = "test-result.md" } task codegen_blackbox_reflection_kClassInAnnotation (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/kClassInAnnotation" - logFileName = "codegen/blackbox/reflection/kClassInAnnotation/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/kClassInAnnotation" + logFileName = "test-result.md" } task codegen_blackbox_reflection_lambdaClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/lambdaClasses" - logFileName = "codegen/blackbox/reflection/lambdaClasses/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/lambdaClasses" + logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping" - logFileName = "codegen/blackbox/reflection/mapping/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/mapping" + logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping_fakeOverrides (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping/fakeOverrides" - logFileName = "codegen/blackbox/reflection/mapping/fakeOverrides/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/mapping/fakeOverrides" + logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping_jvmStatic (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping/jvmStatic" - logFileName = "codegen/blackbox/reflection/mapping/jvmStatic/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/mapping/jvmStatic" + logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping_types (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping/types" - logFileName = "codegen/blackbox/reflection/mapping/types/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/mapping/types" + logFileName = "test-result.md" } task codegen_blackbox_reflection_methodsFromAny (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/methodsFromAny" - logFileName = "codegen/blackbox/reflection/methodsFromAny/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/methodsFromAny" + logFileName = "test-result.md" } task codegen_blackbox_reflection_modifiers (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/modifiers" - logFileName = "codegen/blackbox/reflection/modifiers/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/modifiers" + logFileName = "test-result.md" } task codegen_blackbox_reflection_multifileClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/multifileClasses" - logFileName = "codegen/blackbox/reflection/multifileClasses/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/multifileClasses" + logFileName = "test-result.md" } task codegen_blackbox_reflection_noReflectAtRuntime (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime" - logFileName = "codegen/blackbox/reflection/noReflectAtRuntime/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime" + logFileName = "test-result.md" } task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny" - logFileName = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny" + logFileName = "test-result.md" } task codegen_blackbox_reflection_parameters (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/parameters" - logFileName = "codegen/blackbox/reflection/parameters/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/parameters" + logFileName = "test-result.md" } task codegen_blackbox_reflection_properties (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/properties" - logFileName = "codegen/blackbox/reflection/properties/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/properties" + logFileName = "test-result.md" } task codegen_blackbox_reflection_properties_accessors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/properties/accessors" - logFileName = "codegen/blackbox/reflection/properties/accessors/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/properties/accessors" + logFileName = "test-result.md" } task codegen_blackbox_reflection_specialBuiltIns (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/specialBuiltIns" - logFileName = "codegen/blackbox/reflection/specialBuiltIns/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/specialBuiltIns" + logFileName = "test-result.md" } task codegen_blackbox_reflection_supertypes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/supertypes" - logFileName = "codegen/blackbox/reflection/supertypes/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/supertypes" + logFileName = "test-result.md" } task codegen_blackbox_reflection_typeParameters (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/typeParameters" - logFileName = "codegen/blackbox/reflection/typeParameters/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/typeParameters" + logFileName = "test-result.md" } task codegen_blackbox_reflection_types (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/types" - logFileName = "codegen/blackbox/reflection/types/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/types" + logFileName = "test-result.md" } task codegen_blackbox_reflection_types_createType (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/types/createType" - logFileName = "codegen/blackbox/reflection/types/createType/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/types/createType" + logFileName = "test-result.md" } task codegen_blackbox_reflection_types_subtyping (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/types/subtyping" - logFileName = "codegen/blackbox/reflection/types/subtyping/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reflection/types/subtyping" + logFileName = "test-result.md" } task codegen_blackbox_regressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/regressions" - logFileName = "codegen/blackbox/regressions/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/regressions" + logFileName = "test-result.md" } task codegen_blackbox_reified (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reified" - logFileName = "codegen/blackbox/reified/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reified" + logFileName = "test-result.md" } task codegen_blackbox_reified_arraysReification (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reified/arraysReification" - logFileName = "codegen/blackbox/reified/arraysReification/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/reified/arraysReification" + logFileName = "test-result.md" } task codegen_blackbox_safeCall (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/safeCall" - logFileName = "codegen/blackbox/safeCall/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/safeCall" + logFileName = "test-result.md" } task codegen_blackbox_sam_constructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/sam/constructors" - logFileName = "codegen/blackbox/sam/constructors/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/sam/constructors" + logFileName = "test-result.md" } task codegen_blackbox_sealed (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/sealed" - logFileName = "codegen/blackbox/sealed/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/sealed" + logFileName = "test-result.md" } task codegen_blackbox_secondaryConstructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/secondaryConstructors" - logFileName = "codegen/blackbox/secondaryConstructors/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/secondaryConstructors" + logFileName = "test-result.md" } task codegen_blackbox_smap (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/smap" - logFileName = "codegen/blackbox/smap/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/smap" + logFileName = "test-result.md" } task codegen_blackbox_smartCasts (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/smartCasts" - logFileName = "codegen/blackbox/smartCasts/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/smartCasts" + logFileName = "test-result.md" } task codegen_blackbox_specialBuiltins (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/specialBuiltins" - logFileName = "codegen/blackbox/specialBuiltins/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/specialBuiltins" + logFileName = "test-result.md" } task codegen_blackbox_statics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/statics" - logFileName = "codegen/blackbox/statics/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/statics" + logFileName = "test-result.md" } task codegen_blackbox_storeStackBeforeInline (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/storeStackBeforeInline" - logFileName = "codegen/blackbox/storeStackBeforeInline/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/storeStackBeforeInline" + logFileName = "test-result.md" } task codegen_blackbox_strings (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/strings" - logFileName = "codegen/blackbox/strings/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/strings" + logFileName = "test-result.md" } task codegen_blackbox_super (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/super" - logFileName = "codegen/blackbox/super/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/super" + logFileName = "test-result.md" } task codegen_blackbox_synchronized (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/synchronized" - logFileName = "codegen/blackbox/synchronized/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/synchronized" + logFileName = "test-result.md" } task codegen_blackbox_syntheticAccessors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/syntheticAccessors" - logFileName = "codegen/blackbox/syntheticAccessors/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/syntheticAccessors" + logFileName = "test-result.md" } task codegen_blackbox_toArray (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/toArray" - logFileName = "codegen/blackbox/toArray/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/toArray" + logFileName = "test-result.md" } task codegen_blackbox_topLevelPrivate (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/topLevelPrivate" - logFileName = "codegen/blackbox/topLevelPrivate/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/topLevelPrivate" + logFileName = "test-result.md" } task codegen_blackbox_traits (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/traits" - logFileName = "codegen/blackbox/traits/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/traits" + logFileName = "test-result.md" } task codegen_blackbox_typealias (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/typealias" - logFileName = "codegen/blackbox/typealias/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/typealias" + logFileName = "test-result.md" } task codegen_blackbox_typeInfo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/typeInfo" - logFileName = "codegen/blackbox/typeInfo/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/typeInfo" + logFileName = "test-result.md" } task codegen_blackbox_typeMapping (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/typeMapping" - logFileName = "codegen/blackbox/typeMapping/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/typeMapping" + logFileName = "test-result.md" } task codegen_blackbox_unaryOp (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/unaryOp" - logFileName = "codegen/blackbox/unaryOp/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/unaryOp" + logFileName = "test-result.md" } task codegen_blackbox_unit (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/unit" - logFileName = "codegen/blackbox/unit/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/unit" + logFileName = "test-result.md" } task codegen_blackbox_vararg (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/vararg" - logFileName = "codegen/blackbox/vararg/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/vararg" + logFileName = "test-result.md" } task codegen_blackbox_when (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/when" - logFileName = "codegen/blackbox/when/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/when" + logFileName = "test-result.md" } task codegen_blackbox_when_enumOptimization (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/when/enumOptimization" - logFileName = "codegen/blackbox/when/enumOptimization/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/when/enumOptimization" + logFileName = "test-result.md" } task codegen_blackbox_when_stringOptimization (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/when/stringOptimization" - logFileName = "codegen/blackbox/when/stringOptimization/test-result.md" + dependsOn(createLogFile) + groupDirectory = "codegen/blackbox/when/stringOptimization" + logFileName = "test-result.md" } diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index a1307b6073a..111dfc1ae2e 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -226,7 +226,8 @@ class RunExternalTestGroup extends RunKonanTest { @Override void executeTest() { def logFile = project.file(logFileName) - logFile.write("|Test|Status|Comment|\n|----|------|-------|") + logFile.append("\n$groupDirectory\n\n") + logFile.append("|Test|Status|Comment|\n|----|------|-------|\n") def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() { @Override boolean accept(File pathname) { @@ -262,8 +263,8 @@ class RunExternalTestGroup extends RunKonanTest { skipped++ } println("TEST $status\n") - logFile.append("\n|$it.name|$status|$comment|") + logFile.append("|$it.name|$status|$comment|\n") } - print("TOTAL PASSED: $passed/$current (SKIPPED: $skipped)") + println("TOTAL PASSED: $passed/$current (SKIPPED: $skipped)") } } From 65444ec6909d31e60fc9501b24d5d674398ad830 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 20 Jan 2017 11:20:32 +0700 Subject: [PATCH 22/86] backend: improve type operators support: * add initial support for casts with generics; * optimize out the casts to subtypes Also add tests unchecked_cast{1,2}, the latter is disabled. --- .../kotlin/backend/common/lower/LowerUtils.kt | 28 ++++++------- .../konan/lower/CallableReferenceLowering.kt | 6 +-- .../lower/DefaultParameterStubGenerator.kt | 15 +++---- .../konan/lower/TypeOperatorLowering.kt | 41 ++++++++++++++++--- backend.native/tests/build.gradle | 11 +++++ .../tests/codegen/basics/unchecked_cast1.kt | 16 ++++++++ .../tests/codegen/basics/unchecked_cast2.kt | 10 +++++ 7 files changed, 94 insertions(+), 33 deletions(-) create mode 100644 backend.native/tests/codegen/basics/unchecked_cast1.kt create mode 100644 backend.native/tests/codegen/basics/unchecked_cast2.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt index 3451ad801eb..44c64428ec5 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LowerUtils.kt @@ -18,28 +18,28 @@ import org.jetbrains.kotlin.utils.Printer class IrLoweringContext(backendContext: BackendContext) : IrGeneratorContext(backendContext.irBuiltIns) -class FunctionIrGenerator(backendContext: BackendContext, functionDescriptor: FunctionDescriptor) : IrGeneratorWithScope { - override val context = IrLoweringContext(backendContext) - override val scope = Scope(functionDescriptor) -} +class FunctionIrBuilder(backendContext: BackendContext, functionDescriptor: FunctionDescriptor) : + IrBuilderWithScope( + IrLoweringContext(backendContext), + Scope(functionDescriptor), + UNDEFINED_OFFSET, + UNDEFINED_OFFSET + ) -fun BackendContext.createFunctionIrGenerator(functionDescriptor: FunctionDescriptor) = - FunctionIrGenerator(this, functionDescriptor) +fun BackendContext.createFunctionIrBuilder(functionDescriptor: FunctionDescriptor) = + FunctionIrBuilder(this, functionDescriptor) -class FunctionIrBuilder(context: IrLoweringContext, scope: Scope, startOffset: Int, endOffset: Int) : - IrBuilderWithScope(context, scope, startOffset, endOffset) - -fun FunctionIrGenerator.createIrBuilder() = FunctionIrBuilder(context, scope, UNDEFINED_OFFSET, UNDEFINED_OFFSET) +fun T.at(element: IrElement) = this.at(element.startOffset, element.endOffset) /** * Builds [IrBlock] to be used instead of given expression. */ -inline fun FunctionIrGenerator.irBlock(expression: IrExpression, origin: IrStatementOrigin? = null, - resultType: KotlinType? = expression.type, - body: IrBlockBuilder.() -> Unit) = +inline fun IrGeneratorWithScope.irBlock(expression: IrExpression, origin: IrStatementOrigin? = null, + resultType: KotlinType? = expression.type, + body: IrBlockBuilder.() -> Unit) = this.irBlock(expression.startOffset, expression.endOffset, origin, resultType, body) -inline fun FunctionIrGenerator.irBlockBody(irElement: IrElement, body: IrBlockBodyBuilder.() -> Unit) = +inline fun IrGeneratorWithScope.irBlockBody(irElement: IrElement, body: IrBlockBodyBuilder.() -> Unit) = this.irBlockBody(irElement.startOffset, irElement.endOffset, body) fun computeOverrides(current: ClassDescriptor, functionsFromCurrent: List): List { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/CallableReferenceLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/CallableReferenceLowering.kt index f110aeb70f1..2a4d7b34382 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/CallableReferenceLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/CallableReferenceLowering.kt @@ -1,7 +1,7 @@ package org.jetbrains.kotlin.backend.konan.lower import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass -import org.jetbrains.kotlin.backend.common.lower.createFunctionIrGenerator +import org.jetbrains.kotlin.backend.common.lower.createFunctionIrBuilder import org.jetbrains.kotlin.backend.konan.* import org.jetbrains.kotlin.backend.konan.descriptors.* import org.jetbrains.kotlin.backend.konan.ir.* @@ -136,8 +136,8 @@ private class CallableReferencesUnbinder(val lower: CallableReferenceLowering, // Create new function descriptor: val newDescriptor = createSimpleFunctionImplTargetDescriptor(descriptor, unboundParams) - val generator = lower.context.createFunctionIrGenerator(newDescriptor) - val blockBody = generator.irBlockBody(startOffset, endOffset) { + val builder = lower.context.createFunctionIrBuilder(newDescriptor) + val blockBody = builder.irBlockBody(startOffset, endOffset) { val boundArgsGet = irCall(simpleFunctionImplBoundArgsGetter).apply { dispatchReceiver = irGet(newDescriptor.valueParameters[0]) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt index ae8a6f3fc75..0943c6f0bde 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt @@ -2,8 +2,8 @@ package org.jetbrains.kotlin.backend.konan.lower import org.jetbrains.kotlin.backend.common.BodyLoweringPass import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass -import org.jetbrains.kotlin.backend.common.lower.createFunctionIrGenerator -import org.jetbrains.kotlin.backend.common.lower.createIrBuilder +import org.jetbrains.kotlin.backend.common.lower.createFunctionIrBuilder +import org.jetbrains.kotlin.backend.common.lower.irBlockBody import org.jetbrains.kotlin.backend.konan.Context import org.jetbrains.kotlin.backend.konan.KonanPlatform import org.jetbrains.kotlin.builtins.KotlinBuiltIns @@ -61,14 +61,9 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): val functionDescriptor = irFunction.descriptor if (bodies.isNotEmpty()) { - val (descriptor, mask, extension, dispatch) = functionDescriptor.generateDefaultsDescriptor() - val generator = context.createFunctionIrGenerator(descriptor) - val builder = generator.createIrBuilder() - builder.apply { - startOffset = irFunction.startOffset - endOffset = irFunction.endOffset - } - val body = generator.irBlockBody { + val (descriptor, mask, extension, dispatch) = functionDescriptor.generateDefaultsDescriptor() + val builder = context.createFunctionIrBuilder(descriptor) + val body = builder.irBlockBody(irFunction) { val params = mutableListOf() val variables = mutableMapOf() diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt index 3c6b574f764..84dbbe15e9d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt @@ -1,10 +1,10 @@ package org.jetbrains.kotlin.backend.konan.lower import org.jetbrains.kotlin.backend.common.FunctionLoweringPass -import org.jetbrains.kotlin.backend.common.lower.createFunctionIrGenerator -import org.jetbrains.kotlin.backend.common.lower.irBlock +import org.jetbrains.kotlin.backend.common.lower.* import org.jetbrains.kotlin.backend.konan.Context import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.declarations.IrFunction @@ -13,6 +13,8 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperator import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf /** * This lowering pass lowers some [IrTypeOperatorCall]s. @@ -27,19 +29,45 @@ internal class TypeOperatorLowering(val context: Context) : FunctionLoweringPass private class TypeOperatorTransformer(val context: Context, val function: FunctionDescriptor) : IrElementTransformerVoid() { - private val generator = context.createFunctionIrGenerator(function) + private val builder = context.createFunctionIrBuilder(function) override fun visitFunction(declaration: IrFunction): IrStatement { // ignore inner functions during this pass return declaration } + private tailrec fun KotlinType.erasure(): KotlinType { + val descriptor = this.constructor.declarationDescriptor + return if (descriptor is TypeParameterDescriptor) { + val upperBound = descriptor.upperBounds.singleOrNull() ?: + TODO("$descriptor : ${descriptor.upperBounds}") + + upperBound.erasure() + } else { + this + } + } + + private fun lowerCast(expression: IrTypeOperatorCall): IrExpression { + val typeOperand = expression.typeOperand.erasure() + return if (expression.argument.type.isSubtypeOf(typeOperand)) { + // TODO: consider the case when expression type is wrong e.g. due to generics-related unchecked casts. + expression.argument + } else if (typeOperand == expression.typeOperand) { + expression + } else { + builder.at(expression).irAs(expression.argument, typeOperand) + } + } + private fun lowerSafeCast(expression: IrTypeOperatorCall): IrExpression { - return generator.irBlock(expression) { + val typeOperand = expression.typeOperand.erasure() + + return builder.irBlock(expression) { +irLet(expression.argument) { variable -> irIfThenElse(expression.type, - condition = irIs(irGet(variable), expression.typeOperand), - thenPart = irImplicitCast(irGet(variable), expression.typeOperand), + condition = irIs(irGet(variable), typeOperand), + thenPart = irImplicitCast(irGet(variable), typeOperand), elsePart = irNull()) } } @@ -50,6 +78,7 @@ private class TypeOperatorTransformer(val context: Context, val function: Functi return when (expression.operator) { IrTypeOperator.SAFE_CAST -> lowerSafeCast(expression) + IrTypeOperator.CAST -> lowerCast(expression) else -> expression } } diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 1ee692920fa..2862fd98bdd 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -208,6 +208,17 @@ task cast_simple(type: RunKonanTest) { source = "codegen/basics/cast_simple.kt" } +task unchecked_cast1(type: RunKonanTest) { + goldValue = "17\n17\n42\n42\n" + source = "codegen/basics/unchecked_cast1.kt" +} + +task unchecked_cast2(type: RunKonanTest) { + disabled = true + goldValue = "Ok\n" + source = "codegen/basics/unchecked_cast2.kt" +} + task null_check(type: RunKonanTest) { source = "codegen/basics/null_check.kt" } diff --git a/backend.native/tests/codegen/basics/unchecked_cast1.kt b/backend.native/tests/codegen/basics/unchecked_cast1.kt new file mode 100644 index 00000000000..1cb92d6b866 --- /dev/null +++ b/backend.native/tests/codegen/basics/unchecked_cast1.kt @@ -0,0 +1,16 @@ +fun main(args: Array) { + foo("17") + bar("17") + foo(42) + bar(42) +} + +fun foo(x: Any?) { + val y = x as T + println(y.toString()) +} + +fun bar(x: Any?) { + val y = x as? T + println(y.toString()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/unchecked_cast2.kt b/backend.native/tests/codegen/basics/unchecked_cast2.kt new file mode 100644 index 00000000000..ffde9b02e41 --- /dev/null +++ b/backend.native/tests/codegen/basics/unchecked_cast2.kt @@ -0,0 +1,10 @@ +fun main(args: Array) { + try { + val x = cast(Any()) + println(x.length) + } catch (e: Throwable) { + println("Ok") + } +} + +fun cast(x: Any?) = x as T \ No newline at end of file From 0958d32605118edfb704a07e5fe35dd36f0bb833 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 13 Jan 2017 16:57:04 +0700 Subject: [PATCH 23/86] backend: improve typealias support: * handle TypeAliasConstructorDescriptor in codegen * ignore ignore typealias declaration in codegen Also add test 'typealias1'. --- .../kotlin/backend/konan/llvm/ContextUtils.kt | 4 ++++ .../kotlin/backend/konan/llvm/IrToBitcode.kt | 14 ++++++++++---- backend.native/tests/build.gradle | 5 +++++ backend.native/tests/codegen/basics/typealias1.kt | 6 ++++++ 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 backend.native/tests/codegen/basics/typealias1.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index fc0f65ee207..1724d7e1dc6 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.konan.descriptors.vtableSize import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.IrField import org.jetbrains.kotlin.ir.declarations.IrProperty @@ -102,6 +103,9 @@ internal interface ContextUtils { val FunctionDescriptor.llvmFunction: LLVMValueRef get() { assert (this.kind.isReal) + if (this is TypeAliasConstructorDescriptor) { + return this.underlyingConstructorDescriptor.llvmFunction + } val globalName = this.symbolName val module = context.llvmModule diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index fea79580d6f..061294d1616 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -587,6 +587,12 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid //-------------------------------------------------------------------------// + override fun visitTypeAlias(declaration: IrTypeAlias) { + // Nothing to do. + } + + //-------------------------------------------------------------------------// + override fun visitProperty(declaration: IrProperty) { declaration.acceptChildrenVoid(this) } @@ -1663,7 +1669,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid when (descriptor) { is IrBuiltinOperatorDescriptorBase -> return evaluateOperatorCall (callee, args) - is ClassConstructorDescriptor -> return evaluateConstructorCall (callee, args) + is ConstructorDescriptor -> return evaluateConstructorCall (callee, args) else -> return evaluateSimpleFunctionCall(descriptor, args) } } @@ -1728,10 +1734,10 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid private fun evaluateConstructorCall(callee: IrCall, args: List): LLVMValueRef { context.log("evaluateConstructorCall : ${ir2string(callee)}") memScoped { - val containingClass = (callee.descriptor as ClassConstructorDescriptor).containingDeclaration - val typeInfo = codegen.typeInfoValue(containingClass) + val constructedClass = (callee.descriptor as ConstructorDescriptor).constructedClass + val typeInfo = codegen.typeInfoValue(constructedClass) val allocHint = Int32(1).llvm - val thisValue = if (containingClass.isArray) { + val thisValue = if (constructedClass.isArray) { assert(args.size >= 1 && args[0].type == int32Type) val allocArrayInstanceArgs = listOf(typeInfo, allocHint, args[0]) call(context.llvm.allocArrayFunction, allocArrayInstanceArgs) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 2862fd98bdd..99331dfdbae 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -143,6 +143,11 @@ task safe_cast(type: RunKonanTest) { source = "codegen/basics/safe_cast.kt" } +task typealias1(type: RunKonanTest) { + goldValue = "42\n" + source = "codegen/basics/typealias1.kt" +} + task aritmetic(type: RunKonanTest) { source = "codegen/function/arithmetic.kt" } diff --git a/backend.native/tests/codegen/basics/typealias1.kt b/backend.native/tests/codegen/basics/typealias1.kt new file mode 100644 index 00000000000..b7d93d724ff --- /dev/null +++ b/backend.native/tests/codegen/basics/typealias1.kt @@ -0,0 +1,6 @@ +fun main(args: Array) { + println(Bar(42).x) +} + +class Foo(val x: Int) +typealias Bar = Foo \ No newline at end of file From 1f7738e052cd3d8e6d6e1e9571efa3b1a9de27c1 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 20 Jan 2017 18:40:24 +0700 Subject: [PATCH 24/86] backend: fix minor bug in evaluateWhen Also add the corresponding test 'when9'. --- .../jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 9 +++++++-- backend.native/tests/build.gradle | 5 +++++ backend.native/tests/codegen/branching/when9.kt | 10 ++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 backend.native/tests/codegen/branching/when9.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 061294d1616..757a49345f3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1151,9 +1151,13 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid if (!isNothing) // If "when" has "exit". bbExit = codegen.basicBlock() // Create basic block to process "exit". - val resultPhi = if (isUnit || isNothing) null else + val hasNoValue = !isUnconditional(expression.branches.last()) + // (It is possible if IrWhen is used as statement). + + val llvmType = codegen.getLLVMType(expression.type) + val resultPhi = if (isUnit || isNothing || hasNoValue) null else codegen.appendingTo(bbExit!!) { - codegen.phi(codegen.getLLVMType(expression.type)) + codegen.phi(llvmType) } expression.branches.forEach { // Iterate through "when" branches (clauses). @@ -1167,6 +1171,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid // FIXME: remove the hacks. isUnit -> codegen.theUnitInstanceRef.llvm isNothing -> codegen.kNothingFakeValue + hasNoValue -> LLVMGetUndef(llvmType)!! else -> resultPhi!! } } diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 99331dfdbae..2fd9aecb9f4 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -330,6 +330,11 @@ task when8(type: RunKonanTest) { goldValue = "true\n" } +task when9(type: RunKonanTest) { + goldValue = "Ok\n" + source = "codegen/branching/when9.kt" +} + task when_through(type: RunKonanTest) { source = "codegen/branching/when_through.kt" } diff --git a/backend.native/tests/codegen/branching/when9.kt b/backend.native/tests/codegen/branching/when9.kt new file mode 100644 index 00000000000..02ad49de4c8 --- /dev/null +++ b/backend.native/tests/codegen/branching/when9.kt @@ -0,0 +1,10 @@ +fun main(args: Array) { + foo(0) + println("Ok") +} + +fun foo(x: Int) { + when (x) { + 0 -> 0 + } +} \ No newline at end of file From d31b44135a774680a125553ed0fa082b7fb58526 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 20 Jan 2017 19:03:54 +0300 Subject: [PATCH 25/86] Temporary disable inlining. --- .../src/org/jetbrains/kotlin/backend/konan/KonanLower.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index 16b9031c6c7..cb9a3b4660e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -40,7 +40,7 @@ internal class KonanLower(val context: Context) { Autoboxing(context).lower(irFile) } phaser.phase(KonanPhase.LOWER_INLINE) { - FunctionInlining(context).inline(irFile) + //FunctionInlining(context).inline(irFile) } } } From afaa50ce3444efd4c4305eda1ffecaf8bcfe26b3 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 13 Jan 2017 16:38:40 +0300 Subject: [PATCH 26/86] Introduced -target and -list_targets flags. Use it like $ konanc hello.kt -target iphone --- backend.native/build.gradle | 65 +++++----- .../org/jetbrains/kotlin/cli/bc/K2Native.kt | 12 +- .../cli/bc/K2NativeCompilerArguments.java | 7 ++ .../kotlin/backend/konan/Distribution.kt | 62 +++++----- .../kotlin/backend/konan/KonanConfig.kt | 4 +- .../backend/konan/KonanConfigurationKeys.kt | 56 +++++---- .../kotlin/backend/konan/KonanDriver.kt | 8 ++ .../kotlin/backend/konan/KonanProperties.kt | 5 +- .../kotlin/backend/konan/KonanTarget.kt | 104 ++++++++++++++++ .../kotlin/backend/konan/LinkStage.kt | 107 +++++++++-------- .../kotlin/backend/konan/llvm/ContextUtils.kt | 2 +- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 5 + backend.native/konan.properties | 21 +++- build.gradle | 111 +++++++----------- .../jetbrains/kotlin/CompileToBitcode.groovy | 77 +++++++++++- .../org/jetbrains/kotlin/ExecClang.groovy | 4 +- .../org/jetbrains/kotlin/KonanTest.groovy | 9 -- .../kotlin/NativeInteropPlugin.groovy | 4 +- common/build.gradle | 7 +- dependencies/build.gradle | 19 +-- runtime/build.gradle | 19 +-- 21 files changed, 458 insertions(+), 250 deletions(-) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt diff --git a/backend.native/build.gradle b/backend.native/build.gradle index 5282e10d4af..297ac48ad09 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -182,47 +182,58 @@ dependencies { build.dependsOn 'compilerClasses','cli_bcClasses','bc_frontendClasses' + +// These are just a couple of aliases +task stdlib(dependsOn: 'hostStdlib') +task start(dependsOn: 'hostStart') + // These files are built before the 'dist' is complete, // so we provide custom values for // -runtime, -properties, -library and -Djava.library.path -task stdlib(type: JavaExec) { - main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' - classpath = project.configurations.cli_bc - jvmArgs "-ea", - "-Dkonan.home=${project.parent.file('dist')}", - "-Djava.library.path=${project.buildDir}/nativelibs" - args('-output', project(':runtime').file('build/stdlib.kt.bc'), - '-nolink', '-nostdlib', - '-runtime', project(':runtime').file('build/runtime.bc'), - '-properties', project(':backend.native').file('konan.properties'), +targetList.each { platformName -> + task("${platformName}Stdlib", type: JavaExec) { + main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' + classpath = project.configurations.cli_bc + jvmArgs "-ea", + "-Dkonan.home=${project.parent.file('dist')}", + "-Djava.library.path=${project.buildDir}/nativelibs" + args('-output', project(':runtime').file("build/${platformName}/stdlib.kt.bc"), + '-nolink', '-nostdlib', + '-target', platformName, + '-runtime', project(':runtime').file("build/${platformName}/runtime.bc"), + '-properties', project(':backend.native').file('konan.properties'), project(':runtime').file('src/main/kotlin'), *project.globalArgs) - inputs.dir(project(':runtime').file('src/main/kotlin')) - outputs.file(project(':runtime').file('build/stdlib.kt.bc')) + inputs.dir(project(':runtime').file('src/main/kotlin')) + outputs.file(project(':runtime').file("build/${platformName}/stdlib.kt.bc")) - dependsOn ':runtime:build' + dependsOn ":runtime:build" + } } -task start(type: JavaExec) { - main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' - classpath = project.configurations.cli_bc - jvmArgs "-ea", - "-Dkonan.home=${project.parent.file('dist')}", - "-Djava.library.path=${project.buildDir}/nativelibs" - args('-output', project(':runtime').file('build/start.kt.bc'), - '-nolink', '-nostdlib', - '-library', project(':runtime').file('build/stdlib.kt.bc'), - '-runtime', project(':runtime').file('build/runtime.bc'), - '-properties', project(':backend.native').file('konan.properties'), +targetList.each { platformName -> + task("${platformName}Start", type: JavaExec) { + main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' + classpath = project.configurations.cli_bc + jvmArgs "-ea", + "-Dkonan.home=${project.parent.file('dist')}", + "-Djava.library.path=${project.buildDir}/nativelibs" + args('-output', project(':runtime').file("build/${platformName}/start.kt.bc"), + '-nolink', '-nostdlib', + '-target', platformName, + '-library', project(':runtime').file("build/${platformName}/stdlib.kt.bc"), + '-runtime', project(':runtime').file("build/${platformName}/runtime.bc"), + '-properties', project(':backend.native').file('konan.properties'), project(':runtime').file('src/launcher/kotlin'), *project.globalArgs) - inputs.dir(project(':runtime').file('src/launcher/kotlin')) - outputs.file(project(':runtime').file('build/start.kt.bc')) + inputs.dir(project(':runtime').file('src/launcher/kotlin')) + outputs.file(project(':runtime').file("build/${platformName}/start.kt.bc")) - dependsOn ':runtime:build', 'stdlib' + dependsOn ":runtime:build", "${platformName}Stdlib" + } } task run { diff --git a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt index 96dffefe77f..0b906b0c73d 100644 --- a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt +++ b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt @@ -77,11 +77,13 @@ class K2Native : CLICompiler() { put(EXECUTABLE_FILE, arguments.outputFile ?: "program.kexe") - put(RUNTIME_FILE, - arguments.runtimeFile ?: Distribution.runtime) - put(PROPERTY_FILE, - arguments.propertyFile ?: Distribution.propertyFile) - + if (arguments.runtimeFile != null) + put(RUNTIME_FILE, arguments.runtimeFile) + if (arguments.propertyFile != null) + put(PROPERTY_FILE, arguments.propertyFile) + if (arguments.target != null) + put(TARGET, arguments.target) + put(LIST_TARGETS, arguments.listTargets) put(OPTIMIZATION, arguments.optimization) put(PRINT_IR, arguments.printIr) diff --git a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.java b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.java index ac125d346b7..a5904a15c8d 100644 --- a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.java +++ b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.java @@ -30,6 +30,13 @@ public class K2NativeCompilerArguments extends CommonCompilerArguments { @Argument(value = "opt", description = "Enable optimizations during compilation") public boolean optimization; + @Argument(value = "target", description = "Set hardware target") + @ValueDescription("") + public String target; + + @Argument(value = "list_targets", description = "List available hardware targets") + public boolean listTargets; + @Argument(value = "print_ir", description = "Print IR") public boolean printIr; diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt index 789bc0f7109..455eb396c92 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt @@ -1,36 +1,42 @@ package org.jetbrains.kotlin.backend.konan +import org.jetbrains.kotlin.config.CompilerConfiguration import java.io.File import java.util.Properties -public class Distribution(val properties: KonanProperties, - val os: String, val target: String) { +public class Distribution(val config: CompilerConfiguration) { - companion object { + val targetManager = TargetManager(config) + val target = + if (!targetManager.crossCompile) "host" + else targetManager.current.name.toLowerCase() + val suffix = targetManager.currentSuffix() - private fun findKonanHome(): String { - val value = System.getProperty("konan.home", "dist") - val path = File(value).absolutePath - return path - } - - val konanHome = findKonanHome() - val propertyFile = "$konanHome/konan/konan.properties" - - val lib = "$konanHome/lib" - - // TODO: Pack all needed things to dist. - val dependencies = "$konanHome/../dependencies/all" - - val start = "$lib/start.kt.bc" - val stdlib = "$lib/stdlib.kt.bc" - val runtime = "$lib/runtime.bc" - val launcher = "$lib/launcher.bc" + private fun findKonanHome(): String { + val value = System.getProperty("konan.home", "dist") + val path = File(value).absolutePath + return path } - val llvmHome = "$dependencies/${properties.propertyString("llvmHome.$os")}" - val sysRoot = "$dependencies/${properties.propertyString("sysRoot.$os")}" - val libGcc = "$dependencies/${properties.propertyString("libGcc.$os")}" + val konanHome = findKonanHome() + val propertyFile = config.get(KonanConfigKeys.PROPERTY_FILE) + ?: "$konanHome/konan/konan.properties" + val properties = KonanProperties(propertyFile) + + val lib = "$konanHome/lib/$target" + + // TODO: Pack all needed things to dist. + val dependencies = "$konanHome/../dependencies/all" + + val stdlib = "$lib/stdlib.kt.bc" + val start = "$lib/start.kt.bc" + val launcher = "$lib/launcher.bc" + val runtime = config.get(KonanConfigKeys.RUNTIME_FILE) + ?: "$lib/runtime.bc" + + val llvmHome = "$dependencies/${properties.propertyString("llvmHome.$suffix")}" + val sysRoot = "$dependencies/${properties.propertyString("sysRoot.$suffix")}" + val libGcc = "$dependencies/${properties.propertyString("libGcc.$suffix")}" val llvmBin = "$llvmHome/bin" val llvmLib = "$llvmHome/lib" @@ -40,9 +46,9 @@ public class Distribution(val properties: KonanProperties, val llvmLto = "$llvmBin/llvm-lto" val llvmLink = "$llvmBin/llvm-link" val libCppAbi = "$llvmLib/libc++abi.a" - val libLTO = when (os) { - "osx" -> "$llvmLib/libLTO.dylib" - "linux" -> "$llvmLib/libLTO.so" - else -> error("Don't know libLTO location for the platform.") + val libLTO = when (TargetManager.host) { + KonanTarget.MACBOOK -> "$llvmLib/libLTO.dylib" + KonanTarget.LINUX -> "$llvmLib/libLTO.so" + else -> error("Don't know libLTO location for this platform.") } } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt index faae3d2d54c..53b8fe550ea 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt @@ -16,13 +16,15 @@ import java.io.File class KonanConfig(val project: Project, val configuration: CompilerConfiguration) { + internal val distribution = Distribution(configuration) + internal val libraries: List get() { val fromCommandLine = configuration.getList(KonanConfigKeys.LIBRARY_FILES) if (configuration.get(KonanConfigKeys.NOSTDLIB) ?: false) { return fromCommandLine } - return fromCommandLine + Distribution.stdlib + return fromCommandLine + distribution.stdlib } private val loadedDescriptors = loadLibMetadata(libraries) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt index 95ca1afc425..97af9c0eef5 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt @@ -1,60 +1,64 @@ -package org.jetbrains.kotlin.backend.konan; +package org.jetbrains.kotlin.backend.konan -import org.jetbrains.kotlin.config.CompilerConfigurationKey; -import org.jetbrains.kotlin.serialization.js.ModuleKind; +import org.jetbrains.kotlin.config.CompilerConfigurationKey +import org.jetbrains.kotlin.serialization.js.ModuleKind class KonanConfigKeys { companion object { val LIBRARY_FILES: CompilerConfigurationKey> - = CompilerConfigurationKey.create("library file paths"); + = CompilerConfigurationKey.create("library file paths") val BITCODE_FILE: CompilerConfigurationKey - = CompilerConfigurationKey.create("emitted bitcode file path"); + = CompilerConfigurationKey.create("emitted bitcode file path") val EXECUTABLE_FILE: CompilerConfigurationKey - = CompilerConfigurationKey.create("final executable file path"); + = CompilerConfigurationKey.create("final executable file path") val RUNTIME_FILE: CompilerConfigurationKey - = CompilerConfigurationKey.create("override default runtime file path"); + = CompilerConfigurationKey.create("override default runtime file path") val PROPERTY_FILE: CompilerConfigurationKey - = CompilerConfigurationKey.create("override default property file path"); + = CompilerConfigurationKey.create("override default property file path") val ABI_VERSION: CompilerConfigurationKey - = CompilerConfigurationKey.create("current abi version"); + = CompilerConfigurationKey.create("current abi version") val OPTIMIZATION: CompilerConfigurationKey - = CompilerConfigurationKey.create("optimized compilation"); + = CompilerConfigurationKey.create("optimized compilation") val NOSTDLIB: CompilerConfigurationKey - = CompilerConfigurationKey.create("don't link with stdlib"); + = CompilerConfigurationKey.create("don't link with stdlib") val NOLINK: CompilerConfigurationKey - = CompilerConfigurationKey.create("don't link, only produce a bitcode file "); + = CompilerConfigurationKey.create("don't link, only produce a bitcode file ") + val TARGET: CompilerConfigurationKey + = CompilerConfigurationKey.create("target we compile for") + val LIST_TARGETS: CompilerConfigurationKey + = CompilerConfigurationKey.create("list available targets") val SOURCE_MAP: CompilerConfigurationKey> - = CompilerConfigurationKey.create("generate source map"); + = CompilerConfigurationKey.create("generate source map") val META_INFO: CompilerConfigurationKey> - = CompilerConfigurationKey.create("generate metadata"); + = CompilerConfigurationKey.create("generate metadata") val MODULE_KIND: CompilerConfigurationKey - = CompilerConfigurationKey.create("module kind"); + = CompilerConfigurationKey.create("module kind") val VERIFY_IR: CompilerConfigurationKey - = CompilerConfigurationKey.create("verify ir"); + = CompilerConfigurationKey.create("verify ir") val VERIFY_DESCRIPTORS: CompilerConfigurationKey - = CompilerConfigurationKey.create("verify descriptors"); + = CompilerConfigurationKey.create("verify descriptors") val VERIFY_BITCODE: CompilerConfigurationKey - = CompilerConfigurationKey.create("verify bitcode"); + = CompilerConfigurationKey.create("verify bitcode") val PRINT_IR: CompilerConfigurationKey - = CompilerConfigurationKey.create("print ir"); + = CompilerConfigurationKey.create("print ir") val PRINT_DESCRIPTORS: CompilerConfigurationKey - = CompilerConfigurationKey.create("print descriptors"); + = CompilerConfigurationKey.create("print descriptors") val PRINT_BITCODE: CompilerConfigurationKey - = CompilerConfigurationKey.create("print bitcode"); + = CompilerConfigurationKey.create("print bitcode") val ENABLED_PHASES: CompilerConfigurationKey> - = CompilerConfigurationKey.create("enable backend phases"); + = CompilerConfigurationKey.create("enable backend phases") val DISABLED_PHASES: CompilerConfigurationKey> - = CompilerConfigurationKey.create("disable backend phases"); + = CompilerConfigurationKey.create("disable backend phases") val VERBOSE_PHASES: CompilerConfigurationKey> - = CompilerConfigurationKey.create("verbose backend phases"); + = CompilerConfigurationKey.create("verbose backend phases") val LIST_PHASES: CompilerConfigurationKey - = CompilerConfigurationKey.create("list backend phases"); + = CompilerConfigurationKey.create("list backend phases") val TIME_PHASES: CompilerConfigurationKey - = CompilerConfigurationKey.create("time backend phases"); + = CompilerConfigurationKey.create("time backend phases") } } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt index ad78da2e2da..af83087103e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.config.CommonConfigurationKeys import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.config.kotlinSourceRoots import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.psi2ir.Psi2IrConfiguration @@ -35,11 +36,18 @@ public fun runTopLevelPhases(konanConfig: KonanConfig, environment: KotlinCoreEn val config = konanConfig.configuration + val targets = TargetManager(config) + if (config.get(KonanConfigKeys.LIST_TARGETS) ?: false) { + targets.list() + } + KonanPhases.config(konanConfig) if (config.get(KonanConfigKeys.LIST_PHASES) ?: false) { KonanPhases.list() } + if (config.kotlinSourceRoots.isEmpty()) return + val collector = config.getNotNull( CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanProperties.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanProperties.kt index e8770ee8887..4dbc1996d4c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanProperties.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanProperties.kt @@ -1,15 +1,14 @@ package org.jetbrains.kotlin.backend.konan -import org.jetbrains.kotlin.config.CompilerConfiguration import java.io.File import java.util.Properties -public class KonanProperties(config: CompilerConfiguration) { +public class KonanProperties(val propertyFile: String) { val properties = Properties() init { - val file = File(config.get(KonanConfigKeys.PROPERTY_FILE)) + val file = File(propertyFile) file.bufferedReader()?.use { reader -> properties.load(reader) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt new file mode 100644 index 00000000000..fca55c6824d --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt @@ -0,0 +1,104 @@ +package org.jetbrains.kotlin.backend.konan + +import org.jetbrains.kotlin.config.CommonConfigurationKeys +import org.jetbrains.kotlin.config.CompilerConfiguration + +enum class KonanTarget(var enabled: Boolean = false) { + IPHONE(), + IPHONE_SIM(), + LINUX(), + MACBOOK() +} + +class TargetManager(val config: CompilerConfiguration) { + val targets = KonanTarget.values().associate{ it.name.toLowerCase() to it } + val current = determineCurrent() + + init { + when (host) { + KonanTarget.MACBOOK -> KonanTarget.MACBOOK.enabled = true + KonanTarget.LINUX -> KonanTarget.LINUX.enabled = true + } + KonanTarget.IPHONE.enabled = true + KonanTarget.IPHONE_SIM.enabled = true + + if (!current.enabled) { + error("Target $current is not available on the current host") + } + } + + fun known(name: String): String { + if (targets[name] == null) { + error("Unknown target: $name. Use -list_targets to see the list of available targets") + } + return name!! + } + + fun list() { + targets.forEach { key, target -> + if (target.enabled) { + val isDefault = if (target == current) "(default)" else "" + println(String.format("%1$-30s%2$-10s", "$key:", "$isDefault")) + } + } + } + + fun determineCurrent(): KonanTarget { + val userRequest = config.get(KonanConfigKeys.TARGET) + return if (userRequest == null || userRequest == "host") { + host + } else { + targets[known(userRequest)]!! + } + } + + fun currentSuffix(): String { + if (host == KonanTarget.MACBOOK) { + when (current) { + KonanTarget.MACBOOK -> return("osx") + KonanTarget.IPHONE -> return("osx-ios") + KonanTarget.IPHONE_SIM -> return("osx-ios-sim") + else -> error("Impossible combination of $host and $current") + } + } + if (host == KonanTarget.LINUX) { + when (current) { + KonanTarget.LINUX -> return("linux") + KonanTarget.IPHONE -> return("linux-ios") + KonanTarget.IPHONE_SIM -> return("linux-ios-sim") + else -> error("Impossible combination of $host and $current") + } + } + error("Unknown host target $host)") + } + + companion object { + fun host_os(): String { + val javaOsName = System.getProperty("os.name") + return when (javaOsName) { + "Mac OS X" -> "osx" + "Linux" -> "linux" + else -> error("Unknown operating system: ${javaOsName}") + } + } + + fun host_arch(): String { + val javaArch = System.getProperty("os.arch") + return when (javaArch) { + "x86_64" -> "x86_64" + "amd64" -> "x86_64" + "arm64" -> "arm64" + else -> error("Unknown hardware platform: ${javaArch}") + } + } + + val host: KonanTarget = when (host_os()) { + "osx" -> KonanTarget.MACBOOK + "linux" -> KonanTarget.LINUX + else -> error("Unknown host target: ${host_os()} ${host_arch()}") + } + } + + val crossCompile = (host != current) +} + diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt index 5e5a3384db7..eff3e808dd9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt @@ -10,8 +10,8 @@ typealias ExecutableFile = String // Use "clang -v -save-temps" to write linkCommand() method // for another implementation of this class. -internal abstract class PlatformFlags(val distrib: Distribution, - val properties: KonanProperties) { +internal abstract class PlatformFlags(val distribution: Distribution) { + val properties = distribution.properties abstract val llvmLtoFlags: List abstract val llvmLlcFlags: List @@ -25,8 +25,8 @@ internal abstract class PlatformFlags(val distrib: Distribution, } -internal class MacOSPlatform(distrib: Distribution, - properties: KonanProperties) : PlatformFlags(distrib, properties) { +internal open class MacOSPlatform(distribution: Distribution) + : PlatformFlags(distribution) { override val llvmLtoFlags = properties.propertyList("llvmLtoFlags.osx") override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.osx") @@ -34,28 +34,41 @@ internal class MacOSPlatform(distrib: Distribution, override val linkerOptimizationFlags = properties.propertyList("linkerOptimizationFlags.osx") override val linkerKonanFlags = properties.propertyList("linkerKonanFlags.osx") - override val linker = "${distrib.sysRoot}/usr/bin/ld" + override val linker = "${distribution.sysRoot}/usr/bin/ld" + + open val arch = properties.propertyString("arch.osx")!! + open val osVersionMin = properties.propertyList("osVersionMin.osx") + + open val sysRoot = distribution.sysRoot + open val targetSysRoot = sysRoot + open val llvmLib = distribution.llvmLib override fun linkCommand(objectFiles: List, executable: String, optimize: Boolean): List { - val sysRoot = distrib.sysRoot - val llvmLib = distrib.llvmLib - return mutableListOf(linker, "-demangle") + - if (optimize) listOf("-object_path_lto", "temporary.o", "-lto_library", distrib.libLTO) else {listOf()} + - listOf( "-dynamic", "-arch", "x86_64", "-macosx_version_min") + - properties.propertyList("macosVersionMin.osx") + - listOf("-syslibroot", "$sysRoot", + if (optimize) listOf("-object_path_lto", "temporary.o", "-lto_library", distribution.libLTO) else {listOf()} + + listOf( "-dynamic", "-arch", arch) + + osVersionMin + + listOf("-syslibroot", "$targetSysRoot", "-o", executable) + objectFiles + if (optimize) linkerOptimizationFlags else {listOf()} + linkerKonanFlags + - listOf("-lSystem", "$llvmLib/clang/3.8.0/lib/darwin/libclang_rt.osx.a") + listOf("-lSystem") } } -internal class LinuxPlatform(distrib: Distribution, - properties: KonanProperties) : PlatformFlags(distrib, properties) { +internal class IPhoneOSfromMacOSPlatform(distribution: Distribution) + : MacOSPlatform(distribution) { + + override val arch = properties.propertyString("arch.osx-ios")!! + override val osVersionMin = properties.propertyList("osVersionMin.osx-ios") + override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.osx-ios") + override val targetSysRoot = "${distribution.dependencies}/${properties.propertyString("targetSysRoot.osx-ios")!!}" +} + +internal class LinuxPlatform(distribution: Distribution) + : PlatformFlags(distribution) { override val llvmLtoFlags = properties.propertyList("llvmLtoFlags.linux") override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.linux") @@ -63,16 +76,16 @@ internal class LinuxPlatform(distrib: Distribution, override val linkerOptimizationFlags = properties.propertyList("linkerOptimizationFlags.linux") override val linkerKonanFlags = properties.propertyList("linkerKonanFlags.linux") - override val linker = "${distrib.sysRoot}/../bin/ld.gold" + override val linker = "${distribution.sysRoot}/../bin/ld.gold" val pluginOptimizationFlags = properties.propertyList("pluginOptimizationFlags.linux") override fun linkCommand(objectFiles: List, executable: String, optimize: Boolean): List { - val sysRoot = distrib.sysRoot - val llvmLib = distrib.llvmLib - val libGcc = distrib.libGcc + val sysRoot = distribution.sysRoot + val llvmLib = distribution.llvmLib + val libGcc = distribution.libGcc // TODO: Can we extract more to the konan.properties? return mutableListOf("$linker", @@ -97,31 +110,27 @@ internal class LinuxPlatform(distrib: Distribution, internal class LinkStage(val context: Context) { - - private val javaOsName = System.getProperty("os.name") - private val javaArch = System.getProperty("os.arch") - - val os = when (javaOsName) { - "Mac OS X" -> "osx" - "Linux" -> "linux" - else -> error("Unknown operating system: ${javaOsName}") - } - val arch = when (javaArch) { - "x86_64" -> "x86_64" - "amd64" -> "x86_64" - else -> error("Unknown hardware platform: ${javaArch}") - } - - private val properties = KonanProperties(context.config.configuration) - private val distrib = Distribution(properties, os, arch) - - val platform: PlatformFlags = when (os) { - "linux" -> LinuxPlatform(distrib, properties) - "osx" -> MacOSPlatform(distrib, properties) - else -> error("Could not tell the current platform") - } val config = context.config.configuration + + val targetManager = TargetManager(config) + private val distribution = + Distribution(context.config.configuration) + private val properties = distribution.properties + + val platform: PlatformFlags = when (TargetManager.host) { + KonanTarget.LINUX -> LinuxPlatform(distribution) + KonanTarget.MACBOOK -> when (targetManager.current) { + KonanTarget.IPHONE + -> IPhoneOSfromMacOSPlatform(distribution) + KonanTarget.MACBOOK + -> MacOSPlatform(distribution) + else -> TODO("Target not implemented yet.") + } + else -> TODO("Target not implemented yet") + } + val suffix = targetManager.currentSuffix() + val optimize = config.get(KonanConfigKeys.OPTIMIZATION) ?: false val emitted = config.get(KonanConfigKeys.BITCODE_FILE)!! val nostdlib = config.get(KonanConfigKeys.NOSTDLIB) ?: false @@ -131,7 +140,7 @@ internal class LinkStage(val context: Context) { // TODO: Make it a temporary file. val combined = "combined.o" - val tool = distrib.llvmLto + val tool = distribution.llvmLto val command = mutableListOf(tool, "-o", combined) if (optimize) { command.addAll(platform.llvmLtoFlags) @@ -146,9 +155,9 @@ internal class LinkStage(val context: Context) { // TODO: Make it a temporary file. val objectFile = "$file.o" - val tool = distrib.llvmLlc - val command = listOf(distrib.llvmLlc, "-o", objectFile, "-filetype=obj") + - properties.propertyList("llvmLlcFlags.$os") + listOf(file) + val tool = distribution.llvmLlc + val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") + + properties.propertyList("llvmLlcFlags.$suffix") + listOf(file) runTool(*command.toTypedArray()) return objectFile @@ -186,10 +195,10 @@ internal class LinkStage(val context: Context) { } fun linkStage() { - context.log("# Compiler root: ${Distribution.konanHome}") + context.log("# Compiler root: ${distribution.konanHome}") - val bitcodeFiles = listOf(emitted, Distribution.start, Distribution.runtime, - Distribution.launcher) + libraries + val bitcodeFiles = listOf(emitted, distribution.start, distribution.runtime, + distribution.launcher) + libraries val objectFiles = if (optimize) { listOf( llvmLto(bitcodeFiles ) ) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index 1724d7e1dc6..877e0ef6f0e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -250,7 +250,7 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) { val staticData = StaticData(context) - val runtimeFile = context.config.configuration.get(KonanConfigKeys.RUNTIME_FILE)!! + val runtimeFile = context.config.distribution.runtime val runtime = Runtime(runtimeFile) // TODO: dispose init { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 757a49345f3..8088e1d225a 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -33,6 +33,11 @@ import org.jetbrains.kotlin.utils.addToStdlib.singletonList internal fun emitLLVM(context: Context) { val irModule = context.irModule!! + // Note that we don't set module target explicitly. + // It is determined by the target of runtime.bc + // (see Llvm class in ContextUtils) + // Which in turn is determined by the clang flags + // used to compile runtime.bc. val llvmModule = LLVMModuleCreateWithName("out")!! // TODO: dispose context.llvmModule = llvmModule diff --git a/backend.native/konan.properties b/backend.native/konan.properties index c45907461ec..729f32031dc 100644 --- a/backend.native/konan.properties +++ b/backend.native/konan.properties @@ -1,19 +1,28 @@ // TODO: utilize substitution mechanism from interop. +arch.osx = x86_64 sysRoot.osx = target-sysroot-1-darwin-macos llvmHome.osx = clang+llvm-3.8.0-darwin-macos - -sysRoot.linux = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot -llvmHome.linux = clang+llvm-3.8.0-linux-x86-64 -libGcc.linux = target-gcc-toolchain-3-linux-x86-64/lib/gcc/x86_64-unknown-linux-gnu/4.8.5 - llvmLtoFlags.osx = -O3 -function-sections -exported-symbol=_main llvmLlcFlags.osx = -mtriple=x86_64-apple-macosx10.10.0 linkerKonanFlags.osx = -lc++ linkerOptimizationFlags.osx = -dead_strip -macosVersionMin.osx = 10.10.0 +osVersionMin.osx = -macosx_version_min 10.10.0 +arch.osx-ios = arm64 +sysRoot.osx-ios = target-sysroot-1-darwin-macos +targetSysRoot.osx-ios = target-sysroot-1-darwin-ios +llvmHome.osx-ios = clang+llvm-3.8.0-darwin-macos +llvmLtoFlags.osx-ios = -O3 -function-sections -exported-symbol=_main +llvmLlcFlags.osx-ios = -mtriple=arm64-apple-ios5.0.0 +linkerKonanFlags.osx-ios = -lc++ +linkerOptimizationFlags.osx-ios = -dead_strip +osVersionMin.osx-ios = -iphoneos_version_min 5.0.0 + +sysRoot.linux = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot +llvmHome.linux = clang+llvm-3.8.0-linux-x86-64 +libGcc.linux = target-gcc-toolchain-3-linux-x86-64/lib/gcc/x86_64-unknown-linux-gnu/4.8.5 llvmLtoFlags.linux = -O3 -function-sections -exported-symbol=main llvmLlcFlags.linux = -march=x86-64 linkerKonanFlags.linux = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread diff --git a/build.gradle b/build.gradle index 71dbcea2d6b..322a36a912e 100644 --- a/build.gradle +++ b/build.gradle @@ -22,28 +22,43 @@ allprojects { } } - - convention.plugins.clangFlags = new ClangFlags(new PlatformInfo(), "$llvmDir") ext.clangPath = ["$llvmDir/bin"] ext.clangArgs = [] + ext.targetArgs = [:] final String binDir + + if (isLinux()) { + ext.targetArgs << + ["host": ["--sysroot=${gccToolchainDir}/${gnuTriplet}/sysroot"]] + } else { + ext.targetArgs << + ["host": + ["--sysroot=$hostSysrootDir"], + "iphone": + ["-stdlib=libc++", "-arch", "arm64", "-isysroot", "$iphoneSysrootDir"], + "iphone_sim": + ["-stdlib=libc++"] + ] + } + ext.targetList = ext.targetArgs.keySet() as List + if (isLinux()) { binDir = "$gccToolchainDir/$gnuTriplet/bin" ext.clangArgs.addAll([ - "--sysroot=$gccToolchainDir/$gnuTriplet/sysroot", "--gcc-toolchain=$gccToolchainDir", "-L$llvmDir/lib" ]) } else { - binDir = "$sysrootDir/usr/bin" - ext.clangArgs << "--sysroot=$sysrootDir" + binDir = "$hostSysrootDir/usr/bin" } ext.clangArgs << "-B$binDir" + ext.hostClangArgs = ext.clangArgs.clone() + ext.hostClangArgs.addAll(ext.targetArgs['host']) + ext.clangPath << binDir ext.jvmArgs = ["-ea"] - ext.clangLinkArgs = libLink() - ext.clangOptArgs = optArgs() ext.globalArgs = project.hasProperty("konanc_flags") ? ext.konanc_flags.split(' ') : [] + convention.plugins.execClang = new org.jetbrains.kotlin.ExecClang(project) plugins.withType(NativeComponentPlugin) { @@ -56,7 +71,7 @@ allprojects { eachPlatform { // TODO: will not work when cross-compiling [cCompiler, cppCompiler, linker].each { - it.withArguments { it.addAll(clangArgs) } + it.withArguments { it.addAll(hostClangArgs) } } } @@ -66,56 +81,6 @@ allprojects { } } -class ClangFlags { - - protected PlatformInfo platform - protected String llvmDir - - private List linkCppAbi, linkPlatform, optArgs - - ClangFlags(platformInfo, llvm) { - platform = platformInfo - llvmDir = llvm - - if (platform.isLinux()) { - linkCppAbi= ["-Wl,-Bstatic", "-lc++abi", "-Wl,-Bdynamic"] - linkPlatform= ["-ldl", "-lpthread", "-lm", "-rdynamic"] - optArgs = ["-O3", "-fuse-ld=gold", "-flto", "-ffunction-sections", "-Wl,--gc-sections"] - } else if (platform.isMac()) { - // Life is hard. MacOS linker is harder. - // This is how we force the linker to link statically. - linkCppAbi= ["${llvmDir}/lib/libc++abi.a"] - linkPlatform= [] - optArgs = ["-O3", "-flto", "-Wl,-dead_strip"] - } else { - throw unsupportedPlatformException() - } - - } - - public List linkCppAbi() { - return linkCppAbi - } - - public List linkPlatform() { - return linkPlatform - } - - public List optArgs() { - return optArgs - } - - - public List libLink() { - def libs = [] - libs.addAll(linkPlatform()) - libs.addAll(linkCppAbi()) - return libs - } -} - - - class PlatformInfo { private final String osName = System.properties['os.name'] private final String osArch = System.properties['os.arch'] @@ -170,13 +135,6 @@ task dist_compiler(type: Copy) { fileMode(0755) include('konanc') include('kotlinc-native') - - def allClangArgs = "${clangArgs.join(' ')} ${clangLinkArgs.join(' ')}" - - filter { line -> line.replaceAll("FILTER_CLANG_PLATFORM_ARGS", allClangArgs) } - filter { line -> line.replaceAll("FILTER_CLANG_PLATFORM_OPT", "${clangOptArgs.join(' ')}") } - filter { line -> line.replaceAll("FILTER_CLANG_BIN_PATH", "${project.llvmDir}/bin") } - into('bin') } @@ -190,12 +148,27 @@ task list_dist(type: Exec) { } task dist_runtime(type: Copy) { - dependsOn ':runtime:build', ':backend.native:stdlib', ':backend.native:start' + dependsOn ':runtime:build' + dependsOn ':backend.native:hostStdlib' + dependsOn ':backend.native:hostStart' destinationDir file('dist') from(project(':runtime').file('build')) { - include('*.bc') + include('*/*.bc') + into('lib') + } +} + +task cross_dist_runtime(type: Copy) { + dependsOn ':runtime:build' + dependsOn.addAll(targetList.collect { ":backend.native:${it}Stdlib" }) + dependsOn.addAll(targetList.collect { ":backend.native:${it}Start" }) + + destinationDir file('dist') + + from(project(':runtime').file('build')) { + include('*/*.bc') into('lib') } } @@ -204,6 +177,10 @@ task dist { dependsOn 'dist_compiler', 'dist_runtime' } +task cross_dist { + dependsOn 'cross_dist_runtime', 'dist_compiler' +} + task demo(type: Exec) { dependsOn 'dist' diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy index da6ab4b27a9..e60343b83f5 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy @@ -1,16 +1,65 @@ package org.jetbrains.kotlin import org.gradle.api.DefaultTask +import org.gradle.api.tasks.* import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction +class CompilePerTarget extends CompileCppToBitcode { + private List targetList = [] + private Map> targetArgs = null + private Map> targetLinkerArgs = null + + void targetList(List list) { + targetList.addAll(list) + } + + void targetArgs(Map> map) { + targetArgs = map + } + + private Map> getTargetArgs() { + return targetArgs + } + + void targetLinkerArgs(Map> map) { + targetLinkerArgs = map + } + + private Map> getTargetLinkerArgs() { + return targetLinkerArgs + } + + @TaskAction + void compile() { + def targetList = this.targetList + def targetArgs = getTargetArgs() + def targetLinkerArgs = getTargetLinkerArgs() + def commonCompilerArgs = getCompilerArgs().clone() + def commonLinkerArgs = getLinkerArgs().clone() + targetList.each { + this.compilerArgs = [] + this.linkerArgs = [] + target(it) + compilerArgs(commonCompilerArgs) + if (targetArgs != null) + compilerArgs(targetArgs[it]) + linkerArgs(commonLinkerArgs) + if (targetLinkerArgs != null) + linkerArgs(targetLinkerArgs[it]) + super.compile() + } + } +} + class CompileCppToBitcode extends DefaultTask { private String name = "main" + private String target = "host" private File srcRoot; - private List compilerArgs = [] - private List linkerArgs = [] + protected List compilerArgs = [] + protected List linkerArgs = [] @InputDirectory File getSrcRoot() { @@ -19,7 +68,7 @@ class CompileCppToBitcode extends DefaultTask { @OutputFile File getOutFile() { - return new File(project.buildDir, "${name}.bc") + return new File(getTargetDir(), "${name}.bc") } private File getSrcDir() { @@ -30,23 +79,31 @@ class CompileCppToBitcode extends DefaultTask { return new File(this.getSrcRoot(), "headers") } + private File getTargetDir() { + return new File(project.buildDir, target) + } + private File getObjDir() { - return new File(project.buildDir, name) + return new File(getTargetDir(), name) } void name(String value) { name = value } + void target(String value) { + target = value + } + void srcRoot(File value) { srcRoot = value } - private List getCompilerArgs() { + protected List getCompilerArgs() { return compilerArgs } - private List getLinkerArgs() { + protected List getLinkerArgs() { return linkerArgs } @@ -54,10 +111,18 @@ class CompileCppToBitcode extends DefaultTask { compilerArgs.addAll(args) } + void compilerArgs(List args) { + compilerArgs.addAll(args) + } + void linkerArgs(String... args) { linkerArgs.addAll(args) } + void linkerArgs(List args) { + linkerArgs.addAll(args) + } + @TaskAction void compile() { // the strange code below seems to be required due to some Gradle (Groovy?) behaviour diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/ExecClang.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/ExecClang.groovy index b4e87ef4b29..2576259b0b6 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/ExecClang.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/ExecClang.groovy @@ -34,7 +34,7 @@ class ExecClang { if (executable in ['clang', 'clang++']) { executable = "${project.llvmDir}/bin/$executable" } else { - throw new GradleException("unsupport clang executable: $executable") + throw new GradleException("unsupported clang executable: $executable") } environment["PATH"] = project.files(project.clangPath).asPath + @@ -47,4 +47,4 @@ class ExecClang { } return project.exec(extendedAction) } -} \ No newline at end of file +} diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 111dfc1ae2e..930c92b75ca 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -12,7 +12,6 @@ abstract class KonanTest extends DefaultTask { def backendNative = project.project(":backend.native") def runtimeProject = project.project(":runtime") def dist = project.rootProject.file("dist") - def llvmLlc = llvmTool("llc") def runtimeBc = new File("${dist.canonicalPath}/lib/runtime.bc").absolutePath def launcherBc = new File("${dist.canonicalPath}/lib/launcher.bc").absolutePath def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath @@ -100,14 +99,6 @@ abstract class KonanTest extends DefaultTask { if (goldValue != null && goldValue != out.toString()) throw new RuntimeException("test failed.") } - - private String llvmTool(String tool) { - return "${project.llvmDir}/bin/${tool}" - } - - protected List clangLinkArgs() { - return project.clangLinkArgs - } } class RunKonanTest extends KonanTest { diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy index 5dd8a6acdfe..8a0d718cc9d 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy @@ -182,8 +182,8 @@ class NamedNativeInteropConfig implements Named { environment['PATH'] = project.files(project.clangPath).asPath + File.pathSeparator + environment['PATH'] - compilerOpts += project.clangArgs - linkerOpts += project.clangArgs + compilerOpts += project.hostClangArgs + linkerOpts += project.hostClangArgs args compilerOpts.collect { "-copt:$it" } args linkerOpts.collect { "-lopt:$it" } diff --git a/common/build.gradle b/common/build.gradle index 09d78a6f1c1..a676dfa0c6a 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,10 +1,11 @@ -import org.jetbrains.kotlin.CompileCppToBitcode +import org.jetbrains.kotlin.CompilePerTarget // TODO: consider using some Gradle plugins to build and test - -task compileHash(type: CompileCppToBitcode) { +task compileHash(type: CompilePerTarget) { name 'hash' + targetList targetList + targetArgs targetArgs } task build { diff --git a/dependencies/build.gradle b/dependencies/build.gradle index 2cd09a4120e..0faa97197e4 100644 --- a/dependencies/build.gradle +++ b/dependencies/build.gradle @@ -10,7 +10,7 @@ abstract class NativeDep extends DefaultTask { } } - protected final String target = getCurrentHostTarget(); + protected final String host = getCurrentHostTarget(); @Input abstract String getFileName() @@ -27,7 +27,7 @@ abstract class NativeDep extends DefaultTask { protected File download() { File result = new File(baseOutDir, fileName) - if (!result.exists()) + if (!result.exists()) ant.get(src: url, dest: result, usetimestamp: true) return result } @@ -71,20 +71,23 @@ class TgzNativeDep extends NativeDep { task libffi(type: TgzNativeDep) { - baseName = "libffi-3.2.1-2-$target" + baseName = "libffi-3.2.1-2-$host" } task llvm(type: TgzNativeDep) { - baseName = "clang+llvm-3.8.0-$target" + baseName = "clang+llvm-3.8.0-$host" } if (isLinux()) { task gccToolchain(type: TgzNativeDep) { - baseName = "target-gcc-toolchain-3-$target" + baseName = "target-gcc-toolchain-3-$host" } } else { - task sysroot(type: TgzNativeDep) { - baseName = "target-sysroot-1-$target" + task hostSysroot(type: TgzNativeDep) { + baseName = "target-sysroot-1-$host" + } + task iphoneSysroot(type: TgzNativeDep) { + baseName = "target-sysroot-1-darwin-ios" } } @@ -95,4 +98,4 @@ task update { tasks.withType(TgzNativeDep) { rootProject.ext.set("${name}Dir", outputDir.path) -} \ No newline at end of file +} diff --git a/runtime/build.gradle b/runtime/build.gradle index b0f42ba7b57..11baaf62517 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -1,21 +1,26 @@ -import org.jetbrains.kotlin.CompileCppToBitcode +import org.jetbrains.kotlin.CompilePerTarget // TODO: consider using some Gradle plugins to build and test -task build(type: CompileCppToBitcode) { +task build(type: CompilePerTarget) { name 'runtime' srcRoot file('src/main') - - dependsOn ':common:compileHash' - dependsOn 'launcher' + dependsOn ":common:compileHash" + dependsOn "launcher" + targetList targetList + targetArgs targetArgs compilerArgs '-I' + project.file('../common/src/hash/headers') // TODO: copy-pasted from 'common' - linkerArgs project.file('../common/build/hash.bc').path + targetLinkerArgs targetList.collectEntries { + [it,[project.file("../common/build/$it/hash.bc")]] + } } -task launcher(type: CompileCppToBitcode) { +task launcher(type: CompilePerTarget) { name 'launcher' srcRoot file('src/launcher') + targetList targetList + targetArgs targetArgs compilerArgs '-I' + project.file('../common/src/hash/headers') // TODO: copy-pasted from 'common' compilerArgs '-I' + project.file('src/main/cpp') } From f36bb78a7f3c6b56ea6461000d7510020df1ee9c Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 23 Jan 2017 14:27:26 +0700 Subject: [PATCH 27/86] backend/tests: enable fields2 because it was fixed --- backend.native/tests/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 2fd9aecb9f4..2185ab191d6 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -104,7 +104,6 @@ task fields1(type: RunKonanTest) { } task fields2(type: RunKonanTest) { - disabled = true goldValue = "Set global = 1\n" + "Set member = 42\n" + From 4765a20ae8d949381309588e7ce50daf7aef28c4 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 19 Jan 2017 17:19:04 +0300 Subject: [PATCH 28/86] Add bitwise operations for Short and Byte This commit adds and, or and xor operations to Byte and Short types. It also implements inv operation for all integer types, shl for Long and Char + Int operation. --- runtime/src/main/cpp/Operator.cpp | 19 ++++++++++--- runtime/src/main/kotlin/kotlin/Primitives.kt | 28 +++++++++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/runtime/src/main/cpp/Operator.cpp b/runtime/src/main/cpp/Operator.cpp index d3e9b49c479..0561ae40e0c 100644 --- a/runtime/src/main/cpp/Operator.cpp +++ b/runtime/src/main/cpp/Operator.cpp @@ -16,7 +16,7 @@ KInt Kotlin_Boolean_compareTo_Boolean(KBoolean a, KBoolean b) { if (a == b) //--- Char --------------------------------------------------------------------// KInt Kotlin_Char_compareTo_Char (KChar a, KChar b) { if (a == b) return 0; return (a < b) ? -1 : 1; } -KChar Kotlin_Char_plus_Char (KChar a, KInt b) { return a + b; } +KChar Kotlin_Char_plus_Int (KChar a, KInt b) { return a + b; } KInt Kotlin_Char_minus_Char (KChar a, KChar b) { return a - b; } KChar Kotlin_Char_minus_Int (KChar a, KInt b) { return a - b; } KChar Kotlin_Char_inc (KChar a ) { return a + 1; } @@ -79,6 +79,11 @@ KByte Kotlin_Byte_dec (KByte a ) { return --a; } KInt Kotlin_Byte_unaryPlus (KByte a ) { return +a; } KInt Kotlin_Byte_unaryMinus (KByte a ) { return -a; } +KByte Kotlin_Byte_or_Byte (KByte a, KByte b) { return a | b; } +KByte Kotlin_Byte_xor_Byte (KByte a, KByte b) { return a ^ b; } +KByte Kotlin_Byte_and_Byte (KByte a, KByte b) { return a & b; } +KByte Kotlin_Byte_inv (KByte a ) { return ~a; } + KByte Kotlin_Byte_toByte (KByte a ) { return a; } KChar Kotlin_Byte_toChar (KByte a ) { return a; } KShort Kotlin_Byte_toShort (KByte a ) { return a; } @@ -136,6 +141,11 @@ KShort Kotlin_Short_dec (KShort a ) { return --a; } KInt Kotlin_Short_unaryPlus (KShort a ) { return +a; } KInt Kotlin_Short_unaryMinus (KShort a ) { return -a; } +KShort Kotlin_Short_or_Short (KShort a, KShort b) { return a | b; } +KShort Kotlin_Short_xor_Short (KShort a, KShort b) { return a ^ b; } +KShort Kotlin_Short_and_Short (KShort a, KShort b) { return a & b; } +KShort Kotlin_Short_inv (KShort a ) { return ~a; } + KByte Kotlin_Short_toByte (KShort a ) { return a; } KChar Kotlin_Short_toChar (KShort a ) { return a; } KShort Kotlin_Short_toShort (KShort a ) { return a; } @@ -196,6 +206,7 @@ KInt Kotlin_Int_unaryMinus (KInt a ) { return -a; } KInt Kotlin_Int_or_Int (KInt a, KInt b) { return a | b; } KInt Kotlin_Int_xor_Int (KInt a, KInt b) { return a ^ b; } KInt Kotlin_Int_and_Int (KInt a, KInt b) { return a & b; } +KInt Kotlin_Int_inv (KInt a ) { return ~a; } KInt Kotlin_Int_shl_Int (KInt a, KInt b) { return a << b; } KInt Kotlin_Int_shr_Int (KInt a, KInt b) { return a >> b; } KInt Kotlin_Int_ushr_Int (KInt a, KInt b) { @@ -262,9 +273,9 @@ KLong Kotlin_Long_unaryMinus (KLong a ) { return -a; } KLong Kotlin_Long_xor_Long (KLong a, KLong b) { return a ^ b; } KLong Kotlin_Long_or_Long (KLong a, KLong b) { return a | b; } KLong Kotlin_Long_and_Long (KLong a, KLong b) { return a & b; } -KLong Kotlin_Long_shr_Int (KLong a, KInt b) { - return a >> b; -} +KLong Kotlin_Long_inv (KLong a ) { return ~a; } +KLong Kotlin_Long_shl_Int (KLong a, KInt b) { return a << b; } +KLong Kotlin_Long_shr_Int (KLong a, KInt b) { return a >> b; } KLong Kotlin_Long_ushr_Int (KLong a, KInt b) { return static_cast(a) >> b; } diff --git a/runtime/src/main/kotlin/kotlin/Primitives.kt b/runtime/src/main/kotlin/kotlin/Primitives.kt index 439470934ec..f4d11b7f18f 100644 --- a/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -168,6 +168,19 @@ public final class Byte : Number(), Comparable { @SymbolName("Kotlin_Byte_unaryMinus") external public operator fun unaryMinus(): Int + /** Performs a bitwise AND operation between the two values. */ + @SymbolName("Kotlin_Byte_and_Byte") + external public infix fun and(other: Byte): Byte + /** Performs a bitwise OR operation between the two values. */ + @SymbolName("Kotlin_Byte_or_Byte") + external public infix fun or(other: Byte): Byte + /** Performs a bitwise XOR operation between the two values. */ + @SymbolName("Kotlin_Byte_xor_Byte") + external public infix fun xor(other: Byte): Byte + /** Inverts the bits in this value/ */ + @SymbolName("Kotlin_Byte_inv") + external public fun inv(): Byte + @SymbolName("Kotlin_Byte_toByte") external public override fun toByte(): Byte @SymbolName("Kotlin_Byte_toChar") @@ -377,6 +390,19 @@ public final class Short : Number(), Comparable { @SymbolName("Kotlin_Short_unaryMinus") external public operator fun unaryMinus(): Int + /** Performs a bitwise AND operation between the two values. */ + @SymbolName("Kotlin_Short_and_Short") + external public infix fun and(other: Short): Short + /** Performs a bitwise OR operation between the two values. */ + @SymbolName("Kotlin_Short_or_Short") + external public infix fun or(other: Short): Short + /** Performs a bitwise XOR operation between the two values. */ + @SymbolName("Kotlin_Short_xor_Short") + external public infix fun xor(other: Short): Short + /** Inverts the bits in this value/ */ + @SymbolName("Kotlin_Short_inv") + external public fun inv(): Short + /** Creates a range from this value to the specified [other] value. */ public operator fun rangeTo(other: Byte): IntRange { return IntRange(this.toInt(), other.toInt()) @@ -861,7 +887,7 @@ public final class Long : Number(), Comparable { } /** Shifts this value left by [bits]. */ - @SymbolName("Kotlin_Long_shl_Long") + @SymbolName("Kotlin_Long_shl_Int") external public infix fun shl(bitCount: Int): Long /** Shifts this value right by [bits], filling the leftmost bits with copies of the sign bit. */ @SymbolName("Kotlin_Long_shr_Int") From 7f911b8085b6f396d8744bceca96740971df27f1 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Jan 2017 15:25:02 +0300 Subject: [PATCH 29/86] backend/tests: Ignore binaryOp/compareWithBoxed... tests --- .../codegen/blackbox/binaryOp/compareWithBoxedDouble.kt | 4 ++-- .../codegen/blackbox/binaryOp/compareWithBoxedLong.kt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt index 553773be648..a1040aac132 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedDouble.kt @@ -1,9 +1,9 @@ // IGNORE_BACKEND: JS // reason - multifile tests are not supported in JS tests // IGNORE_BACKEND: NATIVE -// reason - no java interop. Consider testing by another way +// reason - no java interop. -//FILE: Holder.kt +//FILE: Holder.java class Holder { public Double value; diff --git a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt index 14a07fe1eb3..68c226c8295 100644 --- a/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt +++ b/backend.native/tests/external/codegen/blackbox/binaryOp/compareWithBoxedLong.kt @@ -1,5 +1,8 @@ // IGNORE_BACKEND: JS // reason - multifile tests are not supported in JS tests +// IGNORE_BACKEND: NATIVE +// reason - no java interop. + //FILE: JavaClass.java class JavaClass { From 154c889517a5d2f627f3ab533c7b7b837ab8160c Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Jan 2017 16:06:34 +0300 Subject: [PATCH 30/86] runtime: Add exception for division by zero --- runtime/src/main/cpp/Exceptions.h | 2 + runtime/src/main/cpp/Operator.cpp | 43 ++++++++++++------- .../kotlin/konan/internal/RuntimeUtils.kt | 5 +++ runtime/src/main/kotlin/kotlin/Exceptions.kt | 8 ++++ 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/runtime/src/main/cpp/Exceptions.h b/runtime/src/main/cpp/Exceptions.h index ce6b2b18fa5..a7fb95bcaae 100644 --- a/runtime/src/main/cpp/Exceptions.h +++ b/runtime/src/main/cpp/Exceptions.h @@ -22,6 +22,8 @@ void ThrowNullPointerException(); void ThrowArrayIndexOutOfBoundsException(); // Throws class cast exception. void ThrowClassCastException(); +// Throws arithmetic exception +void ThrowArithmeticException(); #ifdef __cplusplus } // extern "C" diff --git a/runtime/src/main/cpp/Operator.cpp b/runtime/src/main/cpp/Operator.cpp index 0561ae40e0c..6d751e06f09 100644 --- a/runtime/src/main/cpp/Operator.cpp +++ b/runtime/src/main/cpp/Operator.cpp @@ -1,7 +1,18 @@ #include #include "Natives.h" +#include "Exceptions.h" +namespace { + +inline template R div(Ta a, Tb b) { + if (__builtin_expect(b == 0, false)) { + ThrowArithmeticException(); + } + return a / b; +} + +} extern "C" { @@ -53,10 +64,10 @@ KLong Kotlin_Byte_minus_Long (KByte a, KLong b) { return a - b; } KFloat Kotlin_Byte_minus_Float (KByte a, KFloat b) { return a - b; } KDouble Kotlin_Byte_minus_Double (KByte a, KDouble b) { return a - b; } -KInt Kotlin_Byte_div_Byte (KByte a, KByte b) { return a / b; } -KInt Kotlin_Byte_div_Short (KByte a, KShort b) { return a / b; } -KInt Kotlin_Byte_div_Int (KByte a, KInt b) { return a / b; } -KLong Kotlin_Byte_div_Long (KByte a, KLong b) { return a / b; } +KInt Kotlin_Byte_div_Byte (KByte a, KByte b) { return div(a, b); } +KInt Kotlin_Byte_div_Short (KByte a, KShort b) { return div(a, b); } +KInt Kotlin_Byte_div_Int (KByte a, KInt b) { return div(a, b); } +KLong Kotlin_Byte_div_Long (KByte a, KLong b) { return div(a, b); } KFloat Kotlin_Byte_div_Float (KByte a, KFloat b) { return a / b; } KDouble Kotlin_Byte_div_Double (KByte a, KDouble b) { return a / b; } @@ -115,10 +126,10 @@ KLong Kotlin_Short_minus_Long (KShort a, KLong b) { return a - b; } KFloat Kotlin_Short_minus_Float (KShort a, KFloat b) { return a - b; } KDouble Kotlin_Short_minus_Double (KShort a, KDouble b) { return a - b; } -KInt Kotlin_Short_div_Byte (KShort a, KByte b) { return a / b; } -KInt Kotlin_Short_div_Short (KShort a, KShort b) { return a / b; } -KInt Kotlin_Short_div_Int (KShort a, KInt b) { return a / b; } -KLong Kotlin_Short_div_Long (KShort a, KLong b) { return a / b; } +KInt Kotlin_Short_div_Byte (KShort a, KByte b) { return div(a, b); } +KInt Kotlin_Short_div_Short (KShort a, KShort b) { return div(a, b); } +KInt Kotlin_Short_div_Int (KShort a, KInt b) { return div(a, b); } +KLong Kotlin_Short_div_Long (KShort a, KLong b) { return div(a, b); } KFloat Kotlin_Short_div_Float (KShort a, KFloat b) { return a / b; } KDouble Kotlin_Short_div_Double (KShort a, KDouble b) { return a / b; } @@ -177,10 +188,10 @@ KLong Kotlin_Int_minus_Long (KInt a, KLong b) { return a - b; } KFloat Kotlin_Int_minus_Float (KInt a, KFloat b) { return a - b; } KDouble Kotlin_Int_minus_Double (KInt a, KDouble b) { return a - b; } -KInt Kotlin_Int_div_Byte (KInt a, KByte b) { return a / b; } -KInt Kotlin_Int_div_Short (KInt a, KShort b) { return a / b; } -KInt Kotlin_Int_div_Int (KInt a, KInt b) { return a / b; } -KLong Kotlin_Int_div_Long (KInt a, KLong b) { return a / b; } +KInt Kotlin_Int_div_Byte (KInt a, KByte b) { return div(a, b); } +KInt Kotlin_Int_div_Short (KInt a, KShort b) { return div(a, b); } +KInt Kotlin_Int_div_Int (KInt a, KInt b) { return div(a, b); } +KLong Kotlin_Int_div_Long (KInt a, KLong b) { return div(a, b); } KFloat Kotlin_Int_div_Float (KInt a, KFloat b) { return a / b; } KDouble Kotlin_Int_div_Double (KInt a, KDouble b) { return a / b; } @@ -244,10 +255,10 @@ KLong Kotlin_Long_minus_Long (KLong a, KLong b) { return a - b; } KFloat Kotlin_Long_minus_Float (KLong a, KFloat b) { return a - b; } KDouble Kotlin_Long_minus_Double (KLong a, KDouble b) { return a - b; } -KLong Kotlin_Long_div_Byte (KLong a, KByte b) { return a / b; } -KLong Kotlin_Long_div_Short (KLong a, KShort b) { return a / b; } -KLong Kotlin_Long_div_Int (KLong a, KInt b) { return a / b; } -KLong Kotlin_Long_div_Long (KLong a, KLong b) { return a / b; } +KLong Kotlin_Long_div_Byte (KLong a, KByte b) { return div(a, b); } +KLong Kotlin_Long_div_Short (KLong a, KShort b) { return div(a, b); } +KLong Kotlin_Long_div_Int (KLong a, KInt b) { return div(a, b); } +KLong Kotlin_Long_div_Long (KLong a, KLong b) { return div(a, b); } KFloat Kotlin_Long_div_Float (KLong a, KFloat b) { return a / b; } KDouble Kotlin_Long_div_Double (KLong a, KDouble b) { return a / b; } diff --git a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt index e0cf2cce35f..c7587ced3f0 100644 --- a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt +++ b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt @@ -15,6 +15,11 @@ internal fun ThrowClassCastException(): Nothing { throw ClassCastException() } +@ExportForCppRuntime +internal fun ThrowArithmeticException() : Nothing { + throw ArithmeticException() +} + internal fun ThrowNoWhenBranchMatchedException(): Nothing { throw NoWhenBranchMatchedException() } diff --git a/runtime/src/main/kotlin/kotlin/Exceptions.kt b/runtime/src/main/kotlin/kotlin/Exceptions.kt index 75f3c2c32a0..79efffba2f3 100644 --- a/runtime/src/main/kotlin/kotlin/Exceptions.kt +++ b/runtime/src/main/kotlin/kotlin/Exceptions.kt @@ -126,6 +126,14 @@ public class ClassCastException : RuntimeException { } } +public class ArithmeticException : RuntimeException { + constructor() : super() { + } + + constructor(s: String) : super(s) { + } +} + public class AssertionError : Error { constructor() { From a3b8d26c1ffdb405205bd7d937b201f57641770c Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 20 Jan 2017 18:06:14 +0300 Subject: [PATCH 31/86] runtime: Avoid UB in shift operations --- runtime/src/main/cpp/Operator.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/runtime/src/main/cpp/Operator.cpp b/runtime/src/main/cpp/Operator.cpp index 6d751e06f09..e88bbeb3bba 100644 --- a/runtime/src/main/cpp/Operator.cpp +++ b/runtime/src/main/cpp/Operator.cpp @@ -218,10 +218,13 @@ KInt Kotlin_Int_or_Int (KInt a, KInt b) { return a | b; } KInt Kotlin_Int_xor_Int (KInt a, KInt b) { return a ^ b; } KInt Kotlin_Int_and_Int (KInt a, KInt b) { return a & b; } KInt Kotlin_Int_inv (KInt a ) { return ~a; } -KInt Kotlin_Int_shl_Int (KInt a, KInt b) { return a << b; } -KInt Kotlin_Int_shr_Int (KInt a, KInt b) { return a >> b; } + +// According to C++11 the result is undefined if the second operator is < 0 or >= . +// We avoid it by using only the least significant bits +KInt Kotlin_Int_shl_Int (KInt a, KInt b) { return a << (b & 31); } +KInt Kotlin_Int_shr_Int (KInt a, KInt b) { return a >> (b & 31); } KInt Kotlin_Int_ushr_Int (KInt a, KInt b) { - return static_cast(a) >> b; + return static_cast(a) >> (b & 31); } KByte Kotlin_Int_toByte (KInt a ) { return a; } @@ -285,10 +288,13 @@ KLong Kotlin_Long_xor_Long (KLong a, KLong b) { return a ^ b; } KLong Kotlin_Long_or_Long (KLong a, KLong b) { return a | b; } KLong Kotlin_Long_and_Long (KLong a, KLong b) { return a & b; } KLong Kotlin_Long_inv (KLong a ) { return ~a; } -KLong Kotlin_Long_shl_Int (KLong a, KInt b) { return a << b; } -KLong Kotlin_Long_shr_Int (KLong a, KInt b) { return a >> b; } + +// According to C++11 the result is undefined if the second operator is < 0 or >= . +// We avoid it by using only the least significant bits +KLong Kotlin_Long_shl_Int (KLong a, KInt b) { return a << (b & 63); } +KLong Kotlin_Long_shr_Int (KLong a, KInt b) { return a >> (b & 63); } KLong Kotlin_Long_ushr_Int (KLong a, KInt b) { - return static_cast(a) >> b; + return static_cast(a) >> (b & 63); } KByte Kotlin_Long_toByte (KLong a ) { return a; } From 8ca5d08e8ef7de95e734f10210d3273e886e78b7 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 11:34:24 +0300 Subject: [PATCH 32/86] compiler: 1.1-20170120.135555-375 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6db9416d62a..3c7a7e2ed50 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin_version=1.1-M03 #kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-SNAPSHOT -kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170119.231846-374 \ No newline at end of file +kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170120.135555-375 From 3aa48b7e0cc8764345d08d675ce074b4712bd6b0 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 23 Jan 2017 13:21:06 +0700 Subject: [PATCH 33/86] backend: do not rely on `parameter.original` in autoboxing `function.parameter.original` sometimes turns out to be not the same as `function.original.parameter`. --- .../common/AbstractValueUsageTransformer.kt | 17 +++++++++++++---- .../kotlin/backend/konan/lower/Autoboxing.kt | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractValueUsageTransformer.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractValueUsageTransformer.kt index 306b94027db..bdec3766e81 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractValueUsageTransformer.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractValueUsageTransformer.kt @@ -37,6 +37,15 @@ abstract class AbstractValueUsageTransformer(val builtIns: KotlinBuiltIns): IrEl protected open fun IrExpression.useAsArgument(parameter: ParameterDescriptor): IrExpression = this.useAsValue(parameter) + protected open fun IrExpression.useAsDispatchReceiver(function: CallableDescriptor): IrExpression = + this.useAsArgument(function.dispatchReceiverParameter!!) + + protected open fun IrExpression.useAsExtensionReceiver(function: CallableDescriptor): IrExpression = + this.useAsArgument(function.extensionReceiverParameter!!) + + protected open fun IrExpression.useAsValueArgument(parameter: ValueParameterDescriptor): IrExpression = + this.useAsArgument(parameter) + protected open fun IrExpression.useForVariable(variable: VariableDescriptor): IrExpression = this.useAsValue(variable) @@ -55,12 +64,12 @@ abstract class AbstractValueUsageTransformer(val builtIns: KotlinBuiltIns): IrEl expression.transformChildrenVoid(this) with(expression) { - dispatchReceiver = dispatchReceiver?.useAsArgument(descriptor.dispatchReceiverParameter!!) - extensionReceiver = extensionReceiver?.useAsArgument(descriptor.extensionReceiverParameter!!) + dispatchReceiver = dispatchReceiver?.useAsDispatchReceiver(descriptor) + extensionReceiver = extensionReceiver?.useAsExtensionReceiver(descriptor) for (index in descriptor.valueParameters.indices) { val argument = getValueArgument(index) ?: continue val parameter = descriptor.valueParameters[index] - putValueArgument(index, argument.useAsArgument(parameter)) + putValueArgument(index, argument.useAsValueArgument(parameter)) } } @@ -214,7 +223,7 @@ abstract class AbstractValueUsageTransformer(val builtIns: KotlinBuiltIns): IrEl declaration.descriptor.valueParameters.forEach { parameter -> val defaultValue = declaration.getDefault(parameter) if (defaultValue is IrExpressionBody) { - defaultValue.expression = defaultValue.expression.useAsArgument(parameter) + defaultValue.expression = defaultValue.expression.useAsValueArgument(parameter) } } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt index 51994a3c352..b920948d69e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt @@ -6,8 +6,9 @@ import org.jetbrains.kotlin.backend.konan.Context import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalClass import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalFunctions import org.jetbrains.kotlin.backend.konan.descriptors.unboundCallableReferenceTypeOrNull -import org.jetbrains.kotlin.descriptors.ParameterDescriptor +import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl @@ -128,8 +129,17 @@ private class AutoboxingTransformer(val context: Context) : AbstractValueUsageTr return this.adaptIfNecessary(actualType, type) } - override fun IrExpression.useAsArgument(parameter: ParameterDescriptor): IrExpression { - return this.useAsValue(parameter.original) + override fun IrExpression.useAsDispatchReceiver(function: CallableDescriptor): IrExpression { + return this.useAsArgument(function.original.dispatchReceiverParameter!!) + } + + override fun IrExpression.useAsExtensionReceiver(function: CallableDescriptor): IrExpression { + return this.useAsArgument(function.original.extensionReceiverParameter!!) + } + + override fun IrExpression.useAsValueArgument(parameter: ValueParameterDescriptor): IrExpression { + val function = parameter.containingDeclaration + return this.useAsArgument(function.original.valueParameters[parameter.index]) } override fun IrExpression.useForField(field: PropertyDescriptor): IrExpression { From 97ce2227d5fb1bb6ccce2b2247d093659ff288fe Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 23 Jan 2017 12:49:53 +0700 Subject: [PATCH 34/86] backend/tests: add boxing{14,15} the latter is disabled. --- backend.native/tests/build.gradle | 11 +++++++++++ backend.native/tests/codegen/boxing/boxing14.kt | 5 +++++ backend.native/tests/codegen/boxing/boxing15.kt | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 backend.native/tests/codegen/boxing/boxing14.kt create mode 100644 backend.native/tests/codegen/boxing/boxing15.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 2185ab191d6..7b54c0e32d0 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -502,6 +502,17 @@ task boxing13(type: RunKonanTest) { source = "codegen/boxing/boxing13.kt" } +task boxing14(type: RunKonanTest) { + goldValue = "42\n" + source = "codegen/boxing/boxing14.kt" +} + +task boxing15(type: RunKonanTest) { + disabled = true + goldValue = "17\n" + source = "codegen/boxing/boxing15.kt" +} + task interface0(type: RunKonanTest) { goldValue = "PASSED\n" source = "runtime/basic/interface0.kt" diff --git a/backend.native/tests/codegen/boxing/boxing14.kt b/backend.native/tests/codegen/boxing/boxing14.kt new file mode 100644 index 00000000000..0cf6ae3ff59 --- /dev/null +++ b/backend.native/tests/codegen/boxing/boxing14.kt @@ -0,0 +1,5 @@ +fun main(args: Array) { + 42.println() +} + +fun T.println() = println(this.toString()) \ No newline at end of file diff --git a/backend.native/tests/codegen/boxing/boxing15.kt b/backend.native/tests/codegen/boxing/boxing15.kt new file mode 100644 index 00000000000..f9a27c90931 --- /dev/null +++ b/backend.native/tests/codegen/boxing/boxing15.kt @@ -0,0 +1,5 @@ +fun main(args: Array) { + println(foo(17)) +} + +fun foo(x: T): Int = x \ No newline at end of file From 183155a8a1f15c379e55d2948a50c8ee3af96048 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 23 Jan 2017 12:04:23 +0700 Subject: [PATCH 35/86] backend: handle nullability in cast --- .../konan/lower/TypeOperatorLowering.kt | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt index 84dbbe15e9d..f5f5b277748 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt @@ -3,6 +3,7 @@ package org.jetbrains.kotlin.backend.konan.lower import org.jetbrains.kotlin.backend.common.FunctionLoweringPass import org.jetbrains.kotlin.backend.common.lower.* import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalFunctions import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.IrStatement @@ -14,7 +15,9 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf +import org.jetbrains.kotlin.types.typeUtil.makeNotNullable /** * This lowering pass lowers some [IrTypeOperatorCall]s. @@ -31,6 +34,10 @@ private class TypeOperatorTransformer(val context: Context, val function: Functi private val builder = context.createFunctionIrBuilder(function) + val throwClassCastException by lazy { + context.builtIns.getKonanInternalFunctions("ThrowClassCastException").single() + } + override fun visitFunction(declaration: IrFunction): IrStatement { // ignore inner functions during this pass return declaration @@ -49,17 +56,44 @@ private class TypeOperatorTransformer(val context: Context, val function: Functi } private fun lowerCast(expression: IrTypeOperatorCall): IrExpression { + builder.at(expression) val typeOperand = expression.typeOperand.erasure() - return if (expression.argument.type.isSubtypeOf(typeOperand)) { - // TODO: consider the case when expression type is wrong e.g. due to generics-related unchecked casts. - expression.argument - } else if (typeOperand == expression.typeOperand) { - expression - } else { - builder.at(expression).irAs(expression.argument, typeOperand) + + assert (!TypeUtils.hasNullableSuperType(typeOperand)) // So that `isNullable()` <=> `isMarkedNullable`. + + // TODO: consider the case when expression type is wrong e.g. due to generics-related unchecked casts. + + return when { + expression.argument.type.isSubtypeOf(typeOperand) -> expression.argument + + expression.argument.type.isNullable() -> { + with (builder) { + irLet(expression.argument) { argument -> + irIfThenElse( + type = expression.type, + condition = irEqeqeq(irGet(argument), irNull()), + + thenPart = if (typeOperand.isMarkedNullable) + irNull() + else + irCall(throwClassCastException), + + elsePart = irAs(irGet(argument), typeOperand.makeNotNullable()) + ) + } + } + } + + typeOperand.isMarkedNullable -> builder.irAs(expression.argument, typeOperand.makeNotNullable()) + + typeOperand == expression.typeOperand -> expression + + else -> builder.irAs(expression.argument, typeOperand) } } + private fun KotlinType.isNullable() = TypeUtils.isNullableType(this) + private fun lowerSafeCast(expression: IrTypeOperatorCall): IrExpression { val typeOperand = expression.typeOperand.erasure() From ef6c5364a66737c4caa03774a2a312781b607872 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 23 Jan 2017 11:22:13 +0700 Subject: [PATCH 36/86] backend: fix handling `T?` as type operand: Preserve erased type nullability in type operations lowering. Also make erasure more strict to detect unsupported cases. --- .../konan/lower/TypeOperatorLowering.kt | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt index f5f5b277748..cbf34eb8774 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TypeOperatorLowering.kt @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.backend.common.FunctionLoweringPass import org.jetbrains.kotlin.backend.common.lower.* import org.jetbrains.kotlin.backend.konan.Context import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalFunctions +import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.IrStatement @@ -18,6 +19,7 @@ import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf import org.jetbrains.kotlin.types.typeUtil.makeNotNullable +import org.jetbrains.kotlin.types.typeUtil.makeNullable /** * This lowering pass lowers some [IrTypeOperatorCall]s. @@ -43,15 +45,22 @@ private class TypeOperatorTransformer(val context: Context, val function: Functi return declaration } - private tailrec fun KotlinType.erasure(): KotlinType { + private fun KotlinType.erasure(): KotlinType { val descriptor = this.constructor.declarationDescriptor - return if (descriptor is TypeParameterDescriptor) { - val upperBound = descriptor.upperBounds.singleOrNull() ?: - TODO("$descriptor : ${descriptor.upperBounds}") + return when (descriptor) { + is ClassDescriptor -> this + is TypeParameterDescriptor -> { + val upperBound = descriptor.upperBounds.singleOrNull() ?: + TODO("$descriptor : ${descriptor.upperBounds}") - upperBound.erasure() - } else { - this + if (this.isMarkedNullable) { + // `T?` + upperBound.erasure().makeNullable() + } else { + upperBound.erasure() + } + } + else -> TODO(this.toString()) } } From 16ca88229822161010d9777ab842601e78bf2b86 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Mon, 23 Jan 2017 11:04:42 +0700 Subject: [PATCH 37/86] backend/tests: add cast_null and unchecked_cast3 --- backend.native/tests/build.gradle | 10 ++++ .../tests/codegen/basics/cast_null.kt | 48 +++++++++++++++++++ .../tests/codegen/basics/unchecked_cast3.kt | 35 ++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 backend.native/tests/codegen/basics/cast_null.kt create mode 100644 backend.native/tests/codegen/basics/unchecked_cast3.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 7b54c0e32d0..36dc91b399e 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -212,6 +212,11 @@ task cast_simple(type: RunKonanTest) { source = "codegen/basics/cast_simple.kt" } +task cast_null(type: RunKonanTest) { + goldValue = "Ok\n" + source = "codegen/basics/cast_null.kt" +} + task unchecked_cast1(type: RunKonanTest) { goldValue = "17\n17\n42\n42\n" source = "codegen/basics/unchecked_cast1.kt" @@ -223,6 +228,11 @@ task unchecked_cast2(type: RunKonanTest) { source = "codegen/basics/unchecked_cast2.kt" } +task unchecked_cast3(type: RunKonanTest) { + goldValue = "Ok\n" + source = "codegen/basics/unchecked_cast3.kt" +} + task null_check(type: RunKonanTest) { source = "codegen/basics/null_check.kt" } diff --git a/backend.native/tests/codegen/basics/cast_null.kt b/backend.native/tests/codegen/basics/cast_null.kt new file mode 100644 index 00000000000..cb76a559f78 --- /dev/null +++ b/backend.native/tests/codegen/basics/cast_null.kt @@ -0,0 +1,48 @@ +fun main(args: Array) { + testCast(null, false) + testCastToNullable(null, true) + testCastToNullable(Test(), true) + testCastToNullable("", false) + testCastNotNullableToNullable(Test(), true) + testCastNotNullableToNullable("", false) + + println("Ok") +} + +class Test + +fun ensure(b: Boolean) { + if (!b) { + println("Error") + } +} + +fun testCast(x: Any?, expectSuccess: Boolean) { + try { + x as Test + } catch (e: Throwable) { + ensure(!expectSuccess) + return + } + ensure(expectSuccess) +} + +fun testCastToNullable(x: Any?, expectSuccess: Boolean) { + try { + x as Test? + } catch (e: Throwable) { + ensure(!expectSuccess) + return + } + ensure(expectSuccess) +} + +fun testCastNotNullableToNullable(x: Any, expectSuccess: Boolean) { + try { + x as Test? + } catch (e: Throwable) { + ensure(!expectSuccess) + return + } + ensure(expectSuccess) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/unchecked_cast3.kt b/backend.native/tests/codegen/basics/unchecked_cast3.kt new file mode 100644 index 00000000000..82a514d2226 --- /dev/null +++ b/backend.native/tests/codegen/basics/unchecked_cast3.kt @@ -0,0 +1,35 @@ +fun main(args: Array) { + testCast(Test(), true) + testCast(null, false) + testCastToNullable(null, true) + + println("Ok") +} + +class Test + +fun ensure(b: Boolean) { + if (!b) { + println("Error") + } +} + +fun testCast(x: Any?, expectSuccess: Boolean) { + try { + x as T + } catch (e: Throwable) { + ensure(!expectSuccess) + return + } + ensure(expectSuccess) +} + +fun testCastToNullable(x: Any?, expectSuccess: Boolean) { + try { + x as T? + } catch (e: Throwable) { + ensure(!expectSuccess) + return + } + ensure(expectSuccess) +} \ No newline at end of file From 9999275f4af07b9b7232bb14f8da5a4752a791dd Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 23 Jan 2017 16:15:33 +0300 Subject: [PATCH 38/86] Disabled cross-compilation to iphone on Linux. --- .../src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt index fca55c6824d..965d66e221d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanTarget.kt @@ -16,11 +16,13 @@ class TargetManager(val config: CompilerConfiguration) { init { when (host) { - KonanTarget.MACBOOK -> KonanTarget.MACBOOK.enabled = true KonanTarget.LINUX -> KonanTarget.LINUX.enabled = true + KonanTarget.MACBOOK -> { + KonanTarget.MACBOOK.enabled = true + KonanTarget.IPHONE.enabled = true + KonanTarget.IPHONE_SIM.enabled = true + } } - KonanTarget.IPHONE.enabled = true - KonanTarget.IPHONE_SIM.enabled = true if (!current.enabled) { error("Target $current is not available on the current host") From 5c11c28a094a426dff5252af8c9c78d4f4178df2 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 18 Jan 2017 06:32:52 +0300 Subject: [PATCH 39/86] CODEGEN: variable manager uses descriptor.name as part of the key instead of descriptor minor changes: - rename descriptors -> contextVariableToIndex in variable manager --- .../backend/konan/llvm/VariableManager.kt | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt index 417c3c13f5e..842477a9551 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt @@ -2,6 +2,7 @@ package org.jetbrains.kotlin.backend.konan.llvm import llvm.* import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.* @@ -19,20 +20,20 @@ internal class VariableManager(val codegen: CodeGenerator) { override fun toString() = (if (refSlot) "refslot" else "slot") + " for ${address}" } - class ValueRecord(val value: LLVMValueRef, val descriptor: ValueDescriptor) : Record { + class ValueRecord(val value: LLVMValueRef, val name: Name) : Record { override fun load() : LLVMValueRef = value - override fun store(value: LLVMValueRef) = throw Error("writing to immutable: ${descriptor}") - override fun address() : LLVMValueRef = throw Error("no address for: ${descriptor}") - override fun toString() = "value of ${value} from ${descriptor}" + override fun store(value: LLVMValueRef) = throw Error("writing to immutable: ${name}") + override fun address() : LLVMValueRef = throw Error("no address for: ${name}") + override fun toString() = "value of ${value} from ${name}" } val variables: ArrayList = arrayListOf() - val descriptors: HashMap, Int> = hashMapOf() + val contextVariablesToIndex: HashMap, Int> = hashMapOf() // Clears inner state of variable manager. fun clear() { variables.clear() - descriptors.clear() + contextVariablesToIndex.clear() } fun createVariable(scoped: Pair, value: LLVMValueRef? = null) : Int { @@ -51,14 +52,15 @@ internal class VariableManager(val codegen: CodeGenerator) { fun createMutable(scoped: Pair, isVar: Boolean, value: LLVMValueRef? = null) : Int { val descriptor = scoped.first - assert(descriptors.get(scoped) == null) + val scopedVariable = scoped.first.name to scoped.second + assert(!contextVariablesToIndex.contains(scopedVariable)) val index = variables.size val type = codegen.getLLVMType(descriptor.type) val slot = codegen.alloca(type, descriptor.name.asString()) if (value != null) codegen.storeAnyLocal(value, slot) variables.add(SlotRecord(slot, codegen.isObjectType(type), isVar)) - descriptors[scoped] = index + contextVariablesToIndex[scopedVariable] = index return index } @@ -84,15 +86,20 @@ internal class VariableManager(val codegen: CodeGenerator) { fun createImmutable(scoped: Pair, value: LLVMValueRef) : Int { val descriptor = scoped.first - assert(descriptors.get(scoped) == null) + val scopedVariable = scoped.first.name to scoped.second + assert(!contextVariablesToIndex.containsKey(scopedVariable)) val index = variables.size - variables.add(ValueRecord(value, descriptor)) - descriptors[scoped] = index + variables.add(ValueRecord(value, descriptor.name)) + contextVariablesToIndex[scopedVariable] = index return index } fun indexOf(scoped: Pair) : Int { - return descriptors.getOrElse(scoped) { -1 } + return indexOfNamed(scoped.first.name to scoped.second) + } + + private fun indexOfNamed(scoped: Pair) : Int { + return contextVariablesToIndex.getOrElse(scoped) { -1 } } fun addressOf(index: Int): LLVMValueRef { From dce532f236a08a3964f681e0b0807d4ffc033c07 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 10:42:29 +0300 Subject: [PATCH 40/86] IR: default parameter extension emproved espcially for overided cases and fields evaluating in paramter's expressions. minor changes: - added phase's logging. --- .../lower/DefaultParameterStubGenerator.kt | 262 ++++++++++++------ 1 file changed, 176 insertions(+), 86 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt index 0943c6f0bde..3046764d67a 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt @@ -6,10 +6,11 @@ import org.jetbrains.kotlin.backend.common.lower.createFunctionIrBuilder import org.jetbrains.kotlin.backend.common.lower.irBlockBody import org.jetbrains.kotlin.backend.konan.Context import org.jetbrains.kotlin.backend.konan.KonanPlatform +import org.jetbrains.kotlin.backend.konan.ir.ir2string import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.Annotations -import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor +import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl import org.jetbrains.kotlin.ir.IrElement @@ -18,10 +19,11 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationContainer import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl -import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.ir.util.transformFlat import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid @@ -49,6 +51,11 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): private fun lower(irFunction: IrFunction): List { val bodies = mutableListOf() + val functionDescriptor = irFunction.descriptor + + if (hasNotDefaultParameters(functionDescriptor)) + return irFunction.singletonList() + irFunction.acceptChildrenVoid(object:IrElementVisitorVoid{ override fun visitExpressionBody(body: IrExpressionBody) { bodies.add(body) @@ -59,16 +66,17 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): } }) - val functionDescriptor = irFunction.descriptor + log("detected ${functionDescriptor.name.asString()} has got #${bodies.size} default expressions") + functionDescriptor.overriddenDescriptors.forEach { context.log("DEFAULT-REPLACER: $it") } if (bodies.isNotEmpty()) { - val (descriptor, mask, extension, dispatch) = functionDescriptor.generateDefaultsDescriptor() - val builder = context.createFunctionIrBuilder(descriptor) + val description = functionDescriptor.generateDefaultsDescription() + val builder = context.createFunctionIrBuilder(description.function) val body = builder.irBlockBody(irFunction) { val params = mutableListOf() val variables = mutableMapOf() for (valueParameter in functionDescriptor.valueParameters) { - val parameterDescriptor = descriptor.valueParameters[valueParameter.index] + val parameterDescriptor = description.function.valueParameters[valueParameter.index] if (valueParameter.hasDefaultValue()) { val variable = scope.createTemporaryVariable( irExpression = nullConst(valueParameter.type)!!, @@ -77,7 +85,7 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): params.add(variableDescriptor) +variable val condition = irNotEquals(irCall(intAnd).apply { - dispatchReceiver = irGet(mask) + dispatchReceiver = irGet(description.mask) putValueArgument(0, irInt(1 shl valueParameter.index)) }, irInt(0)) val exprBody = getDefaultParameterExpressionBody(irFunction, valueParameter) @@ -92,36 +100,54 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): /* Mapping calculated values with its origin variables. */ variables.put(valueParameter, variableDescriptor) +irIfThenElse( - type = KonanPlatform.builtIns.unitType, + type = KonanPlatform.builtIns.unitType, condition = condition, - thenPart = irSetVar(variableDescriptor, exprBody.expression), - elsePart = irSetVar(variableDescriptor, irGet(parameterDescriptor))) - + thenPart = irSetVar(variableDescriptor, exprBody.expression), + elsePart = irSetVar(variableDescriptor, irGet(parameterDescriptor))) } else { params.add(parameterDescriptor) } } - + irReturn(irCall(functionDescriptor).apply { - if (functionDescriptor.dispatchReceiverParameter != null) { - dispatchReceiver = irGet(dispatch!!) - } - if (functionDescriptor.extensionReceiverParameter != null) { - extensionReceiver = irGet(extension!!) - } - params.forEachIndexed { i, variable -> - putValueArgument(i, irGet(variable)) - } - }) + if (functionDescriptor !is ClassConstructorDescriptor) { + +irReturn(irCall(functionDescriptor).apply { + if (functionDescriptor.dispatchReceiverParameter != null) { + dispatchReceiver = irThis() + } + if (functionDescriptor.extensionReceiverParameter != null) { + extensionReceiver = IrGetValueImpl( + startOffset = irFunction.startOffset, + endOffset = irFunction.endOffset, + descriptor = functionDescriptor.extensionReceiverParameter!!, + origin = null + ) + } + params.forEachIndexed { i, variable -> + putValueArgument(i, irGet(variable)) + } + }) + } else { + + irReturn(IrDelegatingConstructorCallImpl( + startOffset = irFunction.startOffset, + endOffset = irFunction.endOffset, + descriptor = functionDescriptor + ).apply { + params.forEachIndexed { i, variable -> + putValueArgument(i, irGet(variable)) + } + }) + } } // TODO: replace irFunction with new one without expression bodies. return listOf(irFunction, IrFunctionImpl( - irFunction.startOffset , + irFunction.startOffset, irFunction.endOffset, DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER, - descriptor, body)) + description.function, body)) } return irFunction.singletonList() } + + private fun log(msg:String) = context.log("DEFAULT-REPLACER: $msg") } private fun getDefaultParameterExpressionBody(irFunction: IrFunction, valueParameter: ValueParameterDescriptor):IrExpressionBody { @@ -144,81 +170,134 @@ private fun nullConst(type: KotlinType): IrExpression? { class DefaultParameterInjector internal constructor(val context: Context): BodyLoweringPass { override fun lower(irBody: IrBody) { irBody.transformChildrenVoid(object : IrElementTransformerVoid() { + override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall): IrExpression { + super.visitDelegatingConstructorCall(expression) + val descriptor = expression.descriptor + if (hasNotDefaultParameters(descriptor)) + return expression + val argumentsCount = argumentCount(expression) + if (argumentsCount == descriptor.valueParameters.size) + return expression + val (desc, params) = parametersForCall(expression) + return IrDelegatingConstructorCallImpl( + startOffset = irBody.startOffset, + endOffset = irBody.endOffset, + descriptor = desc.function as ClassConstructorDescriptor) + .apply { + params.forEach { + log("call::params@${it.first.index}/${it.first.name.asString()}: ${ir2string(it.second)}") + putValueArgument(it.first.index, it.second) + } + } + } + override fun visitCall(expression: IrCall): IrExpression { super.visitCall(expression) - val descriptor = expression.descriptor - if (descriptor.valueParameters.none{it.hasDefaultValue()}) + val functionDescriptor = expression.descriptor as FunctionDescriptor + + if (hasNotDefaultParameters(functionDescriptor)) return expression + + val argumentsCount = argumentCount(expression) + if (argumentsCount == functionDescriptor.valueParameters.size) + return expression + val (desc, params) = parametersForCall(expression) + return IrCallImpl( + startOffset = irBody.startOffset, + endOffset = irBody.endOffset, + type = desc.function.returnType!!, + descriptor = desc.function, + typeArguments = null) + .apply { + params.forEach { + log("call::params@${it.first.index}/${it.first.name.asString()}: ${ir2string(it.second)}") + putValueArgument(it.first.index, it.second) + } + expression.extensionReceiver?.apply{ + extensionReceiver = expression.extensionReceiver + } + expression.dispatchReceiver?.apply { + dispatchReceiver = expression.dispatchReceiver + } + log("call::extension@: ${ir2string(expression.extensionReceiver)}") + log("call::dispatch@: ${ir2string(expression.dispatchReceiver)}") + } + } + + private fun parametersForCall(expression: IrMemberAccessExpression): Pair>> { + var maskValue = 0 + val rawDescriptor = expression.descriptor as FunctionDescriptor + val descriptor = rawDescriptor.overriddenDescriptors.firstOrNull()?:rawDescriptor + val desc = descriptor.generateDefaultsDescription() + descriptor.valueParameters.forEach { + log("descriptor::${descriptor.name.asString()}#${it.index}: ${it.name.asString()}") + } + val params = descriptor.valueParameters.mapIndexed { i, _ -> + val valueArgument = expression.getValueArgument(i) + if (valueArgument == null) maskValue = maskValue or (1 shl i) + val valueParameterDescriptor = desc.function.valueParameters[i] + val pair = valueParameterDescriptor to (valueArgument ?: nullConst(valueParameterDescriptor.type)) + return@mapIndexed pair + } + (desc.mask to IrConstImpl( + startOffset = irBody.startOffset, + endOffset = irBody.endOffset, + type = KonanPlatform.builtIns.intType, + kind = IrConstKind.Int, + value = maskValue)) + params.forEach { + log("descriptor::${desc.function.name.asString()}#${it.first.index}: ${it.first.name.asString()}") + } + return Pair(desc, params) + } + + private fun argumentCount(expression: IrMemberAccessExpression): Int { var argumentsCount = 0 - expression.acceptChildrenVoid(object:IrElementVisitorVoid{ + expression.acceptChildrenVoid(object : IrElementVisitorVoid { override fun visitElement(element: IrElement) { argumentsCount++ } }) - if (descriptor.dispatchReceiverParameter != null || descriptor.extensionReceiverParameter != null) + val descriptor = expression.descriptor + if (descriptor !is ConstructorDescriptor && (descriptor.dispatchReceiverParameter != null || descriptor.extensionReceiverParameter != null)) argumentsCount-- - if (argumentsCount == descriptor.valueParameters.size) - return expression - var maskValue = 0 - val functionDescriptor = descriptor as FunctionDescriptor - val (defaultFunctiondescriptor, mask, extension, dispatch) = functionDescriptor.generateDefaultsDescriptor() - val params = descriptor.valueParameters.mapIndexed { i, it -> - if (expression.getValueArgument(i) == null) maskValue = maskValue or (1 shl i) - val valueParameterDescriptor = defaultFunctiondescriptor.valueParameters[i] - return@mapIndexed valueParameterDescriptor to (expression.getValueArgument(i) ?: nullConst(valueParameterDescriptor.type)) - } + (mask to IrConstImpl( - startOffset = irBody.startOffset, - endOffset = irBody.endOffset, - type = KonanPlatform.builtIns.intType, - kind = IrConstKind.Int, - value = maskValue)) - return IrCallImpl( - startOffset = irBody.startOffset, - endOffset = irBody.endOffset, - type = descriptor.returnType!!, - descriptor = defaultFunctiondescriptor, - typeArguments = null) - .apply { - params.forEach { - putValueArgument(it.first.index, it.second) - } - extension?.apply { - putValueArgument(extension.index, expression.extensionReceiver) - } - dispatch?.apply { - putValueArgument(dispatch.index, expression.dispatchReceiver) - } - } + return argumentsCount } }) } + private fun log(msg: String) = context.log("DEFAULT-INJECTOR: $msg") } +private fun hasNotDefaultParameters(descriptor: CallableDescriptor) = descriptor.valueParameters.none { it.hasDefaultValue() } + val intDesctiptor = DescriptorUtils.getClassDescriptorForType(KonanPlatform.builtIns.intType) val intAnd = DescriptorUtils.getFunctionByName(intDesctiptor.unsubstitutedMemberScope, Name.identifier("and")) -data class DefaultParameterDescriptor(val function: FunctionDescriptor, val mask:ValueParameterDescriptor, - val extensionReceiver:ValueParameterDescriptor?, val dispatchReceiver: ValueParameterDescriptor?) +data class DefaultParameterDescription(val function: FunctionDescriptor, val mask:ValueParameterDescriptor, + val hasExtensionReceiver:Boolean, val hasDispatchReceiver: Boolean) -fun FunctionDescriptor.generateDefaultsDescriptor():DefaultParameterDescriptor { - val name = Name.identifier("${this.name.asString()}\$default") - val descriptor = SimpleFunctionDescriptorImpl.create(this.containingDeclaration, Annotations.EMPTY, - name, CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE) - val maskVariable = valueParameter(descriptor, valueParameters.size, "__\$mask\$__", KonanPlatform.builtIns.intType) - - var extensionReceiver:ValueParameterDescriptor? = null - var index = valueParameters.size + 1 - extensionReceiverParameter?.let { - extensionReceiver = valueParameter(descriptor, index++, "__\$ext_receiver\$__", extensionReceiverParameter!!.type) - } - var dispatchReceiver:ValueParameterDescriptor? = null - dispatchReceiverParameter?.let { - dispatchReceiver = valueParameter(descriptor, index++, "__\$dispatch_receiver\$__", dispatchReceiverParameter!!.type) +fun FunctionDescriptor.generateDefaultsDescription(): DefaultParameterDescription { + val descriptor = when (this){ + is ConstructorDescriptor -> ClassConstructorDescriptorImpl.createSynthesized( + /* containingDeclaration = */ this.containingDeclaration as ClassDescriptor, + /* annotations = */ annotations, + /* isPrimary = */ false, + /* source = */ SourceElement.NO_SOURCE) + is FunctionDescriptor -> SimpleFunctionDescriptorImpl.create( + /* containingDeclaration = */ this.containingDeclaration, + /* annotations = */ Annotations.EMPTY, + /* name = */ name, + /* kind = */ CallableMemberDescriptor.Kind.SYNTHESIZED, + /* source = */ SourceElement.NO_SOURCE) + else -> TODO("FIXME!!!") } - val parameterList = mutableListOf(*valueParameters.map{ - if (it.hasDefaultValue()) ValueParameterDescriptorImpl( + val parameterList = mutableListOf() + + val maskVariable = valueParameter(descriptor, valueParameters.size , "__\$mask\$__", KonanPlatform.builtIns.intType) + + parameterList += valueParameters.map{ + ValueParameterDescriptorImpl( containingDeclaration = it.containingDeclaration, original = it.original, index = it.index, @@ -230,21 +309,23 @@ fun FunctionDescriptor.generateDefaultsDescriptor():DefaultParameterDescriptor { isNoinline = it.isNoinline, varargElementType = it.varargElementType, source = it.source) - else it - }.toTypedArray()) + } parameterList.add(maskVariable) - if (extensionReceiver != null) parameterList.add(extensionReceiver) - if (dispatchReceiver != null) parameterList.add(dispatchReceiver) descriptor.initialize( - /* receiverParameterType = */ null, - /* dispatchReceiverParameterType = */ null, + /* receiverParameterType = */ extensionReceiverParameter?.type, + /* dispatchReceiverParameter = */ dispatchReceiverParameter, /* typeParameters = */ typeParameters, /* unsubstitutedValueParameters = */ parameterList, /* unsubstitutedReturnType = */ returnType, - /* modality = */ this.modality, + /* modality = */ Modality.FINAL, /* visibility = */ this.visibility) - return DefaultParameterDescriptor(descriptor, maskVariable, extensionReceiver, dispatchReceiver) + return DefaultParameterDescription( + function = if (descriptor is ClassConstructorDescriptor) DefaultParameterClassConstructorDescriptor(descriptor) + else descriptor, + mask = maskVariable, + hasDispatchReceiver = (extensionReceiverParameter != null), + hasExtensionReceiver = (dispatchReceiverParameter != null)) } private fun valueParameter(descriptor: FunctionDescriptor, index: Int, name: String, type: KotlinType):ValueParameterDescriptor { @@ -261,4 +342,13 @@ private fun valueParameter(descriptor: FunctionDescriptor, index: Int, name: Str varargElementType = null, source = SourceElement.NO_SOURCE ) +} + +/** + * This descriptor overrides name property, for class constructor : instead of -> $defeult symbol. + */ +class DefaultParameterClassConstructorDescriptor(val descriptor: ClassConstructorDescriptor): ClassConstructorDescriptor by descriptor { + override fun getName(): Name { + return Name.identifier("${descriptor.name.asString()}\$default") + } } \ No newline at end of file From 00aba8a08d2ba7cde94e6a9a09080cf4752a2d66 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 18 Jan 2017 06:31:37 +0300 Subject: [PATCH 41/86] TEST: enable defaults{4,5,6} --- backend.native/tests/build.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 36dc91b399e..80604dab017 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -177,19 +177,16 @@ task defaults3(type: RunKonanTest) { } task defaults4(type: RunKonanTest) { - disabled = true goldValue = "43\n" source = "codegen/function/defaults4.kt" } task defaults5(type: RunKonanTest) { - disabled = true goldValue = "5\n6\n" source = "codegen/function/defaults5.kt" } task defaults6(type: RunKonanTest) { - disabled = true goldValue = "42\n" source = "codegen/function/defaults6.kt" } From e895c0939c48e2c1c54b6e56afdcb85e112651fb Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 23 Jan 2017 19:42:59 +0300 Subject: [PATCH 42/86] More complete iphone_sim target support. --- .../jetbrains/kotlin/backend/konan/LinkStage.kt | 10 ++++++++++ backend.native/konan.properties | 14 ++++++++++++++ build.gradle | 2 +- dependencies/build.gradle | 3 +++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt index eff3e808dd9..0fe7e41762e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt @@ -67,6 +67,14 @@ internal class IPhoneOSfromMacOSPlatform(distribution: Distribution) override val targetSysRoot = "${distribution.dependencies}/${properties.propertyString("targetSysRoot.osx-ios")!!}" } +internal class IPhoneSimulatorFromMacOSPlatform(distribution: Distribution) + : MacOSPlatform(distribution) { + + override val arch = properties.propertyString("arch.osx-ios-sim")!! + override val osVersionMin = properties.propertyList("osVersionMin.osx-ios-sim") + override val llvmLlcFlags = properties.propertyList("llvmLlcFlags.osx-ios-sim") + override val targetSysRoot = "${distribution.dependencies}/${properties.propertyString("targetSysRoot.osx-ios-sim")!!}" +} internal class LinuxPlatform(distribution: Distribution) : PlatformFlags(distribution) { @@ -121,6 +129,8 @@ internal class LinkStage(val context: Context) { val platform: PlatformFlags = when (TargetManager.host) { KonanTarget.LINUX -> LinuxPlatform(distribution) KonanTarget.MACBOOK -> when (targetManager.current) { + KonanTarget.IPHONE_SIM + -> IPhoneSimulatorFromMacOSPlatform(distribution) KonanTarget.IPHONE -> IPhoneOSfromMacOSPlatform(distribution) KonanTarget.MACBOOK diff --git a/backend.native/konan.properties b/backend.native/konan.properties index 729f32031dc..56e630975a5 100644 --- a/backend.native/konan.properties +++ b/backend.native/konan.properties @@ -1,6 +1,7 @@ // TODO: utilize substitution mechanism from interop. +// macbook arch.osx = x86_64 sysRoot.osx = target-sysroot-1-darwin-macos llvmHome.osx = clang+llvm-3.8.0-darwin-macos @@ -10,6 +11,7 @@ linkerKonanFlags.osx = -lc++ linkerOptimizationFlags.osx = -dead_strip osVersionMin.osx = -macosx_version_min 10.10.0 +// iphone arch.osx-ios = arm64 sysRoot.osx-ios = target-sysroot-1-darwin-macos targetSysRoot.osx-ios = target-sysroot-1-darwin-ios @@ -20,6 +22,18 @@ linkerKonanFlags.osx-ios = -lc++ linkerOptimizationFlags.osx-ios = -dead_strip osVersionMin.osx-ios = -iphoneos_version_min 5.0.0 +// iphone_sim +arch.osx-ios-sim = x86_64 +sysRoot.osx-ios-sim = target-sysroot-1-darwin-macos +targetSysRoot.osx-ios-sim = target-sysroot-1-darwin-ios-sim +llvmHome.osx-ios-sim = clang+llvm-3.8.0-darwin-macos +llvmLtoFlags.osx-ios-sim = -O3 -function-sections -exported-symbol=_main +llvmLlcFlags.osx-ios-sim = -mtriple=x86_64-apple-ios5.0.0 +linkerKonanFlags.osx-ios-sim = -lc++ +linkerOptimizationFlags.osx-ios-sim = -dead_strip +osVersionMin.osx-ios-sim = -ios_simulator_version_min 5.0.0 + +// linux sysRoot.linux = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot llvmHome.linux = clang+llvm-3.8.0-linux-x86-64 libGcc.linux = target-gcc-toolchain-3-linux-x86-64/lib/gcc/x86_64-unknown-linux-gnu/4.8.5 diff --git a/build.gradle b/build.gradle index 322a36a912e..99ca05a0dc9 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ allprojects { "iphone": ["-stdlib=libc++", "-arch", "arm64", "-isysroot", "$iphoneSysrootDir"], "iphone_sim": - ["-stdlib=libc++"] + ["-stdlib=libc++", "-isysroot", "$iphoneSimSysrootDir"], ] } ext.targetList = ext.targetArgs.keySet() as List diff --git a/dependencies/build.gradle b/dependencies/build.gradle index 0faa97197e4..9a98ec732ae 100644 --- a/dependencies/build.gradle +++ b/dependencies/build.gradle @@ -89,6 +89,9 @@ if (isLinux()) { task iphoneSysroot(type: TgzNativeDep) { baseName = "target-sysroot-1-darwin-ios" } + task iphoneSimSysroot(type: TgzNativeDep) { + baseName = "target-sysroot-1-darwin-ios-sim" + } } From a856b0d9ceb350484fc6904a9940d0a72affd10c Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 23 Jan 2017 20:32:24 +0300 Subject: [PATCH 43/86] More accurate host- and cross- target separations. --- backend.native/build.gradle | 34 ++++++++-------- .../kotlin/backend/konan/llvm/Runtime.kt | 1 + build.gradle | 4 +- common/build.gradle | 14 ++++--- runtime/build.gradle | 39 ++++++++++--------- 5 files changed, 48 insertions(+), 44 deletions(-) diff --git a/backend.native/build.gradle b/backend.native/build.gradle index 297ac48ad09..6ae53526e12 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -143,7 +143,7 @@ kotlinNativeInterop { compilerOpts '-fPIC' linkerOpts '-fPIC' linker 'clang++' - linkOutputs ':common:compileHash' + linkOutputs ':common:hostHash' headers fileTree('../common/src/hash/headers') { include '**/*.h' @@ -191,48 +191,48 @@ task start(dependsOn: 'hostStart') // so we provide custom values for // -runtime, -properties, -library and -Djava.library.path -targetList.each { platformName -> - task("${platformName}Stdlib", type: JavaExec) { +targetList.each { target -> + task("${target}Stdlib", type: JavaExec) { main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' classpath = project.configurations.cli_bc jvmArgs "-ea", "-Dkonan.home=${project.parent.file('dist')}", "-Djava.library.path=${project.buildDir}/nativelibs" - args('-output', project(':runtime').file("build/${platformName}/stdlib.kt.bc"), + args('-output', project(':runtime').file("build/${target}/stdlib.kt.bc"), '-nolink', '-nostdlib', - '-target', platformName, - '-runtime', project(':runtime').file("build/${platformName}/runtime.bc"), + '-target', target, + '-runtime', project(':runtime').file("build/${target}/runtime.bc"), '-properties', project(':backend.native').file('konan.properties'), project(':runtime').file('src/main/kotlin'), *project.globalArgs) inputs.dir(project(':runtime').file('src/main/kotlin')) - outputs.file(project(':runtime').file("build/${platformName}/stdlib.kt.bc")) + outputs.file(project(':runtime').file("build/${target}/stdlib.kt.bc")) - dependsOn ":runtime:build" + dependsOn ":runtime:${target}Runtime" } } -targetList.each { platformName -> - task("${platformName}Start", type: JavaExec) { +targetList.each { target -> + task("${target}Start", type: JavaExec) { main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' classpath = project.configurations.cli_bc jvmArgs "-ea", "-Dkonan.home=${project.parent.file('dist')}", "-Djava.library.path=${project.buildDir}/nativelibs" - args('-output', project(':runtime').file("build/${platformName}/start.kt.bc"), + args('-output', project(':runtime').file("build/${target}/start.kt.bc"), '-nolink', '-nostdlib', - '-target', platformName, - '-library', project(':runtime').file("build/${platformName}/stdlib.kt.bc"), - '-runtime', project(':runtime').file("build/${platformName}/runtime.bc"), + '-target', target, + '-library', project(':runtime').file("build/${target}/stdlib.kt.bc"), + '-runtime', project(':runtime').file("build/${target}/runtime.bc"), '-properties', project(':backend.native').file('konan.properties'), project(':runtime').file('src/launcher/kotlin'), *project.globalArgs) inputs.dir(project(':runtime').file('src/launcher/kotlin')) - outputs.file(project(':runtime').file("build/${platformName}/start.kt.bc")) + outputs.file(project(':runtime').file("build/${target}/start.kt.bc")) - dependsOn ":runtime:build", "${platformName}Stdlib" + dependsOn ":runtime:${target}Runtime", "${target}Stdlib" } } @@ -248,7 +248,7 @@ task jars(type: Jar) { 'build/classes/hashInteropStubs', 'build/classes/llvmInteropStubs' - dependsOn 'build', ':runtime:build', 'external_jars' + dependsOn 'build', ':runtime:hostRuntime', 'external_jars' } task external_jars(type: Copy) { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt index 9bcd2bc4bf6..76c97f54cc2 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt @@ -11,6 +11,7 @@ class Runtime(private val bitcodeFile: String) { val bufRef = alloc() val errorRef = allocPointerTo() + val res = LLVMCreateMemoryBufferWithContentsOfFile(bitcodeFile, bufRef.ptr, errorRef.ptr) if (res != 0) { throw Error(errorRef.value?.asCString()?.toString()) diff --git a/build.gradle b/build.gradle index 99ca05a0dc9..d88d10dc60e 100644 --- a/build.gradle +++ b/build.gradle @@ -148,7 +148,7 @@ task list_dist(type: Exec) { } task dist_runtime(type: Copy) { - dependsOn ':runtime:build' + dependsOn ':runtime:hostRuntime' dependsOn ':backend.native:hostStdlib' dependsOn ':backend.native:hostStart' @@ -161,7 +161,7 @@ task dist_runtime(type: Copy) { } task cross_dist_runtime(type: Copy) { - dependsOn ':runtime:build' + dependsOn.addAll(targetList.collect { ":runtime:${it}Runtime" }) dependsOn.addAll(targetList.collect { ":backend.native:${it}Stdlib" }) dependsOn.addAll(targetList.collect { ":backend.native:${it}Start" }) diff --git a/common/build.gradle b/common/build.gradle index a676dfa0c6a..698c7e49608 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,15 +1,17 @@ -import org.jetbrains.kotlin.CompilePerTarget +import org.jetbrains.kotlin.CompileCppToBitcode // TODO: consider using some Gradle plugins to build and test -task compileHash(type: CompilePerTarget) { - name 'hash' - targetList targetList - targetArgs targetArgs +targetList.each { targetName -> + task ("${targetName}Hash", type: CompileCppToBitcode) { + name 'hash' + target targetName + compilerArgs targetArgs[targetName] + } } task build { - dependsOn compileHash + dependsOn hostHash } task clean << { diff --git a/runtime/build.gradle b/runtime/build.gradle index 11baaf62517..37647e082b3 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -1,28 +1,29 @@ -import org.jetbrains.kotlin.CompilePerTarget +import org.jetbrains.kotlin.CompileCppToBitcode // TODO: consider using some Gradle plugins to build and test - -task build(type: CompilePerTarget) { - name 'runtime' - srcRoot file('src/main') - dependsOn ":common:compileHash" - dependsOn "launcher" - targetList targetList - targetArgs targetArgs - compilerArgs '-I' + project.file('../common/src/hash/headers') // TODO: copy-pasted from 'common' - targetLinkerArgs targetList.collectEntries { - [it,[project.file("../common/build/$it/hash.bc")]] +targetList.each { targetName -> + task("${targetName}Runtime", type: CompileCppToBitcode) { + name "runtime" + srcRoot file('src/main') + dependsOn ":common:${targetName}Hash" + dependsOn "${targetName}Launcher" + target targetName + compilerArgs targetArgs[targetName] + compilerArgs '-I' + project.file('../common/src/hash/headers') + linkerArgs project.file("../common/build/$targetName/hash.bc").path } } -task launcher(type: CompilePerTarget) { - name 'launcher' - srcRoot file('src/launcher') - targetList targetList - targetArgs targetArgs - compilerArgs '-I' + project.file('../common/src/hash/headers') // TODO: copy-pasted from 'common' - compilerArgs '-I' + project.file('src/main/cpp') +targetList.each { targetName -> + task("${targetName}Launcher", type: CompileCppToBitcode) { + name "launcher" + srcRoot file('src/launcher') + target targetName + compilerArgs targetArgs[targetName] + compilerArgs '-I' + project.file('../common/src/hash/headers') + compilerArgs '-I' + project.file('src/main/cpp') + } } task clean << { From 5814c72c74f80f0fa7124ceb45e9f7d5f5c55fc0 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 23 Jan 2017 23:54:21 +0300 Subject: [PATCH 44/86] Temporarily disabled iphone_sim build, until we figure out how to bring the sysroot for it. --- build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index d88d10dc60e..c4bca47d1c8 100644 --- a/build.gradle +++ b/build.gradle @@ -36,8 +36,9 @@ allprojects { ["--sysroot=$hostSysrootDir"], "iphone": ["-stdlib=libc++", "-arch", "arm64", "-isysroot", "$iphoneSysrootDir"], - "iphone_sim": - ["-stdlib=libc++", "-isysroot", "$iphoneSimSysrootDir"], +// TODO: re-enable after simulator sysroot is available in the dependencies +// "iphone_sim": +// ["-stdlib=libc++", "-isysroot", "$iphoneSimSysrootDir"], ] } ext.targetList = ext.targetArgs.keySet() as List From 7226a47edf0815eeed2cb37ee9f8eba5e466ac75 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Tue, 24 Jan 2017 01:38:21 +0300 Subject: [PATCH 45/86] Disable simulator sysroot download. --- dependencies/build.gradle | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dependencies/build.gradle b/dependencies/build.gradle index 9a98ec732ae..0175635a5dd 100644 --- a/dependencies/build.gradle +++ b/dependencies/build.gradle @@ -89,9 +89,11 @@ if (isLinux()) { task iphoneSysroot(type: TgzNativeDep) { baseName = "target-sysroot-1-darwin-ios" } - task iphoneSimSysroot(type: TgzNativeDep) { - baseName = "target-sysroot-1-darwin-ios-sim" - } +// TODO: re-enable when we known how to bring the simulator +// sysroot to dependencies. +// task iphoneSimSysroot(type: TgzNativeDep) { +// baseName = "target-sysroot-1-darwin-ios-sim" +// } } From afeb1b2d557f45ec8df3290ae73358cec94f2d04 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 24 Jan 2017 15:27:08 +0300 Subject: [PATCH 46/86] More of stdlib. (#183) --- .../kotlin/backend/konan/descriptors/utils.kt | 2 +- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 2 + runtime/src/main/cpp/Operator.cpp | 10 +- runtime/src/main/kotlin/konan/Annotations.kt | 25 + runtime/src/main/kotlin/kotlin/Annotations.kt | 3 +- runtime/src/main/kotlin/kotlin/Array.kt | 7 - runtime/src/main/kotlin/kotlin/Arrays.kt | 304 ++- runtime/src/main/kotlin/kotlin/Comparable.kt | 5 + runtime/src/main/kotlin/kotlin/Numbers.kt | 39 + .../kotlin/kotlin/collections/ArrayList.kt | 2 +- .../kotlin/kotlin/collections/Collections.kt | 2125 ++++++++++++++++- .../main/kotlin/kotlin/collections/HashMap.kt | 5 +- .../main/kotlin/kotlin/collections/HashSet.kt | 5 +- .../kotlin/kotlin/collections/IndexedValue.kt | 9 + .../kotlin/kotlin/collections/Iterables.kt | 82 + .../kotlin/kotlin/collections/Iterators.kt | 28 + .../main/kotlin/kotlin/collections/Maps.kt | 73 +- .../kotlin/collections/MutableCollections.kt | 81 +- .../kotlin/kotlin/collections/RandomAccess.kt | 3 + .../kotlin/kotlin/comparisons/Comparisons.kt | 300 +++ .../src/main/kotlin/kotlin/ranges/Ranges.kt | 9 + .../{collections => sequences}/Sequence.kt | 19 + .../main/kotlin/kotlin/sequences/Sequences.kt | 1527 ++++++++++++ .../src/main/kotlin/kotlin/text/Appendable.kt | 7 + .../main/kotlin/kotlin/text/StringBuilder.kt | 12 +- .../main/kotlin/kotlin/util/Preconditions.kt | 98 + 26 files changed, 4613 insertions(+), 169 deletions(-) create mode 100644 runtime/src/main/kotlin/kotlin/Numbers.kt create mode 100644 runtime/src/main/kotlin/kotlin/collections/IndexedValue.kt create mode 100644 runtime/src/main/kotlin/kotlin/collections/Iterables.kt create mode 100644 runtime/src/main/kotlin/kotlin/collections/RandomAccess.kt create mode 100644 runtime/src/main/kotlin/kotlin/comparisons/Comparisons.kt rename runtime/src/main/kotlin/kotlin/{collections => sequences}/Sequence.kt (66%) create mode 100644 runtime/src/main/kotlin/kotlin/sequences/Sequences.kt create mode 100644 runtime/src/main/kotlin/kotlin/text/Appendable.kt create mode 100644 runtime/src/main/kotlin/kotlin/util/Preconditions.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt index 50848338d7e..5ab5c6fbc63 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt @@ -37,5 +37,5 @@ val PropertyDescriptor.backingField: PropertyDescriptor? } fun DeclarationDescriptor.deepPrint() { - this!!.accept(DeepPrintVisitor(PrintVisitor()), 0) + this.accept(DeepPrintVisitor(PrintVisitor()), 0) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 8088e1d225a..dd41c2912aa 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1334,6 +1334,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid private fun genInstanceOf(obj: LLVMValueRef, type: KotlinType): LLVMValueRef { val dstDescriptor = TypeUtils.getClassDescriptor(type) // Get class descriptor for dst type. + // Reified parameters are not yet supported. + assert(dstDescriptor != null) val dstTypeInfo = codegen.typeInfoValue(dstDescriptor!!) // Get TypeInfo for dst type. val srcObjInfoPtr = codegen.bitcast(codegen.kObjHeaderPtr, obj) // Cast src to ObjInfoPtr. val args = listOf(srcObjInfoPtr, dstTypeInfo) // Create arg list. diff --git a/runtime/src/main/cpp/Operator.cpp b/runtime/src/main/cpp/Operator.cpp index e88bbeb3bba..0408aa043f3 100644 --- a/runtime/src/main/cpp/Operator.cpp +++ b/runtime/src/main/cpp/Operator.cpp @@ -370,7 +370,11 @@ KInt Kotlin_Float_bits (KFloat a) { return alias.i; } -//--- Double ------------------------------------------------------------------// +KBoolean Kotlin_Float_isNaN (KFloat a) { return isnan(a); } +KBoolean Kotlin_Float_isInfinite (KFloat a) { return isinf(a); } +KBoolean Kotlin_Float_isFinite (KFloat a) { return isfinite(a); } + + //--- Double ------------------------------------------------------------------// KInt Kotlin_Double_compareTo_Byte (KDouble a, KByte b) { if (a == b) return 0; return (a < b) ? -1 : 1; } KInt Kotlin_Double_compareTo_Short (KDouble a, KShort b) { if (a == b) return 0; return (a < b) ? -1 : 1; } @@ -435,4 +439,8 @@ KLong Kotlin_Double_bits (KDouble a) { return alias.l; } +KBoolean Kotlin_Double_isNaN (KDouble a) { return isnan(a); } +KBoolean Kotlin_Double_isInfinite (KDouble a) { return isinf(a); } +KBoolean Kotlin_Double_isFinite (KDouble a) { return isfinite(a); } + } // extern "C" diff --git a/runtime/src/main/kotlin/konan/Annotations.kt b/runtime/src/main/kotlin/konan/Annotations.kt index dbd0712ed4f..c83a8807deb 100644 --- a/runtime/src/main/kotlin/konan/Annotations.kt +++ b/runtime/src/main/kotlin/konan/Annotations.kt @@ -31,6 +31,31 @@ public annotation class Used */ public annotation class FixmeInner +/** + * Need to be fixed because of reification support. + */ +public annotation class FixmeReified + +/** + * Need to be fixed because of sorting support. + */ +public annotation class FixmeSorting + +/** + * Need to be fixed because of specialization support. + */ +public annotation class FixmeSpecialization + +/** + * Need to be fixed because of sequences support. + */ +public annotation class FixmeSequences + +/** + * Need to be fixed because of variance support. + */ +public annotation class FixmeVariance + /** * Need to be fixed. */ diff --git a/runtime/src/main/kotlin/kotlin/Annotations.kt b/runtime/src/main/kotlin/kotlin/Annotations.kt index f0419f3ee78..edc4e8af6c4 100644 --- a/runtime/src/main/kotlin/kotlin/Annotations.kt +++ b/runtime/src/main/kotlin/kotlin/Annotations.kt @@ -6,7 +6,8 @@ package kotlin */ //@Target(CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, // CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE, TYPEALIAS) -@Target(AnnotationTarget.TYPE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION) +@Target(AnnotationTarget.TYPE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION, + AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FUNCTION) //@Retention(SOURCE) public annotation class Suppress(vararg val names: String) diff --git a/runtime/src/main/kotlin/kotlin/Array.kt b/runtime/src/main/kotlin/kotlin/Array.kt index 7b02c11f628..53e5b9d41f9 100644 --- a/runtime/src/main/kotlin/kotlin/Array.kt +++ b/runtime/src/main/kotlin/kotlin/Array.kt @@ -48,13 +48,6 @@ private class IteratorImpl(val collection: Array) : Iterator { fun arrayOf(vararg elements: T) : Array = elements -public fun > Array.toCollection(destination: C): C { - for (item in this) { - destination.add(item) - } - return destination -} - @kotlin.internal.InlineOnly public inline operator fun Array.plus(elements: Array): Array { val result = copyOfUninitializedElements(this.size + elements.size) diff --git a/runtime/src/main/kotlin/kotlin/Arrays.kt b/runtime/src/main/kotlin/kotlin/Arrays.kt index 78e5f6c0bab..182585a5b92 100644 --- a/runtime/src/main/kotlin/kotlin/Arrays.kt +++ b/runtime/src/main/kotlin/kotlin/Arrays.kt @@ -488,14 +488,6 @@ public inline fun Array.lastOrNull(predicate: (T) -> Boolean): T? { return null } -/** - * Returns `true` if the array is empty. - */ -@kotlin.internal.InlineOnly -public inline fun Array.isEmpty(): Boolean { - return size == 0 -} - /** * Returns the range of valid indices for the array. */ @@ -592,4 +584,300 @@ public fun Array.sum(): Double { return sum } +// From _Arrays.kt. +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun Array.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun ByteArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun ShortArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun IntArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun LongArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun FloatArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun DoubleArray.isEmpty(): Boolean { + return size == 0 +} +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun BooleanArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is empty. + */ +@kotlin.internal.InlineOnly +public inline fun CharArray.isEmpty(): Boolean { + return size == 0 +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun Array.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun ByteArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun ShortArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun IntArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun LongArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun FloatArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun DoubleArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun BooleanArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Returns `true` if the array is not empty. + */ +@kotlin.internal.InlineOnly +public inline fun CharArray.isNotEmpty(): Boolean { + return !isEmpty() +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > Array.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > ByteArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > ShortArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > IntArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > LongArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > FloatArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > DoubleArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > BooleanArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > CharArray.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun Array.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun ByteArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun ShortArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun IntArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun LongArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun FloatArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun DoubleArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun BooleanArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun CharArray.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(size))) +} diff --git a/runtime/src/main/kotlin/kotlin/Comparable.kt b/runtime/src/main/kotlin/kotlin/Comparable.kt index ea286e91e02..9ef2491dc2b 100644 --- a/runtime/src/main/kotlin/kotlin/Comparable.kt +++ b/runtime/src/main/kotlin/kotlin/Comparable.kt @@ -1,5 +1,7 @@ package kotlin +import kotlin.comparisons.Comparator + /** * Classes which inherit from this interface have a defined total ordering between their instances. */ @@ -11,3 +13,6 @@ public interface Comparable { */ public operator fun compareTo(other: T): Int } + +typealias Comparator = kotlin.comparisons.Comparator + diff --git a/runtime/src/main/kotlin/kotlin/Numbers.kt b/runtime/src/main/kotlin/kotlin/Numbers.kt new file mode 100644 index 00000000000..3d0e5f8b6bd --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/Numbers.kt @@ -0,0 +1,39 @@ +package kotlin + +/** + * Returns `true` if the specified number is a + * Not-a-Number (NaN) value, `false` otherwise. + */ +@SymbolName("Kotlin_Double_isNaN") +external public fun Double.isNaN(): Boolean + +/** + * Returns `true` if the specified number is a + * Not-a-Number (NaN) value, `false` otherwise. + */ +@SymbolName("Kotlin_Float_isNaN") +external public fun Float.isNaN(): Boolean + +/** + * Returns `true` if this value is infinitely large in magnitude. + */ +@SymbolName("Kotlin_Double_isInfinite") +external public fun Double.isInfinite(): Boolean + +/** + * Returns `true` if this value is infinitely large in magnitude. + */ +@SymbolName("Kotlin_Float_isInfinite") +external public fun Float.isInfinite(): Boolean + +/** + * Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments). + */ +@SymbolName("Kotlin_Double_isFinite") +external public fun Double.isFinite(): Boolean + +/** + * Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments). + */ +@SymbolName("Kotlin_Float_isFinite") +external public fun Float.isFinite(): Boolean diff --git a/runtime/src/main/kotlin/kotlin/collections/ArrayList.kt b/runtime/src/main/kotlin/kotlin/collections/ArrayList.kt index f97e037b53b..c8cfb957108 100644 --- a/runtime/src/main/kotlin/kotlin/collections/ArrayList.kt +++ b/runtime/src/main/kotlin/kotlin/collections/ArrayList.kt @@ -5,7 +5,7 @@ class ArrayList private constructor( private var offset: Int, private var length: Int, private val backing: ArrayList? -) : MutableList { +) : MutableList, RandomAccess { constructor() : this(10) diff --git a/runtime/src/main/kotlin/kotlin/collections/Collections.kt b/runtime/src/main/kotlin/kotlin/collections/Collections.kt index 783add20e8c..99740b8cd25 100644 --- a/runtime/src/main/kotlin/kotlin/collections/Collections.kt +++ b/runtime/src/main/kotlin/kotlin/collections/Collections.kt @@ -1,5 +1,7 @@ package kotlin.collections +import kotlin.comparisons.* + internal object EmptyIterator : ListIterator { override fun hasNext(): Boolean = false override fun hasPrevious(): Boolean = false @@ -115,7 +117,7 @@ public inline fun <@kotlin.internal.OnlyInputTypes T> Collection.containsAll( // copies typed varargs array to array of objects // TODO: generally wrong, wrt specialization. -@Fixme +@FixmeSpecialization private fun Array.copyToArrayOfAny(isVarargs: Boolean): Array = if (isVarargs) // if the array came from varargs and already is array of Any, copying isn't required. @@ -147,61 +149,8 @@ public interface MutableIterable : Iterable { override fun iterator(): MutableIterator } -/** - * Returns `true` if all elements match the given [predicate]. - */ -public inline fun Iterable.all(predicate: (T) -> Boolean): Boolean { - for (element in this) if (!predicate(element)) return false - return true -} - -/** - * Returns `true` if collection has at least one element. - */ -public fun Iterable.any(): Boolean { - for (element in this) return true - return false -} - -/** - * Returns `true` if at least one element matches the given [predicate]. - */ -public inline fun Iterable.any(predicate: (T) -> Boolean): Boolean { - for (element in this) if (predicate(element)) return true - return false -} - -/** - * Returns a list containing all elements not matching the given [predicate]. - */ -public inline fun Iterable.filterNot(predicate: (T) -> Boolean): List { - return filterNotTo(ArrayList(), predicate) -} - -/** - * Returns a list containing all elements that are not `null`. - */ -public fun Iterable.filterNotNull(): List { - return filterNotNullTo(ArrayList()) -} - -/** - * Appends all elements that are not `null` to the given [destination]. - */ -public fun , T : Any> Iterable.filterNotNullTo(destination: C): C { - for (element in this) if (element != null) destination.add(element) - return destination -} - -/** - * Appends all elements not matching the given [predicate] to the given [destination]. - */ -public inline fun > Iterable.filterNotTo(destination: C, predicate: (T) -> Boolean): C { - for (element in this) if (!predicate(element)) destination.add(element) - return destination -} - +@Fixme fun Array.asList(): List { // TODO: consider making lighter list over an array. val result = ArrayList(this.size) @@ -230,6 +179,7 @@ fun Array.toSet(): Set { return result } +@FixmeVariance public fun > Iterable.toCollection(destination: C): C { for (item in this) { destination.add(item) @@ -237,7 +187,260 @@ public fun > Iterable.toCollection(destina return destination } +@Fixme +internal fun List.optimizeReadOnlyList() = this + // From generated _Collections.kt. +///////// + +/** + * Returns 1st *element* from the collection. + */ +@kotlin.internal.InlineOnly +public inline operator fun List.component1(): T { + return get(0) +} + +/** + * Returns 2nd *element* from the collection. + */ +@kotlin.internal.InlineOnly +public inline operator fun List.component2(): T { + return get(1) +} + +/** + * Returns 3rd *element* from the collection. + */ +@kotlin.internal.InlineOnly +public inline operator fun List.component3(): T { + return get(2) +} + +/** + * Returns 4th *element* from the collection. + */ +@kotlin.internal.InlineOnly +public inline operator fun List.component4(): T { + return get(3) +} + +/** + * Returns 5th *element* from the collection. + */ +@kotlin.internal.InlineOnly +public inline operator fun List.component5(): T { + return get(4) +} + +/** + * Returns `true` if [element] is found in the collection. + */ +public operator fun <@kotlin.internal.OnlyInputTypes T> Iterable.contains(element: T): Boolean { + if (this is Collection) + return contains(element) + return indexOf(element) >= 0 +} + +/** + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection. + */ +public fun Iterable.elementAt(index: Int): T { + if (this is List) + return get(index) + return elementAtOrElse(index) { throw IndexOutOfBoundsException("Collection doesn't contain element at index $index.") } +} + +/** + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this list. + */ +@kotlin.internal.InlineOnly +public inline fun List.elementAt(index: Int): T { + return get(index) +} + +/** + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection. + */ +public fun Iterable.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T { + if (this is List) + return this.getOrElse(index, defaultValue) + if (index < 0) + return defaultValue(index) + val iterator = iterator() + var count = 0 + while (iterator.hasNext()) { + val element = iterator.next() + if (index == count++) + return element + } + return defaultValue(index) +} + +/** + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this list. + */ +@kotlin.internal.InlineOnly +public inline fun List.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T { + return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) +} + +/** + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection. + */ +public fun Iterable.elementAtOrNull(index: Int): T? { + if (this is List) + return this.getOrNull(index) + if (index < 0) + return null + val iterator = iterator() + var count = 0 + while (iterator.hasNext()) { + val element = iterator.next() + if (index == count++) + return element + } + return null +} + +/** + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this list. + */ +@kotlin.internal.InlineOnly +public inline fun List.elementAtOrNull(index: Int): T? { + return this.getOrNull(index) +} + +/** + * Returns the first element matching the given [predicate], or `null` if no such element was found. + */ +@kotlin.internal.InlineOnly +public inline fun Iterable.find(predicate: (T) -> Boolean): T? { + return firstOrNull(predicate) +} + +/** + * Returns the last element matching the given [predicate], or `null` if no such element was found. + */ +@kotlin.internal.InlineOnly +public inline fun Iterable.findLast(predicate: (T) -> Boolean): T? { + return lastOrNull(predicate) +} + +/** + * Returns the last element matching the given [predicate], or `null` if no such element was found. + */ +@kotlin.internal.InlineOnly +public inline fun List.findLast(predicate: (T) -> Boolean): T? { + return lastOrNull(predicate) +} + +/** + * Returns first element. + * @throws [NoSuchElementException] if the collection is empty. + */ +public fun Iterable.first(): T { + when (this) { + is List -> return this.first() + else -> { + val iterator = iterator() + if (!iterator.hasNext()) + throw NoSuchElementException("Collection is empty.") + return iterator.next() + } + } +} + +/** + * Returns first element. + * @throws [NoSuchElementException] if the list is empty. + */ +public fun List.first(): T { + if (isEmpty()) + throw NoSuchElementException("List is empty.") + return this[0] +} + +/** + * Returns the first element matching the given [predicate]. + * @throws [NoSuchElementException] if no such element is found. + */ +public inline fun Iterable.first(predicate: (T) -> Boolean): T { + for (element in this) if (predicate(element)) return element + throw NoSuchElementException("Collection contains no element matching the predicate.") +} + +/** + * Returns the first element, or `null` if the collection is empty. + */ +public fun Iterable.firstOrNull(): T? { + when (this) { + is List -> { + if (isEmpty()) + return null + else + return this[0] + } + else -> { + val iterator = iterator() + if (!iterator.hasNext()) + return null + return iterator.next() + } + } +} + +/** + * Returns the first element, or `null` if the list is empty. + */ +public fun List.firstOrNull(): T? { + return if (isEmpty()) null else this[0] +} + +/** + * Returns the first element matching the given [predicate], or `null` if element was not found. + */ +public inline fun Iterable.firstOrNull(predicate: (T) -> Boolean): T? { + for (element in this) if (predicate(element)) return element + return null +} + +/** + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this list. + */ +@kotlin.internal.InlineOnly +public inline fun List.getOrElse(index: Int, defaultValue: (Int) -> T): T { + return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index) +} + +/** + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this list. + */ +public fun List.getOrNull(index: Int): T? { + return if (index >= 0 && index <= lastIndex) get(index) else null +} + +/** + * Returns first index of [element], or -1 if the collection does not contain element. + */ +public fun <@kotlin.internal.OnlyInputTypes T> Iterable.indexOf(element: T): Int { + if (this is List) return this.indexOf(element) + var index = 0 + for (item in this) { + if (element == item) + return index + index++ + } + return -1 +} + +/** + * Returns first index of [element], or -1 if the list does not contain element. + */ +public fun <@kotlin.internal.OnlyInputTypes T> List.indexOf(element: T): Int { + return indexOf(element) +} + /** * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element. */ @@ -290,3 +493,1815 @@ public inline fun List.indexOfLast(predicate: (T) -> Boolean): Int { } return -1 } + +/** + * Returns the last element. + * @throws [NoSuchElementException] if the collection is empty. + */ +public fun Iterable.last(): T { + when (this) { + is List -> return this.last() + else -> { + val iterator = iterator() + if (!iterator.hasNext()) + throw NoSuchElementException("Collection is empty.") + var last = iterator.next() + while (iterator.hasNext()) + last = iterator.next() + return last + } + } +} + +/** + * Returns the last element. + * @throws [NoSuchElementException] if the list is empty. + */ +public fun List.last(): T { + if (isEmpty()) + throw NoSuchElementException("List is empty.") + return this[lastIndex] +} + +/** + * Returns the last element matching the given [predicate]. + * @throws [NoSuchElementException] if no such element is found. + */ +public inline fun Iterable.last(predicate: (T) -> Boolean): T { + var last: T? = null + var found = false + for (element in this) { + if (predicate(element)) { + last = element + found = true + } + } + if (!found) throw NoSuchElementException("Collection contains no element matching the predicate.") + return last as T +} + +/** + * Returns the last element matching the given [predicate]. + * @throws [NoSuchElementException] if no such element is found. + */ +public inline fun List.last(predicate: (T) -> Boolean): T { + val iterator = this.listIterator(size) + while (iterator.hasPrevious()) { + val element = iterator.previous() + if (predicate(element)) return element + } + throw NoSuchElementException("List contains no element matching the predicate.") +} + +/** + * Returns last index of [element], or -1 if the collection does not contain element. + */ +public fun <@kotlin.internal.OnlyInputTypes T> Iterable.lastIndexOf(element: T): Int { + if (this is List) return this.lastIndexOf(element) + var lastIndex = -1 + var index = 0 + for (item in this) { + if (element == item) + lastIndex = index + index++ + } + return lastIndex +} + +/** + * Returns last index of [element], or -1 if the list does not contain element. + */ +public fun <@kotlin.internal.OnlyInputTypes T> List.lastIndexOf(element: T): Int { + return lastIndexOf(element) +} + +/** + * Returns the last element, or `null` if the collection is empty. + */ +public fun Iterable.lastOrNull(): T? { + when (this) { + is List -> return if (isEmpty()) null else this[size - 1] + else -> { + val iterator = iterator() + if (!iterator.hasNext()) + return null + var last = iterator.next() + while (iterator.hasNext()) + last = iterator.next() + return last + } + } +} + +/** + * Returns the last element, or `null` if the list is empty. + */ +public fun List.lastOrNull(): T? { + return if (isEmpty()) null else this[size - 1] +} + +/** + * Returns the last element matching the given [predicate], or `null` if no such element was found. + */ +public inline fun Iterable.lastOrNull(predicate: (T) -> Boolean): T? { + var last: T? = null + for (element in this) { + if (predicate(element)) { + last = element + } + } + return last +} + +/** + * Returns the last element matching the given [predicate], or `null` if no such element was found. + */ +public inline fun List.lastOrNull(predicate: (T) -> Boolean): T? { + val iterator = this.listIterator(size) + while (iterator.hasPrevious()) { + val element = iterator.previous() + if (predicate(element)) return element + } + return null +} + +/** + * Returns the single element, or throws an exception if the collection is empty or has more than one element. + */ +public fun Iterable.single(): T { + when (this) { + is List -> return this.single() + else -> { + val iterator = iterator() + if (!iterator.hasNext()) + throw NoSuchElementException("Collection is empty.") + val single = iterator.next() + if (iterator.hasNext()) + throw IllegalArgumentException("Collection has more than one element.") + return single + } + } +} + +/** + * Returns the single element, or throws an exception if the list is empty or has more than one element. + */ +public fun List.single(): T { + return when (size) { + 0 -> throw NoSuchElementException("List is empty.") + 1 -> this[0] + else -> throw IllegalArgumentException("List has more than one element.") + } +} + +/** + * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element. + */ +public inline fun Iterable.single(predicate: (T) -> Boolean): T { + var single: T? = null + var found = false + for (element in this) { + if (predicate(element)) { + if (found) throw IllegalArgumentException("Collection contains more than one matching element.") + single = element + found = true + } + } + if (!found) throw NoSuchElementException("Collection contains no element matching the predicate.") + return single as T +} + +/** + * Returns single element, or `null` if the collection is empty or has more than one element. + */ +public fun Iterable.singleOrNull(): T? { + when (this) { + is List -> return if (size == 1) this[0] else null + else -> { + val iterator = iterator() + if (!iterator.hasNext()) + return null + val single = iterator.next() + if (iterator.hasNext()) + return null + return single + } + } +} + +/** + * Returns single element, or `null` if the list is empty or has more than one element. + */ +public fun List.singleOrNull(): T? { + return if (size == 1) this[0] else null +} + +/** + * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found. + */ +public inline fun Iterable.singleOrNull(predicate: (T) -> Boolean): T? { + var single: T? = null + var found = false + for (element in this) { + if (predicate(element)) { + if (found) return null + single = element + found = true + } + } + if (!found) return null + return single +} + +/** + * Returns a list containing all elements except first [n] elements. + */ +public fun Iterable.drop(n: Int): List { + require(n >= 0) { "Requested element count $n is less than zero." } + if (n == 0) return toList() + val list: ArrayList + if (this is Collection<*>) { + val resultSize = size - n + if (resultSize <= 0) + return emptyList() + if (resultSize == 1) + return listOf(last()) + list = ArrayList(resultSize) + if (this is List) { + if (this is RandomAccess) { + for (index in n..size - 1) + list.add(this[index]) + } else { + for (item in this.listIterator(n)) + list.add(item) + } + return list + } + } + else { + list = ArrayList() + } + var count = 0 + for (item in this) { + if (count++ >= n) list.add(item) + } + return list.optimizeReadOnlyList() +} + +/** + * Returns a list containing all elements except last [n] elements. + */ +public fun List.dropLast(n: Int): List { + require(n >= 0) { "Requested element count $n is less than zero." } + return take((size - n).coerceAtLeast(0)) +} + +/** + * Returns a list containing all elements except last elements that satisfy the given [predicate]. + */ +public inline fun List.dropLastWhile(predicate: (T) -> Boolean): List { + if (!isEmpty()) { + val iterator = this.listIterator(size) + while (iterator.hasPrevious()) { + if (!predicate(iterator.previous())) { + return take(iterator.nextIndex() + 1) + } + } + } + return emptyList() +} + +/** + * Returns a list containing all elements except first elements that satisfy the given [predicate]. + */ +public inline fun Iterable.dropWhile(predicate: (T) -> Boolean): List { + var yielding = false + val list = ArrayList() + for (item in this) + if (yielding) + list.add(item) + else if (!predicate(item)) { + list.add(item) + yielding = true + } + return list +} + +/** + * Returns a list containing only elements matching the given [predicate]. + */ +public inline fun Iterable.filter(predicate: (T) -> Boolean): List { + return filterTo(ArrayList(), predicate) +} + +/** + * Returns a list containing only elements matching the given [predicate]. + * @param [predicate] function that takes the index of an element and the element itself + * and returns the result of predicate evaluation on the element. + */ +public inline fun Iterable.filterIndexed(predicate: (Int, T) -> Boolean): List { + return filterIndexedTo(ArrayList(), predicate) +} + +/** + * Appends all elements matching the given [predicate] to the given [destination]. + * @param [predicate] function that takes the index of an element and the element itself + * and returns the result of predicate evaluation on the element. + */ +public inline fun > Iterable.filterIndexedTo(destination: C, predicate: (Int, T) -> Boolean): C { + forEachIndexed { index, element -> + if (predicate(index, element)) destination.add(element) + } + return destination +} + +/** + * Returns a list containing all elements that are instances of specified type parameter R. + */ +/* +@FixmeReified +public inline fun Iterable<*>.filterIsInstance(): List<@kotlin.internal.NoInfer R> { + return filterIsInstanceTo(ArrayList()) +} + +/** + * Appends all elements that are instances of specified type parameter R to the given [destination]. + */ +public inline fun > Iterable<*>.filterIsInstanceTo(destination: C): C { + for (element in this) if (element is R) destination.add(element) + return destination +} +*/ + +/** + * Returns a list containing all elements not matching the given [predicate]. + */ +public inline fun Iterable.filterNot(predicate: (T) -> Boolean): List { + return filterNotTo(ArrayList(), predicate) +} + +/** + * Returns a list containing all elements that are not `null`. + */ +public fun Iterable.filterNotNull(): List { + return filterNotNullTo(ArrayList()) +} + +/** + * Appends all elements that are not `null` to the given [destination]. + */ +public fun , T : Any> Iterable.filterNotNullTo(destination: C): C { + for (element in this) if (element != null) destination.add(element) + return destination +} + +/** + * Appends all elements not matching the given [predicate] to the given [destination]. + */ +public inline fun > Iterable.filterNotTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination +} + +/** + * Appends all elements matching the given [predicate] to the given [destination]. + */ +public inline fun > Iterable.filterTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination +} + +/** + * Returns a list containing elements at indices in the specified [indices] range. + */ +public fun List.slice(indices: IntRange): List { + if (indices.isEmpty()) return listOf() + return this.subList(indices.start, indices.endInclusive + 1).toList() +} + +/** + * Returns a list containing elements at specified [indices]. + */ +public fun List.slice(indices: Iterable): List { + val size = indices.collectionSizeOrDefault(10) + if (size == 0) return emptyList() + val list = ArrayList(size) + for (index in indices) { + list.add(get(index)) + } + return list +} + +/** + * Returns a list containing first [n] elements. + */ +public fun Iterable.take(n: Int): List { + require(n >= 0) { "Requested element count $n is less than zero." } + if (n == 0) return emptyList() + if (this is Collection) { + if (n >= size) return toList() + if (n == 1) return listOf(first()) + } + var count = 0 + val list = ArrayList(n) + for (item in this) { + if (count++ == n) + break + list.add(item) + } + return list.optimizeReadOnlyList() +} + +/** + * Returns a list containing last [n] elements. + */ +public fun List.takeLast(n: Int): List { + require(n >= 0) { "Requested element count $n is less than zero." } + if (n == 0) return emptyList() + val size = size + if (n >= size) return toList() + if (n == 1) return listOf(last()) + val list = ArrayList(n) + if (this is RandomAccess) { + for (index in size - n .. size - 1) + list.add(this[index]) + } else { + for (item in this.listIterator(n)) + list.add(item) + } + return list +} + +/** + * Returns a list containing last elements satisfying the given [predicate]. + */ +public inline fun List.takeLastWhile(predicate: (T) -> Boolean): List { + if (isEmpty()) + return emptyList() + val iterator = this.listIterator(size) + while (iterator.hasPrevious()) { + if (!predicate(iterator.previous())) { + iterator.next() + val expectedSize = size - iterator.nextIndex() + if (expectedSize == 0) return emptyList() + return ArrayList(expectedSize).apply { + while (iterator.hasNext()) + add(iterator.next()) + } + } + } + return toList() +} + +/** + * Returns a list containing first elements satisfying the given [predicate]. + */ +public inline fun Iterable.takeWhile(predicate: (T) -> Boolean): List { + val list = ArrayList() + for (item in this) { + if (!predicate(item)) + break + list.add(item) + } + return list +} + +/** + * Reverses elements in the list in-place. + */ +@Fixme +public fun MutableList.reverse(): Unit { + //java.util.Collections.reverse(this) + TODO() +} + +/** + * Returns a list with elements in reversed order. + */ +public fun Iterable.reversed(): List { + if (this is Collection && size <= 1) return toList() + val list = toMutableList() + list.reverse() + return list +} + +/** + * Sorts elements in the list in-place according to natural sort order of the value returned by specified [selector] function. + */ +public inline fun > MutableList.sortBy(crossinline selector: (T) -> R?): Unit { + if (size > 1) sortWith(compareBy(selector)) +} + +/** + * Sorts elements in the list in-place descending according to natural sort order of the value returned by specified [selector] function. + */ +public inline fun > MutableList.sortByDescending(crossinline selector: (T) -> R?): Unit { + if (size > 1) sortWith(compareByDescending(selector)) +} + +/** + * Sorts elements in the list in-place descending according to their natural sort order. + */ +public fun > MutableList.sortDescending(): Unit { + sortWith(reverseOrder()) +} + +/** + * Returns a list of all elements sorted according to their natural sort order. + */ +@FixmeSorting +public fun > Iterable.sorted(): List { + TODO() + //if (this is Collection) { + // if (size <= 1) return this.toList() + // @Suppress("UNCHECKED_CAST") + // return (toTypedArray>() as Array).apply { sort() }.asList() + //} + //return toMutableList().apply { sort() } +} + +/** + * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function. + */ +public inline fun > Iterable.sortedBy(crossinline selector: (T) -> R?): List { + return sortedWith(compareBy(selector)) +} + +/** + * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function. + */ +public inline fun > Iterable.sortedByDescending(crossinline selector: (T) -> R?): List { + return sortedWith(compareByDescending(selector)) +} + +/** + * Returns a list of all elements sorted descending according to their natural sort order. + */ +public fun > Iterable.sortedDescending(): List { + return sortedWith(reverseOrder()) +} + +/** + * Returns a list of all elements sorted according to the specified [comparator]. + */ +@FixmeSorting +public fun Iterable.sortedWith(comparator: Comparator): List { + TODO() + //if (this is Collection) { + // if (size <= 1) return this.toList() + // @Suppress("UNCHECKED_CAST") + // return (toTypedArray() as Array).apply { sortWith(comparator) }.asList() + //} + //return toMutableList().apply { sortWith(comparator) } +} + +/** + * Returns an array of Boolean containing all of the elements of this collection. + */ +public fun Collection.toBooleanArray(): BooleanArray { + val result = BooleanArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Byte containing all of the elements of this collection. + */ +public fun Collection.toByteArray(): ByteArray { + val result = ByteArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Char containing all of the elements of this collection. + */ +public fun Collection.toCharArray(): CharArray { + val result = CharArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Double containing all of the elements of this collection. + */ +public fun Collection.toDoubleArray(): DoubleArray { + val result = DoubleArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Float containing all of the elements of this collection. + */ +public fun Collection.toFloatArray(): FloatArray { + val result = FloatArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Int containing all of the elements of this collection. + */ +public fun Collection.toIntArray(): IntArray { + val result = IntArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Long containing all of the elements of this collection. + */ +public fun Collection.toLongArray(): LongArray { + val result = LongArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns an array of Short containing all of the elements of this collection. + */ +public fun Collection.toShortArray(): ShortArray { + val result = ShortArray(size) + var index = 0 + for (element in this) + result[index++] = element + return result +} + +/** + * Returns a [Map] containing key-value pairs provided by [transform] function + * applied to elements of the given collection. + * + * If any of two pairs would have the same key the last one gets added to the map. + * + * The returned map preserves the entry iteration order of the original collection. + */ +public inline fun Iterable.associate(transform: (T) -> Pair): Map { + val capacity = @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16) + return associateTo(LinkedHashMap(capacity), transform) +} + +/** + * Returns a [Map] containing the elements from the given collection indexed by the key + * returned from [keySelector] function applied to each element. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + * + * The returned map preserves the entry iteration order of the original collection. + */ +public inline fun Iterable.associateBy(keySelector: (T) -> K): Map { + val capacity = @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16) + return associateByTo(LinkedHashMap(capacity), keySelector) +} + +/** + * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given collection. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + * + * The returned map preserves the entry iteration order of the original collection. + */ +public inline fun Iterable.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map { + val capacity = @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16) + return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform) +} + +/** + * Populates and returns the [destination] mutable map with key-value pairs, + * where key is provided by the [keySelector] function applied to each element of the given collection + * and value is the element itself. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + */ +public inline fun > Iterable.associateByTo(destination: M, keySelector: (T) -> K): M { + for (element in this) { + destination.put(keySelector(element), element) + } + return destination +} + +/** + * Populates and returns the [destination] mutable map with key-value pairs, + * where key is provided by the [keySelector] function and + * and value is provided by the [valueTransform] function applied to elements of the given collection. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + */ +public inline fun > Iterable.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M { + for (element in this) { + destination.put(keySelector(element), valueTransform(element)) + } + return destination +} + +/** + * Populates and returns the [destination] mutable map with key-value pairs + * provided by [transform] function applied to each element of the given collection. + * + * If any of two pairs would have the same key the last one gets added to the map. + */ +public inline fun > Iterable.associateTo(destination: M, transform: (T) -> Pair): M { + for (element in this) { + destination += transform(element) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > Iterable.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun Iterable.toHashSet(): HashSet { + return toCollection(HashSet(mapCapacity(collectionSizeOrDefault(12)))) +} + +/** + * Returns a [List] containing all elements. + */ +public fun Iterable.toList(): List { + if (this is Collection) { + return when (size) { + 0 -> emptyList() + 1 -> listOf(if (this is List) get(0) else iterator().next()) + else -> this.toMutableList() + } + } + return this.toMutableList().optimizeReadOnlyList() +} + +/** + * Returns a [MutableList] filled with all elements of this collection. + */ +public fun Iterable.toMutableList(): MutableList { + if (this is Collection) + return this.toMutableList() + return toCollection(ArrayList()) +} + +/** + * Returns a [MutableList] filled with all elements of this collection. + */ +public fun Collection.toMutableList(): MutableList { + return ArrayList(this) +} + +/** + * Returns a [Set] of all elements. + * + * The returned set preserves the element iteration order of the original collection. + */ +public fun Iterable.toSet(): Set { + if (this is Collection) { + return when (size) { + 0 -> emptySet() + 1 -> setOf(if (this is List) this[0] else iterator().next()) + else -> toCollection(LinkedHashSet(mapCapacity(size))) + } + } + return toCollection(LinkedHashSet()).optimizeReadOnlySet() +} + +/** + * Returns a [SortedSet] of all elements. + */ +//public fun > Iterable.toSortedSet(): SortedSet { +// return toCollection(TreeSet()) +//} + +/** + * Returns a [SortedSet] of all elements. + * + * Elements in the set returned are sorted according to the given [comparator]. + */ +//public fun Iterable.toSortedSet(comparator: Comparator): SortedSet { +// return toCollection(TreeSet(comparator)) +//} + +/** + * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection. + */ +public inline fun Iterable.flatMap(transform: (T) -> Iterable): List { + return flatMapTo(ArrayList(), transform) +} + +/** + * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]. + */ +public inline fun > Iterable.flatMapTo(destination: C, transform: (T) -> Iterable): C { + for (element in this) { + val list = transform(element) + destination.addAll(list) + } + return destination +} + +/** + * Groups elements of the original collection by the key returned by the given [keySelector] function + * applied to each element and returns a map where each group key is associated with a list of corresponding elements. + * + * The returned map preserves the entry iteration order of the keys produced from the original collection. + * + * @sample samples.collections.Collections.Transformations.groupBy + */ +public inline fun Iterable.groupBy(keySelector: (T) -> K): Map> { + return groupByTo(LinkedHashMap>(), keySelector) +} + +/** + * Groups values returned by the [valueTransform] function applied to each element of the original collection + * by the key returned by the given [keySelector] function applied to the element + * and returns a map where each group key is associated with a list of corresponding values. + * + * The returned map preserves the entry iteration order of the keys produced from the original collection. + * + * @sample samples.collections.Collections.Transformations.groupByKeysAndValues + */ +public inline fun Iterable.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map> { + return groupByTo(LinkedHashMap>(), keySelector, valueTransform) +} + +/** + * Groups elements of the original collection by the key returned by the given [keySelector] function + * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements. + * + * @return The [destination] map. + * + * @sample samples.collections.Collections.Transformations.groupBy + */ +public inline fun >> Iterable.groupByTo(destination: M, keySelector: (T) -> K): M { + for (element in this) { + val key = keySelector(element) + val list = destination.getOrPut(key) { ArrayList() } + list.add(element) + } + return destination +} + +/** + * Groups values returned by the [valueTransform] function applied to each element of the original collection + * by the key returned by the given [keySelector] function applied to the element + * and puts to the [destination] map each group key associated with a list of corresponding values. + * + * @return The [destination] map. + * + * @sample samples.collections.Collections.Transformations.groupByKeysAndValues + */ +public inline fun >> Iterable.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M { + for (element in this) { + val key = keySelector(element) + val list = destination.getOrPut(key) { ArrayList() } + list.add(valueTransform(element)) + } + return destination +} + +/** + * Returns a list containing the results of applying the given [transform] function + * to each element in the original collection. + */ +public inline fun Iterable.map(transform: (T) -> R): List { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + return mapTo(ArrayList(collectionSizeOrDefault(10)), transform) +} + +/** + * Returns a list containing the results of applying the given [transform] function + * to each element and its index in the original collection. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +public inline fun Iterable.mapIndexed(transform: (Int, T) -> R): List { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + return mapIndexedTo(ArrayList(collectionSizeOrDefault(10)), transform) +} + +/** + * Returns a list containing only the non-null results of applying the given [transform] function + * to each element and its index in the original collection. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +public inline fun Iterable.mapIndexedNotNull(transform: (Int, T) -> R?): List { + return mapIndexedNotNullTo(ArrayList(), transform) +} + +/** + * Applies the given [transform] function to each element and its index in the original collection + * and appends only the non-null results to the given [destination]. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +public inline fun > Iterable.mapIndexedNotNullTo(destination: C, transform: (Int, T) -> R?): C { + forEachIndexed { index, element -> transform(index, element)?.let { destination.add(it) } } + return destination +} + +/** + * Applies the given [transform] function to each element and its index in the original collection + * and appends the results to the given [destination]. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +public inline fun > Iterable.mapIndexedTo(destination: C, transform: (Int, T) -> R): C { + var index = 0 + for (item in this) + destination.add(transform(index++, item)) + return destination +} + +/** + * Returns a list containing only the non-null results of applying the given [transform] function + * to each element in the original collection. + */ +public inline fun Iterable.mapNotNull(transform: (T) -> R?): List { + return mapNotNullTo(ArrayList(), transform) +} + +/** + * Applies the given [transform] function to each element in the original collection + * and appends only the non-null results to the given [destination]. + */ +public inline fun > Iterable.mapNotNullTo(destination: C, transform: (T) -> R?): C { + forEach { element -> transform(element)?.let { destination.add(it) } } + return destination +} + +/** + * Applies the given [transform] function to each element of the original collection + * and appends the results to the given [destination]. + */ +public inline fun > Iterable.mapTo(destination: C, transform: (T) -> R): C { + for (item in this) + destination.add(transform(item)) + return destination +} + +/** + * Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection. + */ +public fun Iterable.withIndex(): Iterable> { + return IndexingIterable { iterator() } +} + +/** + * Returns a list containing only distinct elements from the given collection. + * + * The elements in the resulting list are in the same order as they were in the source collection. + */ +public fun Iterable.distinct(): List { + return this.toMutableSet().toList() +} + +/** + * Returns a list containing only elements from the given collection + * having distinct keys returned by the given [selector] function. + * + * The elements in the resulting list are in the same order as they were in the source collection. + */ +public inline fun Iterable.distinctBy(selector: (T) -> K): List { + val set = HashSet() + val list = ArrayList() + for (e in this) { + val key = selector(e) + if (set.add(key)) + list.add(e) + } + return list +} + +/** + * Returns a set containing all elements that are contained by both this set and the specified collection. + * + * The returned set preserves the element iteration order of the original collection. + */ +public infix fun Iterable.intersect(other: Iterable): Set { + val set = this.toMutableSet() + set.retainAll(other) + return set +} + +/** + * Returns a set containing all elements that are contained by this collection and not contained by the specified collection. + * + * The returned set preserves the element iteration order of the original collection. + */ +public infix fun Iterable.subtract(other: Iterable): Set { + val set = this.toMutableSet() + set.removeAll(other) + return set +} + +/** + * Returns a mutable set containing all distinct elements from the given collection. + * + * The returned set preserves the element iteration order of the original collection. + */ +public fun Iterable.toMutableSet(): MutableSet { + return when (this) { + is Collection -> LinkedHashSet(this) + else -> toCollection(LinkedHashSet()) + } +} + +/** + * Returns a set containing all distinct elements from both collections. + * + * The returned set preserves the element iteration order of the original collection. + * Those elements of the [other] collection that are unique are iterated in the end + * in the order of the [other] collection. + */ +public infix fun Iterable.union(other: Iterable): Set { + val set = this.toMutableSet() + set.addAll(other) + return set +} + +/** + * Returns `true` if all elements match the given [predicate]. + */ +public inline fun Iterable.all(predicate: (T) -> Boolean): Boolean { + for (element in this) if (!predicate(element)) return false + return true +} + +/** + * Returns `true` if collection has at least one element. + */ +public fun Iterable.any(): Boolean { + for (element in this) return true + return false +} + +/** + * Returns `true` if at least one element matches the given [predicate]. + */ +public inline fun Iterable.any(predicate: (T) -> Boolean): Boolean { + for (element in this) if (predicate(element)) return true + return false +} + +/** + * Returns the number of elements in this collection. + */ +public fun Iterable.count(): Int { + var count = 0 + for (element in this) count++ + return count +} + +/** + * Returns the number of elements in this collection. + */ +@kotlin.internal.InlineOnly +public inline fun Collection.count(): Int { + return size +} + +/** + * Returns the number of elements matching the given [predicate]. + */ +public inline fun Iterable.count(predicate: (T) -> Boolean): Int { + var count = 0 + for (element in this) if (predicate(element)) count++ + return count +} + +/** + * Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each element. + */ +public inline fun Iterable.fold(initial: R, operation: (R, T) -> R): R { + var accumulator = initial + for (element in this) accumulator = operation(accumulator, element) + return accumulator +} + +/** + * Accumulates value starting with [initial] value and applying [operation] from left to right + * to current accumulator value and each element with its index in the original collection. + * @param [operation] function that takes the index of an element, current accumulator value + * and the element itself, and calculates the next accumulator value. + */ +public inline fun Iterable.foldIndexed(initial: R, operation: (Int, R, T) -> R): R { + var index = 0 + var accumulator = initial + for (element in this) accumulator = operation(index++, accumulator, element) + return accumulator +} + +/** + * Accumulates value starting with [initial] value and applying [operation] from right to left to each element and current accumulator value. + */ +public inline fun List.foldRight(initial: R, operation: (T, R) -> R): R { + var accumulator = initial + if (!isEmpty()) { + val iterator = this.listIterator(size) + while (iterator.hasPrevious()) { + accumulator = operation(iterator.previous(), accumulator) + } + } + return accumulator +} + +/** + * Accumulates value starting with [initial] value and applying [operation] from right to left + * to each element with its index in the original list and current accumulator value. + * @param [operation] function that takes the index of an element, the element itself + * and current accumulator value, and calculates the next accumulator value. + */ +public inline fun List.foldRightIndexed(initial: R, operation: (Int, T, R) -> R): R { + var accumulator = initial + if (!isEmpty()) { + val iterator = this.listIterator(size) + while (iterator.hasPrevious()) { + val index = iterator.previousIndex() + accumulator = operation(index, iterator.previous(), accumulator) + } + } + return accumulator +} + +/** + * Performs the given [action] on each element. + */ +@kotlin.internal.HidesMembers +public inline fun Iterable.forEach(action: (T) -> Unit): Unit { + for (element in this) action(element) +} + +/** + * Performs the given [action] on each element, providing sequential index with the element. + * @param [action] function that takes the index of an element and the element itself + * and performs the desired action on the element. + */ +public inline fun Iterable.forEachIndexed(action: (Int, T) -> Unit): Unit { + var index = 0 + for (item in this) action(index++, item) +} + +/** + * Returns the largest element or `null` if there are no elements. + */ +public fun > Iterable.max(): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var max = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (max < e) max = e + } + return max +} + +/** + * Returns the first element yielding the largest value of the given function or `null` if there are no elements. + */ +public inline fun > Iterable.maxBy(selector: (T) -> R): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var maxElem = iterator.next() + var maxValue = selector(maxElem) + while (iterator.hasNext()) { + val e = iterator.next() + val v = selector(e) + if (maxValue < v) { + maxElem = e + maxValue = v + } + } + return maxElem +} + +/** + * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements. + */ +public fun Iterable.maxWith(comparator: Comparator): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var max = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (comparator.compare(max, e) < 0) max = e + } + return max +} + +/** + * Returns the smallest element or `null` if there are no elements. + */ +public fun > Iterable.min(): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var min = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (min > e) min = e + } + return min +} + +/** + * Returns the first element yielding the smallest value of the given function or `null` if there are no elements. + */ +public inline fun > Iterable.minBy(selector: (T) -> R): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var minElem = iterator.next() + var minValue = selector(minElem) + while (iterator.hasNext()) { + val e = iterator.next() + val v = selector(e) + if (minValue > v) { + minElem = e + minValue = v + } + } + return minElem +} + +/** + * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements. + */ +public fun Iterable.minWith(comparator: Comparator): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var min = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (comparator.compare(min, e) > 0) min = e + } + return min +} + +/** + * Returns `true` if the collection has no elements. + */ +public fun Iterable.none(): Boolean { + for (element in this) return false + return true +} + +/** + * Returns `true` if no elements match the given [predicate]. + */ +public inline fun Iterable.none(predicate: (T) -> Boolean): Boolean { + for (element in this) if (predicate(element)) return false + return true +} + +/** + * Performs the given [action] on each element and returns the collection itself afterwards. + */ +@SinceKotlin("1.1") +public inline fun > C.onEach(action: (T) -> Unit): C { + return apply { for (element in this) action(element) } +} + +/** + * Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element. + */ +public inline fun Iterable.reduce(operation: (S, T) -> S): S { + val iterator = this.iterator() + if (!iterator.hasNext()) throw UnsupportedOperationException("Empty collection can't be reduced.") + var accumulator: S = iterator.next() + while (iterator.hasNext()) { + accumulator = operation(accumulator, iterator.next()) + } + return accumulator +} + +/** + * Accumulates value starting with the first element and applying [operation] from left to right + * to current accumulator value and each element with its index in the original collection. + * @param [operation] function that takes the index of an element, current accumulator value + * and the element itself and calculates the next accumulator value. + */ +public inline fun Iterable.reduceIndexed(operation: (Int, S, T) -> S): S { + val iterator = this.iterator() + if (!iterator.hasNext()) throw UnsupportedOperationException("Empty collection can't be reduced.") + var index = 1 + var accumulator: S = iterator.next() + while (iterator.hasNext()) { + accumulator = operation(index++, accumulator, iterator.next()) + } + return accumulator +} + +/** + * Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value. + */ +public inline fun List.reduceRight(operation: (T, S) -> S): S { + val iterator = listIterator(size) + if (!iterator.hasPrevious()) + throw UnsupportedOperationException("Empty list can't be reduced.") + var accumulator: S = iterator.previous() + while (iterator.hasPrevious()) { + accumulator = operation(iterator.previous(), accumulator) + } + return accumulator +} + +/** + * Accumulates value starting with last element and applying [operation] from right to left + * to each element with its index in the original list and current accumulator value. + * @param [operation] function that takes the index of an element, the element itself + * and current accumulator value, and calculates the next accumulator value. + */ +public inline fun List.reduceRightIndexed(operation: (Int, T, S) -> S): S { + val iterator = this.listIterator(size) + if (!iterator.hasPrevious()) + throw UnsupportedOperationException("Empty list can't be reduced.") + var accumulator: S = iterator.previous() + while (iterator.hasPrevious()) { + val index = iterator.previousIndex() + accumulator = operation(index, iterator.previous(), accumulator) + } + return accumulator +} + +/** + * Returns the sum of all values produced by [selector] function applied to each element in the collection. + */ +public inline fun Iterable.sumBy(selector: (T) -> Int): Int { + var sum: Int = 0 + for (element in this) { + sum += selector(element) + } + return sum +} + +/** + * Returns the sum of all values produced by [selector] function applied to each element in the collection. + */ +public inline fun Iterable.sumByDouble(selector: (T) -> Double): Double { + var sum: Double = 0.0 + for (element in this) { + sum += selector(element) + } + return sum +} + +/** + * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements. + */ +public fun Iterable.requireNoNulls(): Iterable { + for (element in this) { + if (element == null) { + throw IllegalArgumentException("null element found in $this.") + } + } + @Suppress("UNCHECKED_CAST") + return this as Iterable +} + +/** + * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements. + */ +public fun List.requireNoNulls(): List { + for (element in this) { + if (element == null) { + throw IllegalArgumentException("null element found in $this.") + } + } + @Suppress("UNCHECKED_CAST") + return this as List +} + +/** + * Returns a list containing all elements of the original collection without the first occurrence of the given [element]. + */ +public operator fun Iterable.minus(element: T): List { + val result = ArrayList(collectionSizeOrDefault(10)) + var removed = false + return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true } +} + +/** + * Returns a list containing all elements of the original collection except the elements contained in the given [elements] array. + */ +public operator fun Iterable.minus(elements: Array): List { + if (elements.isEmpty()) return this.toList() + val other = elements.toHashSet() + return this.filterNot { it in other } +} + +/** + * Returns a list containing all elements of the original collection except the elements contained in the given [elements] collection. + */ +public operator fun Iterable.minus(elements: Iterable): List { + val other = elements.convertToSetForSetOperationWith(this) + if (other.isEmpty()) + return this.toList() + return this.filterNot { it in other } +} + +/** + * Returns a list containing all elements of the original collection except the elements contained in the given [elements] sequence. + */ +public operator fun Iterable.minus(elements: Sequence): List { + val other = elements.toHashSet() + if (other.isEmpty()) + return this.toList() + return this.filterNot { it in other } +} + +/** + * Returns a list containing all elements of the original collection without the first occurrence of the given [element]. + */ +@kotlin.internal.InlineOnly +public inline fun Iterable.minusElement(element: T): List { + return minus(element) +} + +/** + * Splits the original collection into pair of lists, + * where *first* list contains elements for which [predicate] yielded `true`, + * while *second* list contains elements for which [predicate] yielded `false`. + */ +public inline fun Iterable.partition(predicate: (T) -> Boolean): Pair, List> { + val first = ArrayList() + val second = ArrayList() + for (element in this) { + if (predicate(element)) { + first.add(element) + } else { + second.add(element) + } + } + return Pair(first, second) +} + +/** + * Returns a list containing all elements of the original collection and then the given [element]. + */ +public operator fun Iterable.plus(element: T): List { + if (this is Collection) return this.plus(element) + val result = ArrayList() + result.addAll(this) + result.add(element) + return result +} + +/** + * Returns a list containing all elements of the original collection and then the given [element]. + */ +public operator fun Collection.plus(element: T): List { + val result = ArrayList(size + 1) + result.addAll(this) + result.add(element) + return result +} + +/** + * Returns a list containing all elements of the original collection and then all elements of the given [elements] array. + */ +public operator fun Iterable.plus(elements: Array): List { + if (this is Collection) return this.plus(elements) + val result = ArrayList() + result.addAll(this) + result.addAll(elements) + return result +} + +/** + * Returns a list containing all elements of the original collection and then all elements of the given [elements] array. + */ +public operator fun Collection.plus(elements: Array): List { + val result = ArrayList(this.size + elements.size) + result.addAll(this) + result.addAll(elements) + return result +} + +/** + * Returns a list containing all elements of the original collection and then all elements of the given [elements] collection. + */ +public operator fun Iterable.plus(elements: Iterable): List { + if (this is Collection) return this.plus(elements) + val result = ArrayList() + result.addAll(this) + result.addAll(elements) + return result +} + +/** + * Returns a list containing all elements of the original collection and then all elements of the given [elements] collection. + */ +public operator fun Collection.plus(elements: Iterable): List { + if (elements is Collection) { + val result = ArrayList(this.size + elements.size) + result.addAll(this) + result.addAll(elements) + return result + } else { + val result = ArrayList(this) + result.addAll(elements) + return result + } +} + +/** + * Returns a list containing all elements of the original collection and then all elements of the given [elements] sequence. + */ +public operator fun Iterable.plus(elements: Sequence): List { + val result = ArrayList() + result.addAll(this) + result.addAll(elements) + return result +} + +/** + * Returns a list containing all elements of the original collection and then all elements of the given [elements] sequence. + */ +public operator fun Collection.plus(elements: Sequence): List { + val result = ArrayList(this.size + 10) + result.addAll(this) + result.addAll(elements) + return result +} + +/** + * Returns a list containing all elements of the original collection and then the given [element]. + */ +@kotlin.internal.InlineOnly +public inline fun Iterable.plusElement(element: T): List { + return plus(element) +} + +/** + * Returns a list containing all elements of the original collection and then the given [element]. + */ +@kotlin.internal.InlineOnly +public inline fun Collection.plusElement(element: T): List { + return plus(element) +} + +/** + * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. + */ +public infix fun Iterable.zip(other: Array): List> { + return zip(other) { t1, t2 -> t1 to t2 } +} + +inline fun min(x1: Int, x2: Int) = if (x1 < x2) x1 else x2 + +/** + * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. + */ +public inline fun Iterable.zip(other: Array, transform: (T, R) -> V): List { + val arraySize = other.size + val list = ArrayList(min(collectionSizeOrDefault(10), arraySize)) + var i = 0 + for (element in this) { + if (i >= arraySize) break + list.add(transform(element, other[i++])) + } + return list +} + +/** + * Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection. + */ +public infix fun Iterable.zip(other: Iterable): List> { + return zip(other) { t1, t2 -> t1 to t2 } +} + +/** + * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection. + */ +public inline fun Iterable.zip(other: Iterable, transform: (T, R) -> V): List { + val first = iterator() + val second = other.iterator() + val list = ArrayList(min(collectionSizeOrDefault(10), other.collectionSizeOrDefault(10))) + while (first.hasNext() && second.hasNext()) { + list.add(transform(first.next(), second.next())) + } + return list +} + +/** + * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied. + * + * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit] + * elements will be appended, followed by the [truncated] string (which defaults to "..."). + */ +public fun Iterable.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { + buffer.append(prefix) + var count = 0 + for (element in this) { + if (++count > 1) buffer.append(separator) + if (limit < 0 || count <= limit) { + if (transform != null) + buffer.append(transform(element)) + else + buffer.append(if (element == null) "null" else element.toString()) + } else break + } + if (limit >= 0 && count > limit) buffer.append(truncated) + buffer.append(postfix) + return buffer +} + +/** + * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied. + * + * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit] + * elements will be appended, followed by the [truncated] string (which defaults to "..."). + */ +public fun Iterable.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String { + return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString() +} + +/** + * Returns this collection as an [Iterable]. + */ +@kotlin.internal.InlineOnly +public inline fun Iterable.asIterable(): Iterable { + return this +} + +/** + * Creates a [Sequence] instance that wraps the original collection returning its elements when being iterated. + */ +@FixmeSequences +public fun Iterable.asSequence(): Sequence { + //return Sequence { this.iterator() } + TODO() +} + +/** + * Returns a list containing all elements that are instances of specified class. + */ +//public fun Iterable<*>.filterIsInstance(klass: Class): List { +// return filterIsInstanceTo(ArrayList(), klass) +//} + +/** + * Returns an average value of elements in the collection. + */ +public fun Iterable.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the collection. + */ +public fun Iterable.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the collection. + */ +public fun Iterable.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the collection. + */ +public fun Iterable.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the collection. + */ +public fun Iterable.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the collection. + */ +public fun Iterable.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns the sum of all elements in the collection. + */ +public fun Iterable.sum(): Int { + var sum: Int = 0 + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the collection. + */ +public fun Iterable.sum(): Int { + var sum: Int = 0 + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the collection. + */ +public fun Iterable.sum(): Int { + var sum: Int = 0 + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the collection. + */ +public fun Iterable.sum(): Long { + var sum: Long = 0L + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the collection. + */ +public fun Iterable.sum(): Float { + var sum: Float = 0.0f + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the collection. + */ +public fun Iterable.sum(): Double { + var sum: Double = 0.0 + for (element in this) { + sum += element + } + return sum +} \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/collections/HashMap.kt b/runtime/src/main/kotlin/kotlin/collections/HashMap.kt index 46d155a9752..a91e9a29281 100644 --- a/runtime/src/main/kotlin/kotlin/collections/HashMap.kt +++ b/runtime/src/main/kotlin/kotlin/collections/HashMap.kt @@ -670,4 +670,7 @@ internal class HashMapEntrySet internal constructor( @Suppress("UNCHECKED_CAST") // todo: get rid of unchecked cast here somehow return size == other.size && backing.containsAllEntries(other as Collection>) } -} \ No newline at end of file +} + +// This hash map keeps insertion order. +typealias LinkedHashMap = HashMap \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/collections/HashSet.kt b/runtime/src/main/kotlin/kotlin/collections/HashSet.kt index 90b326ae970..faa477b5e7a 100644 --- a/runtime/src/main/kotlin/kotlin/collections/HashSet.kt +++ b/runtime/src/main/kotlin/kotlin/collections/HashSet.kt @@ -82,4 +82,7 @@ class HashSet internal constructor( // ---------------------------- private ---------------------------- private fun contentEquals(other: Set): Boolean = size == other.size && containsAll(other) -} \ No newline at end of file +} + +// This hash set keeps insertion order. +typealias LinkedHashSet = HashSet \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/collections/IndexedValue.kt b/runtime/src/main/kotlin/kotlin/collections/IndexedValue.kt new file mode 100644 index 00000000000..7259c82a2b4 --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/collections/IndexedValue.kt @@ -0,0 +1,9 @@ +package kotlin.collections + +/** + * Data class representing a value from a collection or sequence, along with its index in that collection or sequence. + * + * @property value the underlying value. + * @property index the index of the value in the collection or sequence. + */ +public data class IndexedValue(public val index: Int, public val value: T) diff --git a/runtime/src/main/kotlin/kotlin/collections/Iterables.kt b/runtime/src/main/kotlin/kotlin/collections/Iterables.kt new file mode 100644 index 00000000000..5cc6005f25a --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/collections/Iterables.kt @@ -0,0 +1,82 @@ +package kotlin.collections + +/** + * Given an [iterator] function constructs an [Iterable] instance that returns values through the [Iterator] + * provided by that function. + */ +@kotlin.internal.InlineOnly +public inline fun Iterable(crossinline iterator: () -> Iterator): Iterable = object : Iterable { + override fun iterator(): Iterator = iterator() +} + +/** + * A wrapper over another [Iterable] (or any other object that can produce an [Iterator]) that returns + * an indexing iterator. + */ +internal class IndexingIterable(private val iteratorFactory: () -> Iterator) : Iterable> { + override fun iterator(): Iterator> = IndexingIterator(iteratorFactory()) +} + + +/** + * Returns the size of this iterable if it is known, or `null` otherwise. + */ +@PublishedApi +internal fun Iterable.collectionSizeOrNull(): Int? = if (this is Collection<*>) this.size else null + +/** + * Returns the size of this iterable if it is known, or the specified [default] value otherwise. + */ +@PublishedApi +internal fun Iterable.collectionSizeOrDefault(default: Int): Int = if (this is Collection<*>) this.size else default + +/** Returns true when it's safe to convert this collection to a set without changing contains method behavior. */ +private fun Collection.safeToConvertToSet() = size > 2 && this is ArrayList + +/** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */ +internal fun Iterable.convertToSetForSetOperationWith(source: Iterable): Collection = + when(this) { + is Set -> this + is Collection -> + when { + source is Collection && source.size < 2 -> this + else -> if (this.safeToConvertToSet()) toHashSet() else this + } + else -> toHashSet() + } + +/** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */ +internal fun Iterable.convertToSetForSetOperation(): Collection = + when(this) { + is Set -> this + is Collection -> if (this.safeToConvertToSet()) toHashSet() else this + else -> toHashSet() + } + + +/** + * Returns a single list of all elements from all collections in the given collection. + */ +public fun Iterable>.flatten(): List { + val result = ArrayList() + for (element in this) { + result.addAll(element) + } + return result +} + +/** + * Returns a pair of lists, where + * *first* list is built from the first values of each pair from this collection, + * *second* list is built from the second values of each pair from this collection. + */ +public fun Iterable>.unzip(): Pair, List> { + val expectedSize = collectionSizeOrDefault(10) + val listT = ArrayList(expectedSize) + val listR = ArrayList(expectedSize) + for (pair in this) { + listT.add(pair.first) + listR.add(pair.second) + } + return listT to listR +} diff --git a/runtime/src/main/kotlin/kotlin/collections/Iterators.kt b/runtime/src/main/kotlin/kotlin/collections/Iterators.kt index 286b4fabab5..dbf0c4d7aeb 100644 --- a/runtime/src/main/kotlin/kotlin/collections/Iterators.kt +++ b/runtime/src/main/kotlin/kotlin/collections/Iterators.kt @@ -63,3 +63,31 @@ public abstract class BooleanIterator : Iterator { /** Returns the next value in the sequence without boxing. */ public abstract fun nextBoolean(): Boolean } + +/** + * Returns the given iterator itself. This allows to use an instance of iterator in a `for` loop. + */ +@kotlin.internal.InlineOnly +public inline operator fun Iterator.iterator(): Iterator = this + +/** + * Returns an [Iterator] wrapping each value produced by this [Iterator] with the [IndexedValue], + * containing value and it's index. + */ +public fun Iterator.withIndex(): Iterator> = IndexingIterator(this) + +/** + * Performs the given [operation] on each element of this [Iterator]. + */ +public inline fun Iterator.forEach(operation: (T) -> Unit) : Unit { + for (element in this) operation(element) +} + +/** + * Iterator transforming original `iterator` into iterator of [IndexedValue], counting index from zero. + */ +internal class IndexingIterator(private val iterator: Iterator) : Iterator> { + private var index = 0 + final override fun hasNext(): Boolean = iterator.hasNext() + final override fun next(): IndexedValue = IndexedValue(index++, iterator.next()) +} \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/collections/Maps.kt b/runtime/src/main/kotlin/kotlin/collections/Maps.kt index 20272206cc3..86f9f3ad9c2 100644 --- a/runtime/src/main/kotlin/kotlin/collections/Maps.kt +++ b/runtime/src/main/kotlin/kotlin/collections/Maps.kt @@ -97,8 +97,7 @@ internal fun mapCapacity(expectedSize: Int): Int { return Int.MAX_VALUE // any large value } -@Fixme -private const val INT_MAX_POWER_OF_TWO: Int = 0x40000000 // Int.MAX_VALUE / 2 + 1 +private const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1 /** Returns `true` if this map is not empty. */ @kotlin.internal.InlineOnly @@ -192,19 +191,14 @@ public inline fun Map.Entry.toPair(): Pair = Pair(key, value) public inline fun Map.getOrElse(key: K, defaultValue: () -> V): V = get(key) ?: defaultValue() -@Fixme internal inline fun Map.getOrElseNullable(key: K, defaultValue: () -> V): V { - TODO() + val value = get(key) + if (value == null && !containsKey(key)) { + return defaultValue() + } else { + return value as V + } } -// val value = get(key) -// if (value == null && !containsKey(key)) { -// return defaultValue() -// } else { -// return value as V -// } -//} - - /** * Returns the value for the given key. If the key is not found in the map, calls the [defaultValue] function, @@ -242,11 +236,9 @@ public inline operator fun MutableMap.iterator(): MutableIterator> Map.mapValuesTo(destination: M, transform: (Map.Entry) -> R): M { - TODO() -// return entries.associateByTo(destination, { it.key }, transform) + return entries.associateByTo(destination, { it.key }, transform) } /** @@ -258,8 +250,7 @@ public inline fun > Map.mapValuesT */ @kotlin.internal.InlineOnly public inline fun > Map.mapKeysTo(destination: M, transform: (Map.Entry) -> R): M { - TODO() -// return entries.associateByTo(destination, transform, { it.value }) + return entries.associateByTo(destination, transform, { it.value }) } /** @@ -297,9 +288,12 @@ public fun MutableMap.putAll(pairs: Sequence>): Uni * * @sample samples.collections.Maps.Transforms.mapValues */ -//public inline fun Map.mapValues(transform: (Map.Entry) -> R): Map { -// return mapValuesTo(HashMap(mapCapacity(size)), transform) // .optimizeReadOnlyMap() -//} +public inline fun Map.mapValues(transform: (Map.Entry) -> R): Map { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + return mapValuesTo(HashMap( + mapCapacity(size)), + transform).optimizeReadOnlyMap() +} /** * Returns a new Map with entries having the keys obtained by applying the [transform] function to each entry in this @@ -312,9 +306,12 @@ public fun MutableMap.putAll(pairs: Sequence>): Uni * * @sample samples.collections.Maps.Transforms.mapKeys */ -//public inline fun Map.mapKeys(transform: (Map.Entry) -> R): Map { -// return mapKeysTo(HashMap(mapCapacity(size)), transform) // .optimizeReadOnlyMap() -//} +public inline fun Map.mapKeys(transform: (Map.Entry) -> R): Map { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + return mapKeysTo(HashMap( + mapCapacity(size)), + transform).optimizeReadOnlyMap() +} /** * Returns a map containing all key-value pairs with keys matching the given [predicate]. @@ -412,6 +409,7 @@ public fun Iterable>.toMap(): Map { /** * Populates and returns the [destination] mutable map with key-value pairs from the given collection of pairs. */ +@Fixme public fun > Iterable>.toMap(destination: M): M { for (pair in this) { destination.put(pair.first, pair.second) @@ -434,6 +432,7 @@ public fun Array>.toMap(): Map = when(size) { /** * Populates and returns the [destination] mutable map with key-value pairs from the given array of pairs. */ +@Fixme public fun > Array>.toMap(destination: M): M { // = destination.apply { putAll(this@toMap) } for (pair in this) { @@ -452,6 +451,7 @@ public fun Sequence>.toMap(): Map = toMap(HashMap( /** * Populates and returns the [destination] mutable map with key-value pairs from the given sequence of pairs. */ +@Fixme public fun > Sequence>.toMap(destination: M): M { for (pair in this) { destination.put(pair.first, pair.second) @@ -484,15 +484,15 @@ public fun Map.toMutableMap(): MutableMap = HashMap(t public fun > Map.toMap(destination: M): M = destination.apply { putAll(this@toMap) } -// TODO: fix me, once have correct type variance in HashMap. /** * Creates a new read-only map by replacing or adding an entry to this map from a given key-value [pair]. * * The returned map preserves the entry iteration order of the original map. * The [pair] is iterated in the end if it has a unique key. */ -// public operator fun Map.plus(pair: Pair): Map -// = if (this.isEmpty()) mapOf(pair) else HashMap(this).apply { put(pair.first, pair.second) } +@FixmeVariance +public operator fun Map.plus(pair: Pair): Map + = if (this.isEmpty()) mapOf(pair) else HashMap(this).apply { put(pair.first, pair.second) } /** * Creates a new read-only map by replacing or adding entries to this map from a given collection of key-value [pairs]. @@ -500,8 +500,9 @@ public fun > Map.toMap(destination: M * The returned map preserves the entry iteration order of the original map. * Those [pairs] with unique keys are iterated in the end in the order of [pairs] collection. */ -//public operator fun Map.plus(pairs: Iterable>): Map -// = if (this.isEmpty()) pairs.toMap() else HashMap(this).apply { putAll(pairs) } +@FixmeVariance +public operator fun Map.plus(pairs: Iterable>): Map + = if (this.isEmpty()) pairs.toMap() else HashMap(this).apply { putAll(pairs) } /** * Creates a new read-only map by replacing or adding entries to this map from a given array of key-value [pairs]. @@ -509,8 +510,9 @@ public fun > Map.toMap(destination: M * The returned map preserves the entry iteration order of the original map. * Those [pairs] with unique keys are iterated in the end in the order of [pairs] array. */ -//public operator fun Map.plus(pairs: Array>): Map -// = if (this.isEmpty()) pairs.toMap() else HashMap(this).apply { putAll(pairs) } +@FixmeVariance +public operator fun Map.plus(pairs: Array>): Map + = if (this.isEmpty()) pairs.toMap() else HashMap(this).apply { putAll(pairs) } /** * Creates a new read-only map by replacing or adding entries to this map from a given sequence of key-value [pairs]. @@ -518,8 +520,8 @@ public fun > Map.toMap(destination: M * The returned map preserves the entry iteration order of the original map. * Those [pairs] with unique keys are iterated in the end in the order of [pairs] sequence. */ -//public operator fun Map.plus(pairs: Sequence>): Map -// = HashMap(this).apply { putAll(pairs) }.optimizeReadOnlyMap() +public operator fun Map.plus(pairs: Sequence>): Map + = HashMap(this).apply { putAll(pairs) }.optimizeReadOnlyMap() /** * Creates a new read-only map by replacing or adding entries to this map from another [map]. @@ -527,8 +529,9 @@ public fun > Map.toMap(destination: M * The returned map preserves the entry iteration order of the original map. * Those entries of another [map] that are missing in this map are iterated in the end in the order of that [map]. */ -//public operator fun Map.plus(map: Map): Map -// = HashMap(this).apply { putAll(map) } +@FixmeVariance +public operator fun Map.plus(map: Map): Map + = HashMap(this).apply { putAll(map) } /** * Appends or replaces the given [pair] in this mutable map. diff --git a/runtime/src/main/kotlin/kotlin/collections/MutableCollections.kt b/runtime/src/main/kotlin/kotlin/collections/MutableCollections.kt index 1713e0e769b..4a934ea582e 100644 --- a/runtime/src/main/kotlin/kotlin/collections/MutableCollections.kt +++ b/runtime/src/main/kotlin/kotlin/collections/MutableCollections.kt @@ -1,5 +1,7 @@ package kotlin.collections +import kotlin.comparisons.* + /** * Removes a single instance of the specified element from this * collection, if it is present. @@ -171,11 +173,7 @@ public fun MutableList.removeAll(predicate: (T) -> Boolean): Boolean = fi */ public fun MutableList.retainAll(predicate: (T) -> Boolean): Boolean = filterInPlace(predicate, false) -@Fixme private fun MutableList.filterInPlace(predicate: (T) -> Boolean, predicateResultToRemove: Boolean): Boolean { - TODO() -} -/* TODO: fix downTo, RandomAccess if (this !is RandomAccess) return (this as MutableIterable).filterInPlace(predicate, predicateResultToRemove) @@ -199,97 +197,68 @@ private fun MutableList.filterInPlace(predicate: (T) -> Boolean, predicat else { return false } -} */ +} /** * Removes all elements from this [MutableCollection] that are also contained in the given [elements] collection. */ -@Fixme public fun MutableCollection.removeAll(elements: Iterable): Boolean { - // TODO: add convertToSetForSetOperationWith - // return removeAll(elements.convertToSetForSetOperationWith(this)) - var removed = false - for (e in elements) { - removed = removed or remove(e) - } - return removed + return removeAll(elements.convertToSetForSetOperationWith(this)) } /** * Removes all elements from this [MutableCollection] that are also contained in the given [elements] sequence. */ -@Fixme public fun MutableCollection.removeAll(elements: Sequence): Boolean { - // TODO: add toHashSet() - //val set = elements.toHashSet() - // return set.isNotEmpty() && removeAll(set) - var removed = false - for (e in elements) { - removed = removed or remove(e) - } - return removed + val set = elements.toHashSet() + return set.isNotEmpty() && removeAll(set) } /** * Removes all elements from this [MutableCollection] that are also contained in the given [elements] array. */ -@Fixme public fun MutableCollection.removeAll(elements: Array): Boolean { - // TODO: add toHashSet() - // return elements.isNotEmpty() && removeAll(elements.toHashSet()) - var removed = false - for (e in elements) { - removed = removed or remove(e) - } - return removed + return elements.isNotEmpty() && removeAll(elements.toHashSet()) } /** * Retains only elements of this [MutableCollection] that are contained in the given [elements] collection. */ -@Fixme public fun MutableCollection.retainAll(elements: Iterable): Boolean { - TODO() - //return retainAll(elements.convertToSetForSetOperationWith(this)) + return retainAll(elements.convertToSetForSetOperationWith(this)) } /** * Retains only elements of this [MutableCollection] that are contained in the given [elements] array. */ -@Fixme public fun MutableCollection.retainAll(elements: Array): Boolean { - TODO() - //if (elements.isNotEmpty()) - // return retainAll(elements.toHashSet()) - //else - // return retainNothing() + if (elements.isNotEmpty()) + return retainAll(elements.toHashSet()) + else + return retainNothing() } /** * Retains only elements of this [MutableCollection] that are contained in the given [elements] sequence. */ -@Fixme public fun MutableCollection.retainAll(elements: Sequence): Boolean { - TODO() - //val set = elements.toHashSet() - //if (set.isNotEmpty()) - // return retainAll(set) - //else - // return retainNothing() + val set = elements.toHashSet() + if (set.isNotEmpty()) + return retainAll(set) + else + return retainNothing() } -@Fixme private fun MutableCollection<*>.retainNothing(): Boolean { - TODO() - //val result = isNotEmpty() - //clear() - //return result + val result = isNotEmpty() + clear() + return result } /** * Sorts elements in the list in-place according to their natural sort order. */ -@Fixme +@FixmeSorting public fun > MutableList.sort(): Unit { TODO() //if (size > 1) java.util.Collections.sort(this) @@ -298,6 +267,8 @@ public fun > MutableList.sort(): Unit { /** * Sorts elements in the list in-place according to the order specified with [comparator]. */ -//public fun MutableList.sortWith(comparator: Comparator): Unit { -//if (size > 1) java.util.Collections.sort(this, comparator) -//} +@FixmeSorting +public fun MutableList.sortWith(comparator: Comparator): Unit { + TODO() + //if (size > 1) java.util.Collections.sort(this, comparator) +} diff --git a/runtime/src/main/kotlin/kotlin/collections/RandomAccess.kt b/runtime/src/main/kotlin/kotlin/collections/RandomAccess.kt new file mode 100644 index 00000000000..78bb8027619 --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/collections/RandomAccess.kt @@ -0,0 +1,3 @@ +package kotlin.collections + +public interface RandomAccess diff --git a/runtime/src/main/kotlin/kotlin/comparisons/Comparisons.kt b/runtime/src/main/kotlin/kotlin/comparisons/Comparisons.kt new file mode 100644 index 00000000000..7611c0b2448 --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/comparisons/Comparisons.kt @@ -0,0 +1,300 @@ +package kotlin.comparisons + +interface Comparator { + fun compare(a: T, b: T): Int +} + +/** + * Compares two values using the specified functions [selectors] to calculate the result of the comparison. + * The functions are called sequentially, receive the given values [a] and [b] and return [Comparable] + * objects. As soon as the [Comparable] instances returned by a function for [a] and [b] values do not + * compare as equal, the result of that comparison is returned. + */ +public fun compareValuesBy(a: T, b: T, vararg selectors: (T) -> Comparable<*>?): Int { + require(selectors.size > 0) + for (fn in selectors) { + val v1 = fn(a) + val v2 = fn(b) + val diff = compareValues(v1, v2) + if (diff != 0) return diff + } + return 0 +} + +/** + * Compares two values using the specified [selector] function to calculate the result of the comparison. + * The function is applied to the given values [a] and [b] and return [Comparable] objects. + * The result of comparison of these [Comparable] instances is returned. + */ +@kotlin.internal.InlineOnly +public inline fun compareValuesBy(a: T, b: T, selector: (T) -> Comparable<*>?): Int { + return compareValues(selector(a), selector(b)) +} + +/** + * Compares two values using the specified [selector] function to calculate the result of the comparison. + * The function is applied to the given values [a] and [b] and return objects of type K which are then being + * compared with the given [comparator]. + */ +@kotlin.internal.InlineOnly +public inline fun compareValuesBy(a: T, b: T, comparator: Comparator, selector: (T) -> K): Int { + return comparator.compare(selector(a), selector(b)) +} + +//// Not so useful without type inference for receiver of expression +//// compareValuesWith(v1, v2, compareBy { it.prop1 } thenByDescending { it.prop2 }) +///** +// * Compares two values using the specified [comparator]. +// */ +//@Suppress("NOTHING_TO_INLINE") +//public inline fun compareValuesWith(a: T, b: T, comparator: Comparator): Int = comparator.compare(a, b) +// + + +/** + * Compares two nullable [Comparable] values. Null is considered less than any value. + */ +public fun > compareValues(a: T?, b: T?): Int { + if (a === b) return 0 + if (a == null) return -1 + if (b == null) return 1 + + @Suppress("UNCHECKED_CAST") + return (a as Comparable).compareTo(b) +} + +/** + * Creates a comparator using the sequence of functions to calculate a result of comparison. + * The functions are called sequentially, receive the given values `a` and `b` and return [Comparable] + * objects. As soon as the [Comparable] instances returned by a function for `a` and `b` values do not + * compare as equal, the result of that comparison is returned from the [Comparator]. + */ +public fun compareBy(vararg selectors: (T) -> Comparable<*>?): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int = compareValuesBy(a, b, *selectors) + } +} + + + +/** + * Creates a comparator using the function to transform value to a [Comparable] instance for comparison. + */ +@kotlin.internal.InlineOnly +public inline fun compareBy(crossinline selector: (T) -> Comparable<*>?): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int = compareValuesBy(a, b, selector) + } +} + +/** + * Creates a comparator using the [selector] function to transform values being compared and then applying + * the specified [comparator] to compare transformed values. + */ +@kotlin.internal.InlineOnly +public inline fun compareBy(comparator: Comparator, crossinline selector: (T) -> K): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int = compareValuesBy(a, b, comparator, selector) + } +} + +/** + * Creates a descending comparator using the function to transform value to a [Comparable] instance for comparison. + */ +@kotlin.internal.InlineOnly +public inline fun compareByDescending(crossinline selector: (T) -> Comparable<*>?): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int = compareValuesBy(b, a, selector) + } +} + +/** + * Creates a descending comparator using the [selector] function to transform values being compared and then applying + * the specified [comparator] to compare transformed values. + * + * Note that an order of [comparator] is reversed by this wrapper. + */ +@kotlin.internal.InlineOnly +public inline fun compareByDescending(comparator: Comparator, crossinline selector: (T) -> K): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int = compareValuesBy(b, a, comparator, selector) + } +} + +/** + * Creates a comparator comparing values after the primary comparator defined them equal. It uses + * the function to transform value to a [Comparable] instance for comparison. + */ +@kotlin.internal.InlineOnly +public inline fun Comparator.thenBy(crossinline selector: (T) -> Comparable<*>?): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@thenBy.compare(a, b) + return if (previousCompare != 0) previousCompare else compareValuesBy(a, b, selector) + } + } +} + +/** + * Creates a comparator comparing values after the primary comparator defined them equal. It uses + * the [selector] function to transform values and then compares them with the given [comparator]. + */ +@kotlin.internal.InlineOnly +public inline fun Comparator.thenBy(comparator: Comparator, crossinline selector: (T) -> K): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@thenBy.compare(a, b) + return if (previousCompare != 0) previousCompare else compareValuesBy(a, b, comparator, selector) + } + } +} + +/** + * Creates a descending comparator using the primary comparator and + * the function to transform value to a [Comparable] instance for comparison. + */ +@kotlin.internal.InlineOnly +public inline fun Comparator.thenByDescending(crossinline selector: (T) -> Comparable<*>?): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@thenByDescending.compare(a, b) + return if (previousCompare != 0) previousCompare else compareValuesBy(b, a, selector) + } + } +} + +/** + * Creates a descending comparator comparing values after the primary comparator defined them equal. It uses + * the [selector] function to transform values and then compares them with the given [comparator]. + */ +@kotlin.internal.InlineOnly +public inline fun Comparator.thenByDescending(comparator: Comparator, crossinline selector: (T) -> K): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@thenByDescending.compare(a, b) + return if (previousCompare != 0) previousCompare else compareValuesBy(b, a, comparator, selector) + } + } +} + + +/** + * Creates a comparator using the primary comparator and function to calculate a result of comparison. + */ +@kotlin.internal.InlineOnly +public inline fun Comparator.thenComparator(crossinline comparison: (T, T) -> Int): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@thenComparator.compare(a, b) + return if (previousCompare != 0) previousCompare else comparison(a, b) + } + } +} + +/** + * Combines this comparator and the given [comparator] such that the latter is applied only + * when the former considered values equal. + */ +public infix fun Comparator.then(comparator: Comparator): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@then.compare(a, b) + return if (previousCompare != 0) previousCompare else comparator.compare(a, b) + } + } +} + +/** + * Combines this comparator and the given [comparator] such that the latter is applied only + * when the former considered values equal. + */ +public infix fun Comparator.thenDescending(comparator: Comparator): Comparator { + return object : Comparator { + public override fun compare(a: T, b: T): Int { + val previousCompare = this@thenDescending.compare(a, b) + return if (previousCompare != 0) previousCompare else comparator.compare(b, a) + } + } +} + +// Not so useful without type inference for receiver of expression +/** + * Extends the given [comparator] of non-nullable values to a comparator of nullable values + * considering `null` value less than any other value. + */ +public fun nullsFirst(comparator: Comparator): Comparator { + return object: Comparator { + override fun compare(a: T?, b: T?): Int { + if (a === b) return 0 + if (a == null) return -1 + if (b == null) return 1 + return comparator.compare(a, b) + } + } +} + +/** + * Provides a comparator of nullable [Comparable] values + * considering `null` value less than any other value. + */ +@kotlin.internal.InlineOnly +public inline fun > nullsFirst(): Comparator = nullsFirst(naturalOrder()) + +/** + * Extends the given [comparator] of non-nullable values to a comparator of nullable values + * considering `null` value greater than any other value. + */ +public fun nullsLast(comparator: Comparator): Comparator { + return object: Comparator { + override fun compare(a: T?, b: T?): Int { + if (a === b) return 0 + if (a == null) return 1 + if (b == null) return -1 + return comparator.compare(a, b) + } + } +} + +/** + * Provides a comparator of nullable [Comparable] values + * considering `null` value greater than any other value. + */ +@kotlin.internal.InlineOnly +public inline fun > nullsLast(): Comparator = nullsLast(naturalOrder()) + +/** + * Returns a comparator that compares [Comparable] objects in natural order. + */ +public fun > naturalOrder(): Comparator = @Suppress("UNCHECKED_CAST") (NaturalOrderComparator as Comparator) + +/** + * Returns a comparator that compares [Comparable] objects in reversed natural order. + */ +public fun > reverseOrder(): Comparator = @Suppress("UNCHECKED_CAST") (ReverseOrderComparator as Comparator) + +/** Returns a comparator that imposes the reverse ordering of this comparator. */ +public fun Comparator.reversed(): Comparator = when (this) { + is ReversedComparator -> this.comparator + NaturalOrderComparator -> @Suppress("UNCHECKED_CAST") (ReverseOrderComparator as Comparator) + ReverseOrderComparator -> @Suppress("UNCHECKED_CAST") (NaturalOrderComparator as Comparator) + else -> ReversedComparator(this) +} + + +private class ReversedComparator(public val comparator: Comparator): Comparator { + override fun compare(a: T, b: T): Int = comparator.compare(b, a) + @Suppress("VIRTUAL_MEMBER_HIDDEN") + fun reversed(): Comparator = comparator +} + +private object NaturalOrderComparator : Comparator> { + override fun compare(a: Comparable, b: Comparable): Int = a.compareTo(b) + @Suppress("VIRTUAL_MEMBER_HIDDEN") + fun reversed(): Comparator> = ReverseOrderComparator +} + +private object ReverseOrderComparator: Comparator> { + override fun compare(a: Comparable, b: Comparable): Int = b.compareTo(a) + @Suppress("VIRTUAL_MEMBER_HIDDEN") + fun reversed(): Comparator> = NaturalOrderComparator +} diff --git a/runtime/src/main/kotlin/kotlin/ranges/Ranges.kt b/runtime/src/main/kotlin/kotlin/ranges/Ranges.kt index 768cb33ef48..12096e272d4 100644 --- a/runtime/src/main/kotlin/kotlin/ranges/Ranges.kt +++ b/runtime/src/main/kotlin/kotlin/ranges/Ranges.kt @@ -333,3 +333,12 @@ public fun Long.coerceIn(range: ClosedRange): Long { public fun IntProgression.reversed(): IntProgression { return IntProgression.fromClosedRange(last, first, -step) } + +/** + * Returns a progression from this value down to the specified [to] value with the step -1. + * + * The [to] value has to be less than this value. + */ +public infix fun Int.downTo(to: Int): IntProgression { + return IntProgression.fromClosedRange(this, to, -1) +} diff --git a/runtime/src/main/kotlin/kotlin/collections/Sequence.kt b/runtime/src/main/kotlin/kotlin/sequences/Sequence.kt similarity index 66% rename from runtime/src/main/kotlin/kotlin/collections/Sequence.kt rename to runtime/src/main/kotlin/kotlin/sequences/Sequence.kt index 5ac63d3354d..3cdeee1c228 100644 --- a/runtime/src/main/kotlin/kotlin/collections/Sequence.kt +++ b/runtime/src/main/kotlin/kotlin/sequences/Sequence.kt @@ -21,3 +21,22 @@ public interface Sequence { */ public operator fun iterator(): Iterator } + +/** + * A sequence that supports drop(n) and take(n) operations + */ +internal interface DropTakeSequence : Sequence { + fun drop(n: Int): Sequence + fun take(n: Int): Sequence +} + +/** + * Returns an empty sequence. + */ +public fun emptySequence(): Sequence = EmptySequence + +private object EmptySequence : Sequence, DropTakeSequence { + override fun iterator(): Iterator = EmptyIterator + override fun drop(n: Int) = EmptySequence + override fun take(n: Int) = EmptySequence +} \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/sequences/Sequences.kt b/runtime/src/main/kotlin/kotlin/sequences/Sequences.kt new file mode 100644 index 00000000000..fe304bbf4e2 --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/sequences/Sequences.kt @@ -0,0 +1,1527 @@ +package kotlin.sequences + +import kotlin.comparisons.* + +/** + * Returns `true` if [element] is found in the sequence. + */ +public operator fun <@kotlin.internal.OnlyInputTypes T> Sequence.contains(element: T): Boolean { + return indexOf(element) >= 0 +} + +/** + * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this sequence. + */ +public fun Sequence.elementAt(index: Int): T { + return elementAtOrElse(index) { throw IndexOutOfBoundsException("Sequence doesn't contain element at index $index.") } +} + +/** + * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this sequence. + */ +public fun Sequence.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T { + if (index < 0) + return defaultValue(index) + val iterator = iterator() + var count = 0 + while (iterator.hasNext()) { + val element = iterator.next() + if (index == count++) + return element + } + return defaultValue(index) +} + +/** + * Returns an element at the given [index] or `null` if the [index] is out of bounds of this sequence. + */ +public fun Sequence.elementAtOrNull(index: Int): T? { + if (index < 0) + return null + val iterator = iterator() + var count = 0 + while (iterator.hasNext()) { + val element = iterator.next() + if (index == count++) + return element + } + return null +} + +/** + * Returns the first element matching the given [predicate], or `null` if no such element was found. + */ +@kotlin.internal.InlineOnly +public inline fun Sequence.find(predicate: (T) -> Boolean): T? { + return firstOrNull(predicate) +} + +/** + * Returns the last element matching the given [predicate], or `null` if no such element was found. + */ +@kotlin.internal.InlineOnly +public inline fun Sequence.findLast(predicate: (T) -> Boolean): T? { + return lastOrNull(predicate) +} + +/** + * Returns first element. + * @throws [NoSuchElementException] if the sequence is empty. + */ +public fun Sequence.first(): T { + val iterator = iterator() + if (!iterator.hasNext()) + throw NoSuchElementException("Sequence is empty.") + return iterator.next() +} + +/** + * Returns the first element matching the given [predicate]. + * @throws [NoSuchElementException] if no such element is found. + */ +public inline fun Sequence.first(predicate: (T) -> Boolean): T { + for (element in this) if (predicate(element)) return element + throw NoSuchElementException("Sequence contains no element matching the predicate.") +} + +/** + * Returns the first element, or `null` if the sequence is empty. + */ +public fun Sequence.firstOrNull(): T? { + val iterator = iterator() + if (!iterator.hasNext()) + return null + return iterator.next() +} + +/** + * Returns the first element matching the given [predicate], or `null` if element was not found. + */ +public inline fun Sequence.firstOrNull(predicate: (T) -> Boolean): T? { + for (element in this) if (predicate(element)) return element + return null +} + +/** + * Returns first index of [element], or -1 if the sequence does not contain element. + */ +public fun <@kotlin.internal.OnlyInputTypes T> Sequence.indexOf(element: T): Int { + var index = 0 + for (item in this) { + if (element == item) + return index + index++ + } + return -1 +} + +/** + * Returns index of the first element matching the given [predicate], or -1 if the sequence does not contain such element. + */ +public inline fun Sequence.indexOfFirst(predicate: (T) -> Boolean): Int { + var index = 0 + for (item in this) { + if (predicate(item)) + return index + index++ + } + return -1 +} + +/** + * Returns index of the last element matching the given [predicate], or -1 if the sequence does not contain such element. + */ +public inline fun Sequence.indexOfLast(predicate: (T) -> Boolean): Int { + var lastIndex = -1 + var index = 0 + for (item in this) { + if (predicate(item)) + lastIndex = index + index++ + } + return lastIndex +} + +/** + * Returns the last element. + * @throws [NoSuchElementException] if the sequence is empty. + */ +public fun Sequence.last(): T { + val iterator = iterator() + if (!iterator.hasNext()) + throw NoSuchElementException("Sequence is empty.") + var last = iterator.next() + while (iterator.hasNext()) + last = iterator.next() + return last +} + +/** + * Returns the last element matching the given [predicate]. + * @throws [NoSuchElementException] if no such element is found. + */ +public inline fun Sequence.last(predicate: (T) -> Boolean): T { + var last: T? = null + var found = false + for (element in this) { + if (predicate(element)) { + last = element + found = true + } + } + if (!found) throw NoSuchElementException("Sequence contains no element matching the predicate.") + return last as T +} + +/** + * Returns last index of [element], or -1 if the sequence does not contain element. + */ +public fun <@kotlin.internal.OnlyInputTypes T> Sequence.lastIndexOf(element: T): Int { + var lastIndex = -1 + var index = 0 + for (item in this) { + if (element == item) + lastIndex = index + index++ + } + return lastIndex +} + +/** + * Returns the last element, or `null` if the sequence is empty. + */ +public fun Sequence.lastOrNull(): T? { + val iterator = iterator() + if (!iterator.hasNext()) + return null + var last = iterator.next() + while (iterator.hasNext()) + last = iterator.next() + return last +} + +/** + * Returns the last element matching the given [predicate], or `null` if no such element was found. + */ +public inline fun Sequence.lastOrNull(predicate: (T) -> Boolean): T? { + var last: T? = null + for (element in this) { + if (predicate(element)) { + last = element + } + } + return last +} + +/** + * Returns the single element, or throws an exception if the sequence is empty or has more than one element. + */ +public fun Sequence.single(): T { + val iterator = iterator() + if (!iterator.hasNext()) + throw NoSuchElementException("Sequence is empty.") + val single = iterator.next() + if (iterator.hasNext()) + throw IllegalArgumentException("Sequence has more than one element.") + return single +} + +/** + * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element. + */ +public inline fun Sequence.single(predicate: (T) -> Boolean): T { + var single: T? = null + var found = false + for (element in this) { + if (predicate(element)) { + if (found) throw IllegalArgumentException("Sequence contains more than one matching element.") + single = element + found = true + } + } + if (!found) throw NoSuchElementException("Sequence contains no element matching the predicate.") + return single as T +} + +/** + * Returns single element, or `null` if the sequence is empty or has more than one element. + */ +public fun Sequence.singleOrNull(): T? { + val iterator = iterator() + if (!iterator.hasNext()) + return null + val single = iterator.next() + if (iterator.hasNext()) + return null + return single +} + +/** + * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found. + */ +public inline fun Sequence.singleOrNull(predicate: (T) -> Boolean): T? { + var single: T? = null + var found = false + for (element in this) { + if (predicate(element)) { + if (found) return null + single = element + found = true + } + } + if (!found) return null + return single +} + +/** + * Returns a sequence containing all elements except first [n] elements. + */ +@FixmeSequences +public fun Sequence.drop(n: Int): Sequence { + require(n >= 0) { "Requested element count $n is less than zero." } + TODO() + //return when { + // n == 0 -> this + // this is DropTakeSequence -> this.drop(n) + // else -> DropSequence(this, n) + //} +} + +/** + * Returns a sequence containing all elements except first elements that satisfy the given [predicate]. + */ +@FixmeSequences +public fun Sequence.dropWhile(predicate: (T) -> Boolean): Sequence { + TODO() + //return DropWhileSequence(this, predicate) +} + +/** + * A sequence that returns the values from the underlying [sequence] that either match or do not match + * the specified [predicate]. + * + * @param sendWhen If `true`, values for which the predicate returns `true` are returned. Otherwise, + * values for which the predicate returns `false` are returned + */ +internal class FilteringSequence(private val sequence: Sequence, + private val sendWhen: Boolean = true, + private val predicate: (T) -> Boolean +) : Sequence { + + override fun iterator(): Iterator = object : Iterator { + val iterator = sequence.iterator() + var nextState: Int = -1 // -1 for unknown, 0 for done, 1 for continue + var nextItem: T? = null + + private fun calcNext() { + while (iterator.hasNext()) { + val item = iterator.next() + if (predicate(item) == sendWhen) { + nextItem = item + nextState = 1 + return + } + } + nextState = 0 + } + + override fun next(): T { + if (nextState == -1) + calcNext() + if (nextState == 0) + throw NoSuchElementException() + val result = nextItem + nextItem = null + nextState = -1 + return result as T + } + + override fun hasNext(): Boolean { + if (nextState == -1) + calcNext() + return nextState == 1 + } + } +} + +/** + * Returns a sequence containing only elements matching the given [predicate]. + */ +public fun Sequence.filter(predicate: (T) -> Boolean): Sequence { + return FilteringSequence(this, true, predicate) +} + +/** + * Returns a sequence containing only elements matching the given [predicate]. + * @param [predicate] function that takes the index of an element and the element itself + * and returns the result of predicate evaluation on the element. + */ +@Fixme +public fun Sequence.filterIndexed(predicate: (Int, T) -> Boolean): Sequence { + TODO() + // TODO: Rewrite with generalized MapFilterIndexingSequence + // return TransformingSequence(FilteringSequence(IndexingSequence(this), true, { predicate(it.index, it.value) }), { it.value }) +} + +/** + * Appends all elements matching the given [predicate] to the given [destination]. + * @param [predicate] function that takes the index of an element and the element itself + * and returns the result of predicate evaluation on the element. + */ +public inline fun > Sequence.filterIndexedTo(destination: C, predicate: (Int, T) -> Boolean): C { + forEachIndexed { index, element -> + if (predicate(index, element)) destination.add(element) + } + return destination +} + +/** + * Returns a sequence containing all elements that are instances of specified type parameter R. + */ +@FixmeReified +public inline fun Sequence<*>.filterIsInstance(): Sequence<@kotlin.internal.NoInfer R> { + //@Suppress("UNCHECKED_CAST") + //return filter { it is R } as Sequence + TODO() +} + +/** + * Appends all elements that are instances of specified type parameter R to the given [destination]. + */ +@FixmeReified +public inline fun > Sequence<*>.filterIsInstanceTo(destination: C): C { + //for (element in this) if (element is R) destination.add(element) + //return destination + TODO() +} + +/** + * Returns a sequence containing all elements not matching the given [predicate]. + */ +public fun Sequence.filterNot(predicate: (T) -> Boolean): Sequence { + return FilteringSequence(this, false, predicate) +} + +/** + * Returns a sequence containing all elements that are not `null`. + */ +public fun Sequence.filterNotNull(): Sequence { + @Suppress("UNCHECKED_CAST") + return filterNot { it == null } as Sequence +} + +/** + * Appends all elements that are not `null` to the given [destination]. + */ +public fun , T : Any> Sequence.filterNotNullTo(destination: C): C { + for (element in this) if (element != null) destination.add(element) + return destination +} + +/** + * Appends all elements not matching the given [predicate] to the given [destination]. + */ +public inline fun > Sequence.filterNotTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination +} + +/** + * Appends all elements matching the given [predicate] to the given [destination]. + */ +public inline fun > Sequence.filterTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination +} + +/** + * Returns a sequence containing first [n] elements. + */ +@FixmeSequences +public fun Sequence.take(n: Int): Sequence { + //require(n >= 0) { "Requested element count $n is less than zero." } + //return when { + // n == 0 -> emptySequence() + // this is DropTakeSequence -> this.take(n) + // else -> TakeSequence(this, n) + //} + TODO() +} + +/** + * Returns a sequence containing first elements satisfying the given [predicate]. + */ +@FixmeSequences +public fun Sequence.takeWhile(predicate: (T) -> Boolean): Sequence { + // return TakeWhileSequence(this, predicate) + TODO() +} + +/** + * Returns a sequence that yields elements of this sequence sorted according to their natural sort order. + */ +public fun > Sequence.sorted(): Sequence { + return object : Sequence { + override fun iterator(): Iterator { + val sortedList = this@sorted.toMutableList() + sortedList.sort() + return sortedList.iterator() + } + } +} + +/** + * Returns a sequence that yields elements of this sequence sorted according to natural sort order of the value returned by specified [selector] function. + */ +public inline fun > Sequence.sortedBy(crossinline selector: (T) -> R?): Sequence { + return sortedWith(compareBy(selector)) +} + +/** + * Returns a sequence that yields elements of this sequence sorted descending according to natural sort order of the value returned by specified [selector] function. + */ +public inline fun > Sequence.sortedByDescending(crossinline selector: (T) -> R?): Sequence { + return sortedWith(compareByDescending(selector)) +} + +/** + * Returns a sequence that yields elements of this sequence sorted descending according to their natural sort order. + */ +public fun > Sequence.sortedDescending(): Sequence { + return sortedWith(reverseOrder()) +} + +/** + * Returns a sequence that yields elements of this sequence sorted according to the specified [comparator]. + */ +public fun Sequence.sortedWith(comparator: Comparator): Sequence { + return object : Sequence { + override fun iterator(): Iterator { + val sortedList = this@sortedWith.toMutableList() + sortedList.sortWith(comparator) + return sortedList.iterator() + } + } +} + +/** + * Returns a [Map] containing key-value pairs provided by [transform] function + * applied to elements of the given sequence. + * + * If any of two pairs would have the same key the last one gets added to the map. + * + * The returned map preserves the entry iteration order of the original sequence. + */ +public inline fun Sequence.associate(transform: (T) -> Pair): Map { + return associateTo(LinkedHashMap(), transform) +} + +/** + * Returns a [Map] containing the elements from the given sequence indexed by the key + * returned from [keySelector] function applied to each element. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + * + * The returned map preserves the entry iteration order of the original sequence. + */ +public inline fun Sequence.associateBy(keySelector: (T) -> K): Map { + return associateByTo(LinkedHashMap(), keySelector) +} + +/** + * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given sequence. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + * + * The returned map preserves the entry iteration order of the original sequence. + */ +public inline fun Sequence.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map { + return associateByTo(LinkedHashMap(), keySelector, valueTransform) +} + +/** + * Populates and returns the [destination] mutable map with key-value pairs, + * where key is provided by the [keySelector] function applied to each element of the given sequence + * and value is the element itself. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + */ +public inline fun > Sequence.associateByTo(destination: M, keySelector: (T) -> K): M { + for (element in this) { + destination.put(keySelector(element), element) + } + return destination +} + +/** + * Populates and returns the [destination] mutable map with key-value pairs, + * where key is provided by the [keySelector] function and + * and value is provided by the [valueTransform] function applied to elements of the given sequence. + * + * If any two elements would have the same key returned by [keySelector] the last one gets added to the map. + */ +public inline fun > Sequence.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M { + for (element in this) { + destination.put(keySelector(element), valueTransform(element)) + } + return destination +} + +/** + * Populates and returns the [destination] mutable map with key-value pairs + * provided by [transform] function applied to each element of the given sequence. + * + * If any of two pairs would have the same key the last one gets added to the map. + */ +public inline fun > Sequence.associateTo(destination: M, transform: (T) -> Pair): M { + for (element in this) { + destination += transform(element) + } + return destination +} + +/** + * Appends all elements to the given [destination] collection. + */ +public fun > Sequence.toCollection(destination: C): C { + for (item in this) { + destination.add(item) + } + return destination +} + +/** + * Returns a [HashSet] of all elements. + */ +public fun Sequence.toHashSet(): HashSet { + return toCollection(HashSet()) +} + +/** + * Returns a [List] containing all elements. + */ +public fun Sequence.toList(): List { + return this.toMutableList().optimizeReadOnlyList() +} + +/** + * Returns a [MutableList] filled with all elements of this sequence. + */ +public fun Sequence.toMutableList(): MutableList { + return toCollection(ArrayList()) +} + +/** + * Returns a [Set] of all elements. + * + * The returned set preserves the element iteration order of the original sequence. + */ +public fun Sequence.toSet(): Set { + return toCollection(LinkedHashSet()).optimizeReadOnlySet() +} + +/** + * Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence. + */ +@FixmeSequences +public fun Sequence.flatMap(transform: (T) -> Sequence): Sequence { + // return FlatteningSequence(this, transform, { it.iterator() }) + TODO() +} + +/** + * Appends all elements yielded from results of [transform] function being invoked on each element of original sequence, to the given [destination]. + */ +public inline fun > Sequence.flatMapTo(destination: C, transform: (T) -> Sequence): C { + for (element in this) { + val list = transform(element) + destination.addAll(list) + } + return destination +} + +/** + * Groups elements of the original sequence by the key returned by the given [keySelector] function + * applied to each element and returns a map where each group key is associated with a list of corresponding elements. + * + * The returned map preserves the entry iteration order of the keys produced from the original sequence. + * + * @sample samples.collections.Collections.Transformations.groupBy + */ +public inline fun Sequence.groupBy(keySelector: (T) -> K): Map> { + return groupByTo(LinkedHashMap>(), keySelector) +} + +/** + * Groups values returned by the [valueTransform] function applied to each element of the original sequence + * by the key returned by the given [keySelector] function applied to the element + * and returns a map where each group key is associated with a list of corresponding values. + * + * The returned map preserves the entry iteration order of the keys produced from the original sequence. + * + * @sample samples.collections.Collections.Transformations.groupByKeysAndValues + */ +public inline fun Sequence.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map> { + return groupByTo(LinkedHashMap>(), keySelector, valueTransform) +} + +/** + * Groups elements of the original sequence by the key returned by the given [keySelector] function + * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements. + * + * @return The [destination] map. + * + * @sample samples.collections.Collections.Transformations.groupBy + */ +public inline fun >> Sequence.groupByTo(destination: M, keySelector: (T) -> K): M { + for (element in this) { + val key = keySelector(element) + val list = destination.getOrPut(key) { ArrayList() } + list.add(element) + } + return destination +} + +/** + * Groups values returned by the [valueTransform] function applied to each element of the original sequence + * by the key returned by the given [keySelector] function applied to the element + * and puts to the [destination] map each group key associated with a list of corresponding values. + * + * @return The [destination] map. + * + * @sample samples.collections.Collections.Transformations.groupByKeysAndValues + */ +public inline fun >> Sequence.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M { + for (element in this) { + val key = keySelector(element) + val list = destination.getOrPut(key) { ArrayList() } + list.add(valueTransform(element)) + } + return destination +} + +/** + * Creates a [Grouping] source from a sequence to be used later with one of group-and-fold operations + * using the specified [keySelector] function to extract a key from each element. + */ +// @Fixme +// public inline fun Sequence.groupingBy(crossinline keySelector: (T) -> K): Grouping { +// TODO() + //return object : Grouping { + // override fun sourceIterator(): Iterator = this@groupingBy.iterator() + // override fun keyOf(element: T): K = keySelector(element) + //} +//} + +/** + * Returns a sequence containing the results of applying the given [transform] function + * to each element in the original sequence. + */ +@FixmeSequences +public fun Sequence.map(transform: (T) -> R): Sequence { + // return TransformingSequence(this, transform) + TODO() +} + +/** + * Returns a sequence containing the results of applying the given [transform] function + * to each element and its index in the original sequence. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +@FixmeSequences +public fun Sequence.mapIndexed(transform: (Int, T) -> R): Sequence { + TODO() + //return TransformingIndexedSequence(this, transform) +} + +/** + * Returns a sequence containing only the non-null results of applying the given [transform] function + * to each element and its index in the original sequence. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +@FixmeSequences +public fun Sequence.mapIndexedNotNull(transform: (Int, T) -> R?): Sequence { + TODO() + //return TransformingIndexedSequence(this, transform).filterNotNull() +} + +/** + * Applies the given [transform] function to each element and its index in the original sequence + * and appends only the non-null results to the given [destination]. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +public inline fun > Sequence.mapIndexedNotNullTo(destination: C, transform: (Int, T) -> R?): C { + forEachIndexed { index, element -> transform(index, element)?.let { destination.add(it) } } + return destination +} + +/** + * Applies the given [transform] function to each element and its index in the original sequence + * and appends the results to the given [destination]. + * @param [transform] function that takes the index of an element and the element itself + * and returns the result of the transform applied to the element. + */ +public inline fun > Sequence.mapIndexedTo(destination: C, transform: (Int, T) -> R): C { + var index = 0 + for (item in this) + destination.add(transform(index++, item)) + return destination +} + +/** + * Returns a sequence containing only the non-null results of applying the given [transform] function + * to each element in the original sequence. + */ +@FixmeSequences +public fun Sequence.mapNotNull(transform: (T) -> R?): Sequence { + // return TransformingSequence(this, transform).filterNotNull() + TODO() +} + +/** + * Applies the given [transform] function to each element in the original sequence + * and appends only the non-null results to the given [destination]. + */ +public inline fun > Sequence.mapNotNullTo(destination: C, transform: (T) -> R?): C { + forEach { element -> transform(element)?.let { destination.add(it) } } + return destination +} + +/** + * Applies the given [transform] function to each element of the original sequence + * and appends the results to the given [destination]. + */ +public inline fun > Sequence.mapTo(destination: C, transform: (T) -> R): C { + for (item in this) + destination.add(transform(item)) + return destination +} + +/** + * Returns a sequence of [IndexedValue] for each element of the original sequence. + */ +@Fixme +public fun Sequence.withIndex(): Sequence> { + // return IndexingSequence(this) + TODO() +} + +/** + * Returns a sequence containing only distinct elements from the given sequence. + * + * The elements in the resulting sequence are in the same order as they were in the source sequence. + */ +public fun Sequence.distinct(): Sequence { + return this.distinctBy { it } +} + +/** + * Returns a sequence containing only elements from the given sequence + * having distinct keys returned by the given [selector] function. + * + * The elements in the resulting sequence are in the same order as they were in the source sequence. + */ +@FixmeSequences +public fun Sequence.distinctBy(selector: (T) -> K): Sequence { + // return DistinctSequence(this, selector) + TODO() +} + +/** + * Returns a mutable set containing all distinct elements from the given sequence. + * + * The returned set preserves the element iteration order of the original sequence. + */ +public fun Sequence.toMutableSet(): MutableSet { + val set = LinkedHashSet() + for (item in this) set.add(item) + return set +} + +/** + * Returns `true` if all elements match the given [predicate]. + */ +public inline fun Sequence.all(predicate: (T) -> Boolean): Boolean { + for (element in this) if (!predicate(element)) return false + return true +} + +/** + * Returns `true` if sequence has at least one element. + */ +public fun Sequence.any(): Boolean { + for (element in this) return true + return false +} + +/** + * Returns `true` if at least one element matches the given [predicate]. + */ +public inline fun Sequence.any(predicate: (T) -> Boolean): Boolean { + for (element in this) if (predicate(element)) return true + return false +} + +/** + * Returns the number of elements in this sequence. + */ +public fun Sequence.count(): Int { + var count = 0 + for (element in this) count++ + return count +} + +/** + * Returns the number of elements matching the given [predicate]. + */ +public inline fun Sequence.count(predicate: (T) -> Boolean): Int { + var count = 0 + for (element in this) if (predicate(element)) count++ + return count +} + +/** + * Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each element. + */ +public inline fun Sequence.fold(initial: R, operation: (R, T) -> R): R { + var accumulator = initial + for (element in this) accumulator = operation(accumulator, element) + return accumulator +} + +/** + * Accumulates value starting with [initial] value and applying [operation] from left to right + * to current accumulator value and each element with its index in the original sequence. + * @param [operation] function that takes the index of an element, current accumulator value + * and the element itself, and calculates the next accumulator value. + */ +public inline fun Sequence.foldIndexed(initial: R, operation: (Int, R, T) -> R): R { + var index = 0 + var accumulator = initial + for (element in this) accumulator = operation(index++, accumulator, element) + return accumulator +} + +/** + * Performs the given [action] on each element. + */ +public inline fun Sequence.forEach(action: (T) -> Unit): Unit { + for (element in this) action(element) +} + +/** + * Performs the given [action] on each element, providing sequential index with the element. + * @param [action] function that takes the index of an element and the element itself + * and performs the desired action on the element. + */ +public inline fun Sequence.forEachIndexed(action: (Int, T) -> Unit): Unit { + var index = 0 + for (item in this) action(index++, item) +} + +/** + * Returns the largest element or `null` if there are no elements. + * + * If any of elements is `NaN` returns `NaN`. + */ +public fun Sequence.max(): Double? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var max = iterator.next() + if (max.isNaN()) return max + while (iterator.hasNext()) { + val e = iterator.next() + if (e.isNaN()) return e + if (max < e) max = e + } + return max +} + +/** + * Returns the largest element or `null` if there are no elements. + * + * If any of elements is `NaN` returns `NaN`. + */ +public fun Sequence.max(): Float? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var max = iterator.next() + if (max.isNaN()) return max + while (iterator.hasNext()) { + val e = iterator.next() + if (e.isNaN()) return e + if (max < e) max = e + } + return max +} + +/** + * Returns the largest element or `null` if there are no elements. + */ +public fun > Sequence.max(): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var max = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (max < e) max = e + } + return max +} + +/** + * Returns the first element yielding the largest value of the given function or `null` if there are no elements. + */ +public inline fun > Sequence.maxBy(selector: (T) -> R): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var maxElem = iterator.next() + var maxValue = selector(maxElem) + while (iterator.hasNext()) { + val e = iterator.next() + val v = selector(e) + if (maxValue < v) { + maxElem = e + maxValue = v + } + } + return maxElem +} + +/** + * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements. + */ +public fun Sequence.maxWith(comparator: Comparator): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var max = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (comparator.compare(max, e) < 0) max = e + } + return max +} + +/** + * Returns the smallest element or `null` if there are no elements. + * + * If any of elements is `NaN` returns `NaN`. + */ +public fun Sequence.min(): Double? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var min = iterator.next() + if (min.isNaN()) return min + while (iterator.hasNext()) { + val e = iterator.next() + if (e.isNaN()) return e + if (min > e) min = e + } + return min +} + +/** + * Returns the smallest element or `null` if there are no elements. + * + * If any of elements is `NaN` returns `NaN`. + */ +public fun Sequence.min(): Float? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var min = iterator.next() + if (min.isNaN()) return min + while (iterator.hasNext()) { + val e = iterator.next() + if (e.isNaN()) return e + if (min > e) min = e + } + return min +} + +/** + * Returns the smallest element or `null` if there are no elements. + */ +public fun > Sequence.min(): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var min = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (min > e) min = e + } + return min +} + +/** + * Returns the first element yielding the smallest value of the given function or `null` if there are no elements. + */ +public inline fun > Sequence.minBy(selector: (T) -> R): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var minElem = iterator.next() + var minValue = selector(minElem) + while (iterator.hasNext()) { + val e = iterator.next() + val v = selector(e) + if (minValue > v) { + minElem = e + minValue = v + } + } + return minElem +} + +/** + * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements. + */ +public fun Sequence.minWith(comparator: Comparator): T? { + val iterator = iterator() + if (!iterator.hasNext()) return null + var min = iterator.next() + while (iterator.hasNext()) { + val e = iterator.next() + if (comparator.compare(min, e) > 0) min = e + } + return min +} + +/** + * Returns `true` if the sequence has no elements. + */ +public fun Sequence.none(): Boolean { + for (element in this) return false + return true +} + +/** + * Returns `true` if no elements match the given [predicate]. + */ +public inline fun Sequence.none(predicate: (T) -> Boolean): Boolean { + for (element in this) if (predicate(element)) return false + return true +} + +/** + * Returns a sequence which performs the given [action] on each element of the original sequence as they pass though it. + */ +public fun Sequence.onEach(action: (T) -> Unit): Sequence { + return map { + action(it) + it + } +} + +/** + * Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element. + */ +public inline fun Sequence.reduce(operation: (S, T) -> S): S { + val iterator = this.iterator() + if (!iterator.hasNext()) throw UnsupportedOperationException("Empty sequence can't be reduced.") + var accumulator: S = iterator.next() + while (iterator.hasNext()) { + accumulator = operation(accumulator, iterator.next()) + } + return accumulator +} + +/** + * Accumulates value starting with the first element and applying [operation] from left to right + * to current accumulator value and each element with its index in the original sequence. + * @param [operation] function that takes the index of an element, current accumulator value + * and the element itself and calculates the next accumulator value. + */ +public inline fun Sequence.reduceIndexed(operation: (Int, S, T) -> S): S { + val iterator = this.iterator() + if (!iterator.hasNext()) throw UnsupportedOperationException("Empty sequence can't be reduced.") + var index = 1 + var accumulator: S = iterator.next() + while (iterator.hasNext()) { + accumulator = operation(index++, accumulator, iterator.next()) + } + return accumulator +} + +/** + * Returns the sum of all values produced by [selector] function applied to each element in the sequence. + */ +public inline fun Sequence.sumBy(selector: (T) -> Int): Int { + var sum: Int = 0 + for (element in this) { + sum += selector(element) + } + return sum +} + +/** + * Returns the sum of all values produced by [selector] function applied to each element in the sequence. + */ +public inline fun Sequence.sumByDouble(selector: (T) -> Double): Double { + var sum: Double = 0.0 + for (element in this) { + sum += selector(element) + } + return sum +} + +/** + * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements. + */ +public fun Sequence.requireNoNulls(): Sequence { + return map { it ?: throw IllegalArgumentException("null element found in $this.") } +} + +/** + * Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element]. + */ +public operator fun Sequence.minus(element: T): Sequence { + return object: Sequence { + override fun iterator(): Iterator { + var removed = false + return this@minus.filter { if (!removed && it == element) { removed = true; false } else true }.iterator() + } + } +} + +/** + * Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] array. + * + * Note that the source sequence and the array being subtracted are iterated only when an `iterator` is requested from + * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result. + */ +public operator fun Sequence.minus(elements: Array): Sequence { + if (elements.isEmpty()) return this + return object: Sequence { + override fun iterator(): Iterator { + val other = elements.toHashSet() + return this@minus.filterNot { it in other }.iterator() + } + } +} + +/** + * Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] collection. + * + * Note that the source sequence and the collection being subtracted are iterated only when an `iterator` is requested from + * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result. + */ +public operator fun Sequence.minus(elements: Iterable): Sequence { + return object: Sequence { + override fun iterator(): Iterator { + val other = elements.convertToSetForSetOperation() + if (other.isEmpty()) + return this@minus.iterator() + else + return this@minus.filterNot { it in other }.iterator() + } + } +} + +/** + * Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] sequence. + * + * Note that the source sequence and the sequence being subtracted are iterated only when an `iterator` is requested from + * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result. + */ +public operator fun Sequence.minus(elements: Sequence): Sequence { + return object: Sequence { + override fun iterator(): Iterator { + val other = elements.toHashSet() + if (other.isEmpty()) + return this@minus.iterator() + else + return this@minus.filterNot { it in other }.iterator() + } + } +} + +/** + * Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element]. + */ +@kotlin.internal.InlineOnly +public inline fun Sequence.minusElement(element: T): Sequence { + return minus(element) +} + +/** + * Splits the original sequence into pair of lists, + * where *first* list contains elements for which [predicate] yielded `true`, + * while *second* list contains elements for which [predicate] yielded `false`. + */ +public inline fun Sequence.partition(predicate: (T) -> Boolean): Pair, List> { + val first = ArrayList() + val second = ArrayList() + for (element in this) { + if (predicate(element)) { + first.add(element) + } else { + second.add(element) + } + } + return Pair(first, second) +} + +/** + * Returns a sequence containing all elements of the original sequence and then the given [element]. + */ +@FixmeSequences +public operator fun Sequence.plus(element: T): Sequence { + TODO() + // return sequenceOf(this, sequenceOf(element)).flatten() +} + +/** + * Returns a sequence containing all elements of original sequence and then all elements of the given [elements] array. + * + * Note that the source sequence and the array being added are iterated only when an `iterator` is requested from + * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result. + */ +public operator fun Sequence.plus(elements: Array): Sequence { + return this.plus(elements.asList()) +} + +/** + * Returns a sequence containing all elements of original sequence and then all elements of the given [elements] collection. + * + * Note that the source sequence and the collection being added are iterated only when an `iterator` is requested from + * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result. + */ +@FixmeSequences +public operator fun Sequence.plus(elements: Iterable): Sequence { + // return sequenceOf(this, elements.asSequence()).flatten() + TODO() +} + +/** + * Returns a sequence containing all elements of original sequence and then all elements of the given [elements] sequence. + * + * Note that the source sequence and the sequence being added are iterated only when an `iterator` is requested from + * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result. + */ +@FixmeSequences +public operator fun Sequence.plus(elements: Sequence): Sequence { + //return sequenceOf(this, elements).flatten() + TODO() +} + +/** + * Returns a sequence containing all elements of the original sequence and then the given [element]. + */ +@kotlin.internal.InlineOnly +public inline fun Sequence.plusElement(element: T): Sequence { + return plus(element) +} + +/** + * Returns a sequence of pairs built from elements of both sequences with same indexes. + * Resulting sequence has length of shortest input sequence. + */ +@FixmeSequences +public infix fun Sequence.zip(other: Sequence): Sequence> { + TODO() + //return MergingSequence(this, other) { t1, t2 -> t1 to t2 } +} + +/** + * Returns a sequence of values built from elements of both collections with same indexes using provided [transform]. Resulting sequence has length of shortest input sequences. + */ +@FixmeSequences +public fun Sequence.zip(other: Sequence, transform: (T, R) -> V): Sequence { + // return MergingSequence(this, other, transform) + TODO() +} + +/** + * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied. + * + * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit] + * elements will be appended, followed by the [truncated] string (which defaults to "..."). + */ +@FixmeSequences +public fun Sequence.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A { + TODO() + /* + buffer.append(prefix) + var count = 0 + for (element in this) { + if (++count > 1) buffer.append(separator) + if (limit < 0 || count <= limit) { + buffer.appendElement(element, transform) + } else break + } + if (limit >= 0 && count > limit) buffer.append(truncated) + buffer.append(postfix) + return buffer */ +} + +/** + * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied. + * + * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit] + * elements will be appended, followed by the [truncated] string (which defaults to "..."). + */ +public fun Sequence.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String { + return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString() +} + +/** + * Creates an [Iterable] instance that wraps the original sequence returning its elements when being iterated. + */ +public fun Sequence.asIterable(): Iterable { + return Iterable { this.iterator() } +} + +/** + * Returns this sequence as a [Sequence]. + */ +@kotlin.internal.InlineOnly +public inline fun Sequence.asSequence(): Sequence { + return this +} + +/** + * Returns an average value of elements in the sequence. + */ +public fun Sequence.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the sequence. + */ +public fun Sequence.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the sequence. + */ +public fun Sequence.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the sequence. + */ +public fun Sequence.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the sequence. + */ +public fun Sequence.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns an average value of elements in the sequence. + */ +public fun Sequence.average(): Double { + var sum: Double = 0.0 + var count: Int = 0 + for (element in this) { + sum += element + count += 1 + } + return if (count == 0) 0.0 else sum / count +} + +/** + * Returns the sum of all elements in the sequence. + */ +public fun Sequence.sum(): Int { + var sum: Int = 0 + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the sequence. + */ +public fun Sequence.sum(): Int { + var sum: Int = 0 + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the sequence. + */ +public fun Sequence.sum(): Int { + var sum: Int = 0 + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the sequence. + */ +public fun Sequence.sum(): Long { + var sum: Long = 0L + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the sequence. + */ +public fun Sequence.sum(): Float { + var sum: Float = 0.0f + for (element in this) { + sum += element + } + return sum +} + +/** + * Returns the sum of all elements in the sequence. + */ +public fun Sequence.sum(): Double { + var sum: Double = 0.0 + for (element in this) { + sum += element + } + return sum +} + diff --git a/runtime/src/main/kotlin/kotlin/text/Appendable.kt b/runtime/src/main/kotlin/kotlin/text/Appendable.kt new file mode 100644 index 00000000000..3addc63d33f --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/text/Appendable.kt @@ -0,0 +1,7 @@ +package kotlin.text + +interface Appendable { + fun append(c: Char): Appendable + fun append(csq: CharSequence?): Appendable + fun append(csq: CharSequence?, start: Int, end: Int): Appendable +} diff --git a/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt b/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt index fbc2dcb04ed..cd31b4d4d82 100644 --- a/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt +++ b/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt @@ -13,7 +13,7 @@ external fun toCharArray(string: String) : CharArray class StringBuilder private constructor ( private var array: CharArray -) : CharSequence { +) : CharSequence, Appendable { constructor() : this(10) constructor(capacity: Int) : this(CharArray(capacity)) @@ -57,11 +57,17 @@ class StringBuilder private constructor ( } } - fun append(it: Char) { + // Of Appenable. + override fun append(c: Char) : Appendable { ensureExtraCapacity(1) - array[length++] = it + array[length++] = c + return this } + override fun append(csq: CharSequence?): Appendable = TODO() + + override fun append(csq: CharSequence?, start: Int, end: Int): Appendable = TODO() + fun append(it: CharArray) { ensureExtraCapacity(it.size) for (c in it) diff --git a/runtime/src/main/kotlin/kotlin/util/Preconditions.kt b/runtime/src/main/kotlin/kotlin/util/Preconditions.kt new file mode 100644 index 00000000000..d7dd0290437 --- /dev/null +++ b/runtime/src/main/kotlin/kotlin/util/Preconditions.kt @@ -0,0 +1,98 @@ +package kotlin + +/** + * Throws an [IllegalArgumentException] if the [value] is false. + * + * @sample samples.misc.Preconditions.failRequireWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun require(value: Boolean): Unit = require(value) { "Failed requirement." } + +/** + * Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is false. + * + * @sample samples.misc.Preconditions.failRequireWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun require(value: Boolean, lazyMessage: () -> Any): Unit { + if (!value) { + val message = lazyMessage() + throw IllegalArgumentException(message.toString()) + } +} + +/** + * Throws an [IllegalArgumentException] if the [value] is null. Otherwise returns the not null value. + */ +@kotlin.internal.InlineOnly +public inline fun requireNotNull(value: T?): T = requireNotNull(value) { "Required value was null." } + +/** + * Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is null. Otherwise + * returns the not null value. + * + * @sample samples.misc.Preconditions.failRequireWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun requireNotNull(value: T?, lazyMessage: () -> Any): T { + if (value == null) { + val message = lazyMessage() + throw IllegalArgumentException(message.toString()) + } else { + return value + } +} + +/** + * Throws an [IllegalStateException] if the [value] is false. + * + * @sample samples.misc.Preconditions.failCheckWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun check(value: Boolean): Unit = check(value) { "Check failed." } + +/** + * Throws an [IllegalStateException] with the result of calling [lazyMessage] if the [value] is false. + * + * @sample samples.misc.Preconditions.failCheckWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun check(value: Boolean, lazyMessage: () -> Any): Unit { + if (!value) { + val message = lazyMessage() + throw IllegalStateException(message.toString()) + } +} + +/** + * Throws an [IllegalStateException] if the [value] is null. Otherwise + * returns the not null value. + * + * @sample samples.misc.Preconditions.failCheckWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun checkNotNull(value: T?): T = checkNotNull(value) { "Required value was null." } + +/** + * Throws an [IllegalStateException] with the result of calling [lazyMessage] if the [value] is null. Otherwise + * returns the not null value. + * + * @sample samples.misc.Preconditions.failCheckWithLazyMessage + */ +@kotlin.internal.InlineOnly +public inline fun checkNotNull(value: T?, lazyMessage: () -> Any): T { + if (value == null) { + val message = lazyMessage() + throw IllegalStateException(message.toString()) + } else { + return value + } +} + +/** + * Throws an [IllegalStateException] with the given [message]. + * + * @sample samples.misc.Preconditions.failWithError + */ +@kotlin.internal.InlineOnly +public inline fun error(message: Any): Nothing = throw IllegalStateException(message.toString()) From 66293cb89f42fee6992df20820291faacdc85559 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 24 Jan 2017 17:16:54 +0300 Subject: [PATCH 47/86] Frame-local allocations. (#193) --- .../backend/konan/llvm/CodeGenerator.kt | 50 +++- .../kotlin/backend/konan/llvm/ContextUtils.kt | 12 +- .../backend/konan/llvm/EscapeAnalysis.kt | 36 +++ .../kotlin/backend/konan/llvm/IrToBitcode.kt | 56 ++-- .../kotlin/backend/konan/llvm/LlvmUtils.kt | 4 +- runtime/src/launcher/cpp/launcher.cpp | 4 +- runtime/src/main/cpp/Exceptions.cpp | 7 +- runtime/src/main/cpp/Memory.cpp | 274 ++++++++++++------ runtime/src/main/cpp/Memory.h | 157 +++++----- runtime/src/main/cpp/Operator.cpp | 2 +- runtime/src/main/kotlin/kotlin/Arrays.kt | 4 +- 11 files changed, 400 insertions(+), 206 deletions(-) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index a92ed8f3e67..d98d465d1b7 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -20,6 +20,7 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { var returnSlot: LLVMValueRef? = null var slotsPhi: LLVMValueRef? = null var slotCount = 0 + var localAllocs = 0 fun prologue(descriptor: FunctionDescriptor) { prologue(llvmFunction(descriptor), @@ -45,16 +46,18 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { cleanupLandingpad = LLVMAppendBasicBlock(function, "cleanup_landingpad")!! positionAtEnd(entryBb!!) slotsPhi = phi(kObjHeaderPtrPtr) - slotCount = 0 + // First slot can be assigned to keep pointer to frame local arena. + slotCount = 1 + localAllocs = 0 } fun epilogue() { appendingTo(prologueBb!!) { - val slots = if (slotCount > 0) + val slots = if (needSlots) LLVMBuildArrayAlloca(builder, kObjHeaderPtr, Int32(slotCount).llvm, "")!! else kNullObjHeaderPtrPtr - if (slotCount > 0) { + if (needSlots) { // Zero-init slots. val slotsMem = bitcast(kInt8Ptr, slots) val pointerSize = LLVMABISizeOfType(llvmTargetData, kObjHeaderPtr).toInt() @@ -102,9 +105,14 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { slotsPhi = null } - fun releaseVars() { - if (slotCount > 0) { - call(context.llvm.releaseLocalRefsFunction, + private val needSlots: Boolean + get() { + return slotCount > 1 || localAllocs > 0 + } + + private fun releaseVars() { + if (needSlots) { + call(context.llvm.leaveFrameFunction, listOf(slotsPhi!!, Int32(slotCount).llvm)) } } @@ -148,6 +156,36 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { return LLVMBuildAlloca(builder, type, name)!! } } + + + // Return object slot (ab)used for arena matching given allocation. + private fun arenaSlot() : LLVMValueRef { + return gep(slotsPhi!!, Int32(0).llvm) + } + + fun allocInstance(typeInfo: LLVMValueRef, hint: Int) : LLVMValueRef { + if (hint == SCOPE_FRAME) { + val aux = arenaSlot() + localAllocs++ + return call(context.llvm.arenaAllocInstanceFunction, listOf(typeInfo, aux)) + } else { + val slot = vars.createAnonymousSlot() + return call(context.llvm.allocInstanceFunction, listOf(typeInfo, slot)) + } + } + + fun allocArray( + typeInfo: LLVMValueRef, hint: Int, count: LLVMValueRef) : LLVMValueRef { + if (hint == SCOPE_FRAME) { + val aux = arenaSlot() + localAllocs++ + return call(context.llvm.arenaAllocArrayFunction, listOf(typeInfo, count, aux)) + } else { + val slot = vars.createAnonymousSlot() + return call(context.llvm.allocArrayFunction, listOf(typeInfo, count, slot)) + } + } + fun load(value: LLVMValueRef, name: String = ""): LLVMValueRef { val result = LLVMBuildLoad(builder, value, name)!! // Use loadSlot() API for that. diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index 877e0ef6f0e..43e6191393e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -24,6 +24,12 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils +// Different scopes/lifetimes of an object, computed by escape analysis. +const val SCOPE_FRAME = 0 +const val SCOPE_GLOBAL = 1 +const val SCOPE_ARENA = 2 +const val SCOPE_PERMANENT = 3 + /** * Provides utility methods to the implementer. */ @@ -263,13 +269,15 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) { var globalInitIndex:Int = 0 val allocInstanceFunction = importRtFunction("AllocInstance") - val initInstanceFunction = importRtFunction("InitInstance") + val arenaAllocInstanceFunction = importRtFunction("ArenaAllocInstance") val allocArrayFunction = importRtFunction("AllocArrayInstance") + val arenaAllocArrayFunction = importRtFunction("ArenaAllocArrayInstance") + val initInstanceFunction = importRtFunction("InitInstance") val setLocalRefFunction = importRtFunction("SetLocalRef") val setGlobalRefFunction = importRtFunction("SetGlobalRef") val updateLocalRefFunction = importRtFunction("UpdateLocalRef") val updateGlobalRefFunction = importRtFunction("UpdateGlobalRef") - val releaseLocalRefsFunction = importRtFunction("ReleaseLocalRefs") + val leaveFrameFunction = importRtFunction("LeaveFrame") val setArrayFunction = importRtFunction("Kotlin_Array_set") val copyImplArrayFunction = importRtFunction("Kotlin_Array_copyImpl") val lookupFieldOffset = importRtFunction("LookupFieldOffset") diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt new file mode 100644 index 00000000000..4348cf577c6 --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt @@ -0,0 +1,36 @@ +package org.jetbrains.kotlin.backend.konan.llvm + +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.ir.visitors.acceptVoid + +// Analysis we're implementing here is as following. +// We build graph with the following nodes: +// * allocation set, keeping tuple of [local, ctor call, owner function], AS +// * local store set, keeping pair [local, stored], LSS +// * field store set, keeping tuple [local, stored], FSS +// * global store set, [local, stored], GSS +// Function we're trying to compute is the following: +// for each element of AS, could it be referred by someone, whose value is +// alive on return from function, where element was allocated. +// Each element in RS is associated with few elements in AS, which it could refer to. +// TODO: exact algorithm TBD. +internal class EscapeAnalyzerVisitor(val allocHints: MutableMap) : IrElementVisitorVoid { + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitModuleFragment(module: IrModuleFragment) { + module.acceptChildrenVoid(this) + } +} + +fun prepareAllocHints(irModule: IrModuleFragment, allocHints: MutableMap) { + assert(allocHints.size == 0) + + irModule.acceptVoid(EscapeAnalyzerVisitor(allocHints)) +} \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index dd41c2912aa..783d8af129b 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -172,6 +172,7 @@ interface CodeContext { internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid { val codegen = CodeGenerator(context) + val allocHints = mutableMapOf() //-------------------------------------------------------------------------// @@ -240,6 +241,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid override fun visitModuleFragment(module: IrModuleFragment) { context.log("visitModule : ${ir2string(module)}") + prepareAllocHints(module, allocHints) + module.acceptChildrenVoid(this) appendLlvmUsed(context.llvm.usedFunctions) appendStaticInitializers(context.llvm.staticInitializers) @@ -691,10 +694,9 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid codegen.positionAtEnd(bbInit) val typeInfo = codegen.typeInfoValue(value.descriptor) - val allocHint = Int32(1).llvm val initFunction = value.descriptor.constructors.first { it.valueParameters.size == 0 } val ctor = codegen.llvmFunction(initFunction) - val args = listOf(objectPtr, typeInfo, allocHint, ctor) + val args = listOf(objectPtr, typeInfo, ctor) val newValue = call(context.llvm.initInstanceFunction, args) val bbInitResult = codegen.currentBlock codegen.br(bbExit) @@ -802,9 +804,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid codegen.plus(sum, size!!) } - val typeInfo = codegen.typeInfoValue(value.type)!! - val arrayCreationArgs = listOf(typeInfo, kImmInt32One, finalLength) - val array = call(context.llvm.allocArrayFunction, arrayCreationArgs) + val array = codegen.allocArray(codegen.typeInfoValue(value.type)!!, SCOPE_GLOBAL, finalLength) elements.fold(kImmZero) { sum, (exp, size, isArray) -> if (!isArray) { call(context.llvm.setArrayFunction, listOf(array, sum, exp)) @@ -832,6 +832,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val kStringLength = KonanPlatform.builtIns.string.getter2Descriptor(kNameLength) val kStringBuilderToString = kStringBuilder.signature2Descriptor(kNameToString) + //TODO: make it lowering pass. private fun evaluateStringConcatenation(value: IrStringConcatenation): LLVMValueRef { data class Element(val string: LLVMValueRef, val llvmLenght: LLVMValueRef?, val length: Int) @@ -857,8 +858,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val constructor = kStringBuilder!!.constructors .firstOrNull { it -> it.valueParameters.size == 1 && KotlinBuiltIns.isInt(it.valueParameters[0].type) }!! - val stringBuilderObj = call(context.llvm.allocInstanceFunction, - listOf(codegen.typeInfoValue(kStringBuilder.defaultType)!!, kImmOne)) + val stringBuilderObj = codegen.allocInstance(codegen.typeInfoValue(kStringBuilder), SCOPE_FRAME) + call(codegen.llvmFunction(constructor), listOf(stringBuilderObj, totalLength)) stringsWithLengths.fold(stringBuilderObj) { sum, (string, _, _) -> @@ -1434,11 +1435,10 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid */ private fun fieldPtrOfClass(thisPtr: LLVMValueRef, value: PropertyDescriptor): LLVMValueRef { - val objHeaderPtr = codegen.bitcast(codegen.kObjHeaderPtr, thisPtr) val typePtr = pointerType(codegen.classType(value.containingDeclaration as ClassDescriptor)) memScoped { val args = allocArrayOf(kImmOne) - val objectPtr = LLVMBuildGEP(codegen.builder, objHeaderPtr, args[0].ptr, 1, "") + val objectPtr = LLVMBuildGEP(codegen.builder, thisPtr, args[0].ptr, 1, "") val typedObjPtr = codegen.bitcast(typePtr, objectPtr!!) val fieldPtr = LLVMBuildStructGEP(codegen.builder, typedObjPtr, codegen.indexInClass(value), "") return fieldPtr!! @@ -1742,24 +1742,22 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } //-------------------------------------------------------------------------// + private fun hintForCall(callee: IrCall): Int { + return allocHints.getOrElse(callee) { SCOPE_GLOBAL } + } private fun evaluateConstructorCall(callee: IrCall, args: List): LLVMValueRef { context.log("evaluateConstructorCall : ${ir2string(callee)}") memScoped { val constructedClass = (callee.descriptor as ConstructorDescriptor).constructedClass - val typeInfo = codegen.typeInfoValue(constructedClass) - val allocHint = Int32(1).llvm val thisValue = if (constructedClass.isArray) { assert(args.size >= 1 && args[0].type == int32Type) - val allocArrayInstanceArgs = listOf(typeInfo, allocHint, args[0]) - call(context.llvm.allocArrayFunction, allocArrayInstanceArgs) + codegen.allocArray(codegen.typeInfoValue(constructedClass), hintForCall(callee), args[0]) } else { - call(context.llvm.allocInstanceFunction, listOf(typeInfo, allocHint)) + codegen.allocInstance(codegen.typeInfoValue(constructedClass), hintForCall(callee)) } - val constructorParams: MutableList = mutableListOf() - constructorParams += thisValue - constructorParams += args - evaluateSimpleFunctionCall(callee.descriptor as FunctionDescriptor, constructorParams) + evaluateSimpleFunctionCall(callee.descriptor as FunctionDescriptor, + listOf(thisValue) + args) return thisValue } } @@ -1772,8 +1770,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid return when (name) { "konan.internal.areEqualByValue" -> { - val arg0 = args[0]!! - val arg1 = args[1]!! + val arg0 = args[0] + val arg1 = args[1] assert (arg0.type == arg1.type) when (LLVMGetTypeKind(arg0.type)) { @@ -1801,12 +1799,12 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val descriptor = callee.descriptor val ib = context.irModule!!.irBuiltins when (descriptor) { - ib.eqeqeq -> return codegen.icmpEq(args[0]!!, args[1]!!) - ib.gt0 -> return codegen.icmpGt(args[0]!!, kImmZero) - ib.gteq0 -> return codegen.icmpGe(args[0]!!, kImmZero) - ib.lt0 -> return codegen.icmpLt(args[0]!!, kImmZero) - ib.lteq0 -> return codegen.icmpLe(args[0]!!, kImmZero) - ib.booleanNot -> return codegen.icmpNe(args[0]!!, kTrue) + ib.eqeqeq -> return codegen.icmpEq(args[0], args[1]) + ib.gt0 -> return codegen.icmpGt(args[0], kImmZero) + ib.gteq0 -> return codegen.icmpGe(args[0], kImmZero) + ib.lt0 -> return codegen.icmpLt(args[0], kImmZero) + ib.lteq0 -> return codegen.icmpLe(args[0], kImmZero) + ib.booleanNot -> return codegen.icmpNe(args[0], kTrue) else -> { TODO(descriptor.name.toString()) } @@ -1838,7 +1836,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid if (resultPhi != null && !isNothing) codegen.assignPhis(resultPhi to brResult) if (bbExit != null && !isNothing) - codegen.br(bbExit!!) + codegen.br(bbExit) if (bbNext != null) // Switch generation to next or exit. codegen.positionAtEnd(bbNext) else if (bbExit != null) @@ -1878,7 +1876,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val slot = codegen.gep(vtable, Int32(index).llvm) codegen.load(slot) } else { - // Otherwise, call via hashtable. + // Otherwise, call by hash. // TODO: optimize by storing interface number in lower bits of 'this' pointer // when passing object as an interface. This way we can use those bits as index // for an additional per-interface vtable. @@ -1914,7 +1912,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid private fun call(function: LLVMValueRef, args: List): LLVMValueRef { if (codegen.isObjectReturn(function.type)) { // If function returns an object - create slot for the returned value. - // This allows appropriate rootset accounting by just looking on stack slots. + // This allows appropriate rootset accounting by just looking at the stack slots. val resultSlot = codegen.vars.createAnonymousSlot() return currentCodeContext.genCall(function, args + resultSlot) } else { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt index 6a8272a8a5d..ae5155e8330 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt @@ -115,6 +115,8 @@ internal val ContextUtils.kTypeInfo: LLVMTypeRef get() = LLVMGetTypeByName(context.llvmModule, "struct.TypeInfo")!! internal val ContextUtils.kObjHeader: LLVMTypeRef get() = LLVMGetTypeByName(context.llvmModule, "struct.ObjHeader")!! +internal val ContextUtils.kContainerHeader: LLVMTypeRef + get() = LLVMGetTypeByName(context.llvmModule, "struct.ContainerHeader")!! internal val ContextUtils.kObjHeaderPtr: LLVMTypeRef get() = pointerType(kObjHeader) internal val ContextUtils.kObjHeaderPtrPtr: LLVMTypeRef @@ -129,7 +131,7 @@ internal val kInt1 = LLVMInt1Type()!! internal val kBoolean = kInt1 internal val kInt8Ptr = pointerType(int8Type) internal val kInt8PtrPtr = pointerType(kInt8Ptr) -internal val kNullInt8Ptr = LLVMConstNull(kInt8Ptr) +internal val kNullInt8Ptr = LLVMConstNull(kInt8Ptr)!! internal val kImmInt32One = Int32(1).llvm internal val kImmInt64One = Int64(1).llvm internal val ContextUtils.kNullObjHeaderPtr: LLVMValueRef diff --git a/runtime/src/launcher/cpp/launcher.cpp b/runtime/src/launcher/cpp/launcher.cpp index 5e28b99c953..a077f1f266f 100644 --- a/runtime/src/launcher/cpp/launcher.cpp +++ b/runtime/src/launcher/cpp/launcher.cpp @@ -8,10 +8,10 @@ OBJ_GETTER(setupArgs, int argc, char** argv) { // The count is one less, because we skip argv[0] which is the binary name. - AllocArrayInstance(theArrayTypeInfo, SCOPE_GLOBAL, argc - 1, OBJ_RESULT); + AllocArrayInstance(theArrayTypeInfo, argc - 1, OBJ_RESULT); ArrayHeader* array = (*OBJ_RESULT)->array(); for (int index = 1; index < argc; index++) { - AllocStringInstance(SCOPE_GLOBAL, argv[index], strlen(argv[index]), + AllocStringInstance(argv[index], strlen(argv[index]), ArrayAddressOfElementAt(array, index - 1)); } RETURN_OBJ_RESULT(); diff --git a/runtime/src/main/cpp/Exceptions.cpp b/runtime/src/main/cpp/Exceptions.cpp index 6b704d67362..48755a5237d 100644 --- a/runtime/src/main/cpp/Exceptions.cpp +++ b/runtime/src/main/cpp/Exceptions.cpp @@ -50,13 +50,12 @@ OBJ_GETTER0(GetCurrentStackTrace) { RuntimeAssert(symbols != nullptr, "Not enough memory to retrieve the stacktrace"); AutoFree autoFree(symbols); - AllocArrayInstance(theArrayTypeInfo, SCOPE_GLOBAL, size, OBJ_RESULT); + AllocArrayInstance(theArrayTypeInfo, size, OBJ_RESULT); ArrayHeader* array = (*OBJ_RESULT)->array(); for (int index = 0; index < size; ++index) { - AllocStringInstance( - SCOPE_GLOBAL, symbols[index], strlen(symbols[index]), - ArrayAddressOfElementAt(array, index)); + AllocStringInstance(symbols[index], strlen(symbols[index]), + ArrayAddressOfElementAt(array, index)); } RETURN_OBJ_RESULT(); diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index 7c37af313fb..b5b3f2df7be 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -21,11 +21,16 @@ #define TRACE_GC_PHASES 0 ContainerHeader ObjHeader::theStaticObjectsContainer = { - CONTAINER_TAG_NOCOUNT | CONTAINER_TAG_INCREMENT + CONTAINER_TAG_PERMANENT | CONTAINER_TAG_INCREMENT }; namespace { +// Granularity of arena container chunks. +constexpr container_size_t kContainerAlignment = 1024; +// Single object alignment. +constexpr container_size_t kObjectAlignment = 8; + #if USE_GC // Collection threshold default (collect after having so many elements in the // release candidates set). @@ -63,11 +68,30 @@ struct MemoryState { MemoryState* memoryState = nullptr; -#if USE_GC -bool isPermanent(const ContainerHeader* header) { - return (header->ref_count_ & CONTAINER_TAG_MASK) == CONTAINER_TAG_NOCOUNT; +// TODO: use those allocators for STL containers as well. +template +inline T* allocMemory(container_size_t size) { + return reinterpret_cast(calloc(1, size)); } +inline void freeMemory(void* memory) { + free(memory); +} + +inline bool isFreeable(const ContainerHeader* header) { + return (header->refCount_ & CONTAINER_TAG_MASK) < CONTAINER_TAG_PERMANENT; +} + +inline bool isPermanent(const ContainerHeader* header) { + return (header->refCount_ & CONTAINER_TAG_MASK) == CONTAINER_TAG_PERMANENT; +} + +inline container_size_t alignUp(container_size_t size, int alignment) { + return (size + alignment - 1) & ~(alignment - 1); +} + +#if USE_GC + // Must be vector or map 'container -> number', to keep reference counters correct. ContainerHeaderList collectMutableReferred(ContainerHeader* header) { ContainerHeaderList result; @@ -98,8 +122,8 @@ ContainerHeaderList collectMutableReferred(ContainerHeader* header) { void dumpWorker(const char* prefix, ContainerHeader* header, ContainerHeaderSet* seen) { fprintf(stderr, "%s: %p (%08x): %d refs %s\n", prefix, - header, header->ref_count_, header->ref_count_ >> CONTAINER_TAG_SHIFT, - (header->ref_count_ & CONTAINER_TAG_SEEN) != 0 ? "X" : "-"); + header, header->refCount_, header->refCount_ >> CONTAINER_TAG_SHIFT, + (header->refCount_ & CONTAINER_TAG_SEEN) != 0 ? "X" : "-"); seen->insert(header); auto children = collectMutableReferred(header); for (auto child : children) { @@ -117,22 +141,22 @@ void dumpReachable(const char* prefix, const ContainerHeaderSet* roots) { } void phase1(ContainerHeader* header) { - if ((header->ref_count_ & CONTAINER_TAG_SEEN) != 0) + if ((header->refCount_ & CONTAINER_TAG_SEEN) != 0) return; - header->ref_count_ |= CONTAINER_TAG_SEEN; + header->refCount_ |= CONTAINER_TAG_SEEN; auto containers = collectMutableReferred(header); for (auto container : containers) { - container->ref_count_ -= CONTAINER_TAG_INCREMENT; + container->refCount_ -= CONTAINER_TAG_INCREMENT; phase1(container); } } void phase2(ContainerHeader* header, ContainerHeaderSet* rootset) { - if ((header->ref_count_ & CONTAINER_TAG_SEEN) == 0) + if ((header->refCount_ & CONTAINER_TAG_SEEN) == 0) return; - if ((header->ref_count_ >> CONTAINER_TAG_SHIFT) != 0) + if ((header->refCount_ >> CONTAINER_TAG_SHIFT) != 0) rootset->insert(header); - header->ref_count_ &= ~CONTAINER_TAG_SEEN; + header->refCount_ &= ~CONTAINER_TAG_SEEN; auto containers = collectMutableReferred(header); for (auto container : containers) { phase2(container, rootset); @@ -140,32 +164,32 @@ void phase2(ContainerHeader* header, ContainerHeaderSet* rootset) { } void phase3(ContainerHeader* header) { - if ((header->ref_count_ & CONTAINER_TAG_SEEN) != 0) { + if ((header->refCount_ & CONTAINER_TAG_SEEN) != 0) { return; } - header->ref_count_ |= CONTAINER_TAG_SEEN; + header->refCount_ |= CONTAINER_TAG_SEEN; auto containers = collectMutableReferred(header); for (auto container : containers) { - container->ref_count_ += CONTAINER_TAG_INCREMENT; + container->refCount_ += CONTAINER_TAG_INCREMENT; phase3(container); } } void phase4(ContainerHeader* header, ContainerHeaderSet* toRemove) { - auto ref_count = header->ref_count_ >> CONTAINER_TAG_SHIFT; - bool seen = (ref_count > 0 && (header->ref_count_ & CONTAINER_TAG_SEEN) == 0) || - (ref_count == 0 && (header->ref_count_ & CONTAINER_TAG_SEEN) != 0); + auto refCount = header->refCount_ >> CONTAINER_TAG_SHIFT; + bool seen = (refCount > 0 && (header->refCount_ & CONTAINER_TAG_SEEN) == 0) || + (refCount == 0 && (header->refCount_ & CONTAINER_TAG_SEEN) != 0); if (seen) return; // Add to toRemove set. - if (ref_count == 0) + if (refCount == 0) toRemove->insert(header); // Update seen bit. - if (ref_count == 0) - header->ref_count_ |= CONTAINER_TAG_SEEN; + if (refCount == 0) + header->refCount_ |= CONTAINER_TAG_SEEN; else - header->ref_count_ &= ~CONTAINER_TAG_SEEN; + header->refCount_ &= ~CONTAINER_TAG_SEEN; auto containers = collectMutableReferred(header); for (auto container : containers) { phase4(container, toRemove); @@ -174,91 +198,109 @@ void phase4(ContainerHeader* header, ContainerHeaderSet* toRemove) { #endif // USE_GC +// We use first slot as place to store frame-local arena container. +ArenaContainer* initedArena(ObjHeader** auxSlot) { + ObjHeader* slotValue = *auxSlot; + if (slotValue) return reinterpret_cast(slotValue); + ArenaContainer* arena = allocMemory(sizeof(ArenaContainer)); + arena->Init(); + *auxSlot = reinterpret_cast(arena); + return arena; +} + } // namespace ContainerHeader* AllocContainer(size_t size) { - ContainerHeader* result = reinterpret_cast(calloc(1, size)); + ContainerHeader* result = allocMemory(size); #if TRACE_MEMORY - fprintf(stderr, ">>> alloc %d -> %p\n", (int)size, result); - memoryState->containers->insert(result); + fprintf(stderr, ">>> alloc %d -> %p\n", static_cast(size), result); + memoryState->containers->insert(result); #endif // TODO: atomic increment in concurrent case. memoryState->allocCount++; return result; } +// TODO: shall we do padding for alignment? +uint32_t ObjectSize(const ObjHeader* obj) { + const TypeInfo* type_info = obj->type_info(); + if (type_info->instanceSize_ < 0) { + // An array. + return ArrayDataSizeBytes(obj->array()) + sizeof(ArrayHeader); + } else { + return type_info->instanceSize_ + sizeof(ObjHeader); + } +} + void FreeContainer(ContainerHeader* header) { RuntimeAssert(!isPermanent(header), "this kind of container shalln't be freed"); #if TRACE_MEMORY - fprintf(stderr, "<<< free %p\n", header); - memoryState->containers->erase(header); + if (isFreeable(header)) { + fprintf(stderr, "<<< free %p\n", header); + memoryState->containers->erase(header); + } #endif - header->ref_count_ = CONTAINER_TAG_INVALID; + #if USE_GC - if (memoryState->toFree) + if (memoryState->toFree && isFreeable(header)) memoryState->toFree->erase(header); #endif // Now let's clean all object's fields in this container. - // TODO: this is gross hack, relying on the fact that we now only alloc - // ArenaContainer and ObjectContainer, which both have single element. ObjHeader* obj = reinterpret_cast(header + 1); - const TypeInfo* typeInfo = obj->type_info(); - // We use *local* versions as no other threads could see dead objects. - for (int index = 0; index < typeInfo->objOffsetsCount_; index++) { - ObjHeader** location = reinterpret_cast( - reinterpret_cast(obj + 1) + typeInfo->objOffsets_[index]); - UpdateLocalRef(location, nullptr); - } - // Object arrays are *special*. - if (typeInfo == theArrayTypeInfo) { - ArrayHeader* array = obj->array(); - ReleaseLocalRefs(ArrayAddressOfElementAt(array, 0), array->count_); + for (int index = 0; index < header->objectCount_; index++) { + const TypeInfo* typeInfo = obj->type_info(); + + // We use *local* versions as no other threads could see dead objects. + for (int index = 0; index < typeInfo->objOffsetsCount_; index++) { + ObjHeader** location = reinterpret_cast( + reinterpret_cast(obj + 1) + typeInfo->objOffsets_[index]); + UpdateLocalRef(location, nullptr); + } + // Object arrays are *special*. + if (typeInfo == theArrayTypeInfo) { + ArrayHeader* array = obj->array(); + ReleaseLocalRefs(ArrayAddressOfElementAt(array, 0), array->count_); + } + obj = reinterpret_cast(reinterpret_cast(obj) + ObjectSize(obj)); } // And release underlying memory. - // TODO: atomic decrement in concurrent case. + if (isFreeable(header)) { + // TODO: atomic decrement in concurrent case. #if CONCURRENT - #error "Atomic update of allocCount" + #error "Atomic update of allocCount" #endif - memoryState->allocCount--; - free(header); + memoryState->allocCount--; + freeMemory(header); + } } #if USE_GC void FreeContainerNoRef(ContainerHeader* header) { - RuntimeAssert(!isPermanent(header), "this kind of container shalln't be freed"); + RuntimeAssert(isFreeable(header), "this kind of container shalln't be freed"); #if TRACE_MEMORY fprintf(stderr, "<<< free %p\n", header); memoryState->containers->erase(header); #endif - header->ref_count_ = CONTAINER_TAG_INVALID; #if USE_GC if (memoryState->toFree) memoryState->toFree->erase(header); #endif memoryState->allocCount--; - free(header); + freeMemory(header); } #endif -ArenaContainer::ArenaContainer(uint32_t size) { - ArenaContainerHeader* header = - static_cast(AllocContainer(size + sizeof(ArenaContainerHeader))); - header_ = header; - // header->ref_count_ is zero initialized by AllocContainer(). - header->current_ = - reinterpret_cast(header_) + sizeof(ArenaContainerHeader); - header->end_ = header->current_ + size; -} - void ObjectContainer::Init(const TypeInfo* type_info) { RuntimeAssert(type_info->instanceSize_ >= 0, "Must be an object"); uint32_t alloc_size = sizeof(ContainerHeader) + sizeof(ObjHeader) + type_info->instanceSize_; header_ = AllocContainer(alloc_size); if (header_) { - // header->ref_count_ is zero initialized by AllocContainer(). + // One object in this container. + header_->objectCount_ = 1; + // header->refCount_ is zero initialized by AllocContainer(). SetMeta(GetPlace(), type_info); #if TRACE_MEMORY fprintf(stderr, "object at %p\n", GetPlace()); @@ -274,7 +316,9 @@ void ArrayContainer::Init(const TypeInfo* type_info, uint32_t elements) { header_ = AllocContainer(alloc_size); RuntimeAssert(header_ != nullptr, "Cannot alloc memory"); if (header_) { - // header->ref_count_ is zero initialized by AllocContainer(). + // One object in this container. + header_->objectCount_ = 1; + // header->refCount_ is zero initialized by AllocContainer(). GetPlace()->count_ = elements; SetMeta(GetPlace()->obj(), type_info); #if TRACE_MEMORY @@ -283,25 +327,73 @@ void ArrayContainer::Init(const TypeInfo* type_info, uint32_t elements) { } } -ObjHeader* ArenaContainer::PlaceObject(const TypeInfo* type_info) { - RuntimeAssert(type_info->instanceSize_ >= 0, "must be an object"); - uint32_t size = type_info->instanceSize_ + sizeof(ObjHeader); - ObjHeader* result = reinterpret_cast(Place(size)); - if (!result) { - return nullptr; +void ArenaContainer::Init() { + allocContainer(1024); +} + +void ArenaContainer::Deinit() { + auto chunk = currentChunk_; + while (chunk != nullptr) { + auto toRemove = chunk; + // FreeContainer() doesn't release memory when CONTAINER_TAG_STACK is set. + FreeContainer(chunk->asHeader()); + chunk = chunk->next; + freeMemory(toRemove); } - SetMeta(result, type_info); +} + +bool ArenaContainer::allocContainer(container_size_t minSize) { + auto size = minSize + sizeof(ContainerHeader) + sizeof(ContainerChunk); + size = alignUp(size, kContainerAlignment); + ContainerChunk* result = allocMemory(size); + RuntimeAssert(result != nullptr, "Cannot alloc memory"); + if (result == nullptr) return false; + result->next = currentChunk_; + result->asHeader()->refCount_ = (CONTAINER_TAG_STACK | CONTAINER_TAG_INCREMENT); + currentChunk_ = result; + current_ = reinterpret_cast(result->asHeader() + 1); + end_ = reinterpret_cast(result) + size; + return true; +} + +void* ArenaContainer::place(container_size_t size) { + size = alignUp(size, kObjectAlignment); + // Fast path. + if (current_ + size < end_) { + void* result = current_; + current_ += size; + return result; + } + if (!allocContainer(size)) { + return nullptr; + } + void* result = current_; + current_ += size; + RuntimeAssert(current_ <= end_, "Must not overflow"); return result; } -ArrayHeader* ArenaContainer::PlaceArray(const TypeInfo* type_info, int count) { +ObjHeader* ArenaContainer::PlaceObject(const TypeInfo* type_info) { + RuntimeAssert(type_info->instanceSize_ >= 0, "must be an object"); + uint32_t size = type_info->instanceSize_ + sizeof(ObjHeader); + ObjHeader* result = reinterpret_cast(place(size)); + if (!result) { + return nullptr; + } + currentChunk_->asHeader()->objectCount_++; + setMeta(result, type_info); + return result; +} + +ArrayHeader* ArenaContainer::PlaceArray(const TypeInfo* type_info, uint32_t count) { RuntimeAssert(type_info->instanceSize_ < 0, "must be an array"); - uint32_t size = sizeof(ArrayHeader) - type_info->instanceSize_ * count; - ArrayHeader* result = reinterpret_cast(Place(size)); + container_size_t size = sizeof(ArrayHeader) - type_info->instanceSize_ * count; + ArrayHeader* result = reinterpret_cast(place(size)); if (!result) { return nullptr; } - SetMeta(result->obj(), type_info); + currentChunk_->asHeader()->objectCount_++; + setMeta(result->obj(), type_info); result->count_ = count; return result; } @@ -384,6 +476,8 @@ void DeinitMemory() { #if USE_GC GarbageCollect(); + delete memoryState->toFree; + memoryState->toFree = nullptr; #endif // USE_GC if (memoryState->allocCount > 0) { @@ -399,20 +493,28 @@ void DeinitMemory() { memoryState = nullptr; } -// Now we ignore all placement hints and always allocate heap space for new object. -OBJ_GETTER(AllocInstance, const TypeInfo* type_info, PlacementHint hint) { +ObjHeader* ArenaAllocInstance(const TypeInfo* type_info, ObjHeader** auxSlot) { + RuntimeAssert(type_info->instanceSize_ >= 0, "must be an object"); + return initedArena(auxSlot)->PlaceObject(type_info); +} + +OBJ_GETTER(AllocInstance, const TypeInfo* type_info) { RuntimeAssert(type_info->instanceSize_ >= 0, "must be an object"); RETURN_OBJ(ObjectContainer(type_info).GetPlace()); } -OBJ_GETTER(AllocArrayInstance, - const TypeInfo* type_info, PlacementHint hint, uint32_t elements) { +ObjHeader* ArenaAllocArrayInstance( + const TypeInfo* type_info, uint32_t elements, ObjHeader** auxSlot) { + RuntimeAssert(type_info->instanceSize_ < 0, "must be an array"); + return initedArena(auxSlot)->PlaceArray(type_info, elements)->obj(); +} + +OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, uint32_t elements) { RuntimeAssert(type_info->instanceSize_ < 0, "must be an array"); RETURN_OBJ(ArrayContainer(type_info, elements).GetPlace()->obj()); } -OBJ_GETTER(AllocStringInstance, - PlacementHint hint, const char* data, uint32_t length) { +OBJ_GETTER(AllocStringInstance, const char* data, uint32_t length) { ArrayHeader* array = ArrayContainer(theStringTypeInfo, length).GetPlace(); memcpy( ByteArrayAddressOfElementAt(array, 0), @@ -422,8 +524,7 @@ OBJ_GETTER(AllocStringInstance, } OBJ_GETTER(InitInstance, - ObjHeader** location, const TypeInfo* type_info, PlacementHint hint, - void (*ctor)(ObjHeader*)) { + ObjHeader** location, const TypeInfo* type_info, void (*ctor)(ObjHeader*)) { ObjHeader* sentinel = reinterpret_cast(1); ObjHeader* value; // Wait until other initializers. @@ -438,7 +539,7 @@ OBJ_GETTER(InitInstance, RETURN_OBJ(value); } - AllocInstance(type_info, hint, OBJ_RESULT); + AllocInstance(type_info, OBJ_RESULT); ObjHeader* object = *OBJ_RESULT; UpdateGlobalRef(location, object); try { @@ -523,6 +624,15 @@ void UpdateGlobalRef(ObjHeader** location, const ObjHeader* object) { #endif } +void LeaveFrame(ObjHeader** start, int count) { + ReleaseLocalRefs(start + 1, count - 1); + if (*start != nullptr) { + auto arena = initedArena(start); + arena->Deinit(); + freeMemory(arena); + } +} + void ReleaseLocalRefs(ObjHeader** start, int count) { #if TRACE_MEMORY fprintf(stderr, "ReleaseLocalRefs %p .. %p\n", start, start + count); @@ -623,7 +733,7 @@ void GarbageCollect() { memoryState->toFree->clear(); for (auto header : toRemove) { - RuntimeAssert((header->ref_count_ & CONTAINER_TAG_SEEN) != 0, "Must be not seen"); + RuntimeAssert((header->refCount_ & CONTAINER_TAG_SEEN) != 0, "Must be not seen"); FreeContainerNoRef(header); } diff --git a/runtime/src/main/cpp/Memory.h b/runtime/src/main/cpp/Memory.h index 6748e893e2d..7db58109722 100644 --- a/runtime/src/main/cpp/Memory.h +++ b/runtime/src/main/cpp/Memory.h @@ -10,7 +10,7 @@ typedef enum { SCOPE_FRAME = 0, // Allocation is generic global allocation. SCOPE_GLOBAL = 1, - // Allocation shall take place in current arena. + // Allocation shall take place in current stack arena. SCOPE_ARENA = 2, // Allocation is permanent. SCOPE_PERMANENT = 3 @@ -20,15 +20,16 @@ typedef enum { typedef enum { // Container is normal thread local container. CONTAINER_TAG_NORMAL = 0, - // Container shall not be refcounted (const data, frame locals). - CONTAINER_TAG_NOCOUNT = 1, - // Container shall be atomically refcounted. - CONTAINER_TAG_SHARED = 2, - // Container is no longer valid. - CONTAINER_TAG_INVALID = 3, + // Container shall be atomically refcounted. + CONTAINER_TAG_SHARED = 1, + // Those container tags shall not be refcounted. + // Permanent object, cannot refer to non-permanent objects, so no need to cleanup those. + CONTAINER_TAG_PERMANENT = 2, + // Stack objects, no need to free, children cleanup still shall be there. + CONTAINER_TAG_STACK = 3, // Container was seen during GC. CONTAINER_TAG_SEEN = 4, - // Shift to get actual counter.. + // Shift to get actual counter. CONTAINER_TAG_SHIFT = 3, // Actual value to increment/decrement conatiner by. Tag is in lower bits. CONTAINER_TAG_INCREMENT = 1 << CONTAINER_TAG_SHIFT, @@ -36,14 +37,17 @@ typedef enum { CONTAINER_TAG_MASK = ((CONTAINER_TAG_INCREMENT >> 1) - 1) } ContainerTag; -// Could be made 64-bit for large memory configs. typedef uint32_t container_offset_t; +typedef uint32_t container_size_t; + // Header of all container objects. Contains reference counter. struct ContainerHeader { // Reference counter of container. Uses two lower bits of counter for // container type (for polymorphism in ::Release()). - volatile uint32_t ref_count_; + volatile uint32_t refCount_; + // Number of objects in the container. + uint32_t objectCount_; }; struct ArrayHeader; @@ -116,37 +120,25 @@ struct ArrayHeader { uint32_t count_; }; -struct ArenaContainerHeader : public ContainerHeader { - // Current allocation limit. - uint8_t* current_; - // Allocation end. Maybe consider having chunked backing storage - // at cost of smarter ::Release() polymorphic on container type. - uint8_t* end_; -}; - inline uint32_t ArrayDataSizeBytes(const ArrayHeader* obj) { // Instance size is negative. return -obj->type_info()->instanceSize_ * obj->count_; } -void FreeContainer(ContainerHeader* header); - // TODO: those two operations can be implemented by translator when storing // reference to an object. inline void AddRef(ContainerHeader* header) { // Looking at container type we may want to skip AddRef() totally // (non-escaping stack objects, constant objects). - switch (header->ref_count_ & CONTAINER_TAG_MASK) { - case CONTAINER_TAG_NORMAL: - header->ref_count_ += CONTAINER_TAG_INCREMENT; + switch (header->refCount_ & CONTAINER_TAG_MASK) { + case CONTAINER_TAG_STACK: + case CONTAINER_TAG_PERMANENT: break; - case CONTAINER_TAG_NOCOUNT: + case CONTAINER_TAG_NORMAL: + header->refCount_ += CONTAINER_TAG_INCREMENT; break; case CONTAINER_TAG_SHARED: - __sync_fetch_and_add(&header->ref_count_, CONTAINER_TAG_INCREMENT); - break; - case CONTAINER_TAG_INVALID: - RuntimeAssert(false, "trying to addref invalid container"); + __sync_fetch_and_add(&header->refCount_, CONTAINER_TAG_INCREMENT); break; default: RuntimeAssert(false, "unknown container type"); @@ -154,19 +146,22 @@ inline void AddRef(ContainerHeader* header) { } } -// Release returns 'true' iff container cannot be part of cycle (either NOCOUNT +void FreeContainer(ContainerHeader* header); + +// Release() returns 'true' iff container cannot be part of cycle (either NOCOUNT // object or container was fully released and will be collected). inline bool Release(ContainerHeader* header) { - switch (header->ref_count_ & CONTAINER_TAG_MASK) { + switch (header->refCount_ & CONTAINER_TAG_MASK) { + case CONTAINER_TAG_PERMANENT: + case CONTAINER_TAG_STACK: + // permanent/stack containers aren't loop candidates. + return true; case CONTAINER_TAG_NORMAL: - if ((header->ref_count_ -= CONTAINER_TAG_INCREMENT) == CONTAINER_TAG_NORMAL) { + if ((header->refCount_ -= CONTAINER_TAG_INCREMENT) == CONTAINER_TAG_NORMAL) { FreeContainer(header); return true; } break; - case CONTAINER_TAG_NOCOUNT: - // NOCOUNT containers aren't loop candidate. - return true; // Note that shared containers have potentially subtle race, if object holds a // reference to another object, stored in shorter living container. In this // case there's unlikely, but possible case, where one mutator takes reference, @@ -182,14 +177,11 @@ inline bool Release(ContainerHeader* header) { // probability even further. case CONTAINER_TAG_SHARED: if (__sync_sub_and_fetch( - &header->ref_count_, CONTAINER_TAG_INCREMENT) == CONTAINER_TAG_SHARED) { + &header->refCount_, CONTAINER_TAG_INCREMENT) == CONTAINER_TAG_SHARED) { FreeContainer(header); return true; } break; - case CONTAINER_TAG_INVALID: - RuntimeAssert(false, "trying to release invalid container"); - break; default: RuntimeAssert(false, "unknown container type"); break; @@ -236,9 +228,9 @@ class ObjectContainer : public Container { // Object container shalln't have any dtor, as it's being freed by // ::Release(). + ObjHeader* GetPlace() const { - return reinterpret_cast( - reinterpret_cast(header_) + sizeof(ContainerHeader)); + return reinterpret_cast(header_ + 1); } private: @@ -253,41 +245,23 @@ class ArrayContainer : public Container { } // Array container shalln't have any dtor, as it's being freed by ::Release(). + ArrayHeader* GetPlace() const { - return reinterpret_cast( - reinterpret_cast(header_) + sizeof(ContainerHeader)); + return reinterpret_cast(header_ + 1); } private: void Init(const TypeInfo* type_info, uint32_t elements); }; - // Class representing arena-style placement container. -// Container is used for reference counting, -// and it is assumed that objects with related placement will share container. Only +// Container is used for reference counting, and it is assumed that objects +// with related placement will share container. Only // whole container can be freed, individual objects are not taken into account. -class ArenaContainer : public Container { +class ArenaContainer { public: - explicit ArenaContainer(uint32_t size); - - ~ArenaContainer() { - if (header_) { - RuntimeAssert(header_->ref_count_ == 0, "Non-zero refcount"); - Dispose(); - } - } - - // Allocation function. - void* Place(int size) { - ArenaContainerHeader* header = reinterpret_cast(header_); - if (header->current_ + size > header->end_) { - return nullptr; - } - void* result = header->current_; - header->current_ += size; - return result; - } + void Init(); + void Deinit(); // Place individual object in this container. ObjHeader* PlaceObject(const TypeInfo* type_info); @@ -295,15 +269,28 @@ class ArenaContainer : public Container { // Places an array of certain type in this container. Note that array_type_info // is type info for an array, not for an individual element. Also note that exactly // same operation could be used to place strings. - ArrayHeader* PlaceArray(const TypeInfo* array_type_info, int count); + ArrayHeader* PlaceArray(const TypeInfo* array_type_info, container_size_t count); - // Dispose whole container ignoring non-zero refcount. Use with care. - void Dispose() { - if (header_) { - FreeContainer(header_); - header_ = nullptr; + private: + struct ContainerChunk { + ContainerChunk* next; + // Then we have ContainerHeader here. + ContainerHeader* asHeader() { + return reinterpret_cast(this + 1); } + }; + + void* place(container_size_t size); + bool allocContainer(container_size_t minSize); + void setMeta(ObjHeader* obj, const TypeInfo* type_info) { + obj->container_offset_negative_ = + reinterpret_cast(obj) - reinterpret_cast(currentChunk_->asHeader()); + obj->set_type_info(type_info); + RuntimeAssert(obj->container() == currentChunk_->asHeader(), "Placement must match"); } + ContainerChunk* currentChunk_; + uint8_t* current_; + uint8_t* end_; }; #ifdef __cplusplus @@ -321,14 +308,26 @@ extern "C" { void InitMemory(); void DeinitMemory(); -OBJ_GETTER(AllocInstance, const TypeInfo* type_info, PlacementHint hint); -OBJ_GETTER(AllocArrayInstance, - const TypeInfo* type_info, PlacementHint hint, uint32_t elements); -OBJ_GETTER(AllocStringInstance, - PlacementHint hint, const char* data, uint32_t length); +// +// Object allocation. +// +// Allocation can happen in either GLOBAL, FRAME or ARENA scope. Depending on that, +// Alloc* or ArenaAlloc* is called. Regular alloc means allocation happens in the heap, +// and each object gets its individual container. Otherwise, allocator uses aux slot in +// an implementation-defined manner, current behavior is to keep arena pointer there. +// Arena containers are not reference counted, and is explicitly freed when leaving +// its owner frame. +// Escape analysis algorithm is the provider of information for decision on exact aux slot +// selection, and comes from upper bound esteemation of object lifetime. +// +ObjHeader* ArenaAllocInstance(const TypeInfo* type_info, ObjHeader** auxSlot) RUNTIME_NOTHROW; +OBJ_GETTER(AllocInstance, const TypeInfo* type_info) RUNTIME_NOTHROW; +ObjHeader* ArenaAllocArrayInstance( + const TypeInfo* type_info, uint32_t elements, ObjHeader** auxSlot) RUNTIME_NOTHROW; +OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, uint32_t elements) RUNTIME_NOTHROW; +OBJ_GETTER(AllocStringInstance, const char* data, uint32_t length) RUNTIME_NOTHROW; OBJ_GETTER(InitInstance, - ObjHeader** location, const TypeInfo* type_info, PlacementHint hint, - void (*ctor)(ObjHeader*)); + ObjHeader** location, const TypeInfo* type_info, void (*ctor)(ObjHeader*)) RUNTIME_NOTHROW; // // Object reference management. @@ -363,6 +362,8 @@ void UpdateGlobalRef(ObjHeader** location, const ObjHeader* object) RUNTIME_NOTH // Optimization: release all references in range. void ReleaseLocalRefs(ObjHeader** start, int count) RUNTIME_NOTHROW; void ReleaseGlobalRefs(ObjHeader** start, int count) RUNTIME_NOTHROW; +// Called on frame leave, if it has object slots. +void LeaveFrame(ObjHeader** start, int count) RUNTIME_NOTHROW; // Collect garbage, which cannot be found by reference counting (cycles). void GarbageCollect() RUNTIME_NOTHROW; diff --git a/runtime/src/main/cpp/Operator.cpp b/runtime/src/main/cpp/Operator.cpp index 0408aa043f3..d24244a8466 100644 --- a/runtime/src/main/cpp/Operator.cpp +++ b/runtime/src/main/cpp/Operator.cpp @@ -5,7 +5,7 @@ namespace { -inline template R div(Ta a, Tb b) { +template R div(Ta a, Tb b) { if (__builtin_expect(b == 0, false)) { ThrowArithmeticException(); } diff --git a/runtime/src/main/kotlin/kotlin/Arrays.kt b/runtime/src/main/kotlin/kotlin/Arrays.kt index 182585a5b92..b5fa8b5985a 100644 --- a/runtime/src/main/kotlin/kotlin/Arrays.kt +++ b/runtime/src/main/kotlin/kotlin/Arrays.kt @@ -2,6 +2,8 @@ package kotlin import kotlin.collections.* +// TODO: make all iterator() methods inline. + /** * An array of bytes. * @constructor Creates a new array of the specified [size], with all elements initialized to zero. @@ -27,7 +29,7 @@ public final class ByteArray : Cloneable { external private fun getArrayLength(): Int /** Creates an iterator over the elements of the array. */ - public operator fun iterator(): kotlin.collections.ByteIterator { + public operator fun iterator(): ByteIterator { return ByteIteratorImpl(this) } } From c6a4ec2ff44b025b5227f936756efe3b5389974b Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Wed, 25 Jan 2017 12:39:36 +0300 Subject: [PATCH 48/86] Add enumeration support. (#128) * Add enumeration support. * Enum classes lowering. * merge fix * merge fix * used arrayOf from irModule * changed lowering quant from body to file * refactoring * review fixes * lowering for GET_OBJECT in enums * enabled tests * added tests * moved tests to separate dir * renamed test files * moved phase up * review fixes * reformat --- .../jetbrains/kotlin/backend/konan/Context.kt | 1 + .../kotlin/backend/konan/KonanLower.kt | 3 + .../kotlin/backend/konan/KonanPhases.kt | 1 + .../konan/descriptors/DescriptorUtils.kt | 3 +- .../kotlin/backend/konan/descriptors/utils.kt | 2 + .../backend/konan/llvm/CodeGenerator.kt | 7 +- .../kotlin/backend/konan/llvm/NameUtils.kt | 2 + .../backend/konan/lower/EnumClassLowering.kt | 605 ++++++++++++++++++ backend.native/tests/build.gradle | 35 + .../tests/codegen/enum/companionObject.kt | 24 + backend.native/tests/codegen/enum/test0.kt | 9 + backend.native/tests/codegen/enum/test1.kt | 8 + .../tests/codegen/enum/vCallNoEntryClass.kt | 13 + .../tests/codegen/enum/vCallWithEntryClass.kt | 15 + backend.native/tests/codegen/enum/valueOf.kt | 8 + backend.native/tests/codegen/enum/values.kt | 8 + .../codegen/blackbox/enum/emptyConstructor.kt | 2 +- .../codegen/blackbox/enum/kt9711_2.kt | 2 +- .../kotlin/konan/internal/RuntimeUtils.kt | 15 +- runtime/src/main/kotlin/kotlin/Enum.kt | 37 +- 20 files changed, 774 insertions(+), 26 deletions(-) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt create mode 100644 backend.native/tests/codegen/enum/companionObject.kt create mode 100644 backend.native/tests/codegen/enum/test0.kt create mode 100644 backend.native/tests/codegen/enum/test1.kt create mode 100644 backend.native/tests/codegen/enum/vCallNoEntryClass.kt create mode 100644 backend.native/tests/codegen/enum/vCallWithEntryClass.kt create mode 100644 backend.native/tests/codegen/enum/valueOf.kt create mode 100644 backend.native/tests/codegen/enum/values.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index a6531e24a51..ce3152e07b7 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -23,6 +23,7 @@ internal final class Context(val config: KonanConfig) : KonanBackendContext() { var moduleDescriptor: ModuleDescriptor? = null + // TODO: make lateinit? var irModule: IrModuleFragment? = null set(module: IrModuleFragment?) { if (field != null) { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index cb9a3b4660e..c7b3ed3aca1 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -17,6 +17,9 @@ internal class KonanLower(val context: Context) { fun lower(irFile: IrFile) { val phaser = PhaseManager(context) + phaser.phase(KonanPhase.LOWER_ENUMS) { + EnumClassLowering(context).run(irFile) + } phaser.phase(KonanPhase.LOWER_DEFAULT_PARAMETER_EXTENT) { DefaultParameterStubGenerator(context).runOnFilePostfix(irFile) DefaultParameterInjector(context).runOnFilePostfix(irFile) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt index 2443f321cb6..dd6c3d07253 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt @@ -18,6 +18,7 @@ enum class KonanPhase(val description: String, /* ... ... */ LOWER_CALLABLES("Callable references Lowering"), /* ... ... */ LOWER_INLINE("Functions inlining"), /* ... ... */ AUTOBOX("Autoboxing of primitive types"), + /* ... ... */ LOWER_ENUMS("Enum classes lowering"), /* ... */ BITCODE("LLVM BitCode Generation"), /* ... ... */ RTTI("RTTI Generation"), /* ... ... */ CODEGEN("Code Generation"), diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index cbc1a30bf48..26ad0898868 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -171,6 +171,7 @@ internal val ClassDescriptor.сontributedMethods: List } fun ClassDescriptor.isAbstract() = this.modality == Modality.SEALED || this.modality == Modality.ABSTRACT + || this.kind == ClassKind.ENUM_CLASS // TODO: optimize val ClassDescriptor.vtableEntries: List @@ -186,7 +187,7 @@ val ClassDescriptor.vtableEntries: List val methods = this.сontributedMethods val inheritedVtableSlots = superVtableEntries.map { superMethod -> - methods.single { OverridingUtil.overrides(it, superMethod) } + methods.singleOrNull { OverridingUtil.overrides(it, superMethod) } ?: superMethod } return inheritedVtableSlots + (methods - inheritedVtableSlots).filter { it.isOverridable } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt index 5ab5c6fbc63..85725449391 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt @@ -39,3 +39,5 @@ val PropertyDescriptor.backingField: PropertyDescriptor? fun DeclarationDescriptor.deepPrint() { this.accept(DeepPrintVisitor(PrintVisitor()), 0) } + +internal val String.synthesizedName get() = Name.identifier("\$" + this) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index d98d465d1b7..a4e0402556e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -314,8 +314,11 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { } fun countParams(fn: FunctionDescriptor) = LLVMCountParams(fn.llvmFunction) - fun indexInClass(p:PropertyDescriptor):Int = (p.containingDeclaration as ClassDescriptor).fields.indexOf(p) - + fun indexInClass(p:PropertyDescriptor):Int { + val index = (p.containingDeclaration as ClassDescriptor).fields.indexOf(p) + assert(index >= 0) { "Unable to find property $p" } + return index + } fun basicBlock(name: String = "label_"): LLVMBasicBlockRef { val currentBlock = this.currentBlock diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt index bb0fb5c62b0..8b155bc9733 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt @@ -89,6 +89,8 @@ internal val ClassDescriptor.symbolName: String CLASS -> "kclass:" INTERFACE -> "kinf:" OBJECT -> "kclass:" + ENUM_CLASS -> "kclass:" + ENUM_ENTRY -> "kclass:" else -> TODO("fixme: " + this.kind) } + fqNameSafe diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt new file mode 100644 index 00000000000..1b66013bf7c --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt @@ -0,0 +1,605 @@ +package org.jetbrains.kotlin.backend.konan.lower + +import org.jetbrains.kotlin.backend.common.ClassLoweringPass +import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.lower.SimpleMemberScope +import org.jetbrains.kotlin.backend.common.runOnFilePostfix +import org.jetbrains.kotlin.backend.jvm.descriptors.createValueParameter +import org.jetbrains.kotlin.backend.jvm.descriptors.initialize +import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.backend.konan.KonanBuiltIns +import org.jetbrains.kotlin.backend.konan.KonanPlatform +import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalFunctions +import org.jetbrains.kotlin.backend.konan.descriptors.synthesizedName +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl +import org.jetbrains.kotlin.incremental.components.NoLookupLocation +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.* +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.util.dump +import org.jetbrains.kotlin.ir.util.transform +import org.jetbrains.kotlin.ir.util.transformFlat +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.descriptorUtil.classId +import org.jetbrains.kotlin.resolve.descriptorUtil.classValueType +import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter +import org.jetbrains.kotlin.resolve.scopes.MemberScopeImpl +import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver +import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.utils.Printer +import org.jetbrains.kotlin.utils.addToStdlib.singletonList +import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList + +internal data class LoweredSyntheticFunction(val functionDescriptor: FunctionDescriptor, val containingClass: ClassDescriptor) + +internal data class LoweredEnumEntry(val implObject: ClassDescriptor, val valuesProperty: PropertyDescriptor, + val itemGetter: FunctionDescriptor, val entriesMap: Map) + +internal class EnumUsageLowering(val context: Context, + val loweredFunctions: Map, + val loweredEnumEntries: Map) + : IrElementTransformerVoid(), FileLoweringPass { + + override fun lower(irFile: IrFile) { + visitFile(irFile) + } + + override fun visitGetEnumValue(expression: IrGetEnumValue): IrExpression { + val enumClassDescriptor = expression.descriptor.containingDeclaration as ClassDescriptor + enumClassDescriptor.companionObjectDescriptor + return loadEnumEntry(expression.startOffset, expression.endOffset, enumClassDescriptor, expression.descriptor.name) + } + + override fun visitGetObjectValue(expression: IrGetObjectValue): IrExpression { + if(expression.descriptor.kind != ClassKind.ENUM_ENTRY) + return super.visitGetObjectValue(expression) + val enumClassDescriptor = expression.descriptor.containingDeclaration as ClassDescriptor + return loadEnumEntry(expression.startOffset, expression.endOffset, enumClassDescriptor, expression.descriptor.name) + } + + private fun loadEnumEntry(startOffset: Int, endOffset: Int, enumClassDescriptor: ClassDescriptor, name: Name): IrExpression { + val loweredEnumEntry = loweredEnumEntries[enumClassDescriptor]!! + val implObject = loweredEnumEntry.implObject + val implObjectGetter = IrGetObjectValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, implObject.classValueType!!, implObject) + val valuesGetter = IrGetFieldImpl(startOffset, endOffset, loweredEnumEntry.valuesProperty).apply { + receiver = implObjectGetter + } + val ordinal = loweredEnumEntry.entriesMap[name]!! + return IrCallImpl(startOffset, endOffset, loweredEnumEntry.itemGetter).apply { + dispatchReceiver = valuesGetter + putValueArgument(0, IrConstImpl.int(startOffset, endOffset, enumClassDescriptor.module.builtIns.intType, ordinal)) + } + } + + override fun visitCall(expression: IrCall): IrExpression { + val loweredFunction = loweredFunctions[expression.descriptor] ?: return super.visitCall(expression) + return IrCallImpl(expression.startOffset, expression.endOffset, loweredFunction.functionDescriptor).apply { + val containingClass = loweredFunction.containingClass + dispatchReceiver = IrGetObjectValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, containingClass.classValueType!!, containingClass) + expression.descriptor.valueParameters.forEach { p -> putValueArgument(p, expression.getValueArgument(p)) } + } + } +} + +internal class EnumClassLowering(val context: Context) : ClassLoweringPass { + val loweredFunctions = mutableMapOf() + val loweredEnumEntries = mutableMapOf() + + fun run(irFile: IrFile) { + runOnFilePostfix(irFile) + EnumUsageLowering(context, loweredFunctions, loweredEnumEntries).lower(irFile) + } + + override fun lower(irClass: IrClass) { + val descriptor = irClass.descriptor + if (descriptor.kind != ClassKind.ENUM_CLASS) + return + EnumClassTransformer(irClass).run() + } + + private interface EnumConstructorCallTransformer { + fun transform(enumConstructorCall: IrEnumConstructorCall): IrExpression + fun transform(delegatingConstructorCall: IrDelegatingConstructorCall): IrExpression + } + + private inner class EnumClassTransformer(val irClass: IrClass) { + private val enumEntryOrdinals = mutableMapOf() + private val loweredEnumConstructors = mutableMapOf() + private val defaultEnumEntryConstructors = mutableMapOf() + private val loweredEnumConstructorParameters = mutableMapOf() + + private lateinit var valuesFieldDescriptor: PropertyDescriptor + private lateinit var valuesFunctionDescriptor: FunctionDescriptor + private lateinit var valueOfFunctionDescriptor: FunctionDescriptor + + fun run() { + assignOrdinalsToEnumEntries() + lowerEnumConstructors(irClass) + lowerEnumEntriesClasses() + val defaultClass = createDefaultClassForEnumEntries() + lowerEnumClassBody() + if (defaultClass != null) + irClass.declarations.add(defaultClass) + createImplObject() + } + + private fun assignOrdinalsToEnumEntries() { + var ordinal = 0 + irClass.declarations.forEach { + if (it is IrEnumEntry) { + enumEntryOrdinals.put(it.descriptor, ordinal) + ordinal++ + } + } + } + + private fun lowerEnumEntriesClasses() { + irClass.declarations.transformFlat { declaration -> + if (declaration is IrEnumEntry) { + declaration.singletonList() + lowerEnumEntryClass(declaration.correspondingClass).singletonOrEmptyList() + } else null + } + } + + private fun lowerEnumEntryClass(enumEntryClass: IrClass?): IrClass? { + if (enumEntryClass == null) return null + + lowerEnumConstructors(enumEntryClass) + + return enumEntryClass + } + + private fun createDefaultClassForEnumEntries(): IrClass? { + if (!irClass.declarations.any({ it is IrEnumEntry && it.correspondingClass == null })) return null + val descriptor = irClass.descriptor + val defaultClassDescriptor = ClassDescriptorImpl(descriptor, "DEFAULT".synthesizedName, Modality.FINAL, + ClassKind.CLASS, descriptor.defaultType.singletonList(), SourceElement.NO_SOURCE, false) + val defaultClass = IrClassImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, defaultClassDescriptor) + + val constructors = mutableSetOf() + + descriptor.constructors.forEach { + val loweredEnumConstructor = loweredEnumConstructors[it]!! + val (constructorDescriptor, constructor) = createSimpleDelegatingConstructor(defaultClassDescriptor, loweredEnumConstructor) + constructors.add(constructorDescriptor) + defaultClass.declarations.add(constructor) + defaultEnumEntryConstructors.put(loweredEnumConstructor, constructorDescriptor) + } + + val memberScope = SimpleMemberScope(listOf()) + defaultClassDescriptor.initialize(memberScope, constructors, null) + + return defaultClass + } + + private fun createImplObject() { + val descriptor = irClass.descriptor + val implObjectDescriptor = ClassDescriptorImpl(descriptor, "OBJECT".synthesizedName, Modality.FINAL, + ClassKind.OBJECT, KonanPlatform.builtIns.anyType.singletonList(), SourceElement.NO_SOURCE, false) + val implObject = IrClassImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, implObjectDescriptor) + + val enumEntries = mutableListOf() + var i = 0 + while (i < irClass.declarations.size) { + val declaration = irClass.declarations[i] + var delete = false + when (declaration) { + is IrEnumEntry -> { + enumEntries.add(declaration) + delete = true + } + is IrFunction -> { + var copiedDescriptor = tryCopySyntheticBodyDeclaration(implObjectDescriptor, declaration, IrSyntheticBodyKind.ENUM_VALUES) + if(copiedDescriptor != null) + { + valuesFunctionDescriptor = copiedDescriptor + delete = true + } + copiedDescriptor = tryCopySyntheticBodyDeclaration(implObjectDescriptor, declaration, IrSyntheticBodyKind.ENUM_VALUEOF) + if(copiedDescriptor != null) + { + valueOfFunctionDescriptor = copiedDescriptor + delete = true + } + } + } + if (delete) + irClass.declarations.removeAt(i) + else + ++i + } + + val memberScope = SimpleMemberScope(listOf(valuesFunctionDescriptor, valueOfFunctionDescriptor)) + + val constructorOfAny = irClass.descriptor.module.builtIns.any.constructors.first() + val (constructorDescriptor, constructor) = createSimpleDelegatingConstructor(implObjectDescriptor, constructorOfAny) + + implObjectDescriptor.initialize(memberScope, setOf(constructorDescriptor), constructorDescriptor) + + implObject.declarations.add(constructor) + implObject.declarations.add(createSyntheticValuesFieldDeclaration(implObjectDescriptor, enumEntries)) + implObject.declarations.add(createSyntheticValuesMethodDeclaration(implObjectDescriptor)) + implObject.declarations.add(createSyntheticValueOfMethodDeclaration(implObjectDescriptor)) + + irClass.declarations.add(implObject) + } + + private fun tryCopySyntheticBodyDeclaration(implObjectDescriptor: ClassDescriptor, + declaration: IrFunction, + kind: IrSyntheticBodyKind): FunctionDescriptor? { + if (!declaration.body.let { it is IrSyntheticBody && it.kind == kind }) + return null + val newDescriptor = declaration.descriptor + .newCopyBuilder() + .setOwner(implObjectDescriptor) + .setName(declaration.descriptor.name.identifier.synthesizedName) + .setDispatchReceiverParameter(implObjectDescriptor.thisAsReceiverParameter) + .build()!! + loweredFunctions.put(declaration.descriptor, LoweredSyntheticFunction(newDescriptor, implObjectDescriptor)) + return newDescriptor + } + + private fun createSimpleDelegatingConstructor(classDescriptor: ClassDescriptor, + superConstructorDescriptor: ClassConstructorDescriptor) + : Pair { + val constructorDescriptor = ClassConstructorDescriptorImpl.createSynthesized( + classDescriptor, + Annotations.EMPTY, + superConstructorDescriptor.isPrimary, + SourceElement.NO_SOURCE) + val valueParameters = superConstructorDescriptor.valueParameters.map { + it.copy(constructorDescriptor, it.name, it.index) + } + constructorDescriptor.initialize(valueParameters, superConstructorDescriptor.visibility) + constructorDescriptor.returnType = superConstructorDescriptor.returnType + + val body = IrBlockBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, + listOf( + IrDelegatingConstructorCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, superConstructorDescriptor).apply { + valueParameters.forEachIndexed { idx, parameter -> + putValueArgument(idx, IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, parameter)) + } + }, + IrInstanceInitializerCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, classDescriptor) + ) + ) + val constructor = IrConstructorImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, constructorDescriptor, body) + + return Pair(constructorDescriptor, constructor) + } + + private fun createSyntheticValuesFieldDeclaration(implObjectDescriptor: ClassDescriptor, + enumEntries: List): IrFieldImpl { + val valuesArrayType = context.builtIns.getArrayType(Variance.INVARIANT, irClass.descriptor.defaultType) + valuesFieldDescriptor = createSyntheticValuesFieldDescriptor(implObjectDescriptor, valuesArrayType) + + val getter = genericArrayType.unsubstitutedMemberScope.getContributedFunctions(Name.identifier("get"), NoLookupLocation.FROM_BACKEND).single() + + val typeParameterT = genericArrayType.declaredTypeParameters[0] + val enumClassType = irClass.descriptor.defaultType + val typeSubstitutor = TypeSubstitutor.create(mapOf(typeParameterT.typeConstructor to TypeProjectionImpl(enumClassType))) + val substitutedValueOf = getter.substitute(typeSubstitutor)!! + + val entriesMap = enumEntries.associateBy({ it -> it.descriptor.name }, { it -> enumEntryOrdinals[it.descriptor]!! }).toMap() + val loweredEnumEntry = LoweredEnumEntry(implObjectDescriptor, valuesFieldDescriptor, substitutedValueOf, entriesMap) + loweredEnumEntries.put(irClass.descriptor, loweredEnumEntry) + + val irValuesInitializer = createArrayOfExpression(irClass.descriptor.defaultType, enumEntries.map { it.initializerExpression }) + + val irField = IrFieldImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, + valuesFieldDescriptor, + IrExpressionBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, irValuesInitializer)) + return irField + } + + private fun createSyntheticValuesFieldDescriptor(implObjectDescriptor: ClassDescriptor, valuesArrayType: SimpleType): PropertyDescriptorImpl { + val receiver = ReceiverParameterDescriptorImpl(implObjectDescriptor, ImplicitClassReceiver(implObjectDescriptor)) + return PropertyDescriptorImpl.create(implObjectDescriptor, Annotations.EMPTY, Modality.FINAL, Visibilities.PRIVATE, + false, "VALUES".synthesizedName, CallableMemberDescriptor.Kind.SYNTHESIZED, irClass.descriptor.source, + false, false, false, false, false).initialize(valuesArrayType, dispatchReceiverParameter = receiver) + } + + private val kotlinPackage = context.irModule!!.descriptor.getPackage(FqName("kotlin")) + + private val genericArrayOfFun = kotlinPackage.memberScope.getContributedFunctions(Name.identifier("arrayOf"), NoLookupLocation.FROM_BACKEND).first() + + private val genericValueOfFun = context.builtIns.getKonanInternalFunctions("valueOfForEnum").single() + + private val genericValuesFun = context.builtIns.getKonanInternalFunctions("valuesForEnum").single() + + private val genericArrayType = kotlinPackage.memberScope.getContributedClassifier(Name.identifier("Array"), NoLookupLocation.FROM_BACKEND) as ClassDescriptor + + private fun createArrayOfExpression(arrayElementType: KotlinType, arrayElements: List): IrExpression { + val typeParameter0 = genericArrayOfFun.typeParameters[0] + val typeSubstitutor = TypeSubstitutor.create(mapOf(typeParameter0.typeConstructor to TypeProjectionImpl(arrayElementType))) + val substitutedArrayOfFun = genericArrayOfFun.substitute(typeSubstitutor)!! + + val typeArguments = mapOf(typeParameter0 to arrayElementType) + + val valueParameter0 = substitutedArrayOfFun.valueParameters[0] + val arg0VarargType = valueParameter0.type + val arg0VarargElementType = valueParameter0.varargElementType!! + val arg0 = IrVarargImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arg0VarargType, arg0VarargElementType, arrayElements) + + return IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, substitutedArrayOfFun, typeArguments).apply { + putValueArgument(0, arg0) + } + } + + private fun createSyntheticValuesMethodDeclaration(companionObjectDescriptor: ClassDescriptor): IrFunction { + val typeParameterT = genericValuesFun.typeParameters[0] + val enumClassType = irClass.descriptor.defaultType + val typeSubstitutor = TypeSubstitutor.create(mapOf(typeParameterT.typeConstructor to TypeProjectionImpl(enumClassType))) + val substitutedValueOf = genericValuesFun.substitute(typeSubstitutor)!! + + val irValuesCall = IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, substitutedValueOf, mapOf(typeParameterT to enumClassType)) + .apply { + val receiver = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, companionObjectDescriptor.thisAsReceiverParameter) + putValueArgument(0, IrGetFieldImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valuesFieldDescriptor, receiver)) + } + + val body = IrBlockBodyImpl( + UNDEFINED_OFFSET, UNDEFINED_OFFSET, + listOf(IrReturnImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valuesFunctionDescriptor, irValuesCall)) + ) + return IrFunctionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, valuesFunctionDescriptor, body) + } + + private fun createSyntheticValueOfMethodDeclaration(companionObjectDescriptor: ClassDescriptor): IrFunction { + val typeParameterT = genericValueOfFun.typeParameters[0] + val enumClassType = irClass.descriptor.defaultType + val typeSubstitutor = TypeSubstitutor.create(mapOf(typeParameterT.typeConstructor to TypeProjectionImpl(enumClassType))) + val substitutedValueOf = genericValueOfFun.substitute(typeSubstitutor)!! + + val irValueOfCall = IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, substitutedValueOf, mapOf(typeParameterT to enumClassType)) + .apply { + putValueArgument(0, IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueOfFunctionDescriptor.valueParameters[0])) + val receiver = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, companionObjectDescriptor.thisAsReceiverParameter) + putValueArgument(1, IrGetFieldImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valuesFieldDescriptor, receiver)) + } + + val body = IrBlockBodyImpl( + UNDEFINED_OFFSET, UNDEFINED_OFFSET, + listOf(IrReturnImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueOfFunctionDescriptor, irValueOfCall)) + ) + return IrFunctionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, valueOfFunctionDescriptor, body) + } + + private fun lowerEnumConstructors(irClass: IrClass) { + irClass.declarations.transform { declaration -> + if (declaration is IrConstructor) + transformEnumConstructor(declaration) + else + declaration + } + } + + private fun transformEnumConstructor(enumConstructor: IrConstructor): IrConstructor { + val constructorDescriptor = enumConstructor.descriptor + val loweredConstructorDescriptor = lowerEnumConstructor(constructorDescriptor) + val loweredEnumConstructor = IrConstructorImpl( + enumConstructor.startOffset, enumConstructor.endOffset, enumConstructor.origin, + loweredConstructorDescriptor, + enumConstructor.body!! // will be transformed later + ) + return loweredEnumConstructor + } + + private fun lowerEnumConstructor(constructorDescriptor: ClassConstructorDescriptor): ClassConstructorDescriptor { + val loweredConstructorDescriptor = ClassConstructorDescriptorImpl.createSynthesized( + constructorDescriptor.containingDeclaration, + constructorDescriptor.annotations, + constructorDescriptor.isPrimary, + constructorDescriptor.source + ) + + val valueParameters = + listOf( + loweredConstructorDescriptor.createValueParameter(0, "name", context.builtIns.stringType), + loweredConstructorDescriptor.createValueParameter(1, "ordinal", context.builtIns.intType) + ) + + constructorDescriptor.valueParameters.map { + lowerConstructorValueParameter(loweredConstructorDescriptor, it) + } + loweredConstructorDescriptor.initialize(valueParameters, Visibilities.PROTECTED) + + loweredConstructorDescriptor.returnType = constructorDescriptor.returnType + + loweredEnumConstructors[constructorDescriptor] = loweredConstructorDescriptor + + return loweredConstructorDescriptor + } + + private fun lowerConstructorValueParameter( + loweredConstructorDescriptor: ClassConstructorDescriptor, + valueParameterDescriptor: ValueParameterDescriptor + ): ValueParameterDescriptor { + val loweredValueParameterDescriptor = valueParameterDescriptor.copy( + loweredConstructorDescriptor, + valueParameterDescriptor.name, + valueParameterDescriptor.index + 2 + ) + loweredEnumConstructorParameters[valueParameterDescriptor] = loweredValueParameterDescriptor + return loweredValueParameterDescriptor + } + + private fun lowerEnumClassBody() { + irClass.transformChildrenVoid(EnumClassBodyTransformer()) + } + + private inner class InEnumClassConstructor(val enumClassConstructor: ClassConstructorDescriptor) : + EnumConstructorCallTransformer { + override fun transform(enumConstructorCall: IrEnumConstructorCall): IrExpression { + val startOffset = enumConstructorCall.startOffset + val endOffset = enumConstructorCall.endOffset + val origin = enumConstructorCall.origin + + val result = IrDelegatingConstructorCallImpl(startOffset, endOffset, enumConstructorCall.descriptor) + + assert(result.descriptor.valueParameters.size == 2) { + "Enum(String, Int) constructor call expected:\n${result.dump()}" + } + + val nameParameter = enumClassConstructor.valueParameters.getOrElse(0) { + throw AssertionError("No 'name' parameter in enum constructor: $enumClassConstructor") + } + + val ordinalParameter = enumClassConstructor.valueParameters.getOrElse(1) { + throw AssertionError("No 'ordinal' parameter in enum constructor: $enumClassConstructor") + } + + result.putValueArgument(0, IrGetValueImpl(startOffset, endOffset, nameParameter, origin)) + result.putValueArgument(1, IrGetValueImpl(startOffset, endOffset, ordinalParameter, origin)) + + return result + } + + override fun transform(delegatingConstructorCall: IrDelegatingConstructorCall): IrExpression { + val descriptor = delegatingConstructorCall.descriptor + val startOffset = delegatingConstructorCall.startOffset + val endOffset = delegatingConstructorCall.endOffset + + val loweredDelegatedConstructor = loweredEnumConstructors.getOrElse(descriptor) { + throw AssertionError("Constructor called in enum entry initializer should've been lowered: $descriptor") + } + + val result = IrDelegatingConstructorCallImpl(startOffset, endOffset, loweredDelegatedConstructor) + + result.putValueArgument(0, IrGetValueImpl(startOffset, endOffset, enumClassConstructor.valueParameters[0])) + result.putValueArgument(1, IrGetValueImpl(startOffset, endOffset, enumClassConstructor.valueParameters[1])) + + descriptor.valueParameters.forEach { valueParameter -> + val i = valueParameter.index + result.putValueArgument(i + 2, delegatingConstructorCall.getValueArgument(i)) + } + + return result + } + } + + private abstract inner class InEnumEntry(private val enumEntry: ClassDescriptor) : EnumConstructorCallTransformer { + override fun transform(enumConstructorCall: IrEnumConstructorCall): IrExpression { + val name = enumEntry.name.asString() + val ordinal = enumEntryOrdinals[enumEntry]!! + + val descriptor = enumConstructorCall.descriptor + val startOffset = enumConstructorCall.startOffset + val endOffset = enumConstructorCall.endOffset + + val loweredConstructor = loweredEnumConstructors.getOrElse(descriptor) { + throw AssertionError("Constructor called in enum entry initializer should've been lowered: $descriptor") + } + + val result = createConstructorCall(startOffset, endOffset, loweredConstructor) + + result.putValueArgument(0, IrConstImpl.string(startOffset, endOffset, context.builtIns.stringType, name)) + result.putValueArgument(1, IrConstImpl.int(startOffset, endOffset, context.builtIns.intType, ordinal)) + + descriptor.valueParameters.forEach { valueParameter -> + val i = valueParameter.index + result.putValueArgument(i + 2, enumConstructorCall.getValueArgument(i)) + } + + return result + } + + override fun transform(delegatingConstructorCall: IrDelegatingConstructorCall): IrExpression { + throw AssertionError("Unexpected delegating constructor call within enum entry: $enumEntry") + } + + abstract fun createConstructorCall(startOffset: Int, endOffset: Int, loweredConstructor: ClassConstructorDescriptor): IrMemberAccessExpression + } + + private inner class InEnumEntryClassConstructor(enumEntry: ClassDescriptor) : InEnumEntry(enumEntry) { + override fun createConstructorCall(startOffset: Int, endOffset: Int, loweredConstructor: ClassConstructorDescriptor) + = IrDelegatingConstructorCallImpl(startOffset, endOffset, loweredConstructor) + } + + private inner class InEnumEntryInitializer(enumEntry: ClassDescriptor) : InEnumEntry(enumEntry) { + override fun createConstructorCall(startOffset: Int, endOffset: Int, loweredConstructor: ClassConstructorDescriptor) + = IrCallImpl(startOffset, endOffset, defaultEnumEntryConstructors[loweredConstructor] ?: loweredConstructor) + } + + private inner class EnumClassBodyTransformer : IrElementTransformerVoid() { + private var enumConstructorCallTransformer: EnumConstructorCallTransformer? = null + + override fun visitEnumEntry(declaration: IrEnumEntry): IrStatement { + assert(enumConstructorCallTransformer == null) { "Nested enum entry initialization:\n${declaration.dump()}" } + + enumConstructorCallTransformer = InEnumEntryInitializer(declaration.descriptor) + + var result: IrEnumEntry = IrEnumEntryImpl(declaration.startOffset, declaration.endOffset, declaration.origin, + declaration.descriptor, null, declaration.initializerExpression) + result = super.visitEnumEntry(result) as IrEnumEntry + + enumConstructorCallTransformer = null + + return result + } + + override fun visitConstructor(declaration: IrConstructor): IrStatement { + val constructorDescriptor = declaration.descriptor + val containingClass = constructorDescriptor.containingDeclaration + + // TODO local (non-enum) class in enum class constructor? + val previous = enumConstructorCallTransformer + + if (containingClass.kind == ClassKind.ENUM_ENTRY) { + assert(enumConstructorCallTransformer == null) { "Nested enum entry initialization:\n${declaration.dump()}" } + enumConstructorCallTransformer = InEnumEntryClassConstructor(containingClass) + } else if (containingClass.kind == ClassKind.ENUM_CLASS) { + assert(enumConstructorCallTransformer == null) { "Nested enum entry initialization:\n${declaration.dump()}" } + enumConstructorCallTransformer = InEnumClassConstructor(constructorDescriptor) + } + + val result = super.visitConstructor(declaration) + + enumConstructorCallTransformer = previous + + return result + } + + override fun visitEnumConstructorCall(expression: IrEnumConstructorCall): IrExpression { + expression.transformChildrenVoid(this) + + val callTransformer = enumConstructorCallTransformer ?: + throw AssertionError("Enum constructor call outside of enum entry initialization or enum class constructor:\n" + irClass.dump()) + + + return callTransformer.transform(expression) + } + + override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall): IrExpression { + expression.transformChildrenVoid(this) + + if (expression.descriptor.containingDeclaration.kind == ClassKind.ENUM_CLASS) { + val callTransformer = enumConstructorCallTransformer ?: + throw AssertionError("Enum constructor call outside of enum entry initialization or enum class constructor:\n" + irClass.dump()) + + return callTransformer.transform(expression) + } + return expression + } + + override fun visitGetValue(expression: IrGetValue): IrExpression { + val loweredParameter = loweredEnumConstructorParameters[expression.descriptor] + if (loweredParameter != null) + return IrGetValueImpl(expression.startOffset, expression.endOffset, loweredParameter, expression.origin) + else + return expression + } + } + } +} \ No newline at end of file diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 80604dab017..493d14e8893 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -296,6 +296,41 @@ task empty_substring(type: RunKonanTest) { source = "runtime/basic/empty_substring.kt" } +task enum0(type: RunKonanTest) { + goldValue = "VALUE\n" + source = "codegen/enum/test0.kt" +} + +task enum1(type: RunKonanTest) { + goldValue = "z12\n" + source = "codegen/enum/test1.kt" +} + +task enum_valueOf(type: RunKonanTest) { + goldValue = "E1\n" + source = "codegen/enum/valueOf.kt" +} + +task enum_values(type: RunKonanTest) { + goldValue = "E2\n" + source = "codegen/enum/values.kt" +} + +task enum_vCallNoEntryClass(type: RunKonanTest) { + goldValue = "('z3', 3)\n" + source = "codegen/enum/vCallNoEntryClass.kt" +} + +task enum_vCallWithEntryClass(type: RunKonanTest) { + goldValue = "z1z2\n" + source = "codegen/enum/vCallWithEntryClass.kt" +} + +task enum_companionObject(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/enum/companionObject.kt" +} + task array0(type: RunKonanTest) { goldValue = "5\n6\n7\n8\n9\n10\n11\n12\n13\n" source = "runtime/collections/array0.kt" diff --git a/backend.native/tests/codegen/enum/companionObject.kt b/backend.native/tests/codegen/enum/companionObject.kt new file mode 100644 index 00000000000..3aef194b852 --- /dev/null +++ b/backend.native/tests/codegen/enum/companionObject.kt @@ -0,0 +1,24 @@ +enum class Game { + ROCK, + PAPER, + SCISSORS; + + companion object { + fun foo() = ROCK + val bar = PAPER + val values2 = values() + val scissors = valueOf("SCISSORS") + } +} + +fun box(): String { + if (Game.foo() != Game.ROCK) return "Fail 1" + if (Game.bar != Game.PAPER) return "Fail 2: ${Game.bar}" + if (Game.values().size != 3) return "Fail 3" + if (Game.valueOf("SCISSORS") != Game.SCISSORS) return "Fail 4" + if (Game.values2.size != 3) return "Fail 5" + if (Game.scissors != Game.SCISSORS) return "Fail 6" + return "OK" +} + +fun main(args: Array) = println(box()) \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/test0.kt b/backend.native/tests/codegen/enum/test0.kt new file mode 100644 index 00000000000..ff525debbc8 --- /dev/null +++ b/backend.native/tests/codegen/enum/test0.kt @@ -0,0 +1,9 @@ +val TOP_LEVEL = 5 + +enum class MyEnum(value: Int) { + VALUE(TOP_LEVEL) +} + +fun main(args: Array) { + println(MyEnum.VALUE.toString()) +} diff --git a/backend.native/tests/codegen/enum/test1.kt b/backend.native/tests/codegen/enum/test1.kt new file mode 100644 index 00000000000..b9638bbb3bc --- /dev/null +++ b/backend.native/tests/codegen/enum/test1.kt @@ -0,0 +1,8 @@ +enum class Zzz(val zzz: String, val x: Int) { + Z1("z1", 1), + Z2("z2", 2) +} + +fun main(args: Array) { + println(Zzz.Z1.zzz + Zzz.Z2.x) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/vCallNoEntryClass.kt b/backend.native/tests/codegen/enum/vCallNoEntryClass.kt new file mode 100644 index 00000000000..ebfc475e302 --- /dev/null +++ b/backend.native/tests/codegen/enum/vCallNoEntryClass.kt @@ -0,0 +1,13 @@ +enum class Zzz(val zzz: String, val x: Int) { + Z1("z1", 1), + Z2("z2", 2), + Z3("z3", 3); + + override fun toString(): String{ + return "('$zzz', $x)" + } +} + +fun main(args: Array) { + println(Zzz.Z3.toString()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/vCallWithEntryClass.kt b/backend.native/tests/codegen/enum/vCallWithEntryClass.kt new file mode 100644 index 00000000000..c3b509f2258 --- /dev/null +++ b/backend.native/tests/codegen/enum/vCallWithEntryClass.kt @@ -0,0 +1,15 @@ +enum class Zzz { + Z1 { + override fun f() = "z1" + }, + + Z2 { + override fun f() = "z2" + }; + + open fun f() = "" +} + +fun main(args: Array) { + println(Zzz.Z1.f() + Zzz.Z2.f()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/valueOf.kt b/backend.native/tests/codegen/enum/valueOf.kt new file mode 100644 index 00000000000..9883e06369d --- /dev/null +++ b/backend.native/tests/codegen/enum/valueOf.kt @@ -0,0 +1,8 @@ +enum class E { + E1, + E2 +} + +fun main(args: Array) { + println(E.valueOf("E1").toString()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/enum/values.kt b/backend.native/tests/codegen/enum/values.kt new file mode 100644 index 00000000000..aebaa636140 --- /dev/null +++ b/backend.native/tests/codegen/enum/values.kt @@ -0,0 +1,8 @@ +enum class E { + E1, + E2 +} + +fun main(args: Array) { + println(E.values()[1].toString()) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt b/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt index df1c476bfb0..412cf9a2801 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/emptyConstructor.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS package test diff --git a/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt b/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt index c16ffd7ae3c..8642ed92784 100644 --- a/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt +++ b/backend.native/tests/external/codegen/blackbox/enum/kt9711_2.kt @@ -1,5 +1,5 @@ // TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS enum class IssueState { diff --git a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt index c7587ced3f0..dc2fa175581 100644 --- a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt +++ b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt @@ -25,4 +25,17 @@ internal fun ThrowNoWhenBranchMatchedException(): Nothing { } @ExportForCppRuntime -internal fun TheEmptyString() = "" \ No newline at end of file +internal fun TheEmptyString() = "" + +internal fun > valueOfForEnum(name: String, arr: Array) : T +{ + for (x in arr) + if (x.name == name) + return x + throw Exception("Invalid enum name: $name") +} + +internal fun > valuesForEnum(values: Array): Array +{ + return values.clone() as Array +} \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/Enum.kt b/runtime/src/main/kotlin/kotlin/Enum.kt index 8c9d22bf3cd..f88065d160a 100644 --- a/runtime/src/main/kotlin/kotlin/Enum.kt +++ b/runtime/src/main/kotlin/kotlin/Enum.kt @@ -5,30 +5,27 @@ package kotlin * See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/enum-classes.html) for more * information on enum classes. */ -/* -public abstract class Enum>(name: String, ordinal: Int): Comparable { - companion object {} +public abstract class Enum>(public val name: String, public val ordinal: Int): Comparable { - /** - * Returns the name of this enum constant, exactly as declared in its enum declaration. - */ - public final val name: String - - /** - * Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant - * is assigned an ordinal of zero). - */ - public final val ordinal: Int - - public override final fun compareTo(other: E): Int + public override final fun compareTo(other: E): Int { return ordinal - other.ordinal } /** * Throws an exception since enum constants cannot be cloned. * This method prevents enum classes from inheriting from [Cloneable]. */ - protected final fun clone(): Any + protected final fun clone(): Any { + throw UnsupportedOperationException() + } - public override final fun equals(other: Any?): Boolean - public override final fun hashCode(): Int - public override fun toString(): String -} */ + public override final fun equals(other: Any?): Boolean { + return other is Enum<*> && ordinal == other.ordinal + } + + public override final fun hashCode(): Int { + return ordinal + } + + public override fun toString(): String { + return name + } +} From 86e01d3636907160c3adb8b4893cc58405976c6f Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 14:00:12 +0300 Subject: [PATCH 49/86] BuildSrc: logFileName uses task name --- buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 930c92b75ca..6ac6cc765f9 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -123,7 +123,7 @@ class LinkKonanTest extends KonanTest { class RunExternalTestGroup extends RunKonanTest { def groupDirectory = "." - def logFileName = "test-result.md" + def logFileName = "${name}.md" String filter = project.findProperty("filter") String goldValue = "OK" From 822816da3f52e03f86a8ca2ffc9a377383a5e244 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 14:01:29 +0300 Subject: [PATCH 50/86] tests: external gradle script generation emproved --- backend.native/tests/build.gradle | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 493d14e8893..fcc7c481313 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -23,6 +23,10 @@ task regenerate_external_tests() { gradleGenerated.write("import org.jetbrains.kotlin.*\n") gradleGenerated.append( """ +############################################################################### +# WARNING: This file auto generated with command +# ./gradlew :backend.native:tests:regenerate_external_tests +############################################################################### configurations { cli_bc } @@ -30,15 +34,6 @@ configurations { dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } -""" - ) - gradleGenerated.append( -""" -task createLogFile() { - doLast { - project.file("$logFileName").write("") - } -} """ ) externalTestsDir.eachDirRecurse { @@ -52,11 +47,16 @@ task createLogFile() { gradleGenerated.append( "task $taskName (type: RunExternalTestGroup) {\n" + - " dependsOn(createLogFile)\n" + " groupDirectory = \"$taskDirectory\"\n" + - " logFileName = \"$logFileName\"\n" + "}\n\n") } + gradleGenerated.append( +""" +daily { + dependsOn(codegen_blackbox_annotations) +} +""" + ) } } From b9b44ebeb44e100a3b573600df4514b3ef618c6a Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 14:04:10 +0300 Subject: [PATCH 51/86] test: fixed task daily declaration --- backend.native/tests/build.gradle | 2 +- backend.native/tests/external/build.gradle | 410 +-------------------- 2 files changed, 5 insertions(+), 407 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index fcc7c481313..6fc66ba36ae 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -52,7 +52,7 @@ dependencies { } gradleGenerated.append( """ -daily { +task daily { dependsOn(codegen_blackbox_annotations) } """ diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle index 38639043b64..832464567f8 100644 --- a/backend.native/tests/external/build.gradle +++ b/backend.native/tests/external/build.gradle @@ -7,1209 +7,807 @@ configurations { dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } - -task createLogFile() { - doLast { - project.file("test-result.md").write("") - } -} task codegen_blackbox_annotations (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/annotations" - logFileName = "test-result.md" } task codegen_blackbox_annotations_annotatedLambda (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/annotations/annotatedLambda" - logFileName = "test-result.md" } task codegen_blackbox_argumentOrder (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/argumentOrder" - logFileName = "test-result.md" } task codegen_blackbox_arrays (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/arrays" - logFileName = "test-result.md" } task codegen_blackbox_arrays_multiDecl (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/arrays/multiDecl" - logFileName = "test-result.md" } task codegen_blackbox_arrays_multiDecl_int (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/arrays/multiDecl/int" - logFileName = "test-result.md" } task codegen_blackbox_arrays_multiDecl_long (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/arrays/multiDecl/long" - logFileName = "test-result.md" } task codegen_blackbox_binaryOp (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/binaryOp" - logFileName = "test-result.md" } task codegen_blackbox_boxingOptimization (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/boxingOptimization" - logFileName = "test-result.md" } task codegen_blackbox_bridges (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/bridges" - logFileName = "test-result.md" } task codegen_blackbox_bridges_substitutionInSuperClass (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/bridges/substitutionInSuperClass" - logFileName = "test-result.md" } task codegen_blackbox_builtinStubMethods (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/builtinStubMethods" - logFileName = "test-result.md" } task codegen_blackbox_builtinStubMethods_extendJavaCollections (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/builtinStubMethods/extendJavaCollections" - logFileName = "test-result.md" } task codegen_blackbox_callableReference_bound (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/callableReference/bound" - logFileName = "test-result.md" } task codegen_blackbox_callableReference_bound_equals (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/callableReference/bound/equals" - logFileName = "test-result.md" } task codegen_blackbox_callableReference_bound_inline (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/callableReference/bound/inline" - logFileName = "test-result.md" } task codegen_blackbox_callableReference_function (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/callableReference/function" - logFileName = "test-result.md" } task codegen_blackbox_callableReference_function_local (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/callableReference/function/local" - logFileName = "test-result.md" } task codegen_blackbox_callableReference_property (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/callableReference/property" - logFileName = "test-result.md" } task codegen_blackbox_casts (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/casts" - logFileName = "test-result.md" } task codegen_blackbox_casts_functions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/casts/functions" - logFileName = "test-result.md" } task codegen_blackbox_casts_literalExpressionAsGenericArgument (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/casts/literalExpressionAsGenericArgument" - logFileName = "test-result.md" } task codegen_blackbox_casts_mutableCollections (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/casts/mutableCollections" - logFileName = "test-result.md" } task codegen_blackbox_classes (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/classes" - logFileName = "test-result.md" } task codegen_blackbox_classes_inner (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/classes/inner" - logFileName = "test-result.md" } task codegen_blackbox_classLiteral (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/classLiteral" - logFileName = "test-result.md" } task codegen_blackbox_classLiteral_bound (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/classLiteral/bound" - logFileName = "test-result.md" } task codegen_blackbox_classLiteral_java (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/classLiteral/java" - logFileName = "test-result.md" } task codegen_blackbox_closures (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/closures" - logFileName = "test-result.md" } task codegen_blackbox_closures_captureOuterProperty (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/closures/captureOuterProperty" - logFileName = "test-result.md" } task codegen_blackbox_closures_closureInsideClosure (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/closures/closureInsideClosure" - logFileName = "test-result.md" } task codegen_blackbox_collections (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/collections" - logFileName = "test-result.md" } task codegen_blackbox_compatibility (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/compatibility" - logFileName = "test-result.md" } task codegen_blackbox_constants (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/constants" - logFileName = "test-result.md" } task codegen_blackbox_controlStructures (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/controlStructures" - logFileName = "test-result.md" } task codegen_blackbox_controlStructures_breakContinueInExpressions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/controlStructures/breakContinueInExpressions" - logFileName = "test-result.md" } task codegen_blackbox_controlStructures_returnsNothing (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/controlStructures/returnsNothing" - logFileName = "test-result.md" } task codegen_blackbox_controlStructures_tryCatchInExpressions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/controlStructures/tryCatchInExpressions" - logFileName = "test-result.md" } task codegen_blackbox_coroutines (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines" - logFileName = "test-result.md" } task codegen_blackbox_coroutines_controlFlow (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines/controlFlow" - logFileName = "test-result.md" } task codegen_blackbox_coroutines_intLikeVarSpilling (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines/intLikeVarSpilling" - logFileName = "test-result.md" } task codegen_blackbox_coroutines_multiModule (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines/multiModule" - logFileName = "test-result.md" } task codegen_blackbox_coroutines_stackUnwinding (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines/stackUnwinding" - logFileName = "test-result.md" } task codegen_blackbox_coroutines_suspendFunctionTypeCall (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines/suspendFunctionTypeCall" - logFileName = "test-result.md" } task codegen_blackbox_coroutines_unitTypeReturn (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/coroutines/unitTypeReturn" - logFileName = "test-result.md" } task codegen_blackbox_dataClasses (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/dataClasses" - logFileName = "test-result.md" } task codegen_blackbox_dataClasses_copy (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/dataClasses/copy" - logFileName = "test-result.md" } task codegen_blackbox_dataClasses_equals (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/dataClasses/equals" - logFileName = "test-result.md" } task codegen_blackbox_dataClasses_hashCode (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/dataClasses/hashCode" - logFileName = "test-result.md" } task codegen_blackbox_dataClasses_toString (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/dataClasses/toString" - logFileName = "test-result.md" } task codegen_blackbox_deadCodeElimination (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/deadCodeElimination" - logFileName = "test-result.md" } task codegen_blackbox_defaultArguments (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/defaultArguments" - logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_constructor (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/defaultArguments/constructor" - logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_convention (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/defaultArguments/convention" - logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_function (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/defaultArguments/function" - logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_private (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/defaultArguments/private" - logFileName = "test-result.md" } task codegen_blackbox_defaultArguments_signature (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/defaultArguments/signature" - logFileName = "test-result.md" } task codegen_blackbox_delegatedProperty (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/delegatedProperty" - logFileName = "test-result.md" } task codegen_blackbox_delegatedProperty_local (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/delegatedProperty/local" - logFileName = "test-result.md" } task codegen_blackbox_delegatedProperty_provideDelegate (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/delegatedProperty/provideDelegate" - logFileName = "test-result.md" } task codegen_blackbox_delegation (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/delegation" - logFileName = "test-result.md" } task codegen_blackbox_destructuringDeclInLambdaParam (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/destructuringDeclInLambdaParam" - logFileName = "test-result.md" } task codegen_blackbox_diagnostics_functions_inference (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/diagnostics/functions/inference" - logFileName = "test-result.md" } task codegen_blackbox_diagnostics_functions_invoke_onObjects (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/diagnostics/functions/invoke/onObjects" - logFileName = "test-result.md" } task codegen_blackbox_diagnostics_functions_tailRecursion (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/diagnostics/functions/tailRecursion" - logFileName = "test-result.md" } task codegen_blackbox_diagnostics_vararg (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/diagnostics/vararg" - logFileName = "test-result.md" } task codegen_blackbox_elvis (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/elvis" - logFileName = "test-result.md" } task codegen_blackbox_enum (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/enum" - logFileName = "test-result.md" } task codegen_blackbox_evaluate (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/evaluate" - logFileName = "test-result.md" } task codegen_blackbox_exclExcl (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/exclExcl" - logFileName = "test-result.md" } task codegen_blackbox_extensionFunctions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/extensionFunctions" - logFileName = "test-result.md" } task codegen_blackbox_extensionProperties (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/extensionProperties" - logFileName = "test-result.md" } task codegen_blackbox_external (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/external" - logFileName = "test-result.md" } task codegen_blackbox_fakeOverride (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/fakeOverride" - logFileName = "test-result.md" } task codegen_blackbox_fieldRename (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/fieldRename" - logFileName = "test-result.md" } task codegen_blackbox_finally (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/finally" - logFileName = "test-result.md" } task codegen_blackbox_fullJdk (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/fullJdk" - logFileName = "test-result.md" } task codegen_blackbox_fullJdk_native (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/fullJdk/native" - logFileName = "test-result.md" } task codegen_blackbox_fullJdk_regressions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/fullJdk/regressions" - logFileName = "test-result.md" } task codegen_blackbox_functions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/functions" - logFileName = "test-result.md" } task codegen_blackbox_functions_functionExpression (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/functions/functionExpression" - logFileName = "test-result.md" } task codegen_blackbox_functions_invoke (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/functions/invoke" - logFileName = "test-result.md" } task codegen_blackbox_functions_localFunctions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/functions/localFunctions" - logFileName = "test-result.md" } task codegen_blackbox_hashPMap (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/hashPMap" - logFileName = "test-result.md" } task codegen_blackbox_ieee754 (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ieee754" - logFileName = "test-result.md" } task codegen_blackbox_increment (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/increment" - logFileName = "test-result.md" } task codegen_blackbox_innerNested (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/innerNested" - logFileName = "test-result.md" } task codegen_blackbox_innerNested_superConstructorCall (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/innerNested/superConstructorCall" - logFileName = "test-result.md" } task codegen_blackbox_instructions_swap (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/instructions/swap" - logFileName = "test-result.md" } task codegen_blackbox_intrinsics (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/intrinsics" - logFileName = "test-result.md" } task codegen_blackbox_javaInterop (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/javaInterop" - logFileName = "test-result.md" } task codegen_blackbox_javaInterop_generics (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/javaInterop/generics" - logFileName = "test-result.md" } task codegen_blackbox_javaInterop_notNullAssertions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/javaInterop/notNullAssertions" - logFileName = "test-result.md" } task codegen_blackbox_javaInterop_objectMethods (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/javaInterop/objectMethods" - logFileName = "test-result.md" } task codegen_blackbox_jdk (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/jdk" - logFileName = "test-result.md" } task codegen_blackbox_jvmField (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/jvmField" - logFileName = "test-result.md" } task codegen_blackbox_jvmName (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/jvmName" - logFileName = "test-result.md" } task codegen_blackbox_jvmName_fileFacades (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/jvmName/fileFacades" - logFileName = "test-result.md" } task codegen_blackbox_jvmOverloads (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/jvmOverloads" - logFileName = "test-result.md" } task codegen_blackbox_jvmStatic (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/jvmStatic" - logFileName = "test-result.md" } task codegen_blackbox_labels (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/labels" - logFileName = "test-result.md" } task codegen_blackbox_lazyCodegen (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/lazyCodegen" - logFileName = "test-result.md" } task codegen_blackbox_lazyCodegen_optimizations (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/lazyCodegen/optimizations" - logFileName = "test-result.md" } task codegen_blackbox_localClasses (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/localClasses" - logFileName = "test-result.md" } task codegen_blackbox_mangling (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/mangling" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forIterator (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forIterator" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forIterator_longIterator (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forIterator/longIterator" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeTo (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_int (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/int" - logFileName = "test-result.md" } task codegen_blackbox_multiDecl_forRange_long (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multiDecl/forRange/long" - logFileName = "test-result.md" } task codegen_blackbox_multifileClasses (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multifileClasses" - logFileName = "test-result.md" } task codegen_blackbox_multifileClasses_optimized (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/multifileClasses/optimized" - logFileName = "test-result.md" } task codegen_blackbox_nonLocalReturns (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/nonLocalReturns" - logFileName = "test-result.md" } task codegen_blackbox_objectIntrinsics (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/objectIntrinsics" - logFileName = "test-result.md" } task codegen_blackbox_objects (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/objects" - logFileName = "test-result.md" } task codegen_blackbox_operatorConventions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/operatorConventions" - logFileName = "test-result.md" } task codegen_blackbox_operatorConventions_compareTo (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/operatorConventions/compareTo" - logFileName = "test-result.md" } task codegen_blackbox_package (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/package" - logFileName = "test-result.md" } task codegen_blackbox_platformTypes_primitives (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/platformTypes/primitives" - logFileName = "test-result.md" } task codegen_blackbox_primitiveTypes (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/primitiveTypes" - logFileName = "test-result.md" } task codegen_blackbox_private (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/private" - logFileName = "test-result.md" } task codegen_blackbox_privateConstructors (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/privateConstructors" - logFileName = "test-result.md" } task codegen_blackbox_properties (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/properties" - logFileName = "test-result.md" } task codegen_blackbox_properties_const (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/properties/const" - logFileName = "test-result.md" } task codegen_blackbox_properties_lateinit (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/properties/lateinit" - logFileName = "test-result.md" } task codegen_blackbox_publishedApi (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/publishedApi" - logFileName = "test-result.md" } task codegen_blackbox_ranges (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges" - logFileName = "test-result.md" } task codegen_blackbox_ranges_contains (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges/contains" - logFileName = "test-result.md" } task codegen_blackbox_ranges_expression (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges/expression" - logFileName = "test-result.md" } task codegen_blackbox_ranges_forInDownTo (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges/forInDownTo" - logFileName = "test-result.md" } task codegen_blackbox_ranges_forInIndices (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges/forInIndices" - logFileName = "test-result.md" } task codegen_blackbox_ranges_literal (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges/literal" - logFileName = "test-result.md" } task codegen_blackbox_ranges_nullableLoopParameter (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/ranges/nullableLoopParameter" - logFileName = "test-result.md" } task codegen_blackbox_reflection_annotations (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/annotations" - logFileName = "test-result.md" } task codegen_blackbox_reflection_call (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/call" - logFileName = "test-result.md" } task codegen_blackbox_reflection_call_bound (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/call/bound" - logFileName = "test-result.md" } task codegen_blackbox_reflection_callBy (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/callBy" - logFileName = "test-result.md" } task codegen_blackbox_reflection_classes (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/classes" - logFileName = "test-result.md" } task codegen_blackbox_reflection_classLiterals (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/classLiterals" - logFileName = "test-result.md" } task codegen_blackbox_reflection_constructors (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/constructors" - logFileName = "test-result.md" } task codegen_blackbox_reflection_createAnnotation (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/createAnnotation" - logFileName = "test-result.md" } task codegen_blackbox_reflection_enclosing (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/enclosing" - logFileName = "test-result.md" } task codegen_blackbox_reflection_functions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/functions" - logFileName = "test-result.md" } task codegen_blackbox_reflection_genericSignature (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/genericSignature" - logFileName = "test-result.md" } task codegen_blackbox_reflection_isInstance (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/isInstance" - logFileName = "test-result.md" } task codegen_blackbox_reflection_kClassInAnnotation (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/kClassInAnnotation" - logFileName = "test-result.md" } task codegen_blackbox_reflection_lambdaClasses (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/lambdaClasses" - logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/mapping" - logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping_fakeOverrides (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/mapping/fakeOverrides" - logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping_jvmStatic (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/mapping/jvmStatic" - logFileName = "test-result.md" } task codegen_blackbox_reflection_mapping_types (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/mapping/types" - logFileName = "test-result.md" } task codegen_blackbox_reflection_methodsFromAny (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/methodsFromAny" - logFileName = "test-result.md" } task codegen_blackbox_reflection_modifiers (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/modifiers" - logFileName = "test-result.md" } task codegen_blackbox_reflection_multifileClasses (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/multifileClasses" - logFileName = "test-result.md" } task codegen_blackbox_reflection_noReflectAtRuntime (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime" - logFileName = "test-result.md" } task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny" - logFileName = "test-result.md" } task codegen_blackbox_reflection_parameters (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/parameters" - logFileName = "test-result.md" } task codegen_blackbox_reflection_properties (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/properties" - logFileName = "test-result.md" } task codegen_blackbox_reflection_properties_accessors (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/properties/accessors" - logFileName = "test-result.md" } task codegen_blackbox_reflection_specialBuiltIns (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/specialBuiltIns" - logFileName = "test-result.md" } task codegen_blackbox_reflection_supertypes (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/supertypes" - logFileName = "test-result.md" } task codegen_blackbox_reflection_typeParameters (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/typeParameters" - logFileName = "test-result.md" } task codegen_blackbox_reflection_types (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/types" - logFileName = "test-result.md" } task codegen_blackbox_reflection_types_createType (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/types/createType" - logFileName = "test-result.md" } task codegen_blackbox_reflection_types_subtyping (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reflection/types/subtyping" - logFileName = "test-result.md" } task codegen_blackbox_regressions (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/regressions" - logFileName = "test-result.md" } task codegen_blackbox_reified (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reified" - logFileName = "test-result.md" } task codegen_blackbox_reified_arraysReification (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/reified/arraysReification" - logFileName = "test-result.md" } task codegen_blackbox_safeCall (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/safeCall" - logFileName = "test-result.md" } task codegen_blackbox_sam_constructors (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/sam/constructors" - logFileName = "test-result.md" } task codegen_blackbox_sealed (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/sealed" - logFileName = "test-result.md" } task codegen_blackbox_secondaryConstructors (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/secondaryConstructors" - logFileName = "test-result.md" } task codegen_blackbox_smap (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/smap" - logFileName = "test-result.md" } task codegen_blackbox_smartCasts (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/smartCasts" - logFileName = "test-result.md" } task codegen_blackbox_specialBuiltins (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/specialBuiltins" - logFileName = "test-result.md" } task codegen_blackbox_statics (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/statics" - logFileName = "test-result.md" } task codegen_blackbox_storeStackBeforeInline (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/storeStackBeforeInline" - logFileName = "test-result.md" } task codegen_blackbox_strings (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/strings" - logFileName = "test-result.md" } task codegen_blackbox_super (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/super" - logFileName = "test-result.md" } task codegen_blackbox_synchronized (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/synchronized" - logFileName = "test-result.md" } task codegen_blackbox_syntheticAccessors (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/syntheticAccessors" - logFileName = "test-result.md" } task codegen_blackbox_toArray (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/toArray" - logFileName = "test-result.md" } task codegen_blackbox_topLevelPrivate (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/topLevelPrivate" - logFileName = "test-result.md" } task codegen_blackbox_traits (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/traits" - logFileName = "test-result.md" } task codegen_blackbox_typealias (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/typealias" - logFileName = "test-result.md" } task codegen_blackbox_typeInfo (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/typeInfo" - logFileName = "test-result.md" } task codegen_blackbox_typeMapping (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/typeMapping" - logFileName = "test-result.md" } task codegen_blackbox_unaryOp (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/unaryOp" - logFileName = "test-result.md" } task codegen_blackbox_unit (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/unit" - logFileName = "test-result.md" } task codegen_blackbox_vararg (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/vararg" - logFileName = "test-result.md" } task codegen_blackbox_when (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/when" - logFileName = "test-result.md" } task codegen_blackbox_when_enumOptimization (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/when/enumOptimization" - logFileName = "test-result.md" } task codegen_blackbox_when_stringOptimization (type: RunExternalTestGroup) { - dependsOn(createLogFile) groupDirectory = "codegen/blackbox/when/stringOptimization" - logFileName = "test-result.md" } + +task daily { + dependsOn(codegen_blackbox_annotations) +} From a59de510cd5986e510d0027095b28e1005f250be Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 14:07:20 +0300 Subject: [PATCH 52/86] TEST: more fixes in template --- backend.native/tests/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 6fc66ba36ae..352223c6d81 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -23,10 +23,10 @@ task regenerate_external_tests() { gradleGenerated.write("import org.jetbrains.kotlin.*\n") gradleGenerated.append( """ -############################################################################### -# WARNING: This file auto generated with command -# ./gradlew :backend.native:tests:regenerate_external_tests -############################################################################### +/******************************************************************************* +* WARNING: This file auto generated with command +* # ./gradlew :backend.native:tests:regenerate_external_tests +*******************************************************************************/ configurations { cli_bc } From 7cbaa7d6ca7feb1f2aaf799547c07dd39b15396f Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 14:08:04 +0300 Subject: [PATCH 53/86] EXTERNAL:TEST: regenerated --- backend.native/tests/external/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle index 832464567f8..ed6cc93dc9a 100644 --- a/backend.native/tests/external/build.gradle +++ b/backend.native/tests/external/build.gradle @@ -1,5 +1,9 @@ import org.jetbrains.kotlin.* +/******************************************************************************* +* WARNING: This file auto generated with command +* # ./gradlew :backend.native:tests:regenerate_external_tests +*******************************************************************************/ configurations { cli_bc } From 6729d1d824454c682affbf85b28894220d0692d2 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 16:20:37 +0300 Subject: [PATCH 54/86] TEST: external generate run task for externals --- backend.native/tests/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 352223c6d81..fff9aabd710 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -55,6 +55,10 @@ dependencies { task daily { dependsOn(codegen_blackbox_annotations) } + +task run() { + dependsOn(tasks.withType(RunExternalTestGroup).matching { it.enabled }) +} """ ) } From 99a962df42f4cf1f93f295d09275fdf7f8511d6d Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 23 Jan 2017 16:21:23 +0300 Subject: [PATCH 55/86] TEST:EXTERNAL: run task added --- backend.native/tests/external/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle index ed6cc93dc9a..55888a76ce8 100644 --- a/backend.native/tests/external/build.gradle +++ b/backend.native/tests/external/build.gradle @@ -815,3 +815,7 @@ task codegen_blackbox_when_stringOptimization (type: RunExternalTestGroup) { task daily { dependsOn(codegen_blackbox_annotations) } + +task run() { + dependsOn(tasks.withType(RunExternalTestGroup).matching { it.enabled }) +} From a4c4b1e7af4f09458056faa49c4d1e7e7d2b2c9a Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 24 Jan 2017 11:06:45 +0300 Subject: [PATCH 56/86] buildSrc: Use SourceSet to define test output directory. --- .gitignore | 2 +- backend.native/tests/build.gradle | 15 ++++++- .../org/jetbrains/kotlin/KonanTest.groovy | 43 +++++++++++++------ 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 120809d3411..6c68619c0a0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ kotstd/kotstd.iml *.kt.S *.kt.exe *.log -**/test-result.md +testOutput # Ignore Gradle GUI config gradle-app.setting diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index fff9aabd710..c463da264c5 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -13,7 +13,20 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } -def logFileName = "test-result.md" +allprojects { + // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. + sourceSets { + // :backend.native:tests + testOutputLocal { + output.dir(rootProject.file("testOutput/local")) + } + + // :backend.native:tests:external + testOutputExternal { + output.dir(rootProject.file("testOutput/external")) + } + } +} task regenerate_external_tests() { doLast { diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 6ac6cc765f9..6c87994d091 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -1,11 +1,8 @@ package org.jetbrains.kotlin -import groovy.io.FileType import org.gradle.api.DefaultTask -import org.gradle.api.internal.tasks.testing.detection.DefaultTestExecuter import org.gradle.api.tasks.ParallelizableTask import org.gradle.api.tasks.TaskAction -import org.gradle.api.tasks.testing.Test abstract class KonanTest extends DefaultTask { protected String source @@ -17,6 +14,8 @@ abstract class KonanTest extends DefaultTask { def startKtBc = new File("${dist.canonicalPath}/lib/start.kt.bc").absolutePath def stdlibKtBc = new File("${dist.canonicalPath}/lib/stdlib.kt.bc").absolutePath def mainC = 'main.c' + def outputSourceSetName = "testOutputLocal" + String outputDirectory = null String goldValue = null String testData = null List arguments = null @@ -27,10 +26,25 @@ abstract class KonanTest extends DefaultTask { this.enabled = !value } + // Uses directory defined in $outputSourceSetName source set. + // If such source set doesn't exist, uses temporary directory. + public void createOutputDirectory() { + if (outputDirectory != null) { + return + } + + def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName()) + if (outputSourceSet != null) { + outputDirectory = outputSourceSet.output.getDirs().getSingleFile().absolutePath + "/$name" + project.file(outputDirectory).mkdirs() + } else { + outputDirectory = getTemporaryDir().absolutePath + } + } + public KonanTest(){ // TODO: that's a long reach up the project tree. // May be we should reorganize a little. - //dependsOn(project.parent.parent.tasks['dist']) dependsOn(project.rootProject.tasks['dist']) } @@ -65,8 +79,7 @@ abstract class KonanTest extends DefaultTask { String buildExePath() { def exeName = project.file(source).name.replace(".kt", ".kt.exe") - def tempDir = temporaryDir.absolutePath - return "$tempDir/$exeName" + return "$outputDirectory/$exeName" } List buildCompileList() { @@ -75,6 +88,7 @@ abstract class KonanTest extends DefaultTask { @TaskAction void executeTest() { + createOutputDirectory() def exe = buildExePath() compileTest(buildCompileList(), exe) @@ -123,10 +137,11 @@ class LinkKonanTest extends KonanTest { class RunExternalTestGroup extends RunKonanTest { def groupDirectory = "." - def logFileName = "${name}.md" + def outputSourceSetName = "testOutputExternal" String filter = project.findProperty("filter") String goldValue = "OK" + // TODO refactor List buildCompileList() { def result = [] @@ -137,15 +152,14 @@ class RunExternalTestGroup extends RunKonanTest { def srcFile = project.file(source) def srcText = srcFile.text def matcher = filePattern.matcher(srcText) - def tmpDir = temporaryDir.absolutePath if (!matcher.find()) { // There is only one file in the input project.copy{ from srcFile.absolutePath - into tmpDir + into outputDirectory } - def newFile ="$tmpDir/${srcFile.name}" + def newFile ="$outputDirectory/${srcFile.name}" if (srcText =~ boxPattern && srcText =~ packagePattern){ boxPackage = (srcText =~ packagePattern)[0][1] boxPackage += '.' @@ -156,7 +170,7 @@ class RunExternalTestGroup extends RunKonanTest { def processedChars = 0 while (true) { def filePath = matcher.group(1) - filePath = "$tmpDir/$filePath" + filePath = "$outputDirectory/$filePath" def start = processedChars def nextFileExists = matcher.find() def end = nextFileExists ? matcher.start() : srcText.length() @@ -171,8 +185,8 @@ class RunExternalTestGroup extends RunKonanTest { if (!nextFileExists) break } } - createLauncherFile("$tmpDir/_launcher.kt", boxPackage) - result.add("$tmpDir/_launcher.kt") + createLauncherFile("$outputDirectory/_launcher.kt", boxPackage) + result.add("$outputDirectory/_launcher.kt") return result } @@ -216,7 +230,8 @@ class RunExternalTestGroup extends RunKonanTest { @TaskAction @Override void executeTest() { - def logFile = project.file(logFileName) + createOutputDirectory() + def logFile = project.file("${outputDirectory}/result.md") logFile.append("\n$groupDirectory\n\n") logFile.append("|Test|Status|Comment|\n|----|------|-------|\n") def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() { From c04233aebbc5e87d97f7045ace99ea159a06c81d Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 24 Jan 2017 16:05:23 +0300 Subject: [PATCH 57/86] buildSrc: Save test results to JSON --- backend.native/tests/build.gradle | 5 -- .../org/jetbrains/kotlin/KonanTest.groovy | 61 +++++++++++++++---- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index c463da264c5..c4c52b43063 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -1,10 +1,5 @@ -import com.google.common.collect.Lists -import groovy.io.FileType import org.jetbrains.kotlin.* -import java.nio.file.* -import java.util.regex.Matcher - configurations { cli_bc } diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 6c87994d091..7c0b65c59f7 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -1,5 +1,6 @@ package org.jetbrains.kotlin +import groovy.json.JsonBuilder import org.gradle.api.DefaultTask import org.gradle.api.tasks.ParallelizableTask import org.gradle.api.tasks.TaskAction @@ -141,6 +142,17 @@ class RunExternalTestGroup extends RunKonanTest { String filter = project.findProperty("filter") String goldValue = "OK" + class TestResult { + String name = null + String status = null + String comment = null + + TestResult(String name, String status, String comment){ + this.name = name; + this.status = status; + this.comment = comment; + } + } // TODO refactor List buildCompileList() { @@ -212,13 +224,13 @@ class RunExternalTestGroup extends RunKonanTest { def text = project.file(fileName).text def targetBackend = findLinesWithPrefixesRemoved(text, "// TARGET_BACKEND") if (targetBackend.size() != 0) { - // There is some target backend. Check if it is NATIVE or not + // There is some target backend. Check if it is NATIVE or not. for (String s : targetBackend) { if (s.contains("NATIVE")){ return true } } return false } else { - // No target backend. Check if NATIVE backend is ignored + // No target backend. Check if NATIVE backend is ignored. def ignoredBackends = findLinesWithPrefixesRemoved(text, "// IGNORE_BACKEND: ") for (String s : ignoredBackends) { if (s.contains("NATIVE")) { return false } @@ -231,9 +243,8 @@ class RunExternalTestGroup extends RunKonanTest { @Override void executeTest() { createOutputDirectory() - def logFile = project.file("${outputDirectory}/result.md") - logFile.append("\n$groupDirectory\n\n") - logFile.append("|Test|Status|Comment|\n|----|------|-------|\n") + + // Form the test list. def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() { @Override boolean accept(File pathname) { @@ -246,12 +257,15 @@ class RunExternalTestGroup extends RunKonanTest { it.name =~ pattern } } + + // Run the tests. def current = 0 def passed = 0 def skipped = 0 + def failed = 0 def total = ktFiles.size() - def status = null - def comment = null + def results = [] + def currentResult = null ktFiles.each { current++ source = project.relativePath(it) @@ -259,18 +273,39 @@ class RunExternalTestGroup extends RunKonanTest { if (isEnabledForNativeBackend(source)) { try { super.executeTest() - status = "PASSED"; comment = "" + currentResult = new TestResult(it.name, "PASSED", "") passed++ } catch (Exception ex) { - status = "FAILED"; comment = "Exception: ${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}" + currentResult = new TestResult(it.name, "FAILED", + "Exception: ${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}") + failed++ } } else { - status = "SKIPPED"; comment = "" + currentResult = new TestResult(it.name, "SKIPPED", "") skipped++ } - println("TEST $status\n") - logFile.append("|$it.name|$status|$comment|\n") + println("TEST $currentResult.status\n") + results.add(currentResult) } - println("TOTAL PASSED: $passed/$current (SKIPPED: $skipped)") + + // Save the report. + def reportFile = project.file("${outputDirectory}/results.json") + def json = new JsonBuilder() + json { + "statistics" "total" : total, "passed" : passed, "failed" : failed, "skipped" : skipped + + "tests" { + results.each { result -> + "$result.name" { + "status" result.status + "comment" result.comment + } + } + } + + + } + reportFile.write(json.toPrettyString()) + println("TOTAL PASSED: $passed/$total (SKIPPED: $skipped)") } } From 6e0c2fface33c11533447de3c19248d5cf920211 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 24 Jan 2017 16:41:20 +0300 Subject: [PATCH 58/86] backend.native/tests: Add clean task to remove test output directory --- backend.native/tests/build.gradle | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index c4c52b43063..d01c3e9808b 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -8,21 +8,30 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } +def testOutputRoot = rootProject.file("testOutput").absolutePath + allprojects { // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. sourceSets { // :backend.native:tests testOutputLocal { - output.dir(rootProject.file("testOutput/local")) + output.dir(rootProject.file("$testOutputRoot/local")) } // :backend.native:tests:external testOutputExternal { - output.dir(rootProject.file("testOutput/external")) + output.dir(rootProject.file("$testOutputRoot/external")) } } } +task clean { + doLast { + delete(rootProject.file(testOutputRoot)) + } +} + + task regenerate_external_tests() { doLast { def externalTestsProject = childProjects["external"] From f096e272b355af4128d49234b78beed10ea5bc7d Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 24 Jan 2017 19:26:43 +0300 Subject: [PATCH 59/86] backend.native/tests: Add JSON output to run-external task --- .gitignore | 2 +- backend.native/tests/build.gradle | 40 +++++---- .../org/jetbrains/kotlin/KonanTest.groovy | 83 ++++++++++--------- 3 files changed, 69 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index 6c68619c0a0..f87a4bceab3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ kotstd/kotstd.iml *.kt.S *.kt.exe *.log -testOutput +test.output # Ignore Gradle GUI config gradle-app.setting diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index d01c3e9808b..ec765f98bd0 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -1,3 +1,4 @@ +import groovy.json.JsonOutput import org.jetbrains.kotlin.* configurations { @@ -8,7 +9,7 @@ dependencies { cli_bc project(path: ':backend.native', configuration: 'cli_bc') } -def testOutputRoot = rootProject.file("testOutput").absolutePath +def testOutputRoot = rootProject.file("test.output").absolutePath allprojects { // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. @@ -31,7 +32,6 @@ task clean { } } - task regenerate_external_tests() { doLast { def externalTestsProject = childProjects["external"] @@ -86,24 +86,28 @@ task run() { } task run_external () { - project.subprojects { - dependsOn(it.tasks.withType(RunExternalTestGroup).matching { it.enabled }) - } + // TODO Consider test output directory cleaning before execution. + // TODO Consider using some logger instead of println + def testTasks = childProjects["external"].tasks.withType(RunExternalTestGroup).matching { it.enabled } + dependsOn(testTasks) + doLast { - def logFile = childProjects["external"].file(logFileName) - def logText = logFile.text + Map> results = [:] + def statistics = new RunExternalTestGroup.Statistics() + testTasks.matching { it.state.executed }.each { + results.put(it.name, it.results) + statistics.add(it.statistics) + } - def passed = logText.count("|PASSED|") - def failed = logText.count("|FAILED|") - def skipped = logText.count("|SKIPPED|") - - def report = "\nDONE.\n\n" + - "PASSED: $passed\n" + - "FAILED: $failed\n" + - "TOTAL (FAILED + PASSED): ${passed + failed}\n" + - "SKIPPED : $skipped" - logFile.append(report) - println(report) + def output = ["statistics" : statistics, "tests" : results] + def json = JsonOutput.toJson(output) + def reportFile = new File(sourceSets.testOutputExternal.output.getDirs().getSingleFile(), "results.json") + reportFile.write(JsonOutput.prettyPrint(json)) + println("DONE.\n\n" + + "TOTAL: $statistics.total\n" + + "PASSED: $statistics.passed\n" + + "FAILED: $statistics.failed\n" + + "SKIPPED: $statistics.skipped") } } diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 7c0b65c59f7..713c99edbc0 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -1,6 +1,6 @@ package org.jetbrains.kotlin -import groovy.json.JsonBuilder +import groovy.json.JsonOutput import org.gradle.api.DefaultTask import org.gradle.api.tasks.ParallelizableTask import org.gradle.api.tasks.TaskAction @@ -141,19 +141,48 @@ class RunExternalTestGroup extends RunKonanTest { def outputSourceSetName = "testOutputExternal" String filter = project.findProperty("filter") String goldValue = "OK" + Map results = [:] + Statistics statistics = new Statistics() - class TestResult { - String name = null + static class TestResult { String status = null String comment = null - TestResult(String name, String status, String comment){ - this.name = name; + TestResult(String status, String comment = ""){ this.status = status; this.comment = comment; } } + static class Statistics { + int total = 0 + int passed = 0 + int failed = 0 + int skipped = 0 + + void pass(int count = 1) { + passed += count + total += count + } + + void skip(int count = 1) { + skipped += count + total += count + } + + void fail(int count = 1) { + failed += count + total += count + } + + void add(Statistics other) { + total += other.total + passed += other.passed + failed += other.failed + skipped += other.skipped + } + } + // TODO refactor List buildCompileList() { def result = [] @@ -259,53 +288,33 @@ class RunExternalTestGroup extends RunKonanTest { } // Run the tests. - def current = 0 - def passed = 0 - def skipped = 0 - def failed = 0 - def total = ktFiles.size() - def results = [] def currentResult = null + statistics = new Statistics() ktFiles.each { - current++ source = project.relativePath(it) - println("TEST: $it.name ($current/$total, passed: $passed, skipped: $skipped)") + println("TEST: $it.name ($statistics.total/$ktFiles.size, passed: $statistics.passed, skipped: $statistics.skipped)") if (isEnabledForNativeBackend(source)) { try { super.executeTest() - currentResult = new TestResult(it.name, "PASSED", "") - passed++ + currentResult = new TestResult("PASSED") + statistics.pass() } catch (Exception ex) { - currentResult = new TestResult(it.name, "FAILED", + currentResult = new TestResult("FAILED", "Exception: ${ex.getMessage()}. Cause: ${ex.getCause()?.getMessage()}") - failed++ + statistics.fail() } } else { - currentResult = new TestResult(it.name, "SKIPPED", "") - skipped++ + currentResult = new TestResult("SKIPPED") + statistics.skip() } println("TEST $currentResult.status\n") - results.add(currentResult) + results.put(it.name, currentResult) } // Save the report. def reportFile = project.file("${outputDirectory}/results.json") - def json = new JsonBuilder() - json { - "statistics" "total" : total, "passed" : passed, "failed" : failed, "skipped" : skipped - - "tests" { - results.each { result -> - "$result.name" { - "status" result.status - "comment" result.comment - } - } - } - - - } - reportFile.write(json.toPrettyString()) - println("TOTAL PASSED: $passed/$total (SKIPPED: $skipped)") + def json = JsonOutput.toJson(["statistics" : statistics, "tests" : results]) + reportFile.write(JsonOutput.prettyPrint(json)) + println("TOTAL PASSED: $statistics.passed/$statistics.total (SKIPPED: $statistics.skipped)") } } From 7285c57cd833900e8db781c644a23e3090da5d4e Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 25 Jan 2017 10:34:19 +0300 Subject: [PATCH 60/86] backend/tests: Generate external test tasks in config stage We generate tasks for external tests group during Gradle's configuration phase instead of using separate task (regenerate_external_tests) --- backend.native/tests/build.gradle | 76 +- backend.native/tests/external/build.gradle | 821 ------------------ .../org/jetbrains/kotlin/KonanTest.groovy | 4 +- settings.gradle | 1 - 4 files changed, 25 insertions(+), 877 deletions(-) delete mode 100644 backend.native/tests/external/build.gradle diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index ec765f98bd0..e15c4d8e13d 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -10,16 +10,17 @@ dependencies { } def testOutputRoot = rootProject.file("test.output").absolutePath +def externalTestsDir = project.file("external") allprojects { // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. sourceSets { - // :backend.native:tests + // backend.native/tests testOutputLocal { output.dir(rootProject.file("$testOutputRoot/local")) } - // :backend.native:tests:external + // backend.native/tests/external testOutputExternal { output.dir(rootProject.file("$testOutputRoot/external")) } @@ -32,63 +33,28 @@ task clean { } } -task regenerate_external_tests() { - doLast { - def externalTestsProject = childProjects["external"] - def gradleGenerated = externalTestsProject.file("build.gradle") - def externalTestsDir = externalTestsProject.file("codegen/blackbox") - gradleGenerated.write("import org.jetbrains.kotlin.*\n") - gradleGenerated.append( -""" -/******************************************************************************* -* WARNING: This file auto generated with command -* # ./gradlew :backend.native:tests:regenerate_external_tests -*******************************************************************************/ -configurations { - cli_bc -} - -dependencies { - cli_bc project(path: ':backend.native', configuration: 'cli_bc') -} -""" - ) - externalTestsDir.eachDirRecurse { - // Skip build directory and directories without *.kt files. - if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt")} == 0) { - return - } - - def taskDirectory = externalTestsProject.relativePath(it) - def taskName = taskDirectory.replaceAll("[-/]", '_') - - gradleGenerated.append( - "task $taskName (type: RunExternalTestGroup) {\n" + - " groupDirectory = \"$taskDirectory\"\n" + - "}\n\n") - } - gradleGenerated.append( -""" -task daily { - dependsOn(codegen_blackbox_annotations) -} - task run() { - dependsOn(tasks.withType(RunExternalTestGroup).matching { it.enabled }) -} -""" - ) - } -} - -task run() { - dependsOn(tasks.withType(KonanTest).matching { it.enabled }) + dependsOn(tasks.withType(KonanTest).matching { !(it instanceof RunExternalTestGroup) && it.enabled }) } task run_external () { // TODO Consider test output directory cleaning before execution. // TODO Consider using some logger instead of println - def testTasks = childProjects["external"].tasks.withType(RunExternalTestGroup).matching { it.enabled } + // Create tasks for external tests + externalTestsDir.eachDirRecurse { + // Skip build directory and directories without *.kt files. + if (it.name == "build" || it.listFiles().count {it.name.endsWith(".kt")} == 0) { + return + } + + def taskDirectory = project.relativePath(it) + def taskName = taskDirectory.replaceAll("[-/]", '_') + + task("$taskName", type: RunExternalTestGroup){ + groupDirectory = "$taskDirectory" + } + } + def testTasks = tasks.withType(RunExternalTestGroup).matching { it.enabled } dependsOn(testTasks) doLast { @@ -111,6 +77,10 @@ task run_external () { } } +task daily() { + dependsOn(run_external) +} + task sum (type:RunKonanTest) { source = "codegen/function/sum.kt" } diff --git a/backend.native/tests/external/build.gradle b/backend.native/tests/external/build.gradle deleted file mode 100644 index 55888a76ce8..00000000000 --- a/backend.native/tests/external/build.gradle +++ /dev/null @@ -1,821 +0,0 @@ -import org.jetbrains.kotlin.* - -/******************************************************************************* -* WARNING: This file auto generated with command -* # ./gradlew :backend.native:tests:regenerate_external_tests -*******************************************************************************/ -configurations { - cli_bc -} - -dependencies { - cli_bc project(path: ':backend.native', configuration: 'cli_bc') -} -task codegen_blackbox_annotations (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/annotations" -} - -task codegen_blackbox_annotations_annotatedLambda (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/annotations/annotatedLambda" -} - -task codegen_blackbox_argumentOrder (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/argumentOrder" -} - -task codegen_blackbox_arrays (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays" -} - -task codegen_blackbox_arrays_multiDecl (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays/multiDecl" -} - -task codegen_blackbox_arrays_multiDecl_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays/multiDecl/int" -} - -task codegen_blackbox_arrays_multiDecl_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/arrays/multiDecl/long" -} - -task codegen_blackbox_binaryOp (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/binaryOp" -} - -task codegen_blackbox_boxingOptimization (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/boxingOptimization" -} - -task codegen_blackbox_bridges (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/bridges" -} - -task codegen_blackbox_bridges_substitutionInSuperClass (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/bridges/substitutionInSuperClass" -} - -task codegen_blackbox_builtinStubMethods (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/builtinStubMethods" -} - -task codegen_blackbox_builtinStubMethods_extendJavaCollections (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/builtinStubMethods/extendJavaCollections" -} - -task codegen_blackbox_callableReference_bound (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/bound" -} - -task codegen_blackbox_callableReference_bound_equals (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/bound/equals" -} - -task codegen_blackbox_callableReference_bound_inline (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/bound/inline" -} - -task codegen_blackbox_callableReference_function (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/function" -} - -task codegen_blackbox_callableReference_function_local (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/function/local" -} - -task codegen_blackbox_callableReference_property (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/callableReference/property" -} - -task codegen_blackbox_casts (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts" -} - -task codegen_blackbox_casts_functions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts/functions" -} - -task codegen_blackbox_casts_literalExpressionAsGenericArgument (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts/literalExpressionAsGenericArgument" -} - -task codegen_blackbox_casts_mutableCollections (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/casts/mutableCollections" -} - -task codegen_blackbox_classes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classes" -} - -task codegen_blackbox_classes_inner (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classes/inner" -} - -task codegen_blackbox_classLiteral (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classLiteral" -} - -task codegen_blackbox_classLiteral_bound (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classLiteral/bound" -} - -task codegen_blackbox_classLiteral_java (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/classLiteral/java" -} - -task codegen_blackbox_closures (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/closures" -} - -task codegen_blackbox_closures_captureOuterProperty (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/closures/captureOuterProperty" -} - -task codegen_blackbox_closures_closureInsideClosure (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/closures/closureInsideClosure" -} - -task codegen_blackbox_collections (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/collections" -} - -task codegen_blackbox_compatibility (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/compatibility" -} - -task codegen_blackbox_constants (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/constants" -} - -task codegen_blackbox_controlStructures (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures" -} - -task codegen_blackbox_controlStructures_breakContinueInExpressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures/breakContinueInExpressions" -} - -task codegen_blackbox_controlStructures_returnsNothing (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures/returnsNothing" -} - -task codegen_blackbox_controlStructures_tryCatchInExpressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/controlStructures/tryCatchInExpressions" -} - -task codegen_blackbox_coroutines (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines" -} - -task codegen_blackbox_coroutines_controlFlow (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/controlFlow" -} - -task codegen_blackbox_coroutines_intLikeVarSpilling (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/intLikeVarSpilling" -} - -task codegen_blackbox_coroutines_multiModule (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/multiModule" -} - -task codegen_blackbox_coroutines_stackUnwinding (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/stackUnwinding" -} - -task codegen_blackbox_coroutines_suspendFunctionTypeCall (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/suspendFunctionTypeCall" -} - -task codegen_blackbox_coroutines_unitTypeReturn (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/coroutines/unitTypeReturn" -} - -task codegen_blackbox_dataClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses" -} - -task codegen_blackbox_dataClasses_copy (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/copy" -} - -task codegen_blackbox_dataClasses_equals (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/equals" -} - -task codegen_blackbox_dataClasses_hashCode (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/hashCode" -} - -task codegen_blackbox_dataClasses_toString (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/dataClasses/toString" -} - -task codegen_blackbox_deadCodeElimination (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/deadCodeElimination" -} - -task codegen_blackbox_defaultArguments (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments" -} - -task codegen_blackbox_defaultArguments_constructor (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/constructor" -} - -task codegen_blackbox_defaultArguments_convention (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/convention" -} - -task codegen_blackbox_defaultArguments_function (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/function" -} - -task codegen_blackbox_defaultArguments_private (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/private" -} - -task codegen_blackbox_defaultArguments_signature (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/defaultArguments/signature" -} - -task codegen_blackbox_delegatedProperty (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegatedProperty" -} - -task codegen_blackbox_delegatedProperty_local (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegatedProperty/local" -} - -task codegen_blackbox_delegatedProperty_provideDelegate (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegatedProperty/provideDelegate" -} - -task codegen_blackbox_delegation (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/delegation" -} - -task codegen_blackbox_destructuringDeclInLambdaParam (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/destructuringDeclInLambdaParam" -} - -task codegen_blackbox_diagnostics_functions_inference (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/functions/inference" -} - -task codegen_blackbox_diagnostics_functions_invoke_onObjects (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/functions/invoke/onObjects" -} - -task codegen_blackbox_diagnostics_functions_tailRecursion (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/functions/tailRecursion" -} - -task codegen_blackbox_diagnostics_vararg (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/diagnostics/vararg" -} - -task codegen_blackbox_elvis (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/elvis" -} - -task codegen_blackbox_enum (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/enum" -} - -task codegen_blackbox_evaluate (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/evaluate" -} - -task codegen_blackbox_exclExcl (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/exclExcl" -} - -task codegen_blackbox_extensionFunctions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/extensionFunctions" -} - -task codegen_blackbox_extensionProperties (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/extensionProperties" -} - -task codegen_blackbox_external (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/external" -} - -task codegen_blackbox_fakeOverride (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fakeOverride" -} - -task codegen_blackbox_fieldRename (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fieldRename" -} - -task codegen_blackbox_finally (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/finally" -} - -task codegen_blackbox_fullJdk (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fullJdk" -} - -task codegen_blackbox_fullJdk_native (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fullJdk/native" -} - -task codegen_blackbox_fullJdk_regressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/fullJdk/regressions" -} - -task codegen_blackbox_functions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions" -} - -task codegen_blackbox_functions_functionExpression (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions/functionExpression" -} - -task codegen_blackbox_functions_invoke (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions/invoke" -} - -task codegen_blackbox_functions_localFunctions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/functions/localFunctions" -} - -task codegen_blackbox_hashPMap (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/hashPMap" -} - -task codegen_blackbox_ieee754 (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ieee754" -} - -task codegen_blackbox_increment (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/increment" -} - -task codegen_blackbox_innerNested (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/innerNested" -} - -task codegen_blackbox_innerNested_superConstructorCall (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/innerNested/superConstructorCall" -} - -task codegen_blackbox_instructions_swap (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/instructions/swap" -} - -task codegen_blackbox_intrinsics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/intrinsics" -} - -task codegen_blackbox_javaInterop (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop" -} - -task codegen_blackbox_javaInterop_generics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop/generics" -} - -task codegen_blackbox_javaInterop_notNullAssertions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop/notNullAssertions" -} - -task codegen_blackbox_javaInterop_objectMethods (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/javaInterop/objectMethods" -} - -task codegen_blackbox_jdk (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jdk" -} - -task codegen_blackbox_jvmField (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmField" -} - -task codegen_blackbox_jvmName (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmName" -} - -task codegen_blackbox_jvmName_fileFacades (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmName/fileFacades" -} - -task codegen_blackbox_jvmOverloads (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmOverloads" -} - -task codegen_blackbox_jvmStatic (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/jvmStatic" -} - -task codegen_blackbox_labels (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/labels" -} - -task codegen_blackbox_lazyCodegen (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/lazyCodegen" -} - -task codegen_blackbox_lazyCodegen_optimizations (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/lazyCodegen/optimizations" -} - -task codegen_blackbox_localClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/localClasses" -} - -task codegen_blackbox_mangling (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/mangling" -} - -task codegen_blackbox_multiDecl (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl" -} - -task codegen_blackbox_multiDecl_forIterator (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forIterator" -} - -task codegen_blackbox_multiDecl_forIterator_longIterator (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forIterator/longIterator" -} - -task codegen_blackbox_multiDecl_forRange (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/int" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeTo_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeTo/long" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/int" -} - -task codegen_blackbox_multiDecl_forRange_explicitRangeToWithDot_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/explicitRangeToWithDot/long" -} - -task codegen_blackbox_multiDecl_forRange_int (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/int" -} - -task codegen_blackbox_multiDecl_forRange_long (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multiDecl/forRange/long" -} - -task codegen_blackbox_multifileClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multifileClasses" -} - -task codegen_blackbox_multifileClasses_optimized (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/multifileClasses/optimized" -} - -task codegen_blackbox_nonLocalReturns (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/nonLocalReturns" -} - -task codegen_blackbox_objectIntrinsics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/objectIntrinsics" -} - -task codegen_blackbox_objects (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/objects" -} - -task codegen_blackbox_operatorConventions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/operatorConventions" -} - -task codegen_blackbox_operatorConventions_compareTo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/operatorConventions/compareTo" -} - -task codegen_blackbox_package (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/package" -} - -task codegen_blackbox_platformTypes_primitives (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/platformTypes/primitives" -} - -task codegen_blackbox_primitiveTypes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/primitiveTypes" -} - -task codegen_blackbox_private (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/private" -} - -task codegen_blackbox_privateConstructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/privateConstructors" -} - -task codegen_blackbox_properties (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/properties" -} - -task codegen_blackbox_properties_const (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/properties/const" -} - -task codegen_blackbox_properties_lateinit (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/properties/lateinit" -} - -task codegen_blackbox_publishedApi (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/publishedApi" -} - -task codegen_blackbox_ranges (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges" -} - -task codegen_blackbox_ranges_contains (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/contains" -} - -task codegen_blackbox_ranges_expression (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/expression" -} - -task codegen_blackbox_ranges_forInDownTo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/forInDownTo" -} - -task codegen_blackbox_ranges_forInIndices (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/forInIndices" -} - -task codegen_blackbox_ranges_literal (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/literal" -} - -task codegen_blackbox_ranges_nullableLoopParameter (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/ranges/nullableLoopParameter" -} - -task codegen_blackbox_reflection_annotations (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/annotations" -} - -task codegen_blackbox_reflection_call (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/call" -} - -task codegen_blackbox_reflection_call_bound (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/call/bound" -} - -task codegen_blackbox_reflection_callBy (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/callBy" -} - -task codegen_blackbox_reflection_classes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/classes" -} - -task codegen_blackbox_reflection_classLiterals (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/classLiterals" -} - -task codegen_blackbox_reflection_constructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/constructors" -} - -task codegen_blackbox_reflection_createAnnotation (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/createAnnotation" -} - -task codegen_blackbox_reflection_enclosing (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/enclosing" -} - -task codegen_blackbox_reflection_functions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/functions" -} - -task codegen_blackbox_reflection_genericSignature (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/genericSignature" -} - -task codegen_blackbox_reflection_isInstance (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/isInstance" -} - -task codegen_blackbox_reflection_kClassInAnnotation (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/kClassInAnnotation" -} - -task codegen_blackbox_reflection_lambdaClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/lambdaClasses" -} - -task codegen_blackbox_reflection_mapping (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping" -} - -task codegen_blackbox_reflection_mapping_fakeOverrides (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping/fakeOverrides" -} - -task codegen_blackbox_reflection_mapping_jvmStatic (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping/jvmStatic" -} - -task codegen_blackbox_reflection_mapping_types (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/mapping/types" -} - -task codegen_blackbox_reflection_methodsFromAny (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/methodsFromAny" -} - -task codegen_blackbox_reflection_modifiers (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/modifiers" -} - -task codegen_blackbox_reflection_multifileClasses (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/multifileClasses" -} - -task codegen_blackbox_reflection_noReflectAtRuntime (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime" -} - -task codegen_blackbox_reflection_noReflectAtRuntime_methodsFromAny (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/noReflectAtRuntime/methodsFromAny" -} - -task codegen_blackbox_reflection_parameters (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/parameters" -} - -task codegen_blackbox_reflection_properties (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/properties" -} - -task codegen_blackbox_reflection_properties_accessors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/properties/accessors" -} - -task codegen_blackbox_reflection_specialBuiltIns (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/specialBuiltIns" -} - -task codegen_blackbox_reflection_supertypes (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/supertypes" -} - -task codegen_blackbox_reflection_typeParameters (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/typeParameters" -} - -task codegen_blackbox_reflection_types (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/types" -} - -task codegen_blackbox_reflection_types_createType (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/types/createType" -} - -task codegen_blackbox_reflection_types_subtyping (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reflection/types/subtyping" -} - -task codegen_blackbox_regressions (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/regressions" -} - -task codegen_blackbox_reified (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reified" -} - -task codegen_blackbox_reified_arraysReification (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/reified/arraysReification" -} - -task codegen_blackbox_safeCall (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/safeCall" -} - -task codegen_blackbox_sam_constructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/sam/constructors" -} - -task codegen_blackbox_sealed (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/sealed" -} - -task codegen_blackbox_secondaryConstructors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/secondaryConstructors" -} - -task codegen_blackbox_smap (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/smap" -} - -task codegen_blackbox_smartCasts (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/smartCasts" -} - -task codegen_blackbox_specialBuiltins (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/specialBuiltins" -} - -task codegen_blackbox_statics (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/statics" -} - -task codegen_blackbox_storeStackBeforeInline (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/storeStackBeforeInline" -} - -task codegen_blackbox_strings (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/strings" -} - -task codegen_blackbox_super (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/super" -} - -task codegen_blackbox_synchronized (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/synchronized" -} - -task codegen_blackbox_syntheticAccessors (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/syntheticAccessors" -} - -task codegen_blackbox_toArray (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/toArray" -} - -task codegen_blackbox_topLevelPrivate (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/topLevelPrivate" -} - -task codegen_blackbox_traits (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/traits" -} - -task codegen_blackbox_typealias (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/typealias" -} - -task codegen_blackbox_typeInfo (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/typeInfo" -} - -task codegen_blackbox_typeMapping (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/typeMapping" -} - -task codegen_blackbox_unaryOp (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/unaryOp" -} - -task codegen_blackbox_unit (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/unit" -} - -task codegen_blackbox_vararg (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/vararg" -} - -task codegen_blackbox_when (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/when" -} - -task codegen_blackbox_when_enumOptimization (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/when/enumOptimization" -} - -task codegen_blackbox_when_stringOptimization (type: RunExternalTestGroup) { - groupDirectory = "codegen/blackbox/when/stringOptimization" -} - - -task daily { - dependsOn(codegen_blackbox_annotations) -} - -task run() { - dependsOn(tasks.withType(RunExternalTestGroup).matching { it.enabled }) -} diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 713c99edbc0..569fff6f663 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -274,7 +274,7 @@ class RunExternalTestGroup extends RunKonanTest { createOutputDirectory() // Form the test list. - def ktFiles = project.file(groupDirectory).listFiles(new FileFilter() { + List ktFiles = project.file(groupDirectory).listFiles(new FileFilter() { @Override boolean accept(File pathname) { pathname.isFile() && pathname.name.endsWith(".kt") @@ -292,7 +292,7 @@ class RunExternalTestGroup extends RunKonanTest { statistics = new Statistics() ktFiles.each { source = project.relativePath(it) - println("TEST: $it.name ($statistics.total/$ktFiles.size, passed: $statistics.passed, skipped: $statistics.skipped)") + println("TEST: $it.name ($statistics.total/${ktFiles.size()}, passed: $statistics.passed, skipped: $statistics.skipped)") if (isEnabledForNativeBackend(source)) { try { super.executeTest() diff --git a/settings.gradle b/settings.gradle index de284fb5fbb..a4cb6759f92 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,4 +7,3 @@ include ':backend.native' include ':runtime' include ':common' include ':backend.native:tests' -include ':backend.native:tests:external' From 5da131d9f11c932ecec53738be37b9670d2a3df6 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 25 Jan 2017 12:16:20 +0300 Subject: [PATCH 61/86] buildSrc: Add multifile support for internal tests --- .../org/jetbrains/kotlin/KonanTest.groovy | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 569fff6f663..fa28a04c97e 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -83,8 +83,42 @@ abstract class KonanTest extends DefaultTask { return "$outputDirectory/$exeName" } + // TODO refactor List buildCompileList() { - return [project.file(source).absolutePath] + def result = [] + def filePattern = ~/(?m)\/\/\s*FILE:\s*(.*)$/ + def srcFile = project.file(source) + def srcText = srcFile.text + def matcher = filePattern.matcher(srcText) + + if (!matcher.find()) { + // There is only one file in the input + project.copy{ + from srcFile.absolutePath + into outputDirectory + } + def newFile ="$outputDirectory/${srcFile.name}" + result.add(newFile) + } else { + // There are several files + def processedChars = 0 + while (true) { + def filePath = "$outputDirectory/${matcher.group(1)}" + def start = processedChars + def nextFileExists = matcher.find() + def end = nextFileExists ? matcher.start() : srcText.length() + def fileText = srcText.substring(start, end) + processedChars = end + createFile(filePath, fileText) + result.add(filePath) + if (!nextFileExists) break + } + } + return result + } + + void createFile(String file, String text) { + project.file(file).write(text) } @TaskAction @@ -183,47 +217,18 @@ class RunExternalTestGroup extends RunKonanTest { } } - // TODO refactor List buildCompileList() { - def result = [] - def filePattern = ~/(?m)\/\/\s*FILE:\s*(.*)$/ def packagePattern = ~/(?m)package\s*([a-zA-z-][a-zA-Z0-9.-]*)/ //TODO check the regex def boxPattern = ~/(?m)fun\s*box\s*\(\s*\)/ def boxPackage = "" - def srcFile = project.file(source) - def srcText = srcFile.text - def matcher = filePattern.matcher(srcText) - if (!matcher.find()) { - // There is only one file in the input - project.copy{ - from srcFile.absolutePath - into outputDirectory - } - def newFile ="$outputDirectory/${srcFile.name}" - if (srcText =~ boxPattern && srcText =~ packagePattern){ - boxPackage = (srcText =~ packagePattern)[0][1] + def result = super.buildCompileList() + for (String filePath : result) { + def text = project.file(filePath).text + if (text =~ boxPattern && text =~ packagePattern){ + boxPackage = (text =~ packagePattern)[0][1] boxPackage += '.' - } - result.add(newFile) - } else { - // There are several files - def processedChars = 0 - while (true) { - def filePath = matcher.group(1) - filePath = "$outputDirectory/$filePath" - def start = processedChars - def nextFileExists = matcher.find() - def end = nextFileExists ? matcher.start() : srcText.length() - def fileText = srcText.substring(start, end) - processedChars = end - createFile(filePath, fileText) - if (fileText =~ boxPattern && fileText =~ packagePattern){ - boxPackage = (fileText =~ packagePattern)[0][1] - boxPackage += '.' - } - result.add(filePath) - if (!nextFileExists) break + break } } createLauncherFile("$outputDirectory/_launcher.kt", boxPackage) @@ -235,10 +240,6 @@ class RunExternalTestGroup extends RunKonanTest { createFile(file, "fun main(args : Array) { print(${pkg}box()) }") } - void createFile(String file, String text) { - project.file(file).write(text) - } - List findLinesWithPrefixesRemoved(String text, String prefix) { def result = [] text.eachLine { From b1dc14248699746e2b604ee2361a6293f1d41073 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 25 Jan 2017 13:44:48 +0300 Subject: [PATCH 62/86] buildSrc: Add ParallelizableTask annotation to KonanTest class --- buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index fa28a04c97e..be8b0f02749 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -150,12 +150,14 @@ abstract class KonanTest extends DefaultTask { } } +@ParallelizableTask class RunKonanTest extends KonanTest { void compileTest(List filesToCompile, String exe) { runCompiler(filesToCompile, exe, []) } } +@ParallelizableTask class LinkKonanTest extends KonanTest { protected String lib From 778574c428f2373c4e8ecf73fd8a58c52a36cdad Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 25 Jan 2017 17:44:18 +0300 Subject: [PATCH 63/86] STDLIB: arrayOf() public function (cherry picked from commit 3240bec552420dfad73841ed6433b2b5cb29b5e6) --- runtime/src/main/kotlin/kotlin/Array.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/main/kotlin/kotlin/Array.kt b/runtime/src/main/kotlin/kotlin/Array.kt index 53e5b9d41f9..b1b9bf9e46d 100644 --- a/runtime/src/main/kotlin/kotlin/Array.kt +++ b/runtime/src/main/kotlin/kotlin/Array.kt @@ -46,7 +46,7 @@ private class IteratorImpl(val collection: Array) : Iterator { } } -fun arrayOf(vararg elements: T) : Array = elements +public fun arrayOf(vararg elements: T) : Array = elements @kotlin.internal.InlineOnly public inline operator fun Array.plus(elements: Array): Array { From 59e093c8e464dcddbc238a7f8dd9b3b89e452b5a Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 25 Jan 2017 17:21:47 +0300 Subject: [PATCH 64/86] backend: Place *.bc.o files in a temporary directory for llvmLlc() --- .../org/jetbrains/kotlin/backend/konan/LinkStage.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt index 0fe7e41762e..ee0106d4109 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt @@ -162,12 +162,12 @@ internal class LinkStage(val context: Context) { } fun llvmLlc(file: BitcodeFile): ObjectFile { - // TODO: Make it a temporary file. - val objectFile = "$file.o" - + val tmpObjectFile = File.createTempFile(File(file).name, ".o") + tmpObjectFile.deleteOnExit() + val objectFile = tmpObjectFile.absolutePath val tool = distribution.llvmLlc - val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") + - properties.propertyList("llvmLlcFlags.$suffix") + listOf(file) + val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") + + properties.propertyList("llvmLlcFlags.$suffix") + listOf(file) runTool(*command.toTypedArray()) return objectFile From b7a78deafa0f399dd485c979f6ea62ceed587970 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 25 Jan 2017 17:31:44 +0300 Subject: [PATCH 65/86] backend: Place *.bc.o files in a temporary directory for llvmLto() --- .../src/org/jetbrains/kotlin/backend/konan/LinkStage.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt index ee0106d4109..dad44117626 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/LinkStage.kt @@ -147,8 +147,9 @@ internal class LinkStage(val context: Context) { val libraries = context.config.libraries fun llvmLto(files: List): ObjectFile { - // TODO: Make it a temporary file. - val combined = "combined.o" + val tmpCombined = File.createTempFile("combined", ".o") + tmpCombined.deleteOnExit() + val combined = tmpCombined.absolutePath val tool = distribution.llvmLto val command = mutableListOf(tool, "-o", combined) @@ -165,6 +166,7 @@ internal class LinkStage(val context: Context) { val tmpObjectFile = File.createTempFile(File(file).name, ".o") tmpObjectFile.deleteOnExit() val objectFile = tmpObjectFile.absolutePath + val tool = distribution.llvmLlc val command = listOf(distribution.llvmLlc, "-o", objectFile, "-filetype=obj") + properties.propertyList("llvmLlcFlags.$suffix") + listOf(file) From cf946a7676e028615954a652244230bf6f1ff03c Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 26 Jan 2017 13:53:40 +0700 Subject: [PATCH 66/86] backend/tests: update and disable 'defaults4' --- backend.native/tests/build.gradle | 1 + backend.native/tests/codegen/function/defaults4.kt | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index e15c4d8e13d..3b14afb8967 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -172,6 +172,7 @@ task defaults3(type: RunKonanTest) { } task defaults4(type: RunKonanTest) { + disabled = true goldValue = "43\n" source = "codegen/function/defaults4.kt" } diff --git a/backend.native/tests/codegen/function/defaults4.kt b/backend.native/tests/codegen/function/defaults4.kt index 418bf1d35db..96625b8b1e9 100644 --- a/backend.native/tests/codegen/function/defaults4.kt +++ b/backend.native/tests/codegen/function/defaults4.kt @@ -2,10 +2,12 @@ open class A { open fun foo(x: Int = 42) = println(x) } -class B : A() { +open class B : A() + +class C : B() { override fun foo(x: Int) = println(x + 1) } fun main(args: Array) { - B().foo() + C().foo() } \ No newline at end of file From a97b3935e2711fb17c10f6df3f1e5fb8a577bf5f Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Wed, 25 Jan 2017 17:47:17 +0700 Subject: [PATCH 67/86] backend: rework descriptor usage * handle differently internal and exported declarations * bind LLVM declarations to descriptor instances used as keys * fix some related issues --- .../jetbrains/kotlin/backend/konan/Context.kt | 7 +- .../konan/descriptors/DescriptorUtils.kt | 21 +- .../kotlin/backend/konan/ir/ModuleIndex.kt | 12 +- .../backend/konan/llvm/BinaryInterface.kt | 154 ++++++++ .../backend/konan/llvm/CodeGenerator.kt | 17 +- .../kotlin/backend/konan/llvm/ContextUtils.kt | 104 ++---- .../kotlin/backend/konan/llvm/DataLayout.kt | 4 +- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 65 ++-- .../backend/konan/llvm/LlvmDeclarations.kt | 335 ++++++++++++++++++ .../kotlin/backend/konan/llvm/LlvmUtils.kt | 45 ++- .../kotlin/backend/konan/llvm/NameUtils.kt | 101 ------ .../backend/konan/llvm/RTTIGenerator.kt | 70 ++-- .../kotlin/backend/konan/llvm/Runtime.kt | 4 + .../kotlin/backend/konan/llvm/StaticData.kt | 38 +- .../backend/konan/llvm/StaticObjects.kt | 21 +- .../kotlin/konan/internal/RuntimeUtils.kt | 10 +- 16 files changed, 658 insertions(+), 350 deletions(-) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt delete mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index ce3152e07b7..41b4ed80cf5 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -3,10 +3,6 @@ package org.jetbrains.kotlin.backend.konan import llvm.* import org.jetbrains.kotlin.backend.konan.ir.Ir import org.jetbrains.kotlin.backend.konan.ir.ModuleIndex -import org.jetbrains.kotlin.backend.konan.llvm.Runtime -import org.jetbrains.kotlin.backend.konan.llvm.getFunctionType -import org.jetbrains.kotlin.backend.konan.llvm.StaticData -import org.jetbrains.kotlin.backend.konan.llvm.Llvm import org.jetbrains.kotlin.backend.konan.KonanBackendContext import org.jetbrains.kotlin.backend.konan.KonanPhase import org.jetbrains.kotlin.backend.konan.KonanConfig @@ -15,7 +11,7 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.backend.konan.descriptors.deepPrint -import org.jetbrains.kotlin.backend.konan.llvm.verifyModule +import org.jetbrains.kotlin.backend.konan.llvm.* import org.jetbrains.kotlin.ir.util.DumpIrTreeVisitor import java.lang.System.out @@ -50,6 +46,7 @@ internal final class Context(val config: KonanConfig) : KonanBackendContext() { } lateinit var llvm: Llvm + lateinit var llvmDeclarations: LlvmDeclarations var phase: KonanPhase? = null var depth: Int = 0 diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index 26ad0898868..15d46ded1d8 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -35,16 +35,16 @@ internal val ClassDescriptor.implementedInterfaces: List * * TODO: this method is actually a part of resolve and probably duplicates another one */ -internal val FunctionDescriptor.implementation: FunctionDescriptor - get() { - if (this.kind.isReal) { - return this - } else { - val overridden = OverridingUtil.getOverriddenDeclarations(this) - val filtered = OverridingUtil.filterOutOverridden(overridden) - return filtered.first { it.modality != Modality.ABSTRACT } as FunctionDescriptor - } +internal fun FunctionDescriptor.resolveFakeOverride(): FunctionDescriptor { + if (this.kind.isReal) { + return this + } else { + val overridden = OverridingUtil.getOverriddenDeclarations(this) + val filtered = OverridingUtil.filterOutOverridden(overridden) + // TODO: is it correct to take first? + return filtered.first { it.modality != Modality.ABSTRACT } as FunctionDescriptor } +} private val intrinsicAnnotation = FqName("konan.internal.Intrinsic") @@ -193,9 +193,6 @@ val ClassDescriptor.vtableEntries: List return inheritedVtableSlots + (methods - inheritedVtableSlots).filter { it.isOverridable } } -val ClassDescriptor.vtableSize: Int - get() = if (this.isAbstract()) 0 else this.vtableEntries.size - fun ClassDescriptor.vtableIndex(function: FunctionDescriptor): Int { this.vtableEntries.forEachIndexed { index, functionDescriptor -> if (functionDescriptor == function.original) return index diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/ModuleIndex.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/ModuleIndex.kt index 21fb20af825..2550d71dd9c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/ModuleIndex.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/ModuleIndex.kt @@ -1,5 +1,6 @@ package org.jetbrains.kotlin.backend.konan.ir +import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.IrClass @@ -8,15 +9,13 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid import org.jetbrains.kotlin.ir.visitors.acceptVoid -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.resolve.descriptorUtil.classId class ModuleIndex(val module: IrModuleFragment) { /** * Contains all classes declared in [module] */ - val classes: Map + val classes: Map /** * Contains all functions declared in [module] @@ -24,7 +23,7 @@ class ModuleIndex(val module: IrModuleFragment) { val functions = mutableMapOf() init { - val map = mutableMapOf() + val map = mutableMapOf() module.acceptVoid(object : IrElementVisitorVoid { override fun visitElement(element: IrElement) { @@ -34,10 +33,7 @@ class ModuleIndex(val module: IrModuleFragment) { override fun visitClass(declaration: IrClass) { super.visitClass(declaration) - val classId = declaration.descriptor.classId - if (classId != null) { - map[classId] = declaration - } + map[declaration.descriptor] = declaration } override fun visitFunction(declaration: IrFunction) { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt new file mode 100644 index 00000000000..c3f93302941 --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt @@ -0,0 +1,154 @@ +package org.jetbrains.kotlin.backend.konan.llvm + +import llvm.LLVMTypeRef +import org.jetbrains.kotlin.backend.konan.descriptors.allValueParameters +import org.jetbrains.kotlin.backend.konan.descriptors.isUnit +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.resolve.constants.StringValue +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.findOriginalTopMostOverriddenDescriptors +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.TypeUtils +import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty + +// This file describes the ABI for Kotlin descriptors of exported declarations. +// TODO: revise the naming scheme to ensure it produces unique names. +// TODO: do not serialize descriptors of non-exported declarations. + +/** + * Defines whether the declaration is exported, i.e. visible from other modules. + * + * Exported declarations must have predictable and stable ABI + * that doesn't depend on any internal transformations (e.g. IR lowering), + * and so should be computable from the descriptor itself without checking a backend state. + */ +internal tailrec fun DeclarationDescriptor.isExported(): Boolean { + if (this.annotations.findAnnotation(symbolNameAnnotation) != null) { + // Treat any `@SymbolName` declaration as exported. + return true + } + if (this.annotations.findAnnotation(exportForCppRuntimeAnnotation) != null) { + // Treat any `@ExportForCppRuntime` declaration as exported. + return true + } + + if (this is ConstructorDescriptor && constructedClass.kind.isSingleton) { + // Currently code generator can access the constructor of the singleton, + // so ignore visibility of the constructor itself. + return constructedClass.isExported() + } + + if (this is DeclarationDescriptorWithVisibility && !this.visibility.isPublicAPI) { + // If the declaration is explicitly marked as non-public, + // then it must not be accessible from other modules. + return false + } + + if (this is DeclarationDescriptorNonRoot) { + // If the declaration is not root, then check its container too. + return containingDeclaration.isExported() + } + + return true +} + +private val symbolNameAnnotation = FqName("konan.SymbolName") + +private val exportForCppRuntimeAnnotation = FqName("konan.internal.ExportForCppRuntime") + +private fun typeToHashString(type: KotlinType): String { + if (TypeUtils.isTypeParameter(type)) return "GENERIC" + + var hashString = TypeUtils.getClassDescriptor(type)!!.fqNameSafe.asString() + if (!type.arguments.isEmpty()) { + hashString += "<${type.arguments.map { + typeToHashString(it.type) + }.joinToString(",")}>" + } + + if (type.isMarkedNullable) hashString += "?" + return hashString +} + +private val FunctionDescriptor.signature: String + get() { + val extensionReceiverPart = this.extensionReceiverParameter?.let { "${it.type}." } ?: "" + val actualDescriptor = this.findOriginalTopMostOverriddenDescriptors().firstOrNull() ?: this + + val argsPart = actualDescriptor.valueParameters.map { + typeToHashString(it.type) + }.joinToString(";") + + // TODO: add return type + // (it is not simple because return type can be changed when overriding) + return "$extensionReceiverPart($argsPart)" + } + +// TODO: rename to indicate that it has signature included +internal val FunctionDescriptor.functionName: String + get() = with(this.original) { // basic support for generics + "$name$signature" + } + +internal val FunctionDescriptor.symbolName: String + get() { + if (!this.isExported()) { + throw AssertionError(this.toString()) + } + + this.annotations.findAnnotation(symbolNameAnnotation)?.let { + if (this.isExternal) { + return getStringValue(it)!! + } else { + // ignore; TODO: report compile error + } + } + + this.annotations.findAnnotation(exportForCppRuntimeAnnotation)?.let { + val name = getStringValue(it) ?: this.name.asString() + return name // no wrapping currently required + } + + val containingDeclarationPart = containingDeclaration.fqNameSafe.let { + if (it.isRoot) "" else "$it." + } + return "kfun:$containingDeclarationPart$functionName" + } + +private fun getStringValue(annotation: AnnotationDescriptor): String? { + annotation.allValueArguments.values.ifNotEmpty { + val stringValue = this.single() as StringValue + return stringValue.value + } + + return null +} + +// TODO: bring here dependencies of this method? +internal fun RuntimeAware.getLlvmFunctionType(function: FunctionDescriptor): LLVMTypeRef { + val original = function.original + val returnType = if (original is ConstructorDescriptor) voidType else getLLVMReturnType(original.returnType!!) + val paramTypes = ArrayList(original.allValueParameters.map { getLLVMType(it.type) }) + if (isObjectType(returnType)) paramTypes.add(kObjHeaderPtrPtr) + + return functionType(returnType, isVarArg = false, paramTypes = *paramTypes.toTypedArray()) +} + +internal val ClassDescriptor.typeInfoSymbolName: String + get() { + assert (this.isExported()) + return "ktype:" + this.fqNameSafe.toString() + } + +internal val theUnitInstanceName = "kobj:kotlin.Unit" + +internal val ClassDescriptor.objectInstanceFieldSymbolName: String + get() { + assert (this.isExported()) + assert (this.kind.isSingleton) + assert (!this.isUnit()) + + return "kobjref:$fqNameSafe" + } \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index a4e0402556e..3092f1bc544 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -23,8 +23,16 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { var localAllocs = 0 fun prologue(descriptor: FunctionDescriptor) { - prologue(llvmFunction(descriptor), + val llvmFunction = llvmFunction(descriptor) + + prologue(llvmFunction, LLVMGetReturnType(getLlvmFunctionType(descriptor))!!) + + if (!descriptor.isExported()) { + LLVMSetLinkage(llvmFunction, LLVMLinkage.LLVMPrivateLinkage) + // (Cannot do this before the function body is created). + } + if (descriptor is ConstructorDescriptor) { constructedClass = descriptor.constructedClass } @@ -300,7 +308,6 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { //-------------------------------------------------------------------------// /* to class descriptor */ - fun classType(descriptor: ClassDescriptor): LLVMTypeRef = LLVMGetTypeByName(context.llvmModule, descriptor.symbolName)!! fun typeInfoValue(descriptor: ClassDescriptor): LLVMValueRef = descriptor.llvmTypeInfoPtr /** @@ -314,12 +321,6 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { } fun countParams(fn: FunctionDescriptor) = LLVMCountParams(fn.llvmFunction) - fun indexInClass(p:PropertyDescriptor):Int { - val index = (p.containingDeclaration as ClassDescriptor).fields.indexOf(p) - assert(index >= 0) { "Unable to find property $p" } - return index - } - fun basicBlock(name: String = "label_"): LLVMBasicBlockRef { val currentBlock = this.currentBlock val result = LLVMInsertBasicBlock(currentBlock, name)!! diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index 43e6191393e..d2ac04ff9a9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -3,24 +3,15 @@ package org.jetbrains.kotlin.backend.konan.llvm import kotlinx.cinterop.* import llvm.* import org.jetbrains.kotlin.backend.konan.Context -import org.jetbrains.kotlin.backend.konan.Distribution import org.jetbrains.kotlin.backend.konan.hash.GlobalHash -import org.jetbrains.kotlin.backend.konan.KonanConfigKeys -import org.jetbrains.kotlin.backend.konan.descriptors.backingField -import org.jetbrains.kotlin.backend.konan.descriptors.vtableSize import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor import org.jetbrains.kotlin.ir.IrElement -import org.jetbrains.kotlin.ir.declarations.IrField -import org.jetbrains.kotlin.ir.declarations.IrProperty -import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.descriptorUtil.classId -import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe -import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny +import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils @@ -33,10 +24,10 @@ const val SCOPE_PERMANENT = 3 /** * Provides utility methods to the implementer. */ -internal interface ContextUtils { +internal interface ContextUtils : RuntimeAware { val context: Context - val runtime: Runtime + override val runtime: Runtime get() = context.llvm.runtime /** @@ -50,57 +41,7 @@ internal interface ContextUtils { val staticData: StaticData get() = context.llvm.staticData - /** - * All fields of the class instance. - * The order respects the class hierarchy, i.e. a class [fields] contains superclass [fields] as a prefix. - */ - val ClassDescriptor.fields: List - get() { - val superClass = this.getSuperClassNotAny() // TODO: what if Any has fields? - val superFields = if (superClass != null) superClass.fields else emptyList() - - return superFields + this.declaredFields - } - - /** - * Fields declared in the class. - */ - val ClassDescriptor.declaredFields: List - get() { - // TODO: Here's what is going on here: - // The existence of a backing field for a property is only described in the IR, - // but not in the property descriptor. - // That works, while we process the IR, but not for deserialized descriptors. - // - // So to have something in deserialized descriptors, - // while we still see the IR, we mark the property with an annotation. - // - // We could apply the annotation during IR rewite, but we still are not - // that far in the rewriting infrastructure. So we postpone - // the annotation until the serializer. - // - // In this function we check the presence of the backing filed - // two ways: first we check IR, then we check the annotation. - - val irClass = context.ir.moduleIndexForCodegen.classes[this.classId] - if (irClass != null) { - val declarations = irClass.declarations - - return declarations.mapNotNull { - when (it) { - is IrProperty -> it.backingField?.descriptor - is IrField -> it.descriptor - else -> null - } - } - } else { - val properties = this.unsubstitutedMemberScope. - getContributedDescriptors(). - filterIsInstance() - - return properties.mapNotNull{ it.backingField } - } - } + fun isExternal(descriptor: DeclarationDescriptor) = descriptor.module != context.ir.irModule.descriptor /** * LLVM function generated from the Kotlin function. @@ -112,13 +53,12 @@ internal interface ContextUtils { if (this is TypeAliasConstructorDescriptor) { return this.underlyingConstructorDescriptor.llvmFunction } - val globalName = this.symbolName - val module = context.llvmModule - val functionType = getLlvmFunctionType(this) - - return LLVMGetNamedFunction(module, globalName) ?: - LLVMAddFunction(module, globalName, functionType)!! + return if (isExternal(this)) { + context.llvm.externalFunction(this.symbolName, getLlvmFunctionType(this)) + } else { + context.llvmDeclarations.forFunction(this).llvmFunction + } } /** @@ -130,17 +70,14 @@ internal interface ContextUtils { return constValue(result) } - /** - * Pointer to struct { TypeInfo, vtable }. - */ - val ClassDescriptor.typeInfoWithVtable: ConstPointer - get() { - val type = structType(runtime.typeInfoType, LLVMArrayType(int8TypePtr, this.vtableSize)!!) - return constPointer(externalGlobal(this.typeInfoSymbolName, type)) - } - val ClassDescriptor.typeInfoPtr: ConstPointer - get() = typeInfoWithVtable.getElementPtr(0) + get() { + return if (isExternal(this)) { + constPointer(externalGlobal(this.typeInfoSymbolName, runtime.typeInfoType)) + } else { + context.llvmDeclarations.forClass(this).typeInfo + } + } /** * Pointer to type info for given class. @@ -238,13 +175,14 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) { } } - private fun externalFunction(name: String, type: LLVMTypeRef): LLVMValueRef { - val found = LLVMGetNamedFunction(context.llvmModule, name) + internal fun externalFunction(name: String, type: LLVMTypeRef): LLVMValueRef { + val found = LLVMGetNamedFunction(llvmModule, name) if (found != null) { assert (getFunctionType(found) == type) + assert (LLVMGetLinkage(found) == LLVMLinkage.LLVMExternalLinkage) return found } else { - return LLVMAddFunction(context.llvmModule, name, type)!! + return LLVMAddFunction(llvmModule, name, type)!! } } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DataLayout.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DataLayout.kt index 5812584b505..4f03338f621 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DataLayout.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/DataLayout.kt @@ -6,7 +6,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.typeUtil.isUnit -internal fun ContextUtils.getLLVMType(type: KotlinType): LLVMTypeRef { +internal fun RuntimeAware.getLLVMType(type: KotlinType): LLVMTypeRef { return when { // Nullable types must be represented as objects for boxing. type.isMarkedNullable -> this.kObjHeaderPtr @@ -23,7 +23,7 @@ internal fun ContextUtils.getLLVMType(type: KotlinType): LLVMTypeRef { }!! } -internal fun ContextUtils.getLLVMReturnType(type: KotlinType): LLVMTypeRef { +internal fun RuntimeAware.getLLVMReturnType(type: KotlinType): LLVMTypeRef { return when { type.isUnit() -> LLVMVoidType()!! // TODO: stdlib have methods taking Nothing, such as kotlin.collections.EmptySet.contains(). diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 783d8af129b..7bd120c96f3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.ir.visitors.acceptVoid import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorUtils -import org.jetbrains.kotlin.resolve.descriptorUtil.classId import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe import org.jetbrains.kotlin.types.KotlinType @@ -41,6 +40,8 @@ internal fun emitLLVM(context: Context) { val llvmModule = LLVMModuleCreateWithName("out")!! // TODO: dispose context.llvmModule = llvmModule + context.llvmDeclarations = createLlvmDeclarations(context) + val phaser = PhaseManager(context) phaser.phase(KonanPhase.RTTI) { @@ -83,11 +84,6 @@ internal class RTTIGeneratorVisitor(context: Context) : IrElementVisitorVoid { override fun visitClass(declaration: IrClass) { super.visitClass(declaration) - if (declaration.descriptor.kind == ClassKind.ANNOTATION_CLASS) { - // do not generate any RTTI for annotation classes as a workaround for link errors - return - } - if (declaration.descriptor.isIntrinsic) { // do not generate any code for intrinsic classes as they require special handling return @@ -254,7 +250,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val kNodeInitType = LLVMGetTypeByName(context.llvmModule, "struct.InitNode")!! //-------------------------------------------------------------------------// - fun createInitBody(initName: String) { + fun createInitBody(initName: String): LLVMValueRef { val initFunction = LLVMAddFunction(context.llvmModule, initName, kVoidFuncType)!! // create LLVM function codegen.prologue(initFunction, voidType) using(FunctionScope(initFunction)) { @@ -262,33 +258,33 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val irField = it as IrField val descriptor = irField.descriptor val initialization = evaluateExpression(irField.initializer!!.expression) - val globalPtr = LLVMGetNamedGlobal(context.llvmModule, descriptor.symbolName) - codegen.storeAnyGlobal(initialization, globalPtr!!) + val globalPtr = context.llvmDeclarations.forStaticField(descriptor).storage + codegen.storeAnyGlobal(initialization, globalPtr) } codegen.ret(null) } codegen.epilogue() + + return initFunction } //-------------------------------------------------------------------------// // Creates static struct InitNode $nodeName = {$initName, NULL}; - fun createInitNode(initName: String, nodeName: String) { + fun createInitNode(initFunction: LLVMValueRef, nodeName: String): LLVMValueRef { memScoped { - val initFunction = LLVMGetNamedFunction(context.llvmModule, initName)!! // Get initialization function. val nextInitNode = LLVMConstNull(pointerType(kNodeInitType)) // Set InitNode.next = NULL. val argList = allocArrayOf(initFunction, nextInitNode)[0].ptr // Allocate array of args. val initNode = LLVMConstNamedStruct(kNodeInitType, argList, 2)!! // Create static object of class InitNode. - context.llvm.staticData.placeGlobal(nodeName, constPointer(initNode)).llvmGlobal // Put the object in global var with name "nodeName". + return context.llvm.staticData.placeGlobal(nodeName, constPointer(initNode)).llvmGlobal // Put the object in global var with name "nodeName". } } //-------------------------------------------------------------------------// - fun createInitCtor(ctorName: String, nodeName: String) { + fun createInitCtor(ctorName: String, initNodePtr: LLVMValueRef) { val ctorFunction = LLVMAddFunction(context.llvmModule, ctorName, kVoidFuncType)!! // Create constructor function. codegen.prologue(ctorFunction, voidType) - val initNodePtr = LLVMGetNamedGlobal(context.llvmModule, nodeName)!! // Get LLVM function initializing globals of current file. codegen.call(context.llvm.appendToInitalizersTail, initNodePtr.singletonList()) // Add node to the tail of initializers list. codegen.ret(null) codegen.epilogue() @@ -313,9 +309,9 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val nodeName = "${fileName}_node_${context.llvm.globalInitIndex}" val ctorName = "${fileName}_ctor_${context.llvm.globalInitIndex++}" - createInitBody(initName) - createInitNode(initName, nodeName) - createInitCtor(ctorName, nodeName) + val initFunction = createInitBody(initName) + val initNode = createInitNode(initFunction, nodeName) + createInitCtor(ctorName, initNode) } //-------------------------------------------------------------------------// @@ -388,15 +384,13 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid if (constructorDescriptor.isPrimary) { if (DescriptorUtils.isObject(classDescriptor)) { - if (classDescriptor.isUnit()) { - context.llvm.staticData.createUnitInstance(classDescriptor) - } else { + if (!classDescriptor.isUnit()) { val objectPtr = objectPtrByName(classDescriptor) LLVMSetInitializer(objectPtr, codegen.kNullObjHeaderPtr) } } - val irOfCurrentClass = context.ir.moduleIndexForCodegen.classes[classDescriptor.classId] + val irOfCurrentClass = context.ir.moduleIndexForCodegen.classes[classDescriptor] irOfCurrentClass!!.acceptChildrenVoid(object : IrElementVisitorVoid { override fun visitElement(element: IrElement) { element.acceptChildrenVoid(this) @@ -612,13 +606,17 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val descriptor = expression.descriptor if (descriptor.containingDeclaration is PackageFragmentDescriptor) { val type = codegen.getLLVMType(descriptor.type) - val globalProperty = LLVMAddGlobal(context.llvmModule, type, descriptor.symbolName) + val globalProperty = context.llvmDeclarations.forStaticField(descriptor).storage if (expression.initializer!!.expression is IrConst<*>) { LLVMSetInitializer(globalProperty, evaluateExpression(expression.initializer!!.expression)) } else { LLVMSetInitializer(globalProperty, LLVMConstNull(type)) context.llvm.fileInitializers.add(expression) } + + LLVMSetLinkage(globalProperty, LLVMLinkage.LLVMPrivateLinkage) + // (Cannot do this before the global is initialized). + return } } @@ -1363,7 +1361,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } else { assert (value.receiver == null) - val ptr = LLVMGetNamedGlobal(context.llvmModule, value.descriptor.symbolName)!! + val ptr = context.llvmDeclarations.forStaticField(value.descriptor).storage return codegen.loadSlot(ptr, value.descriptor.isVar()) } } @@ -1372,13 +1370,12 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid private fun objectPtrByName(descriptor: ClassDescriptor): LLVMValueRef { assert (!descriptor.isUnit()) - val objName = descriptor.fqNameSafe.asString() - var objectPtr = LLVMGetNamedGlobal(context.llvmModule, objName) - if (objectPtr == null) { + return if (codegen.isExternal(descriptor)) { val llvmType = codegen.getLLVMType(descriptor.defaultType) - objectPtr = LLVMAddGlobal(context.llvmModule, llvmType, objName) + codegen.externalGlobal(descriptor.objectInstanceFieldSymbolName, llvmType) + } else { + context.llvmDeclarations.forSingleton(descriptor).instanceFieldRef } - return objectPtr!! } //-------------------------------------------------------------------------// @@ -1392,8 +1389,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } else { assert (value.receiver == null) - val globalValue = LLVMGetNamedGlobal(context.llvmModule, value.descriptor.symbolName) - codegen.storeAnyGlobal(valueToAssign, globalValue!!) + val globalValue = context.llvmDeclarations.forStaticField(value.descriptor).storage + codegen.storeAnyGlobal(valueToAssign, globalValue) } assert (value.type.isUnit()) @@ -1435,12 +1432,14 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid */ private fun fieldPtrOfClass(thisPtr: LLVMValueRef, value: PropertyDescriptor): LLVMValueRef { - val typePtr = pointerType(codegen.classType(value.containingDeclaration as ClassDescriptor)) + val fieldInfo = context.llvmDeclarations.forField(value) + + val typePtr = pointerType(fieldInfo.classBodyType) memScoped { val args = allocArrayOf(kImmOne) val objectPtr = LLVMBuildGEP(codegen.builder, thisPtr, args[0].ptr, 1, "") val typedObjPtr = codegen.bitcast(typePtr, objectPtr!!) - val fieldPtr = LLVMBuildStructGEP(codegen.builder, typedObjPtr, codegen.indexInClass(value), "") + val fieldPtr = LLVMBuildStructGEP(codegen.builder, typedObjPtr, fieldInfo.index, "") return fieldPtr!! } } @@ -1853,7 +1852,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid //-------------------------------------------------------------------------// fun callDirect(descriptor: FunctionDescriptor, args: List): LLVMValueRef { - val realDescriptor = DescriptorUtils.unwrapFakeOverride(descriptor) + val realDescriptor = descriptor.resolveFakeOverride().original val llvmFunction = codegen.functionLlvmValue(realDescriptor) return call(descriptor, llvmFunction, args) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt new file mode 100644 index 00000000000..7681cbef81e --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt @@ -0,0 +1,335 @@ +package org.jetbrains.kotlin.backend.konan.llvm + +import kotlinx.cinterop.* +import llvm.* +import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.backend.konan.descriptors.* +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny + +internal fun createLlvmDeclarations(context: Context): LlvmDeclarations { + val generator = DeclarationsGeneratorVisitor(context) + context.ir.irModule.acceptChildrenVoid(generator) + return with(generator) { + LlvmDeclarations( + functions, classes, fields, staticFields, theUnitInstanceRef + ) + } + +} + +internal class LlvmDeclarations( + private val functions: Map, + private val classes: Map, + private val fields: Map, + private val staticFields: Map, + private val theUnitInstanceRef: ConstPointer? +) { + fun forFunction(descriptor: FunctionDescriptor) = functions[descriptor] ?: + error(descriptor.toString()) + + fun forClass(descriptor: ClassDescriptor) = classes[descriptor] ?: + error(descriptor.toString()) + + fun forField(descriptor: PropertyDescriptor) = fields[descriptor] ?: + error(descriptor.toString()) + + fun forStaticField(descriptor: PropertyDescriptor) = staticFields[descriptor] ?: + error(descriptor.toString()) + + fun forSingleton(descriptor: ClassDescriptor) = forClass(descriptor).singletonDeclarations ?: + error(descriptor.toString()) + + fun getUnitInstanceRef() = theUnitInstanceRef ?: error("") + +} + +internal class ClassLlvmDeclarations( + val bodyType: LLVMTypeRef, + val fields: List, // TODO: it is not an LLVM declaration. + val typeInfoGlobal: StaticData.Global, + val typeInfo: ConstPointer, + val singletonDeclarations: SingletonLlvmDeclarations?) + +internal class SingletonLlvmDeclarations(val instanceFieldRef: LLVMValueRef) + +internal class FunctionLlvmDeclarations(val llvmFunction: LLVMValueRef) + +internal class FieldLlvmDeclarations(val index: Int, val classBodyType: LLVMTypeRef) + +internal class StaticFieldLlvmDeclarations(val storage: LLVMValueRef) + +// TODO: rework getFields and getDeclaredFields. + +/** + * All fields of the class instance. + * The order respects the class hierarchy, i.e. a class [fields] contains superclass [fields] as a prefix. + */ +private fun getFields(context: Context, classDescriptor: ClassDescriptor): List { + val superClass = classDescriptor.getSuperClassNotAny() // TODO: what if Any has fields? + val superFields = if (superClass != null) getFields(context, superClass) else emptyList() + + return superFields + getDeclaredFields(context, classDescriptor) +} + +/** + * Fields declared in the class. + */ +private fun getDeclaredFields(context: Context, classDescriptor: ClassDescriptor): List { + // TODO: Here's what is going on here: + // The existence of a backing field for a property is only described in the IR, + // but not in the property descriptor. + // That works, while we process the IR, but not for deserialized descriptors. + // + // So to have something in deserialized descriptors, + // while we still see the IR, we mark the property with an annotation. + // + // We could apply the annotation during IR rewite, but we still are not + // that far in the rewriting infrastructure. So we postpone + // the annotation until the serializer. + // + // In this function we check the presence of the backing filed + // two ways: first we check IR, then we check the annotation. + + val irClass = context.ir.moduleIndexForCodegen.classes[classDescriptor] + if (irClass != null) { + val declarations = irClass.declarations + + return declarations.mapNotNull { + when (it) { + is IrProperty -> it.backingField?.descriptor + is IrField -> it.descriptor + else -> null + } + } + } else { + val properties = classDescriptor.unsubstitutedMemberScope. + getContributedDescriptors(). + filterIsInstance() + + return properties.mapNotNull { it.backingField } + } +} + +private fun ContextUtils.createClassBodyType(name: String, fields: List): LLVMTypeRef { + val fieldTypes = fields.map { getLLVMType(it.type) }.toTypedArray() + + val classType = LLVMStructCreateNamed(LLVMGetModuleContext(context.llvmModule), name)!! + + memScoped { + val fieldTypesNativeArrayPtr = allocArrayOf(*fieldTypes)[0].ptr + LLVMStructSetBody(classType, fieldTypesNativeArrayPtr, fieldTypes.size, 0) + } + return classType +} + +private class DeclarationsGeneratorVisitor(override val context: Context) : + IrElementVisitorVoid, ContextUtils { + + val functions = mutableMapOf() + val classes = mutableMapOf() + val fields = mutableMapOf() + val staticFields = mutableMapOf() + var theUnitInstanceRef: ConstPointer? = null + + private class Namer(val prefix: String) { + private val names = mutableMapOf() + private val counts = mutableMapOf() + + fun getName(parent: FqName, descriptor: DeclarationDescriptor): Name { + return names.getOrPut(descriptor) { + val count = counts.getOrDefault(parent, 0) + 1 + counts[parent] = count + Name.identifier(prefix + count) + } + } + } + + val objectNamer = Namer("object-") + + private fun getLocalName(parent: FqName, descriptor: DeclarationDescriptor): Name { + if (DescriptorUtils.isAnonymousObject(descriptor)) { + return objectNamer.getName(parent, descriptor) + } + + return descriptor.name + } + + private fun getFqName(descriptor: DeclarationDescriptor): FqName { + if (descriptor is PackageFragmentDescriptor) { + return descriptor.fqName + } + + + val containingDeclaration = descriptor.containingDeclaration + val parent = if (containingDeclaration != null) { + getFqName(containingDeclaration) + } else { + FqName.ROOT + } + + val localName = getLocalName(parent, descriptor) + return parent.child(localName) + } + + /** + * Produces the name to be used for non-exported LLVM declarations corresponding to [descriptor]. + * + * Note: since these declarations are going to be private, the name is only required not to clash with any + * exported declarations. + */ + private fun qualifyInternalName(descriptor: DeclarationDescriptor): String { + return getFqName(descriptor).asString() + "#internal" + } + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitClass(declaration: IrClass) { + + if (declaration.descriptor.isIntrinsic) { + // do not generate any declarations for intrinsic classes as they require special handling + } else { + this.classes[declaration.descriptor] = createClassDeclarations(declaration) + } + + super.visitClass(declaration) + } + + private fun createClassDeclarations(declaration: IrClass): ClassLlvmDeclarations { + val descriptor = declaration.descriptor + + val internalName = qualifyInternalName(descriptor) + + val fields = getFields(context, descriptor) + val bodyType = createClassBodyType("kclassbody:$internalName", fields) + + val typeInfoPtr: ConstPointer + val typeInfoGlobal: StaticData.Global + + val typeInfoSymbolName = if (descriptor.isExported()) { + descriptor.typeInfoSymbolName + } else { + "ktype:$internalName" + } + + if (!descriptor.isAbstract()) { + // Create the special global consisting of TypeInfo and vtable. + + val typeInfoGlobalName = "ktypeglobal:$internalName" + + val typeInfoWithVtableType = structType( + runtime.typeInfoType, + LLVMArrayType(int8TypePtr, descriptor.vtableEntries.size)!! + ) + + typeInfoGlobal = staticData.createGlobal(typeInfoWithVtableType, typeInfoGlobalName, isExported = false) + + val llvmTypeInfoPtr = LLVMAddAlias(context.llvmModule, + kTypeInfoPtr, + typeInfoGlobal.pointer.getElementPtr(0).llvm, + typeInfoSymbolName)!! + + if (!descriptor.isExported()) { + LLVMSetLinkage(llvmTypeInfoPtr, LLVMLinkage.LLVMPrivateLinkage) + } + + typeInfoPtr = constPointer(llvmTypeInfoPtr) + + } else { + typeInfoGlobal = staticData.createGlobal(runtime.typeInfoType, + typeInfoSymbolName, + isExported = descriptor.isExported()) + + typeInfoPtr = typeInfoGlobal.pointer + } + + val singletonDeclarations = if (descriptor.kind.isSingleton) { + createSingletonDeclarations(descriptor, typeInfoPtr, bodyType) + } else { + null + } + + return ClassLlvmDeclarations(bodyType, fields, typeInfoGlobal, typeInfoPtr, singletonDeclarations) + } + + private fun createSingletonDeclarations( + descriptor: ClassDescriptor, + typeInfoPtr: ConstPointer, + bodyType: LLVMTypeRef + ): SingletonLlvmDeclarations? { + + if (descriptor.isUnit()) { + this.theUnitInstanceRef = staticData.createUnitInstance(descriptor, bodyType, typeInfoPtr) + return null + } + + val symbolName = if (descriptor.isExported()) { + descriptor.objectInstanceFieldSymbolName + } else { + "kobjref:" + qualifyInternalName(descriptor) + } + val instanceFieldRef = LLVMAddGlobal( + context.llvmModule, + getLLVMType(descriptor.defaultType), + symbolName + )!! + + return SingletonLlvmDeclarations(instanceFieldRef) + } + + override fun visitField(declaration: IrField) { + super.visitField(declaration) + + val descriptor = declaration.descriptor + + val dispatchReceiverParameter = descriptor.dispatchReceiverParameter + if (dispatchReceiverParameter != null) { + val containingClass = dispatchReceiverParameter.containingDeclaration + val classDeclarations = this.classes[containingClass] ?: error(containingClass.toString()) + + val allFields = classDeclarations.fields + + this.fields[descriptor] = FieldLlvmDeclarations( + allFields.indexOf(descriptor), + classDeclarations.bodyType + ) + } else { + + // Fields are module-private, so we use internal name: + val name = "kvar:" + qualifyInternalName(descriptor) + + val storage = LLVMAddGlobal(context.llvmModule, getLLVMType(descriptor.type), name)!! + + this.staticFields[descriptor] = StaticFieldLlvmDeclarations(storage) + } + } + + override fun visitFunction(declaration: IrFunction) { + super.visitFunction(declaration) + + val descriptor = declaration.descriptor + val llvmFunctionType = getLlvmFunctionType(descriptor) + + val llvmFunction = if (descriptor.isExternal) { + context.llvm.externalFunction(descriptor.symbolName, llvmFunctionType) + } else { + val symbolName = if (descriptor.isExported()) { + descriptor.symbolName + } else { + "kfun:" + qualifyInternalName(descriptor) + } + LLVMAddFunction(context.llvmModule, symbolName, llvmFunctionType)!! + } + + this.functions[descriptor] = FunctionLlvmDeclarations(llvmFunction) + } +} diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt index ae5155e8330..ad3270372e7 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmUtils.kt @@ -111,21 +111,21 @@ internal val ContextUtils.kTheAnyTypeInfo: LLVMValueRef get() = KonanPlatform.builtIns.any.llvmTypeInfoPtr internal val ContextUtils.kTheArrayTypeInfo: LLVMValueRef get() = KonanPlatform.builtIns.array.llvmTypeInfoPtr -internal val ContextUtils.kTypeInfo: LLVMTypeRef - get() = LLVMGetTypeByName(context.llvmModule, "struct.TypeInfo")!! -internal val ContextUtils.kObjHeader: LLVMTypeRef - get() = LLVMGetTypeByName(context.llvmModule, "struct.ObjHeader")!! -internal val ContextUtils.kContainerHeader: LLVMTypeRef - get() = LLVMGetTypeByName(context.llvmModule, "struct.ContainerHeader")!! -internal val ContextUtils.kObjHeaderPtr: LLVMTypeRef +internal val RuntimeAware.kTypeInfo: LLVMTypeRef + get() = runtime.typeInfoType +internal val RuntimeAware.kObjHeader: LLVMTypeRef + get() = runtime.objHeaderType +internal val RuntimeAware.kContainerHeader: LLVMTypeRef + get() = runtime.containerHeaderType +internal val RuntimeAware.kObjHeaderPtr: LLVMTypeRef get() = pointerType(kObjHeader) -internal val ContextUtils.kObjHeaderPtrPtr: LLVMTypeRef +internal val RuntimeAware.kObjHeaderPtrPtr: LLVMTypeRef get() = pointerType(kObjHeaderPtr) -internal val ContextUtils.kArrayHeader: LLVMTypeRef - get() = LLVMGetTypeByName(context.llvmModule, "struct.ArrayHeader")!! -internal val ContextUtils.kArrayHeaderPtr: LLVMTypeRef +internal val RuntimeAware.kArrayHeader: LLVMTypeRef + get() = runtime.arrayHeaderType +internal val RuntimeAware.kArrayHeaderPtr: LLVMTypeRef get() = pointerType(kArrayHeader) -internal val ContextUtils.kTypeInfoPtr: LLVMTypeRef +internal val RuntimeAware.kTypeInfoPtr: LLVMTypeRef get() = pointerType(kTypeInfo) internal val kInt1 = LLVMInt1Type()!! internal val kBoolean = kInt1 @@ -151,18 +151,6 @@ internal fun structType(types: List): LLVMTypeRef = memScoped { LLVMStructType(allocArrayOf(types)[0].ptr, types.size, 0)!! } -internal fun ContextUtils.getLlvmFunctionType(function: FunctionDescriptor): LLVMTypeRef { - val original = function.original - val returnType = if (original is ConstructorDescriptor) voidType else getLLVMReturnType(original.returnType!!) - val paramTypes = ArrayList(original.allValueParameters.map { getLLVMType(it.type) }) - if (isObjectType(returnType)) paramTypes.add(kObjHeaderPtrPtr) - - memScoped { - val paramTypesPtr = allocArrayOf(paramTypes)[0].ptr - return LLVMFunctionType(returnType, paramTypesPtr, paramTypes.size, 0)!! - } -} - internal fun ContextUtils.numParameters(functionType: LLVMTypeRef) : Int { // Note that type is usually function pointer, so we have to dereference it. return LLVMCountParamTypes(LLVMGetElementType(functionType))!! @@ -178,7 +166,7 @@ internal fun ContextUtils.isObjectRef(value: LLVMValueRef): Boolean { return isObjectType(value.type) } -internal fun ContextUtils.isObjectType(type: LLVMTypeRef): Boolean { +internal fun RuntimeAware.isObjectType(type: LLVMTypeRef): Boolean { return type == kObjHeaderPtr || type == kArrayHeaderPtr } @@ -200,6 +188,7 @@ internal fun ContextUtils.externalGlobal(name: String, type: LLVMTypeRef): LLVMV val found = LLVMGetNamedGlobal(context.llvmModule, name) if (found != null) { assert (getGlobalType(found) == type) + assert (LLVMGetInitializer(found) == null) return found } else { return LLVMAddGlobal(context.llvmModule, type, name)!! @@ -227,3 +216,9 @@ internal operator fun LLVMAttributeSet.contains(attribute: LLVMAttribute): Boole return (this and attribute.value) != 0 } +fun getStructElements(type: LLVMTypeRef): List { + val count = LLVMCountStructElementTypes(type) + return (0 until count).map { + LLVMStructGetTypeAtIndex(type, it)!! + } +} \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt deleted file mode 100644 index 8b155bc9733..00000000000 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/NameUtils.kt +++ /dev/null @@ -1,101 +0,0 @@ -package org.jetbrains.kotlin.backend.konan.llvm - -import org.jetbrains.kotlin.backend.konan.descriptors.isInterface -import org.jetbrains.kotlin.builtins.KotlinBuiltIns -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.ClassKind.* -import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.resolve.OverridingUtil -import org.jetbrains.kotlin.resolve.constants.StringValue -import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe -import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny -import org.jetbrains.kotlin.resolve.findOriginalTopMostOverriddenDescriptors -import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.TypeUtils -import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty - - -private val symbolNameAnnotation = FqName("konan.SymbolName") - -private val exportForCppRuntimeAnnotation = FqName("konan.internal.ExportForCppRuntime") - -fun typeToHashString(type: KotlinType): String { - if (TypeUtils.isTypeParameter(type)) return "GENERIC" - - var hashString = TypeUtils.getClassDescriptor(type)!!.fqNameSafe.asString() - if (!type.arguments.isEmpty()) { - hashString += "<${type.arguments.map { - typeToHashString(it.type) - }.joinToString(",")}>" - } - - if (type.isMarkedNullable) hashString += "?" - return hashString -} - -private val FunctionDescriptor.signature: String - get() { - val extensionReceiverPart = this.extensionReceiverParameter?.let { "${it.type}." } ?: "" - val actualDescriptor = this.findOriginalTopMostOverriddenDescriptors().firstOrNull() ?: this - - val argsPart = actualDescriptor.valueParameters.map { - typeToHashString(it.type) - }.joinToString(";") - - // TODO: add return type - // (it is not simple because return type can be changed when overriding) - return "$extensionReceiverPart($argsPart)" - } - -// TODO: rename to indicate that it has signature included -internal val FunctionDescriptor.functionName: String - get() = with(this.original) { // basic support for generics - "$name$signature" - } - -internal val FunctionDescriptor.symbolName: String - get() { - this.annotations.findAnnotation(symbolNameAnnotation)?.let { - if (this.isExternal) { - return getStringValue(it)!! - } else { - // ignore; TODO: report compile error - } - } - - this.annotations.findAnnotation(exportForCppRuntimeAnnotation)?.let { - val name = getStringValue(it) ?: this.name.asString() - return name // no wrapping currently required - } - - val containingDeclarationPart = containingDeclaration.fqNameSafe.let { - if (it.isRoot) "" else "$it." - } - return "kfun:$containingDeclarationPart$functionName" - } - -private fun getStringValue(annotation: AnnotationDescriptor): String? { - annotation.allValueArguments.values.ifNotEmpty { - val stringValue = this.single() as StringValue - return stringValue.value - } - - return null -} - -internal val ClassDescriptor.symbolName: String - get() = when (this.kind) { - CLASS -> "kclass:" - INTERFACE -> "kinf:" - OBJECT -> "kclass:" - ENUM_CLASS -> "kclass:" - ENUM_ENTRY -> "kclass:" - else -> TODO("fixme: " + this.kind) - } + fqNameSafe - -internal val ClassDescriptor.typeInfoSymbolName: String - get() = "ktype:" + this.fqNameSafe.toString() - -internal val PropertyDescriptor.symbolName:String -get() = "kvar:${this.containingDeclaration.name.asString()}.${this.name.asString()}" \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/RTTIGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/RTTIGenerator.kt index f50e23e5858..53937485183 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/RTTIGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/RTTIGenerator.kt @@ -1,7 +1,5 @@ package org.jetbrains.kotlin.backend.konan.llvm - -import kotlinx.cinterop.* import llvm.* import org.jetbrains.kotlin.backend.konan.Context import org.jetbrains.kotlin.backend.konan.descriptors.* @@ -52,18 +50,6 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils { Int32(fieldsCount) ) - // TODO: probably it should be moved out of this class and shared. - private fun createStructFor(className: FqName, fields: List): LLVMTypeRef? { - val classType = LLVMStructCreateNamed(LLVMGetModuleContext(context.llvmModule), "kclass:" + className) - val fieldTypes = fields.map { getLLVMType(it.returnType!!) }.toTypedArray() - - memScoped { - val fieldTypesNativeArrayPtr = allocArrayOf(*fieldTypes)[0].ptr - LLVMStructSetBody(classType, fieldTypesNativeArrayPtr, fieldTypes.size, 0) - } - return classType - } - private fun exportTypeInfoIfRequired(classDesc: ClassDescriptor, typeInfoGlobal: LLVMValueRef?) { val annot = classDesc.annotations.findAnnotation(FqName("konan.ExportTypeInfo")) if (annot != null) { @@ -97,11 +83,13 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils { val className = classDesc.fqNameSafe - val classType = createStructFor(className, classDesc.fields) + val llvmDeclarations = context.llvmDeclarations.forClass(classDesc) + + val bodyType = llvmDeclarations.bodyType val name = className.globalHash - val size = getInstanceSize(classType, className) + val size = getInstanceSize(bodyType, className) val superTypeOrAny = classDesc.getSuperClassOrAny() val superType = if (KotlinBuiltIns.isAny(classDesc)) NullPointer(runtime.typeInfoType) @@ -111,51 +99,39 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils { val interfacesPtr = staticData.placeGlobalConstArray("kintf:$className", pointerType(runtime.typeInfoType), interfaces) - val refFieldIndices = classDesc.fields.mapIndexedNotNull { index, field -> - val type = field.returnType!! - if (isObjectType(getLLVMType(type))) { - index + // TODO: reuse offsets obtained for 'fields' below + val objOffsets = getStructElements(bodyType).mapIndexedNotNull { index, type -> + if (isObjectType(type)) { + LLVMOffsetOfElement(llvmTargetData, bodyType, index) } else { null } } - // TODO: reuse offsets obtained for 'fields' below - val objOffsets = refFieldIndices.map { LLVMOffsetOfElement(llvmTargetData, classType, it) } + val objOffsetsPtr = staticData.placeGlobalConstArray("krefs:$className", int32Type, objOffsets.map { Int32(it.toInt()) }) - val fields = classDesc.fields.mapIndexed { index, field -> + val fields = llvmDeclarations.fields.mapIndexed { index, field -> // Note: using FQ name because a class may have multiple fields with the same name due to property overriding val nameSignature = field.fqNameSafe.localHash // FIXME: add signature - val fieldOffset = LLVMOffsetOfElement(llvmTargetData, classType, index) + val fieldOffset = LLVMOffsetOfElement(llvmTargetData, bodyType, index) FieldTableRecord(nameSignature, fieldOffset.toInt()) }.sortedBy { it.nameSignature.value } val fieldsPtr = staticData.placeGlobalConstArray("kfields:$className", runtime.fieldTableRecordType, fields) - val vtableEntries: List - val methods: List - - if (!classDesc.isAbstract()) { - // TODO: compile-time resolution limits binary compatibility - vtableEntries = classDesc.vtableEntries.map { it.implementation.entryPointAddress } - - methods = classDesc.methodTableEntries.map { + val methods = if (!classDesc.isAbstract()) { + classDesc.methodTableEntries.map { val nameSignature = it.functionName.localHash // TODO: compile-time resolution limits binary compatibility - val methodEntryPoint = it.implementation.entryPointAddress + val methodEntryPoint = it.resolveFakeOverride().original.entryPointAddress MethodTableRecord(nameSignature, methodEntryPoint) }.sortedBy { it.nameSignature.value } } else { - vtableEntries = emptyList() - methods = emptyList() + emptyList() } - assert (vtableEntries.size == classDesc.vtableSize) - - val vtable = ConstArray(int8TypePtr, vtableEntries) - val methodsPtr = staticData.placeGlobalConstArray("kmethods:$className", runtime.methodTableRecordType, methods) @@ -166,9 +142,19 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils { methodsPtr, methods.size, fieldsPtr, if (classDesc.isInterface) -1 else fields.size) - val typeInfoGlobal = classDesc.typeInfoWithVtable.llvm // TODO: it is a hack - LLVMSetInitializer(typeInfoGlobal, Struct(typeInfo, vtable).llvm) - LLVMSetGlobalConstant(typeInfoGlobal, 1) + val typeInfoGlobal = llvmDeclarations.typeInfoGlobal + + val typeInfoGlobalValue = if (classDesc.isAbstract()) { + typeInfo + } else { + // TODO: compile-time resolution limits binary compatibility + val vtableEntries = classDesc.vtableEntries.map { it.resolveFakeOverride().original.entryPointAddress } + val vtable = ConstArray(int8TypePtr, vtableEntries) + Struct(typeInfo, vtable) + } + + typeInfoGlobal.setInitializer(typeInfoGlobalValue) + typeInfoGlobal.setConstant(true) exportTypeInfoIfRequired(classDesc, classDesc.llvmTypeInfoPtr) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt index 76c97f54cc2..43a7e145052 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/Runtime.kt @@ -3,6 +3,10 @@ package org.jetbrains.kotlin.backend.konan.llvm import kotlinx.cinterop.* import llvm.* +interface RuntimeAware { + val runtime: Runtime +} + class Runtime(private val bitcodeFile: String) { val llvmModule: LLVMModuleRef diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt index 94f3706a4a2..61ff132c58d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt @@ -15,34 +15,34 @@ internal class StaticData(override val context: Context): ContextUtils { class Global private constructor(val staticData: StaticData, val llvmGlobal: LLVMValueRef) { companion object { - private fun createLlvmGlobal(module: LLVMModuleRef, type: LLVMTypeRef, name: String): LLVMValueRef { - val isUnnamed = (name == "") // LLVM will select the unique index and represent the global as `@idx`. + private fun createLlvmGlobal(module: LLVMModuleRef, + type: LLVMTypeRef, + name: String, + isExported: Boolean + ): LLVMValueRef { - if (!isUnnamed) { - LLVMGetNamedGlobal(module, name)?.let { existingGlobal -> - if (getGlobalType(existingGlobal) != type || LLVMGetInitializer(existingGlobal) != null) { - throw IllegalArgumentException("Global '$name' already exists") - } else { - return existingGlobal - } - } + if (isExported && LLVMGetNamedGlobal(module, name) != null) { + throw IllegalArgumentException("Global '$name' already exists") } val llvmGlobal = LLVMAddGlobal(module, type, name)!! - if (isUnnamed) { - // Currently using unnamed globals may result in link errors due to symbol redefinition; - // apply the workaround: + if (!isExported) { LLVMSetLinkage(llvmGlobal, LLVMLinkage.LLVMPrivateLinkage) } return llvmGlobal } - fun create(staticData: StaticData, type: LLVMTypeRef, name: String): Global { + fun create(staticData: StaticData, type: LLVMTypeRef, name: String, isExported: Boolean): Global { val module = staticData.context.llvmModule - val llvmGlobal = createLlvmGlobal(module!!, type, name) + val isUnnamed = (name == "") // LLVM will select the unique index and represent the global as `@idx`. + if (isUnnamed && isExported) { + throw IllegalArgumentException("unnamed global can't be exported") + } + + val llvmGlobal = createLlvmGlobal(module!!, type, name, isExported) return Global(staticData, llvmGlobal) } } @@ -110,15 +110,15 @@ internal class StaticData(override val context: Context): ContextUtils { * * It is external until explicitly initialized with [Global.setInitializer]. */ - fun createGlobal(type: LLVMTypeRef, name: String): Global { - return Global.create(this, type, name) + fun createGlobal(type: LLVMTypeRef, name: String, isExported: Boolean = false): Global { + return Global.create(this, type, name, isExported) } /** * Creates [Global] with given name and value. */ - fun placeGlobal(name: String, initializer: ConstValue): Global { - val global = createGlobal(initializer.llvmType, name) + fun placeGlobal(name: String, initializer: ConstValue, isExported: Boolean = false): Global { + val global = createGlobal(initializer.llvmType, name, isExported) global.setInitializer(initializer) return global } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticObjects.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticObjects.kt index 97d9cd547ab..9e51168714b 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticObjects.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticObjects.kt @@ -117,16 +117,23 @@ internal fun StaticData.createArrayList(elementType: TypeProjection, array: Cons return createKotlinObject(type, body) } -private val theUnitInstanceName = "kobj:kotlin.Unit" - -internal fun StaticData.createUnitInstance(descriptor: ClassDescriptor): ConstPointer { +internal fun StaticData.createUnitInstance(descriptor: ClassDescriptor, + bodyType: LLVMTypeRef, + typeInfo: ConstPointer +): ConstPointer { assert (descriptor.isUnit()) - assert (descriptor.fields.isEmpty()) - val typeInfo = descriptor.defaultType.typeInfoPtr!! + assert (getStructElements(bodyType).isEmpty()) val objHeader = objHeader(typeInfo) - val global = this.placeGlobal(theUnitInstanceName, objHeader) + val global = this.placeGlobal(theUnitInstanceName, objHeader, isExported = true) return global.pointer } internal val ContextUtils.theUnitInstanceRef: ConstPointer - get() = constPointer(externalGlobal(theUnitInstanceName, context.llvm.runtime.objHeaderType)) \ No newline at end of file + get() { + val unitDescriptor = context.builtIns.unit + return if (isExternal(unitDescriptor)) { + constPointer(externalGlobal(theUnitInstanceName, context.llvm.runtime.objHeaderType)) + } else { + context.llvmDeclarations.getUnitInstanceRef() + } + } \ No newline at end of file diff --git a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt index dc2fa175581..743da531602 100644 --- a/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt +++ b/runtime/src/main/kotlin/konan/internal/RuntimeUtils.kt @@ -1,7 +1,7 @@ package konan.internal @ExportForCppRuntime -internal fun ThrowNullPointerException(): Nothing { +fun ThrowNullPointerException(): Nothing { throw NullPointerException() } @@ -11,7 +11,7 @@ internal fun ThrowArrayIndexOutOfBoundsException(): Nothing { } @ExportForCppRuntime -internal fun ThrowClassCastException(): Nothing { +fun ThrowClassCastException(): Nothing { throw ClassCastException() } @@ -20,14 +20,14 @@ internal fun ThrowArithmeticException() : Nothing { throw ArithmeticException() } -internal fun ThrowNoWhenBranchMatchedException(): Nothing { +fun ThrowNoWhenBranchMatchedException(): Nothing { throw NoWhenBranchMatchedException() } @ExportForCppRuntime internal fun TheEmptyString() = "" -internal fun > valueOfForEnum(name: String, arr: Array) : T +fun > valueOfForEnum(name: String, arr: Array) : T { for (x in arr) if (x.name == name) @@ -35,7 +35,7 @@ internal fun > valueOfForEnum(name: String, arr: Array) : T throw Exception("Invalid enum name: $name") } -internal fun > valuesForEnum(values: Array): Array +fun > valuesForEnum(values: Array): Array { return values.clone() as Array } \ No newline at end of file From a72732b543241c777df7aa492c36536c9bbb8755 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 26 Jan 2017 16:03:57 +0700 Subject: [PATCH 68/86] backend: simplify LocalDeclarationsLowering: do not transform descriptors for moved declarations. --- .../common/lower/LocalDeclarationsLowering.kt | 280 +----------------- 1 file changed, 14 insertions(+), 266 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index f05dc2d7bde..e7cf1b20da8 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -52,7 +52,6 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain // Continuous numbering across all declarations in the container. lambdasCount = 0 - objectsCount = 0 irDeclarationContainer.declarations.transformFlat { memberDeclaration -> if (memberDeclaration is IrFunction) @@ -63,7 +62,6 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain } private var lambdasCount = 0 - private var objectsCount = 0 private abstract class LocalContext { /** @@ -111,46 +109,35 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain } private class LocalClassContext(val declaration: IrClass) : LocalContext() { + val descriptor: ClassDescriptor + get() = declaration.descriptor + lateinit var closure: Closure - lateinit var transformedDescriptor: ClassDescriptorImpl - val capturedValueToField: MutableMap = HashMap() - var index: Int = -1 - override fun irGet(startOffset: Int, endOffset: Int, descriptor: ValueDescriptor): IrExpression? { val fieldDescriptor = capturedValueToField[descriptor] ?: return null return IrGetFieldImpl(startOffset, endOffset, fieldDescriptor, - receiver = IrGetValueImpl(startOffset, endOffset, transformedDescriptor.thisAsReceiverParameter) + receiver = IrGetValueImpl(startOffset, endOffset, this.descriptor.thisAsReceiverParameter) ) } override fun toString(): String = - "LocalClassContext for ${declaration.descriptor}" + "LocalClassContext for ${descriptor}" } private inner class LocalDeclarationsTransformer(val memberFunction: IrFunction) { val localFunctions: MutableMap = LinkedHashMap() val localClasses: MutableMap = LinkedHashMap() val localClassConstructors: MutableMap = LinkedHashMap() - val localClassMembers: MutableSet = LinkedHashSet() val transformedDescriptors = mutableMapOf() val CallableDescriptor.transformed: CallableDescriptor? get() = transformedDescriptors[this] as CallableDescriptor? - val CallableMemberDescriptor.transformed: CallableMemberDescriptor? - get() = transformedDescriptors[this] as CallableMemberDescriptor? - - val FunctionDescriptor.transformed: FunctionDescriptor? - get() = transformedDescriptors[this] as FunctionDescriptor? - - val PropertyDescriptor.transformed: PropertyDescriptor? - get() = transformedDescriptors[this] as PropertyDescriptor? - val oldParameterToNew: MutableMap = HashMap() val newParameterToOld: MutableMap = HashMap() val newParameterToCaptured: MutableMap = HashMap() @@ -183,12 +170,7 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain } localClasses.values.mapTo(this) { - val original = it.declaration - IrClassImpl( - original.startOffset, original.endOffset, original.origin, - it.transformedDescriptor, - original.declarations - ) + it.declaration } } @@ -199,63 +181,13 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain return IrCompositeImpl(declaration.startOffset, declaration.endOffset, context.builtIns.unitType) } - override fun visitProperty(declaration: IrProperty): IrStatement { - declaration.transformChildrenVoid(this) - val newDescriptor = declaration.descriptor.transformed ?: return declaration - - return IrPropertyImpl( - declaration.startOffset, declaration.endOffset, - declaration.origin, declaration.isDelegated, newDescriptor, - declaration.backingField, - declaration.getter, declaration.setter - ) - } - - override fun visitField(declaration: IrField): IrStatement { - declaration.transformChildrenVoid(this) - val newDescriptor = declaration.descriptor.transformed ?: return declaration - - return IrFieldImpl( - declaration.startOffset, declaration.endOffset, declaration.origin, - newDescriptor, - declaration.initializer - ) - } - - override fun visitGetField(expression: IrGetField): IrExpression { - expression.transformChildrenVoid(this) - val newDescriptor = expression.descriptor.transformed ?: return expression - - return IrGetFieldImpl( - expression.startOffset, expression.endOffset, newDescriptor, - expression.receiver, expression.origin, expression.superQualifier - ) - } - - override fun visitSetField(expression: IrSetField): IrExpression { - expression.transformChildrenVoid(this) - val newDescriptor = expression.descriptor.transformed ?: return expression - - return IrSetFieldImpl( - expression.startOffset, expression.endOffset, newDescriptor, - expression.receiver, expression.value, - expression.origin, expression.superQualifier - ) - } - override fun visitFunction(declaration: IrFunction): IrStatement { if (declaration.descriptor in localFunctions) { // Replace local function definition with an empty composite. return IrCompositeImpl(declaration.startOffset, declaration.endOffset, context.builtIns.unitType) - } else if (declaration.descriptor in localClassMembers){ - declaration.transformChildrenVoid(this) - - val transformedDescriptor = declaration.descriptor.transformed!! - - return IrFunctionImpl(declaration.startOffset, declaration.endOffset, declaration.origin, - transformedDescriptor, declaration.body) } else { - throw AssertionError("the function is neither local itself nor member of a local class") + declaration.transformChildrenVoid(this) + return declaration } } @@ -441,20 +373,12 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain } localClasses.values.forEach { - createLiftedDescriptor(it) + createFieldsForCapturedValues(it) } localClassConstructors.values.forEach { createTransformedConstructorDescriptor(it) } - - localClassMembers.forEach { - createTransformedMemberDescriptor(it) - } - - localClasses.values.forEach { - initializeClassDescriptor(it) - } } private fun suggestLocalName(descriptor: DeclarationDescriptor): String { @@ -463,11 +387,6 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain return "lambda-${it.index}" } - localClasses[descriptor]?.let { - if (it.index >= 0) - return "object-${it.index}" - } - return descriptor.name.asString() } @@ -551,122 +470,11 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain return newValueParameters } - private fun createTransformedMemberDescriptor(oldDescriptor: MemberDescriptor) { - when (oldDescriptor) { - is PropertyDescriptor -> createTransformedMemberPropertyDescriptor(oldDescriptor) - is PropertyAccessorDescriptor -> { - // Transformed along with the property. - } - is FunctionDescriptor -> createTransformedMemberFunctionDescriptor(oldDescriptor) - - else -> TODO(oldDescriptor.toString()) - } - } - - private fun createTransformedMemberFunctionDescriptor(oldDescriptor: FunctionDescriptor) { - val memberOwner = localClasses[oldDescriptor.containingDeclaration]!!.transformedDescriptor - - val copyBuilder = oldDescriptor.newCopyBuilder() - - copyBuilder.setOwner(memberOwner) - copyBuilder.setDispatchReceiverParameter(memberOwner.thisAsReceiverParameter) - - val newDescriptor = copyBuilder.build()!! - - recordTransformedMemberDescriptor(oldDescriptor, newDescriptor) - } - - private fun createTransformedMemberPropertyDescriptor(oldDescriptor: PropertyDescriptor) { - val memberOwner = localClasses[oldDescriptor.containingDeclaration]!!.transformedDescriptor - - val newDescriptor = PropertyDescriptorImpl.create( - memberOwner, - oldDescriptor.annotations, - oldDescriptor.modality, - oldDescriptor.visibility, - oldDescriptor.isVar, - oldDescriptor.name, - oldDescriptor.kind, - oldDescriptor.source, - oldDescriptor.isLateInit, - oldDescriptor.isConst, - oldDescriptor.isHeader, - oldDescriptor.isImpl, - oldDescriptor.isExternal - ) - - val newDispatchReceiver = memberOwner.thisAsReceiverParameter - - newDescriptor.setType(oldDescriptor.type, oldDescriptor.typeParameters, - newDispatchReceiver, oldDescriptor.extensionReceiverParameter?.type) - - val oldGetter = oldDescriptor.getter - val newGetter = if (oldGetter == null) { - null - } else { - PropertyGetterDescriptorImpl( - newDescriptor, oldGetter.annotations, - oldGetter.modality, oldGetter.visibility, oldGetter.isDefault, - oldGetter.isExternal, oldGetter.isInline, oldGetter.kind, - /* original = */ oldGetter, - oldGetter.source - ).apply { - this.initialize(oldGetter.returnType) - recordTransformedMemberDescriptor(oldGetter, this) - } - } - - val oldSetter = oldDescriptor.setter - val newSetter = if (oldSetter == null) { - null - } else { - PropertySetterDescriptorImpl( - newDescriptor, oldSetter.annotations, - oldSetter.modality, oldSetter.visibility, oldSetter.isDefault, - oldSetter.isExternal, oldSetter.isInline, oldSetter.kind, - /* original = */ oldSetter, - oldSetter.source - ).apply { - val parameter = PropertySetterDescriptorImpl.createSetterParameter(this, - oldSetter.valueParameters.single().type) - - this.initialize(parameter) - recordTransformedMemberDescriptor(oldSetter, this) - } - } - - newDescriptor.initialize(newGetter, newSetter) - - recordTransformedMemberDescriptor(oldDescriptor, newDescriptor) - } - - private fun recordTransformedMemberDescriptor(oldDescriptor: CallableDescriptor, - newDescriptor: CallableDescriptor - ) { - - transformedDescriptors[oldDescriptor] = newDescriptor - - if (oldDescriptor.valueParameters.size != newDescriptor.valueParameters.size) throw AssertionError() - - oldDescriptor.valueParameters.forEach { - recordRemappedParameter(it, newDescriptor.valueParameters[it.index]) - } - - val oldDispatchReceiverParameter = oldDescriptor.dispatchReceiverParameter ?: - throw AssertionError("members of local classes must have dispatch receiver") - - recordRemappedParameter(oldDispatchReceiverParameter, newDescriptor.dispatchReceiverParameter!!) - - oldDescriptor.extensionReceiverParameter?.let { - recordRemappedParameter(it, newDescriptor.extensionReceiverParameter!!) - } - } - private fun createTransformedConstructorDescriptor(localFunctionContext: LocalClassConstructorContext) { val oldDescriptor = localFunctionContext.descriptor val localClassContext = localClasses[oldDescriptor.containingDeclaration]!! val newDescriptor = ClassConstructorDescriptorImpl.create( - localClassContext.transformedDescriptor, + localClassContext.descriptor, Annotations.EMPTY, oldDescriptor.isPrimary, oldDescriptor.source) localFunctionContext.transformedDescriptor = newDescriptor @@ -694,31 +502,12 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain } } - private fun createLiftedDescriptor(localClassContext: LocalClassContext) { - val irClass = localClassContext.declaration - val oldDescriptor = irClass.descriptor - - val memberOwner = memberFunction.descriptor.containingDeclaration - val newDescriptor = ClassDescriptorImpl(memberOwner, - generateNameForLiftedDeclaration(oldDescriptor, memberOwner), - oldDescriptor.modality, - oldDescriptor.kind, - oldDescriptor.typeConstructor.supertypes, - oldDescriptor.source, - oldDescriptor.isExternal) - - localClassContext.transformedDescriptor = newDescriptor - transformedDescriptors[oldDescriptor] = newDescriptor - - createFieldsForCapturedValues(localClassContext) - } - private fun createFieldsForCapturedValues(localClassContext: LocalClassContext) { - val newDescriptor = localClassContext.transformedDescriptor + val classDescriptor = localClassContext.descriptor localClassContext.closure.capturedValues.forEach { capturedValue -> val fieldDescriptor = PropertyDescriptorImpl.create( - newDescriptor, + classDescriptor, Annotations.EMPTY, Modality.FINAL, Visibilities.PRIVATE, @@ -739,40 +528,13 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain fieldDescriptor.setType( capturedValue.type, emptyList(), - newDescriptor.thisAsReceiverParameter, + classDescriptor.thisAsReceiverParameter, extensionReceiverParameter) localClassContext.capturedValueToField[capturedValue] = fieldDescriptor } } - private fun initializeClassDescriptor(localClassContext: LocalClassContext) { - val oldDescriptor = localClassContext.declaration.descriptor - - val constructors = oldDescriptor.constructors.map { - localClassConstructors[it]!!.transformedDescriptor - }.toSet() - - val newPrimaryConstructor = oldDescriptor.unsubstitutedPrimaryConstructor?.let { - localClassConstructors[it]!!.transformedDescriptor - } - - val newDescriptor = localClassContext.transformedDescriptor - - val oldContributedDescriptors = oldDescriptor.unsubstitutedMemberScope.getContributedDescriptors() - val callableMembers = oldContributedDescriptors - .filterIsInstance() - .filter { it.kind.isReal } - .map { it.transformed ?: TODO(it.toString()) } - - val otherMembers = oldContributedDescriptors.filter { it !is CallableMemberDescriptor } - - val fakeOverrides = computeOverrides(newDescriptor, callableMembers) - val newUnsubstitutedMemberScope = SimpleMemberScope(otherMembers + callableMembers + fakeOverrides) - - newDescriptor.initialize(newUnsubstitutedMemberScope, constructors, newPrimaryConstructor) - } - private fun LocalContextWithClosureAsParameters.recordCapturedAsParameter( oldDescriptor: ValueDescriptor, newDescriptor: ValueParameterDescriptor @@ -850,22 +612,12 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain else -> TODO(this.toString()) } - override fun visitProperty(declaration: IrProperty) { - declaration.acceptChildrenVoid(this) - - val descriptor = declaration.descriptor - assert (descriptor.isClassMember()) - localClassMembers.add(descriptor) - } - override fun visitFunction(declaration: IrFunction) { declaration.acceptChildrenVoid(this) val descriptor = declaration.descriptor - if (descriptor.isClassMember()) { - localClassMembers.add(descriptor) - } else { + if (!descriptor.isClassMember()) { val localFunctionContext = LocalFunctionContext(declaration) localFunctions[descriptor] = localFunctionContext @@ -893,13 +645,9 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain if (descriptor.isClassMember()) { assert (descriptor.isInner) - localClassMembers.add(descriptor) } else { val localClassContext = LocalClassContext(declaration) localClasses[descriptor] = localClassContext - if (descriptor.name.isSpecial) { - localClassContext.index = objectsCount++ - } } } }) From 6104648d5bb40d748b56a2a480fa774f7e0da831 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 26 Jan 2017 13:07:41 +0700 Subject: [PATCH 69/86] backend: simplify EnumClassLowering: do not set correct member scope for synthesized classes. --- .../kotlin/backend/konan/lower/EnumClassLowering.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt index 1b66013bf7c..2bc15f31714 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt @@ -2,12 +2,10 @@ package org.jetbrains.kotlin.backend.konan.lower import org.jetbrains.kotlin.backend.common.ClassLoweringPass import org.jetbrains.kotlin.backend.common.FileLoweringPass -import org.jetbrains.kotlin.backend.common.lower.SimpleMemberScope import org.jetbrains.kotlin.backend.common.runOnFilePostfix import org.jetbrains.kotlin.backend.jvm.descriptors.createValueParameter import org.jetbrains.kotlin.backend.jvm.descriptors.initialize import org.jetbrains.kotlin.backend.konan.Context -import org.jetbrains.kotlin.backend.konan.KonanBuiltIns import org.jetbrains.kotlin.backend.konan.KonanPlatform import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalFunctions import org.jetbrains.kotlin.backend.konan.descriptors.synthesizedName @@ -31,14 +29,11 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.descriptorUtil.classId import org.jetbrains.kotlin.resolve.descriptorUtil.classValueType import org.jetbrains.kotlin.resolve.descriptorUtil.module -import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter -import org.jetbrains.kotlin.resolve.scopes.MemberScopeImpl +import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver import org.jetbrains.kotlin.types.* -import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.addToStdlib.singletonList import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList @@ -178,7 +173,7 @@ internal class EnumClassLowering(val context: Context) : ClassLoweringPass { defaultEnumEntryConstructors.put(loweredEnumConstructor, constructorDescriptor) } - val memberScope = SimpleMemberScope(listOf()) + val memberScope = MemberScope.Empty defaultClassDescriptor.initialize(memberScope, constructors, null) return defaultClass @@ -221,7 +216,7 @@ internal class EnumClassLowering(val context: Context) : ClassLoweringPass { ++i } - val memberScope = SimpleMemberScope(listOf(valuesFunctionDescriptor, valueOfFunctionDescriptor)) + val memberScope = MemberScope.Empty val constructorOfAny = irClass.descriptor.module.builtIns.any.constructors.first() val (constructorDescriptor, constructor) = createSimpleDelegatingConstructor(implObjectDescriptor, constructorOfAny) From 36c90ac47d2e659db9f42482bc0a5cf9ca5d619e Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 26 Jan 2017 14:55:22 +0700 Subject: [PATCH 70/86] backend: improve default arguments lowering: use the same `$default`-descriptor in declaration and call. --- .../jetbrains/kotlin/backend/konan/ir/Ir.kt | 4 ++ .../lower/DefaultParameterStubGenerator.kt | 40 +++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt index 02ba74f77c3..b1e6784fa56 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/Ir.kt @@ -1,6 +1,8 @@ package org.jetbrains.kotlin.backend.konan.ir import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.backend.konan.lower.DefaultParameterDescription +import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.descriptors.PropertyDescriptor @@ -8,6 +10,8 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor internal class Ir(val context: Context, val irModule: IrModuleFragment) { val propertiesWithBackingFields = mutableSetOf() + val defaultParameterDescriptions = mutableMapOf() + val originalModuleIndex = ModuleIndex(irModule) lateinit var moduleIndexForCodegen: ModuleIndex diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt index 3046764d67a..509cfcf467d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt @@ -69,7 +69,7 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): log("detected ${functionDescriptor.name.asString()} has got #${bodies.size} default expressions") functionDescriptor.overriddenDescriptors.forEach { context.log("DEFAULT-REPLACER: $it") } if (bodies.isNotEmpty()) { - val description = functionDescriptor.generateDefaultsDescription() + val description = functionDescriptor.getOrCreateDefaultsDescription(context) val builder = context.createFunctionIrBuilder(description.function) val body = builder.irBlockBody(irFunction) { val params = mutableListOf() @@ -228,7 +228,7 @@ class DefaultParameterInjector internal constructor(val context: Context): BodyL var maskValue = 0 val rawDescriptor = expression.descriptor as FunctionDescriptor val descriptor = rawDescriptor.overriddenDescriptors.firstOrNull()?:rawDescriptor - val desc = descriptor.generateDefaultsDescription() + val desc = descriptor.getOrCreateDefaultsDescription(context) descriptor.valueParameters.forEach { log("descriptor::${descriptor.name.asString()}#${it.index}: ${it.name.asString()}") } @@ -276,13 +276,22 @@ val intAnd = DescriptorUtils.getFunctionByName(intDesctiptor.unsubstitutedMember data class DefaultParameterDescription(val function: FunctionDescriptor, val mask:ValueParameterDescriptor, val hasExtensionReceiver:Boolean, val hasDispatchReceiver: Boolean) -fun FunctionDescriptor.generateDefaultsDescription(): DefaultParameterDescription { +private fun FunctionDescriptor.getOrCreateDefaultsDescription(context: Context): DefaultParameterDescription { + return context.ir.defaultParameterDescriptions.getOrPut(this) { + this.generateDefaultsDescription(context) + } +} + +private fun FunctionDescriptor.generateDefaultsDescription(context: Context): DefaultParameterDescription { val descriptor = when (this){ - is ConstructorDescriptor -> ClassConstructorDescriptorImpl.createSynthesized( - /* containingDeclaration = */ this.containingDeclaration as ClassDescriptor, - /* annotations = */ annotations, - /* isPrimary = */ false, - /* source = */ SourceElement.NO_SOURCE) + is ConstructorDescriptor -> DefaultParameterClassConstructorDescriptor( + containingDeclaration = this.containingDeclaration as ClassDescriptor, + annotations = annotations, + original = null, + isPrimary = false, + source = SourceElement.NO_SOURCE, + kind = CallableMemberDescriptor.Kind.SYNTHESIZED) + is FunctionDescriptor -> SimpleFunctionDescriptorImpl.create( /* containingDeclaration = */ this.containingDeclaration, /* annotations = */ Annotations.EMPTY, @@ -321,8 +330,7 @@ fun FunctionDescriptor.generateDefaultsDescription(): DefaultParameterDescriptio /* modality = */ Modality.FINAL, /* visibility = */ this.visibility) return DefaultParameterDescription( - function = if (descriptor is ClassConstructorDescriptor) DefaultParameterClassConstructorDescriptor(descriptor) - else descriptor, + function = descriptor, mask = maskVariable, hasDispatchReceiver = (extensionReceiverParameter != null), hasExtensionReceiver = (dispatchReceiverParameter != null)) @@ -347,8 +355,16 @@ private fun valueParameter(descriptor: FunctionDescriptor, index: Int, name: Str /** * This descriptor overrides name property, for class constructor : instead of -> $defeult symbol. */ -class DefaultParameterClassConstructorDescriptor(val descriptor: ClassConstructorDescriptor): ClassConstructorDescriptor by descriptor { +class DefaultParameterClassConstructorDescriptor( + containingDeclaration: ClassDescriptor, + original: ConstructorDescriptor?, + annotations: Annotations, + isPrimary: Boolean, + kind: CallableMemberDescriptor.Kind, + source: SourceElement +) : ClassConstructorDescriptorImpl(containingDeclaration, original, annotations, isPrimary, kind, source) { + override fun getName(): Name { - return Name.identifier("${descriptor.name.asString()}\$default") + return Name.identifier("${super.getName().asString()}\$default") } } \ No newline at end of file From 01cb9d4cacbd32093cc9fc3f2d37aa6c6a3a8ba9 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Fri, 27 Jan 2017 16:38:48 +0500 Subject: [PATCH 71/86] Implementation of super methods calling (#203) * implemented super call * tests * removed redundant code --- .../konan/descriptors/DescriptorUtils.kt | 12 +++++-- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 8 ++--- backend.native/tests/build.gradle | 15 +++++++++ .../tests/codegen/basics/superFunCall.kt | 19 +++++++++++ .../tests/codegen/basics/superGetterCall.kt | 19 +++++++++++ .../tests/codegen/basics/superSetterCall.kt | 32 +++++++++++++++++++ 6 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 backend.native/tests/codegen/basics/superFunCall.kt create mode 100644 backend.native/tests/codegen/basics/superGetterCall.kt create mode 100644 backend.native/tests/codegen/basics/superSetterCall.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index 15d46ded1d8..4106b161ea8 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -5,6 +5,10 @@ import org.jetbrains.kotlin.backend.konan.llvm.functionName import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.isFunctionType import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -12,6 +16,8 @@ import org.jetbrains.kotlin.resolve.OverridingUtil import org.jetbrains.kotlin.resolve.descriptorUtil.* import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.TypeSubstitution +import org.jetbrains.kotlin.types.TypeSubstitutor import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.typeUtil.isUnit import org.jetbrains.kotlin.util.OperatorNameConventions @@ -152,7 +158,7 @@ internal val FunctionDescriptor.isFunctionInvoke: Boolean internal fun ClassDescriptor.isUnit() = this.defaultType.isUnit() -internal val ClassDescriptor.сontributedMethods: List +internal val ClassDescriptor.contributedMethods: List get() { val contributedDescriptors = unsubstitutedMemberScope.getContributedDescriptors() // (includes declarations from supers) @@ -184,7 +190,7 @@ val ClassDescriptor.vtableEntries: List this.getSuperClassOrAny().vtableEntries } - val methods = this.сontributedMethods + val methods = this.contributedMethods val inheritedVtableSlots = superVtableEntries.map { superMethod -> methods.singleOrNull { OverridingUtil.overrides(it, superMethod) } ?: superMethod @@ -204,6 +210,6 @@ val ClassDescriptor.methodTableEntries: List get() { assert (!this.isAbstract()) - return this.сontributedMethods.filter { it.isOverridableOrOverrides } + return this.contributedMethods.filter { it.isOverridableOrOverrides } // TODO: probably method table should contain all accessible methods to improve binary compatibility } \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 7bd120c96f3..de215d6cbcb 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1681,7 +1681,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid when (descriptor) { is IrBuiltinOperatorDescriptorBase -> return evaluateOperatorCall (callee, args) is ConstructorDescriptor -> return evaluateConstructorCall (callee, args) - else -> return evaluateSimpleFunctionCall(descriptor, args) + else -> return evaluateSimpleFunctionCall(descriptor, args, callee.superQualifier) } } @@ -1721,9 +1721,9 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid //-------------------------------------------------------------------------// - private fun evaluateSimpleFunctionCall(descriptor: FunctionDescriptor, args: List): LLVMValueRef { + private fun evaluateSimpleFunctionCall(descriptor: FunctionDescriptor, args: List, superClass: ClassDescriptor? = null): LLVMValueRef { //context.log("evaluateSimpleFunctionCall : $tmpVariableName = ${ir2string(value)}") - if (descriptor.isOverridable) + if (descriptor.isOverridable && superClass == null) return callVirtual(descriptor, args) else return callDirect(descriptor, args) @@ -1737,7 +1737,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid if (descriptor.dispatchReceiverParameter != null) args.add(evaluateExpression(value.dispatchReceiver!!)) //add this ptr args.add(evaluateExpression(value.getValueArgument(0)!!)) - return evaluateSimpleFunctionCall(descriptor, args) + return evaluateSimpleFunctionCall(descriptor, args, value.superQualifier) } //-------------------------------------------------------------------------// diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 3b14afb8967..3e9852323b6 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -292,6 +292,21 @@ task empty_substring(type: RunKonanTest) { source = "runtime/basic/empty_substring.kt" } +task superFunCall(type: RunKonanTest) { + goldValue = "\n\n" + source = "codegen/basics/superFunCall.kt" +} + +task superGetterCall(type: RunKonanTest) { + goldValue = "\n\n" + source = "codegen/basics/superGetterCall.kt" +} + +task superSetterCall(type: RunKonanTest) { + goldValue = "zzz\nzzz\n" + source = "codegen/basics/superSetterCall.kt" +} + task enum0(type: RunKonanTest) { goldValue = "VALUE\n" source = "codegen/enum/test0.kt" diff --git a/backend.native/tests/codegen/basics/superFunCall.kt b/backend.native/tests/codegen/basics/superFunCall.kt new file mode 100644 index 00000000000..d524ccf961a --- /dev/null +++ b/backend.native/tests/codegen/basics/superFunCall.kt @@ -0,0 +1,19 @@ +open class C { + open fun f() = "" +} + +class C1: C() { + override fun f() = super.f() + "" +} + +open class C2: C() { +} + +class C3: C2() { + override fun f() = super.f() + "" +} + +fun main(args: Array) { + println(C1().f()) + println(C3().f()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/superGetterCall.kt b/backend.native/tests/codegen/basics/superGetterCall.kt new file mode 100644 index 00000000000..63dfd9b09f4 --- /dev/null +++ b/backend.native/tests/codegen/basics/superGetterCall.kt @@ -0,0 +1,19 @@ +open class C { + open val p1 = "" +} + +class C1: C() { + override val p1 = super.p1 + "" +} + +open class C2: C() { +} + +class C3: C2() { + override val p1 = super.p1 + "" +} + +fun main(args: Array) { + println(C1().p1) + println(C3().p1) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/basics/superSetterCall.kt b/backend.native/tests/codegen/basics/superSetterCall.kt new file mode 100644 index 00000000000..215852a1d91 --- /dev/null +++ b/backend.native/tests/codegen/basics/superSetterCall.kt @@ -0,0 +1,32 @@ +open class C { + open var p2 = "" + set(value) { field = "" + value } +} + +class C1: C() { + override var p2 = super.p2 + "" + set(value) { + super.p2 = value + field = "" + super.p2 + } +} + +open class C2: C() { +} + +class C3: C2() { + override var p2 = super.p2 + "" + set(value) { + super.p2 = value + field = "" + super.p2 + } +} + +fun main(args: Array) { + val c1 = C1() + val c3 = C3() + c1.p2 = "zzz" + c3.p2 = "zzz" + println(c1.p2) + println(c3.p2) +} \ No newline at end of file From b06f5d0d5b721647c8bc5679a24ea1939e38b164 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 30 Jan 2017 11:10:32 +0300 Subject: [PATCH 72/86] More preparations for escape analysis. (#201) --- .../jetbrains/kotlin/backend/konan/Context.kt | 2 + .../backend/konan/llvm/CodeGenerator.kt | 91 +++++++++------ .../kotlin/backend/konan/llvm/ContextUtils.kt | 43 +++++-- .../backend/konan/llvm/EscapeAnalysis.kt | 18 +-- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 109 ++++++++++-------- runtime/src/launcher/cpp/launcher.cpp | 6 +- runtime/src/main/cpp/Exceptions.cpp | 8 +- runtime/src/main/cpp/Memory.cpp | 93 +++++++++++---- runtime/src/main/cpp/Memory.h | 35 +++--- runtime/src/main/cpp/ToString.cpp | 4 +- 10 files changed, 254 insertions(+), 155 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index 41b4ed80cf5..8b759fb899d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -17,6 +17,8 @@ import java.lang.System.out internal final class Context(val config: KonanConfig) : KonanBackendContext() { + val debug = true + var moduleDescriptor: ModuleDescriptor? = null // TODO: make lateinit? diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index 3092f1bc544..6eb5fc0c44b 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -17,10 +17,14 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { // TODO: remove, to make CodeGenerator descriptor-agnostic. var constructedClass: ClassDescriptor? = null val vars = VariableManager(this) - var returnSlot: LLVMValueRef? = null - var slotsPhi: LLVMValueRef? = null - var slotCount = 0 - var localAllocs = 0 + private var returnSlot: LLVMValueRef? = null + private var slotsPhi: LLVMValueRef? = null + private var slotCount = 0 + private var localAllocs = 0 + private var arenaSlot: LLVMValueRef? = null + + private val intPtrType = LLVMIntPtrType(llvmTargetData)!! + private val immOneIntPtrType = LLVMConstInt(intPtrType, 1, 1)!! fun prologue(descriptor: FunctionDescriptor) { val llvmFunction = llvmFunction(descriptor) @@ -28,7 +32,7 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { prologue(llvmFunction, LLVMGetReturnType(getLlvmFunctionType(descriptor))!!) - if (!descriptor.isExported()) { + if (!descriptor.isExported() && !context.debug) { LLVMSetLinkage(llvmFunction, LLVMLinkage.LLVMPrivateLinkage) // (Cannot do this before the function body is created). } @@ -57,6 +61,9 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { // First slot can be assigned to keep pointer to frame local arena. slotCount = 1 localAllocs = 0 + // Is removed by DCE trivially, if not needed. + arenaSlot = intToPtr( + or(ptrToInt(slotsPhi, intPtrType), immOneIntPtrType), kObjHeaderPtrPtr) } fun epilogue() { @@ -90,7 +97,7 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { val returnPhi = phi(returnType!!) addPhiIncoming(returnPhi, *returns.toList().toTypedArray()) if (returnSlot != null) { - updateLocalRef(returnPhi, returnSlot!!) + updateReturnRef(returnPhi, returnSlot!!) } releaseVars() LLVMBuildRet(builder, returnPhi) @@ -139,6 +146,8 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { fun div (arg0: LLVMValueRef, arg1: LLVMValueRef, name: String = ""): LLVMValueRef = LLVMBuildSDiv(builder, arg0, arg1, name)!! fun srem (arg0: LLVMValueRef, arg1: LLVMValueRef, name: String = ""): LLVMValueRef = LLVMBuildSRem(builder, arg0, arg1, name)!! + fun or (arg0: LLVMValueRef, arg1: LLVMValueRef, name: String = ""): LLVMValueRef = LLVMBuildOr (builder, arg0, arg1, name)!! + /* integers comparisons */ fun icmpEq(arg0: LLVMValueRef, arg1: LLVMValueRef, name: String = ""): LLVMValueRef = LLVMBuildICmp(builder, LLVMIntPredicate.LLVMIntEQ, arg0, arg1, name)!! fun icmpGt(arg0: LLVMValueRef, arg1: LLVMValueRef, name: String = ""): LLVMValueRef = LLVMBuildICmp(builder, LLVMIntPredicate.LLVMIntSGT, arg0, arg1, name)!! @@ -154,7 +163,8 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { fun bitcast(type: LLVMTypeRef?, value: LLVMValueRef, name: String = "") = LLVMBuildBitCast(builder, value, type, name)!! - fun intToPtr(imm: LLVMValueRef?, DestTy: LLVMTypeRef, Name: String = "") = LLVMBuildIntToPtr(builder, imm, DestTy, Name)!! + fun intToPtr(value: LLVMValueRef?, DestTy: LLVMTypeRef, Name: String = "") = LLVMBuildIntToPtr(builder, value, DestTy, Name)!! + fun ptrToInt(value: LLVMValueRef?, DestTy: LLVMTypeRef, Name: String = "") = LLVMBuildPtrToInt(builder, value, DestTy, Name)!! fun alloca(type: LLVMTypeRef?, name: String = ""): LLVMValueRef { if (isObjectType(type!!)) { @@ -165,33 +175,13 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { } } - - // Return object slot (ab)used for arena matching given allocation. - private fun arenaSlot() : LLVMValueRef { - return gep(slotsPhi!!, Int32(0).llvm) - } - - fun allocInstance(typeInfo: LLVMValueRef, hint: Int) : LLVMValueRef { - if (hint == SCOPE_FRAME) { - val aux = arenaSlot() - localAllocs++ - return call(context.llvm.arenaAllocInstanceFunction, listOf(typeInfo, aux)) - } else { - val slot = vars.createAnonymousSlot() - return call(context.llvm.allocInstanceFunction, listOf(typeInfo, slot)) - } + fun allocInstance(typeInfo: LLVMValueRef, lifetime: Lifetime) : LLVMValueRef { + return call(context.llvm.allocInstanceFunction, listOf(typeInfo), lifetime) } fun allocArray( - typeInfo: LLVMValueRef, hint: Int, count: LLVMValueRef) : LLVMValueRef { - if (hint == SCOPE_FRAME) { - val aux = arenaSlot() - localAllocs++ - return call(context.llvm.arenaAllocArrayFunction, listOf(typeInfo, count, aux)) - } else { - val slot = vars.createAnonymousSlot() - return call(context.llvm.allocArrayFunction, listOf(typeInfo, count, slot)) - } + typeInfo: LLVMValueRef, count: LLVMValueRef, lifetime: Lifetime) : LLVMValueRef { + return call(context.llvm.allocArrayFunction, listOf(typeInfo, count), lifetime) } fun load(value: LLVMValueRef, name: String = ""): LLVMValueRef { @@ -235,6 +225,10 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { } } + fun updateReturnRef(value: LLVMValueRef, address: LLVMValueRef) { + call(context.llvm.updateReturnRefFunction, listOf(address, value)) + } + // Only use ignoreOld, when sure that memory is freshly inited and have no value. fun updateLocalRef(value: LLVMValueRef, address: LLVMValueRef, ignoreOld: Boolean = false) { call(if (ignoreOld) context.llvm.setLocalRefFunction else context.llvm.updateLocalRefFunction, @@ -250,19 +244,44 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { //-------------------------------------------------------------------------// - fun callAtFunctionScope(llvmFunction: LLVMValueRef, args: List, name: String = "") = - call(llvmFunction, args, this::cleanupLandingpad, name) + fun callAtFunctionScope(llvmFunction: LLVMValueRef, args: List, + lifetime: Lifetime) = + call(llvmFunction, args, lifetime, this::cleanupLandingpad) fun call(llvmFunction: LLVMValueRef, args: List, - lazyLandingpad: () -> LLVMBasicBlockRef? = { null }, name: String = ""): LLVMValueRef { + resultLifetime: Lifetime = Lifetime.IRRELEVANT, + lazyLandingpad: () -> LLVMBasicBlockRef? = { null }): LLVMValueRef { + var callArgs = if (isObjectReturn(llvmFunction.type)) { + // If function returns an object - create slot for the returned value or give local arena. + // This allows appropriate rootset accounting by just looking at the stack slots, + // along with ability to allocate in appropriate arena. + val resultSlot = when (resultLifetime.slotType) { + SlotType.ARENA -> { + localAllocs++ + arenaSlot!! + } + SlotType.RETURN -> returnSlot!! + // TODO: for RETURN_IF_ARENA choose between created slot and arenaSlot + // dynamically. + SlotType.ANONYMOUS, SlotType.RETURN_IF_ARENA -> vars.createAnonymousSlot() + else -> throw Error("Incorrect slot type") + } + args + resultSlot + } else { + args + } + return callRaw(llvmFunction, callArgs, lazyLandingpad) + } + private fun callRaw(llvmFunction: LLVMValueRef, args: List, + lazyLandingpad: () -> LLVMBasicBlockRef?): LLVMValueRef { memScoped { val rargs = allocArrayOf(args)[0].ptr if (LLVMIsAFunction(llvmFunction) != null /* the function declaration */ && LLVMAttribute.LLVMNoUnwindAttribute in LLVMGetFunctionAttrSet(llvmFunction)) { - return LLVMBuildCall(builder, llvmFunction, rargs, args.size, name)!! + return LLVMBuildCall(builder, llvmFunction, rargs, args.size, "")!! } else { val landingpad = lazyLandingpad() @@ -276,7 +295,7 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { } val success = basicBlock() - val result = LLVMBuildInvoke(builder, llvmFunction, rargs, args.size, success, landingpad, name)!! + val result = LLVMBuildInvoke(builder, llvmFunction, rargs, args.size, success, landingpad, "")!! positionAtEnd(success) return result } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt index d2ac04ff9a9..29b16df3a71 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/ContextUtils.kt @@ -15,11 +15,41 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils -// Different scopes/lifetimes of an object, computed by escape analysis. -const val SCOPE_FRAME = 0 -const val SCOPE_GLOBAL = 1 -const val SCOPE_ARENA = 2 -const val SCOPE_PERMANENT = 3 +internal enum class SlotType { + // Frame local arena slot can be used. + ARENA, + // Return slot can be used. + RETURN, + // Return slot, if it is an arena, can be used. + RETURN_IF_ARENA, + // Anonymous slot. + ANONYMOUS, + // Unknown slot type. + UNKNOWN +} + +// Lifetimes class of reference, computed by escape analysis. +internal enum class Lifetime(val slotType: SlotType) { + // If reference is frame-local (only obtained from some call and never leaves). + LOCAL(SlotType.ARENA), + // If reference is only returned. + RETURN_VALUE(SlotType.RETURN), + // If reference is set as field of references of class RETURN_VALUE or INDIRECT_RETURN_VALUE. + INDIRECT_RETURN_VALUE(SlotType.RETURN_IF_ARENA), + // If reference is stored to the field of an incoming parameters. + PARAMETER_FIELD(SlotType.ANONYMOUS), + // If reference refers to the global (either global object or global variable). + GLOBAL(SlotType.ANONYMOUS), + // If reference used to throw. + THROW(SlotType.ANONYMOUS), + // If reference used as an argument of outgoing function. Class can be improved by escape analysis + // of called function. + ARGUMENT(SlotType.ANONYMOUS), + // If reference class is unknown. + UNKNOWN(SlotType.UNKNOWN), + // If reference class is irrelevant. + IRRELEVANT(SlotType.UNKNOWN) +} /** * Provides utility methods to the implementer. @@ -207,10 +237,9 @@ internal class Llvm(val context: Context, val llvmModule: LLVMModuleRef) { var globalInitIndex:Int = 0 val allocInstanceFunction = importRtFunction("AllocInstance") - val arenaAllocInstanceFunction = importRtFunction("ArenaAllocInstance") val allocArrayFunction = importRtFunction("AllocArrayInstance") - val arenaAllocArrayFunction = importRtFunction("ArenaAllocArrayInstance") val initInstanceFunction = importRtFunction("InitInstance") + val updateReturnRefFunction = importRtFunction("UpdateReturnRef") val setLocalRefFunction = importRtFunction("SetLocalRef") val setGlobalRefFunction = importRtFunction("SetGlobalRef") val updateLocalRefFunction = importRtFunction("UpdateLocalRef") diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt index 4348cf577c6..5fa8790731a 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/EscapeAnalysis.kt @@ -2,7 +2,7 @@ package org.jetbrains.kotlin.backend.konan.llvm import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.IrModuleFragment -import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid import org.jetbrains.kotlin.ir.visitors.acceptVoid @@ -11,14 +11,15 @@ import org.jetbrains.kotlin.ir.visitors.acceptVoid // We build graph with the following nodes: // * allocation set, keeping tuple of [local, ctor call, owner function], AS // * local store set, keeping pair [local, stored], LSS -// * field store set, keeping tuple [local, stored], FSS -// * global store set, [local, stored], GSS +// * field store set, keeping tuple [local, object to store, stored field id], FSS +// * global store set, [local, stored global address], GSS // Function we're trying to compute is the following: // for each element of AS, could it be referred by someone, whose value is // alive on return from function, where element was allocated. // Each element in RS is associated with few elements in AS, which it could refer to. -// TODO: exact algorithm TBD. -internal class EscapeAnalyzerVisitor(val allocHints: MutableMap) : IrElementVisitorVoid { +// +internal class EscapeAnalyzerVisitor( + val lifetimes: MutableMap) : IrElementVisitorVoid { override fun visitElement(element: IrElement) { element.acceptChildrenVoid(this) @@ -29,8 +30,9 @@ internal class EscapeAnalyzerVisitor(val allocHints: MutableMap) : } } -fun prepareAllocHints(irModule: IrModuleFragment, allocHints: MutableMap) { - assert(allocHints.size == 0) +internal fun computeLifetimes(irModule: IrModuleFragment, + lifetimes: MutableMap) { + assert(lifetimes.size == 0) - irModule.acceptVoid(EscapeAnalyzerVisitor(allocHints)) + irModule.acceptVoid(EscapeAnalyzerVisitor(lifetimes)) } \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index de215d6cbcb..7d3e03b103e 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -119,7 +119,7 @@ internal class MetadatorVisitor(val context: Context) : IrElementVisitorVoid { /** * Defines how to generate context-dependent operations. */ -interface CodeContext { +internal interface CodeContext { /** * Generates `return` [value] operation. @@ -132,7 +132,7 @@ interface CodeContext { fun genContinue(destination: IrContinue) - fun genCall(function: LLVMValueRef, args: List): LLVMValueRef + fun genCall(function: LLVMValueRef, args: List, resultLifetime: Lifetime): LLVMValueRef fun genThrow(exception: LLVMValueRef) @@ -168,7 +168,7 @@ interface CodeContext { internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid { val codegen = CodeGenerator(context) - val allocHints = mutableMapOf() + val resultLifetimes = mutableMapOf() //-------------------------------------------------------------------------// @@ -190,7 +190,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid override fun genContinue(destination: IrContinue) = unsupported() - override fun genCall(function: LLVMValueRef, args: List) = unsupported(function) + override fun genCall(function: LLVMValueRef, args: List, resultLifetime: Lifetime) = unsupported(function) override fun genThrow(exception: LLVMValueRef) = unsupported() @@ -237,7 +237,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid override fun visitModuleFragment(module: IrModuleFragment) { context.log("visitModule : ${ir2string(module)}") - prepareAllocHints(module, allocHints) + computeLifetimes(module, resultLifetimes) module.acceptChildrenVoid(this) appendLlvmUsed(context.llvm.usedFunctions) @@ -529,14 +529,14 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } } - override fun genCall(function: LLVMValueRef, args: List) = - codegen.callAtFunctionScope(function, args) + override fun genCall(function: LLVMValueRef, args: List, resultLifetime: Lifetime) = + codegen.callAtFunctionScope(function, args, resultLifetime) override fun genThrow(exception: LLVMValueRef) { val objHeaderPtr = codegen.bitcast(codegen.kObjHeaderPtr, exception) val args = listOf(objHeaderPtr) - this.genCall(context.llvm.throwExceptionFunction, args) + this.genCall(context.llvm.throwExceptionFunction, args, Lifetime.IRRELEVANT) codegen.unreachable() } @@ -695,7 +695,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val initFunction = value.descriptor.constructors.first { it.valueParameters.size == 0 } val ctor = codegen.llvmFunction(initFunction) val args = listOf(objectPtr, typeInfo, ctor) - val newValue = call(context.llvm.initInstanceFunction, args) + val newValue = call(context.llvm.initInstanceFunction, args, Lifetime.GLOBAL) val bbInitResult = codegen.currentBlock codegen.br(bbExit) @@ -802,7 +802,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid codegen.plus(sum, size!!) } - val array = codegen.allocArray(codegen.typeInfoValue(value.type)!!, SCOPE_GLOBAL, finalLength) + val array = codegen.allocArray(codegen.typeInfoValue(value.type)!!, finalLength, Lifetime.GLOBAL) elements.fold(kImmZero) { sum, (exp, size, isArray) -> if (!isArray) { call(context.llvm.setArrayFunction, listOf(array, sum, exp)) @@ -841,8 +841,10 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid return@map Element(codegen.staticData.kotlinStringLiteral(it as IrConst).llvm, null, string.length) } else { val toStringDescriptor = getToString(it.type) - val string = if (KotlinBuiltIns.isString(it.type)) evaluationResult - else evaluateSimpleFunctionCall(toStringDescriptor, listOf(evaluationResult)) + val string = + if (KotlinBuiltIns.isString(it.type)) evaluationResult + else evaluateSimpleFunctionCall( + toStringDescriptor, listOf(evaluationResult), Lifetime.LOCAL) val length = call(codegen.llvmFunction(kStringLength!!), listOf(string)) return@map Element(string, length, -1) } @@ -856,7 +858,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val constructor = kStringBuilder!!.constructors .firstOrNull { it -> it.valueParameters.size == 1 && KotlinBuiltIns.isInt(it.valueParameters[0].type) }!! - val stringBuilderObj = codegen.allocInstance(codegen.typeInfoValue(kStringBuilder), SCOPE_FRAME) + val stringBuilderObj = codegen.allocInstance(codegen.typeInfoValue(kStringBuilder), Lifetime.LOCAL) call(codegen.llvmFunction(constructor), listOf(stringBuilderObj, totalLength)) @@ -865,7 +867,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid return@fold sum } - return evaluateSimpleFunctionCall(kStringBuilderToString!!, listOf(stringBuilderObj)) + return evaluateSimpleFunctionCall(kStringBuilderToString!!, listOf(stringBuilderObj), + Lifetime.GLOBAL /* TODO: fix */) } //-------------------------------------------------------------------------// @@ -957,8 +960,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } // The call inside [CatchingScope] must be configured to dispatch exception to the scope's handler. - override fun genCall(function: LLVMValueRef, args: List): LLVMValueRef { - val res = codegen.call(function, args, this::landingpad) + override fun genCall(function: LLVMValueRef, args: List, lifetime: Lifetime): LLVMValueRef { + val res = codegen.call(function, args, lifetime, this::landingpad) return res } @@ -1295,7 +1298,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val srcArg = evaluateExpression(value.argument) // Evaluate src expression. val srcObjInfoPtr = codegen.bitcast(codegen.kObjHeaderPtr, srcArg) // Cast src to ObjInfoPtr. val args = listOf(srcObjInfoPtr, dstTypeInfo) // Create arg list. - call(context.llvm.checkInstanceFunction, args) // Check if dst is subclass of src. + call(context.llvm.checkInstanceFunction, args) // Check if dst is subclass of src. return srcArg } @@ -1632,7 +1635,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid value is IrDelegatingConstructorCall -> return delegatingConstructorCall(value.descriptor, args) - value.descriptor is FunctionDescriptor -> return evaluateFunctionCall(value as IrCall, args) + value.descriptor is FunctionDescriptor -> return evaluateFunctionCall( + value as IrCall, args, resultLifetime(value)) else -> { TODO("${ir2string(value)}") } @@ -1667,11 +1671,12 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid //-------------------------------------------------------------------------// - private fun evaluateFunctionCall(callee: IrCall, args: List): LLVMValueRef { + private fun evaluateFunctionCall(callee: IrCall, args: List, + resultLifetime: Lifetime): LLVMValueRef { val descriptor:FunctionDescriptor = callee.descriptor as FunctionDescriptor if (descriptor.isFunctionInvoke) { - return evaluateFunctionInvoke(descriptor, args) + return evaluateFunctionInvoke(descriptor, args, resultLifetime) } if (descriptor.isIntrinsic) { @@ -1681,7 +1686,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid when (descriptor) { is IrBuiltinOperatorDescriptorBase -> return evaluateOperatorCall (callee, args) is ConstructorDescriptor -> return evaluateConstructorCall (callee, args) - else -> return evaluateSimpleFunctionCall(descriptor, args, callee.superQualifier) + else -> return evaluateSimpleFunctionCall( + descriptor, args, resultLifetime, callee.superQualifier) } } @@ -1696,7 +1702,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } private fun evaluateFunctionInvoke(descriptor: FunctionDescriptor, - args: List): LLVMValueRef { + args: List, resultLifetime: Lifetime): LLVMValueRef { // Note: the whole function code below is written in the assumption that // `invoke` method receiver is passed as first argument. @@ -1711,22 +1717,24 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid // Get `functionImpl.unboundRef`: val unboundRef = evaluateSimpleFunctionCall(functionImplUnboundRefGetter, - listOf(functionImpl)) + listOf(functionImpl), Lifetime.IRRELEVANT /* unboundRef isn't managed reference */) // Cast `functionImpl.unboundRef` to pointer to function: val entryPtr = codegen.bitcast(pointerType(unboundRefType), unboundRef, "entry") - return call(descriptor, entryPtr, args) + return call(descriptor, entryPtr, args, resultLifetime) } //-------------------------------------------------------------------------// - private fun evaluateSimpleFunctionCall(descriptor: FunctionDescriptor, args: List, superClass: ClassDescriptor? = null): LLVMValueRef { + private fun evaluateSimpleFunctionCall( + descriptor: FunctionDescriptor, args: List, + resultLifetime: Lifetime, superClass: ClassDescriptor? = null): LLVMValueRef { //context.log("evaluateSimpleFunctionCall : $tmpVariableName = ${ir2string(value)}") if (descriptor.isOverridable && superClass == null) - return callVirtual(descriptor, args) + return callVirtual(descriptor, args, resultLifetime) else - return callDirect(descriptor, args) + return callDirect(descriptor, args, resultLifetime) } //-------------------------------------------------------------------------// @@ -1737,12 +1745,13 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid if (descriptor.dispatchReceiverParameter != null) args.add(evaluateExpression(value.dispatchReceiver!!)) //add this ptr args.add(evaluateExpression(value.getValueArgument(0)!!)) - return evaluateSimpleFunctionCall(descriptor, args, value.superQualifier) + return evaluateSimpleFunctionCall( + descriptor, args, Lifetime.IRRELEVANT, value.superQualifier) } //-------------------------------------------------------------------------// - private fun hintForCall(callee: IrCall): Int { - return allocHints.getOrElse(callee) { SCOPE_GLOBAL } + private fun resultLifetime(callee: IrMemberAccessExpression): Lifetime { + return resultLifetimes.getOrElse(callee) { Lifetime.GLOBAL } } private fun evaluateConstructorCall(callee: IrCall, args: List): LLVMValueRef { @@ -1751,12 +1760,13 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid val constructedClass = (callee.descriptor as ConstructorDescriptor).constructedClass val thisValue = if (constructedClass.isArray) { assert(args.size >= 1 && args[0].type == int32Type) - codegen.allocArray(codegen.typeInfoValue(constructedClass), hintForCall(callee), args[0]) + codegen.allocArray(codegen.typeInfoValue(constructedClass), args[0], + resultLifetime(callee)) } else { - codegen.allocInstance(codegen.typeInfoValue(constructedClass), hintForCall(callee)) + codegen.allocInstance(codegen.typeInfoValue(constructedClass), resultLifetime(callee)) } evaluateSimpleFunctionCall(callee.descriptor as FunctionDescriptor, - listOf(thisValue) + args) + listOf(thisValue) + args, Lifetime.IRRELEVANT /* constructor doesn't return anything */) return thisValue } } @@ -1851,15 +1861,17 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid //-------------------------------------------------------------------------// - fun callDirect(descriptor: FunctionDescriptor, args: List): LLVMValueRef { + fun callDirect(descriptor: FunctionDescriptor, args: List, + resultLifetime: Lifetime): LLVMValueRef { val realDescriptor = descriptor.resolveFakeOverride().original val llvmFunction = codegen.functionLlvmValue(realDescriptor) - return call(descriptor, llvmFunction, args) + return call(descriptor, llvmFunction, args, resultLifetime) } //-------------------------------------------------------------------------// - fun callVirtual(descriptor: FunctionDescriptor, args: List): LLVMValueRef { + fun callVirtual(descriptor: FunctionDescriptor, args: List, + resultLifetime: Lifetime): LLVMValueRef { val typeInfoPtrPtr = LLVMBuildStructGEP(codegen.builder, args[0], 0 /* type_info */, "")!! val typeInfoPtr = codegen.load(typeInfoPtrPtr) assert (typeInfoPtr.type == codegen.kTypeInfoPtr) @@ -1881,12 +1893,11 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid // for an additional per-interface vtable. val methodHash = codegen.functionHash(descriptor) // Calculate hash of the method to be invoked val lookupArgs = listOf(typeInfoPtr, methodHash) // Prepare args for lookup - call(context.llvm.lookupOpenMethodFunction, - lookupArgs) + call(context.llvm.lookupOpenMethodFunction, lookupArgs) } val functionPtrType = pointerType(codegen.getLlvmFunctionType(descriptor)) // Construct type of the method to be invoked val function = codegen.bitcast(functionPtrType, llvmMethod) // Cast method address to the type - return call(descriptor, function, args) // Invoke the method + return call(descriptor, function, args, resultLifetime) // Invoke the method } //-------------------------------------------------------------------------// @@ -1895,8 +1906,9 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid // instead of a plain list. // In such case it would be possible to check that all args are available and in the correct order. // However, it currently requires some refactoring to be performed. - private fun call(descriptor: FunctionDescriptor, function: LLVMValueRef, args: List): LLVMValueRef { - val result = call(function, args) + private fun call(descriptor: FunctionDescriptor, function: LLVMValueRef, args: List, + resultLifetime: Lifetime): LLVMValueRef { + val result = call(function, args, resultLifetime) if (descriptor.returnType?.isNothing() == true) { codegen.unreachable() } @@ -1908,15 +1920,9 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid return result } - private fun call(function: LLVMValueRef, args: List): LLVMValueRef { - if (codegen.isObjectReturn(function.type)) { - // If function returns an object - create slot for the returned value. - // This allows appropriate rootset accounting by just looking at the stack slots. - val resultSlot = codegen.vars.createAnonymousSlot() - return currentCodeContext.genCall(function, args + resultSlot) - } else { - return currentCodeContext.genCall(function, args) - } + private fun call(function: LLVMValueRef, args: List, + resultLifetime: Lifetime = Lifetime.IRRELEVANT): LLVMValueRef { + return currentCodeContext.genCall(function, args, resultLifetime) } //-------------------------------------------------------------------------// @@ -1934,7 +1940,8 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid codegen.bitcast(thisPtrArgType, thisPtr) } - return callDirect(descriptor, listOf(thisPtrArg) + args) + return callDirect(descriptor, listOf(thisPtrArg) + args, + Lifetime.IRRELEVANT /* no value returned */) } //-------------------------------------------------------------------------// diff --git a/runtime/src/launcher/cpp/launcher.cpp b/runtime/src/launcher/cpp/launcher.cpp index a077f1f266f..eaf11f0f927 100644 --- a/runtime/src/launcher/cpp/launcher.cpp +++ b/runtime/src/launcher/cpp/launcher.cpp @@ -8,13 +8,13 @@ OBJ_GETTER(setupArgs, int argc, char** argv) { // The count is one less, because we skip argv[0] which is the binary name. - AllocArrayInstance(theArrayTypeInfo, argc - 1, OBJ_RESULT); - ArrayHeader* array = (*OBJ_RESULT)->array(); + ObjHeader* result = AllocArrayInstance(theArrayTypeInfo, argc - 1, OBJ_RESULT); + ArrayHeader* array = result->array(); for (int index = 1; index < argc; index++) { AllocStringInstance(argv[index], strlen(argv[index]), ArrayAddressOfElementAt(array, index - 1)); } - RETURN_OBJ_RESULT(); + return result; } //--- main --------------------------------------------------------------------// diff --git a/runtime/src/main/cpp/Exceptions.cpp b/runtime/src/main/cpp/Exceptions.cpp index 48755a5237d..65fed9011bd 100644 --- a/runtime/src/main/cpp/Exceptions.cpp +++ b/runtime/src/main/cpp/Exceptions.cpp @@ -50,15 +50,13 @@ OBJ_GETTER0(GetCurrentStackTrace) { RuntimeAssert(symbols != nullptr, "Not enough memory to retrieve the stacktrace"); AutoFree autoFree(symbols); - AllocArrayInstance(theArrayTypeInfo, size, OBJ_RESULT); - - ArrayHeader* array = (*OBJ_RESULT)->array(); + ObjHeader* result = AllocArrayInstance(theArrayTypeInfo, size, OBJ_RESULT); + ArrayHeader* array = result->array(); for (int index = 0; index < size; ++index) { AllocStringInstance(symbols[index], strlen(symbols[index]), ArrayAddressOfElementAt(array, index)); } - - RETURN_OBJ_RESULT(); + return result; } void ThrowException(KRef exception) { diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index b5b3f2df7be..6d5f50e61f8 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -90,6 +90,15 @@ inline container_size_t alignUp(container_size_t size, int alignment) { return (size + alignment - 1) & ~(alignment - 1); } +inline bool isArenaSlot(ObjHeader** slot) { + return (reinterpret_cast(slot) & ARENA_BIT) != 0; +} + +inline ObjHeader** asArenaSlot(ObjHeader** slot) { + return reinterpret_cast( + reinterpret_cast(slot) & ~ARENA_BIT); +} + #if USE_GC // Must be vector or map 'container -> number', to keep reference counters correct. @@ -199,7 +208,9 @@ void phase4(ContainerHeader* header, ContainerHeaderSet* toRemove) { #endif // USE_GC // We use first slot as place to store frame-local arena container. -ArenaContainer* initedArena(ObjHeader** auxSlot) { +// TODO: create ArenaContainer object on the stack, so that we don't +// do two allocations per frame (ArenaContainer + actual container). +inline ArenaContainer* initedArena(ObjHeader** auxSlot) { ObjHeader* slotValue = *auxSlot; if (slotValue) return reinterpret_cast(slotValue); ArenaContainer* arena = allocMemory(sizeof(ArenaContainer)); @@ -208,6 +219,17 @@ ArenaContainer* initedArena(ObjHeader** auxSlot) { return arena; } +// TODO: shall we do padding for alignment? +inline container_size_t objectSize(const ObjHeader* obj) { + const TypeInfo* type_info = obj->type_info(); + container_size_t size = type_info->instanceSize_ < 0 ? + // An array. + ArrayDataSizeBytes(obj->array()) + sizeof(ArrayHeader) + : + type_info->instanceSize_ + sizeof(ObjHeader); + return alignUp(size, kObjectAlignment); +} + } // namespace ContainerHeader* AllocContainer(size_t size) { @@ -221,16 +243,7 @@ ContainerHeader* AllocContainer(size_t size) { return result; } -// TODO: shall we do padding for alignment? -uint32_t ObjectSize(const ObjHeader* obj) { - const TypeInfo* type_info = obj->type_info(); - if (type_info->instanceSize_ < 0) { - // An array. - return ArrayDataSizeBytes(obj->array()) + sizeof(ArrayHeader); - } else { - return type_info->instanceSize_ + sizeof(ObjHeader); - } -} + void FreeContainer(ContainerHeader* header) { RuntimeAssert(!isPermanent(header), "this kind of container shalln't be freed"); @@ -262,7 +275,8 @@ void FreeContainer(ContainerHeader* header) { ArrayHeader* array = obj->array(); ReleaseLocalRefs(ArrayAddressOfElementAt(array, 0), array->count_); } - obj = reinterpret_cast(reinterpret_cast(obj) + ObjectSize(obj)); + obj = reinterpret_cast( + reinterpret_cast(obj) + objectSize(obj)); } // And release underlying memory. @@ -345,6 +359,7 @@ void ArenaContainer::Deinit() { bool ArenaContainer::allocContainer(container_size_t minSize) { auto size = minSize + sizeof(ContainerHeader) + sizeof(ContainerChunk); size = alignUp(size, kContainerAlignment); + // TODO: keep simple cache of container chunks. ContainerChunk* result = allocMemory(size); RuntimeAssert(result != nullptr, "Cannot alloc memory"); if (result == nullptr) return false; @@ -493,24 +508,29 @@ void DeinitMemory() { memoryState = nullptr; } -ObjHeader* ArenaAllocInstance(const TypeInfo* type_info, ObjHeader** auxSlot) { - RuntimeAssert(type_info->instanceSize_ >= 0, "must be an object"); - return initedArena(auxSlot)->PlaceObject(type_info); -} - OBJ_GETTER(AllocInstance, const TypeInfo* type_info) { RuntimeAssert(type_info->instanceSize_ >= 0, "must be an object"); + if (isArenaSlot(OBJ_RESULT)) { + auto arena = initedArena(asArenaSlot(OBJ_RESULT)); + auto result = arena->PlaceObject(type_info); +#if TRACE_MEMORY + fprintf(stderr, "instace %p in arena: %p\n", result, arena); +#endif + return result; + } RETURN_OBJ(ObjectContainer(type_info).GetPlace()); } -ObjHeader* ArenaAllocArrayInstance( - const TypeInfo* type_info, uint32_t elements, ObjHeader** auxSlot) { - RuntimeAssert(type_info->instanceSize_ < 0, "must be an array"); - return initedArena(auxSlot)->PlaceArray(type_info, elements)->obj(); -} - OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, uint32_t elements) { RuntimeAssert(type_info->instanceSize_ < 0, "must be an array"); + if (isArenaSlot(OBJ_RESULT)) { + auto arena = initedArena(asArenaSlot(OBJ_RESULT)); + auto result = arena->PlaceArray(type_info, elements)->obj(); +#if TRACE_MEMORY + fprintf(stderr, "array[%d] %p in arena: %p\n", elements, result, arena); +#endif + return result; + } RETURN_OBJ(ArrayContainer(type_info, elements).GetPlace()->obj()); } @@ -550,7 +570,7 @@ OBJ_GETTER(InitInstance, #if TRACE_MEMORY memoryState->globalObjects->push_back(location); #endif - RETURN_OBJ_RESULT(); + return object; } catch (...) { UpdateLocalRef(OBJ_RESULT, nullptr); UpdateGlobalRef(location, nullptr); @@ -581,7 +601,25 @@ void SetGlobalRef(ObjHeader** location, const ObjHeader* object) { #endif } +void UpdateReturnRef(ObjHeader** returnSlot, const ObjHeader* object) { + if (isArenaSlot(returnSlot)) return; + ObjHeader* old = *returnSlot; +#if TRACE_MEMORY + fprintf(stderr, "UpdateReturnRef *%p: %p -> %p\n", returnSlot, old, object); +#endif + if (old != object) { + if (object != nullptr) { + AddRef(object); + } + *const_cast(returnSlot) = object; + if (old > reinterpret_cast(1)) { + ReleaseRef(old); + } + } +} + void UpdateLocalRef(ObjHeader** location, const ObjHeader* object) { + RuntimeAssert(!isArenaSlot(location), "must not be a slot"); ObjHeader* old = *location; #if TRACE_MEMORY fprintf(stderr, "UpdateLocalRef *%p: %p -> %p\n", location, old, object); @@ -598,6 +636,7 @@ void UpdateLocalRef(ObjHeader** location, const ObjHeader* object) { } void UpdateGlobalRef(ObjHeader** location, const ObjHeader* object) { + RuntimeAssert(!isArenaSlot(location), "Must not be an arena"); #if CONCURRENT ObjHeader* old = *location; #if TRACE_MEMORY @@ -625,9 +664,15 @@ void UpdateGlobalRef(ObjHeader** location, const ObjHeader* object) { } void LeaveFrame(ObjHeader** start, int count) { +#if TRACE_MEMORY + fprintf(stderr, "LeaveFrame %p .. %p\n", start, start + count); +#endif ReleaseLocalRefs(start + 1, count - 1); if (*start != nullptr) { auto arena = initedArena(start); +#if TRACE_MEMORY + fprintf(stderr, "LeaveFrame: free arena %p\n", arena); +#endif arena->Deinit(); freeMemory(arena); } diff --git a/runtime/src/main/cpp/Memory.h b/runtime/src/main/cpp/Memory.h index 7db58109722..fe21299e41f 100644 --- a/runtime/src/main/cpp/Memory.h +++ b/runtime/src/main/cpp/Memory.h @@ -5,17 +5,6 @@ #include "Common.h" #include "TypeInfo.h" -typedef enum { - // Allocation guaranteed to be frame local. - SCOPE_FRAME = 0, - // Allocation is generic global allocation. - SCOPE_GLOBAL = 1, - // Allocation shall take place in current stack arena. - SCOPE_ARENA = 2, - // Allocation is permanent. - SCOPE_PERMANENT = 3 -} PlacementHint; - // Must fit in two bits. typedef enum { // Container is normal thread local container. @@ -297,13 +286,23 @@ class ArenaContainer { extern "C" { #endif +// Bit or'ed to slot pointer, marking the fact that allocation shall happen +// in arena pointed by the slot. +#define ARENA_BIT 1 #define OBJ_RESULT __result__ #define OBJ_GETTER0(name) ObjHeader* name(ObjHeader** OBJ_RESULT) #define OBJ_GETTER(name, ...) ObjHeader* name(__VA_ARGS__, ObjHeader** OBJ_RESULT) -#define RETURN_OBJ(value) { ObjHeader* obj = value; UpdateLocalRef(OBJ_RESULT, obj); return obj; } -#define RETURN_OBJ_RESULT() return *OBJ_RESULT; -#define RETURN_RESULT_OF0(name) name(OBJ_RESULT); return *OBJ_RESULT; -#define RETURN_RESULT_OF(name, ...) name(__VA_ARGS__, OBJ_RESULT); return *OBJ_RESULT; +#define RETURN_OBJ(value) { ObjHeader* obj = value; \ + UpdateReturnRef(OBJ_RESULT, obj); \ + return obj; } +#define RETURN_RESULT_OF0(name) { \ + ObjHeader* obj = name(OBJ_RESULT); \ + return obj; \ + } +#define RETURN_RESULT_OF(name, ...) { \ + ObjHeader* result = name(__VA_ARGS__, OBJ_RESULT); \ + return result; \ + } void InitMemory(); void DeinitMemory(); @@ -320,10 +319,7 @@ void DeinitMemory(); // Escape analysis algorithm is the provider of information for decision on exact aux slot // selection, and comes from upper bound esteemation of object lifetime. // -ObjHeader* ArenaAllocInstance(const TypeInfo* type_info, ObjHeader** auxSlot) RUNTIME_NOTHROW; OBJ_GETTER(AllocInstance, const TypeInfo* type_info) RUNTIME_NOTHROW; -ObjHeader* ArenaAllocArrayInstance( - const TypeInfo* type_info, uint32_t elements, ObjHeader** auxSlot) RUNTIME_NOTHROW; OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, uint32_t elements) RUNTIME_NOTHROW; OBJ_GETTER(AllocStringInstance, const char* data, uint32_t length) RUNTIME_NOTHROW; OBJ_GETTER(InitInstance, @@ -359,9 +355,10 @@ void SetGlobalRef(ObjHeader** location, const ObjHeader* object) RUNTIME_NOTHROW void UpdateLocalRef(ObjHeader** location, const ObjHeader* object) RUNTIME_NOTHROW; // Update potentially globally visible location. void UpdateGlobalRef(ObjHeader** location, const ObjHeader* object) RUNTIME_NOTHROW; +// Update reference in return slot. +void UpdateReturnRef(ObjHeader** returnSlot, const ObjHeader* object) RUNTIME_NOTHROW; // Optimization: release all references in range. void ReleaseLocalRefs(ObjHeader** start, int count) RUNTIME_NOTHROW; -void ReleaseGlobalRefs(ObjHeader** start, int count) RUNTIME_NOTHROW; // Called on frame leave, if it has object slots. void LeaveFrame(ObjHeader** start, int count) RUNTIME_NOTHROW; // Collect garbage, which cannot be found by reference counting (cycles). diff --git a/runtime/src/main/cpp/ToString.cpp b/runtime/src/main/cpp/ToString.cpp index ab42153d84a..89979d1cd4c 100644 --- a/runtime/src/main/cpp/ToString.cpp +++ b/runtime/src/main/cpp/ToString.cpp @@ -11,8 +11,8 @@ namespace { OBJ_GETTER(makeString, const char* cstring) { uint32_t length = strlen(cstring); - ArrayHeader* result = ArrayContainer( - theStringTypeInfo, length).GetPlace(); + ArrayHeader* result = AllocArrayInstance( + theStringTypeInfo, length, OBJ_RESULT)->array(); memcpy( ByteArrayAddressOfElementAt(result, 0), cstring, From 162676c878cef0d60260292cebaff378437d9b13 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Mon, 30 Jan 2017 12:49:49 +0300 Subject: [PATCH 73/86] buildSrc: fix goldValue initialisation in test suite --- .../src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index be8b0f02749..f7d1cf8181b 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -145,8 +145,9 @@ abstract class KonanTest extends DefaultTask { } } - if (goldValue != null && goldValue != out.toString()) + if (goldValue != null && goldValue != out.toString()) { throw new RuntimeException("test failed.") + } } } @@ -176,10 +177,13 @@ class RunExternalTestGroup extends RunKonanTest { def groupDirectory = "." def outputSourceSetName = "testOutputExternal" String filter = project.findProperty("filter") - String goldValue = "OK" Map results = [:] Statistics statistics = new Statistics() + RunExternalTestGroup() { + goldValue = "OK" + } + static class TestResult { String status = null String comment = null From f0950a92c3fe6851b60958b4f6898bfb06ff242b Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 30 Jan 2017 18:36:12 +0300 Subject: [PATCH 74/86] Various small fixes. (#208) --- .../jetbrains/kotlin/backend/konan/Context.kt | 2 - .../backend/konan/llvm/CodeGenerator.kt | 4 +- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 2 +- .../backend/konan/llvm/LlvmDeclarations.kt | 2 +- .../kotlin/backend/konan/llvm/StaticData.kt | 2 +- runtime/src/main/cpp/Memory.cpp | 5 +- runtime/src/main/cpp/Memory.h | 2 +- runtime/src/main/kotlin/kotlin/Array.kt | 1 - runtime/src/main/kotlin/kotlin/Arrays.kt | 120 ++++++++++++++++++ runtime/src/main/kotlin/kotlin/String.kt | 1 + .../main/kotlin/kotlin/collections/HashMap.kt | 7 +- .../kotlin/kotlin/internal/Annotations.kt | 8 ++ 12 files changed, 143 insertions(+), 13 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index 8b759fb899d..41b4ed80cf5 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -17,8 +17,6 @@ import java.lang.System.out internal final class Context(val config: KonanConfig) : KonanBackendContext() { - val debug = true - var moduleDescriptor: ModuleDescriptor? = null // TODO: make lateinit? diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt index 6eb5fc0c44b..5e0ac5f26fa 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/CodeGenerator.kt @@ -32,8 +32,8 @@ internal class CodeGenerator(override val context: Context) : ContextUtils { prologue(llvmFunction, LLVMGetReturnType(getLlvmFunctionType(descriptor))!!) - if (!descriptor.isExported() && !context.debug) { - LLVMSetLinkage(llvmFunction, LLVMLinkage.LLVMPrivateLinkage) + if (!descriptor.isExported()) { + LLVMSetLinkage(llvmFunction, LLVMLinkage.LLVMInternalLinkage) // (Cannot do this before the function body is created). } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 7d3e03b103e..b8cef7fc9eb 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -614,7 +614,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid context.llvm.fileInitializers.add(expression) } - LLVMSetLinkage(globalProperty, LLVMLinkage.LLVMPrivateLinkage) + LLVMSetLinkage(globalProperty, LLVMLinkage.LLVMInternalLinkage) // (Cannot do this before the global is initialized). return diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt index 7681cbef81e..08c7070c5f0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/LlvmDeclarations.kt @@ -239,7 +239,7 @@ private class DeclarationsGeneratorVisitor(override val context: Context) : typeInfoSymbolName)!! if (!descriptor.isExported()) { - LLVMSetLinkage(llvmTypeInfoPtr, LLVMLinkage.LLVMPrivateLinkage) + LLVMSetLinkage(llvmTypeInfoPtr, LLVMLinkage.LLVMInternalLinkage) } typeInfoPtr = constPointer(llvmTypeInfoPtr) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt index 61ff132c58d..1721db48778 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/StaticData.kt @@ -28,7 +28,7 @@ internal class StaticData(override val context: Context): ContextUtils { val llvmGlobal = LLVMAddGlobal(module, type, name)!! if (!isExported) { - LLVMSetLinkage(llvmGlobal, LLVMLinkage.LLVMPrivateLinkage) + LLVMSetLinkage(llvmGlobal, LLVMLinkage.LLVMInternalLinkage) } return llvmGlobal diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index 6d5f50e61f8..f4492dcdd1b 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -559,8 +559,7 @@ OBJ_GETTER(InitInstance, RETURN_OBJ(value); } - AllocInstance(type_info, OBJ_RESULT); - ObjHeader* object = *OBJ_RESULT; + ObjHeader* object = AllocInstance(type_info, OBJ_RESULT); UpdateGlobalRef(location, object); try { ctor(object); @@ -574,7 +573,7 @@ OBJ_GETTER(InitInstance, } catch (...) { UpdateLocalRef(OBJ_RESULT, nullptr); UpdateGlobalRef(location, nullptr); - RETURN_OBJ(nullptr); + throw; } } diff --git a/runtime/src/main/cpp/Memory.h b/runtime/src/main/cpp/Memory.h index fe21299e41f..afc9a99ad88 100644 --- a/runtime/src/main/cpp/Memory.h +++ b/runtime/src/main/cpp/Memory.h @@ -323,7 +323,7 @@ OBJ_GETTER(AllocInstance, const TypeInfo* type_info) RUNTIME_NOTHROW; OBJ_GETTER(AllocArrayInstance, const TypeInfo* type_info, uint32_t elements) RUNTIME_NOTHROW; OBJ_GETTER(AllocStringInstance, const char* data, uint32_t length) RUNTIME_NOTHROW; OBJ_GETTER(InitInstance, - ObjHeader** location, const TypeInfo* type_info, void (*ctor)(ObjHeader*)) RUNTIME_NOTHROW; + ObjHeader** location, const TypeInfo* type_info, void (*ctor)(ObjHeader*)); // // Object reference management. diff --git a/runtime/src/main/kotlin/kotlin/Array.kt b/runtime/src/main/kotlin/kotlin/Array.kt index b1b9bf9e46d..8acea4de9f7 100644 --- a/runtime/src/main/kotlin/kotlin/Array.kt +++ b/runtime/src/main/kotlin/kotlin/Array.kt @@ -46,7 +46,6 @@ private class IteratorImpl(val collection: Array) : Iterator { } } -public fun arrayOf(vararg elements: T) : Array = elements @kotlin.internal.InlineOnly public inline operator fun Array.plus(elements: Array): Array { diff --git a/runtime/src/main/kotlin/kotlin/Arrays.kt b/runtime/src/main/kotlin/kotlin/Arrays.kt index b5fa8b5985a..d9902de728f 100644 --- a/runtime/src/main/kotlin/kotlin/Arrays.kt +++ b/runtime/src/main/kotlin/kotlin/Arrays.kt @@ -1,6 +1,7 @@ package kotlin import kotlin.collections.* +import kotlin.internal.PureReifiable // TODO: make all iterator() methods inline. @@ -883,3 +884,122 @@ public fun BooleanArray.toHashSet(): HashSet { public fun CharArray.toHashSet(): HashSet { return toCollection(HashSet(mapCapacity(size))) } + +// From Library.kt. +/** + * Returns an array of objects of the given type with the given [size], initialized with null values. + */ +public inline fun arrayOfNulls(size: Int): Array = + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + arrayOfUninitializedElements(size) + +/** + * Returns an array containing the specified elements. + */ +public inline fun arrayOf(vararg elements: T): Array = elements as Array + +// TODO: optimize those operations. +/** + * Returns an array containing the specified [Double] numbers. + */ + +public fun doubleArrayOf(vararg elements: Double): DoubleArray { + val result = DoubleArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified [Float] numbers. + */ +public fun floatArrayOf(vararg elements: Float): FloatArray { + val result = FloatArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified [Long] numbers. + */ +public fun longArrayOf(vararg elements: Long): LongArray { + val result = LongArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified [Int] numbers. + */ +public fun intArrayOf(vararg elements: Int): IntArray { + val result = IntArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified characters. + */ +public fun charArrayOf(vararg elements: Char): CharArray { + val result = CharArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified [Short] numbers. + */ +public fun shortArrayOf(vararg elements: Short): ShortArray { + val result = ShortArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified [Byte] numbers. + */ +public fun byteArrayOf(vararg elements: Byte): ByteArray { + val result = ByteArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} + +/** + * Returns an array containing the specified boolean values. + */ +public fun booleanArrayOf(vararg elements: Boolean): BooleanArray { + val result = BooleanArray(elements.size) + var index = 0 + while (index < elements.size) { + result[index] = elements[index] + index++ + } + return result +} \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/String.kt b/runtime/src/main/kotlin/kotlin/String.kt index 4a698a10dbf..0b1d9e953f3 100644 --- a/runtime/src/main/kotlin/kotlin/String.kt +++ b/runtime/src/main/kotlin/kotlin/String.kt @@ -43,6 +43,7 @@ public final class String : Comparable, CharSequence { // TODO: in big Kotlin this operations are in kotlin.kotlin_builtins. private val kNullString = "" + public operator fun kotlin.String?.plus(other: kotlin.Any?): kotlin.String = this?.plus(other?.toString() ?: kNullString) ?: other?.toString() ?: kNullString diff --git a/runtime/src/main/kotlin/kotlin/collections/HashMap.kt b/runtime/src/main/kotlin/kotlin/collections/HashMap.kt index a91e9a29281..7d56b7a517e 100644 --- a/runtime/src/main/kotlin/kotlin/collections/HashMap.kt +++ b/runtime/src/main/kotlin/kotlin/collections/HashMap.kt @@ -37,7 +37,12 @@ class HashMap private constructor( override fun containsKey(key: K): Boolean = findKey(key) >= 0 override fun containsValue(value: V): Boolean = findValue(value) >= 0 - override fun get(key: K): V? { + + operator fun set(key: K, value: V): Unit { + put(key, value) + } + + override operator fun get(key: K): V? { val index = findKey(key) if (index < 0) return null return valuesArray!![index] diff --git a/runtime/src/main/kotlin/kotlin/internal/Annotations.kt b/runtime/src/main/kotlin/kotlin/internal/Annotations.kt index 1c80ba3ed9c..83f2baad656 100644 --- a/runtime/src/main/kotlin/kotlin/internal/Annotations.kt +++ b/runtime/src/main/kotlin/kotlin/internal/Annotations.kt @@ -52,3 +52,11 @@ internal annotation class InlineOnly @Target(AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.BINARY) internal annotation class InlineExposed + +/** + * Specifies that the corresponding type parameter is not used for unsafe operations such as casts or 'is' checks + * That means it's completely safe to use generic types as argument for such parameter. + */ +@Target(AnnotationTarget.TYPE_PARAMETER) +@Retention(AnnotationRetention.BINARY) +internal annotation class PureReifiable From eeea4fc1016327c659cdab9d5aaecf4c87f1c820 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Tue, 31 Jan 2017 11:58:37 +0300 Subject: [PATCH 75/86] compiler: 1.1-20170131.025158-393 --- .../kotlin/backend/common/lower/LocalDeclarationsLowering.kt | 3 ++- .../jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt | 2 +- gradle.properties | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index e7cf1b20da8..906805305b3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -519,7 +519,8 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, - /* isExternal = */ false) + /* isExternal = */ false, + /* isDelegated = */ false) fieldDescriptor.initialize(/* getter = */ null, /* setter = */ null) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt index 2bc15f31714..5cf1eb82631 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/EnumClassLowering.kt @@ -303,7 +303,7 @@ internal class EnumClassLowering(val context: Context) : ClassLoweringPass { val receiver = ReceiverParameterDescriptorImpl(implObjectDescriptor, ImplicitClassReceiver(implObjectDescriptor)) return PropertyDescriptorImpl.create(implObjectDescriptor, Annotations.EMPTY, Modality.FINAL, Visibilities.PRIVATE, false, "VALUES".synthesizedName, CallableMemberDescriptor.Kind.SYNTHESIZED, irClass.descriptor.source, - false, false, false, false, false).initialize(valuesArrayType, dispatchReceiverParameter = receiver) + false, false, false, false, false, false).initialize(valuesArrayType, dispatchReceiverParameter = receiver) } private val kotlinPackage = context.irModule!!.descriptor.getPackage(FqName("kotlin")) diff --git a/gradle.properties b/gradle.properties index 3c7a7e2ed50..b596dba59bc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin_version=1.1-M03 #kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-SNAPSHOT -kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170120.135555-375 +kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170131.025158-393 From 4911f7820013102813dd0a4ed2a0cdcbaad21c94 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Tue, 31 Jan 2017 15:36:21 +0500 Subject: [PATCH 76/86] Inner classes (#207) * Inner classes lowering * cmd line fix * tests * * reverted adding parameter to inner classes constructors * variables are identified by their descriptors * review fixes --- .../jetbrains/kotlin/backend/konan/Context.kt | 44 ++++-- .../kotlin/backend/konan/KonanLower.kt | 3 + .../kotlin/backend/konan/KonanPhases.kt | 1 + .../konan/descriptors/DescriptorUtils.kt | 20 +-- .../backend/konan/llvm/VariableManager.kt | 24 +-- .../lower/DefaultParameterStubGenerator.kt | 21 ++- .../backend/konan/lower/InnerClassLowering.kt | 141 ++++++++++++++++++ backend.native/tests/build.gradle | 20 +++ .../tests/codegen/innerClass/generic.kt | 15 ++ .../tests/codegen/innerClass/getOuterVal.kt | 12 ++ .../tests/codegen/innerClass/qualifiedThis.kt | 46 ++++++ .../tests/codegen/innerClass/simple.kt | 12 ++ cmd/konanc | 2 +- 13 files changed, 323 insertions(+), 38 deletions(-) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InnerClassLowering.kt create mode 100644 backend.native/tests/codegen/innerClass/generic.kt create mode 100644 backend.native/tests/codegen/innerClass/getOuterVal.kt create mode 100644 backend.native/tests/codegen/innerClass/qualifiedThis.kt create mode 100644 backend.native/tests/codegen/innerClass/simple.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index 41b4ed80cf5..e984a0c1f5b 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -1,24 +1,46 @@ package org.jetbrains.kotlin.backend.konan -import llvm.* -import org.jetbrains.kotlin.backend.konan.ir.Ir -import org.jetbrains.kotlin.backend.konan.ir.ModuleIndex -import org.jetbrains.kotlin.backend.konan.KonanBackendContext -import org.jetbrains.kotlin.backend.konan.KonanPhase -import org.jetbrains.kotlin.backend.konan.KonanConfig -import org.jetbrains.kotlin.backend.konan.KonanConfigKeys -import org.jetbrains.kotlin.ir.declarations.IrModuleFragment -import org.jetbrains.kotlin.descriptors.ModuleDescriptor -import org.jetbrains.kotlin.resolve.BindingContext +import llvm.LLVMDumpModule +import llvm.LLVMModuleRef +import org.jetbrains.kotlin.backend.jvm.descriptors.initialize import org.jetbrains.kotlin.backend.konan.descriptors.deepPrint -import org.jetbrains.kotlin.backend.konan.llvm.* +import org.jetbrains.kotlin.backend.konan.descriptors.synthesizedName +import org.jetbrains.kotlin.backend.konan.ir.Ir +import org.jetbrains.kotlin.backend.konan.llvm.Llvm +import org.jetbrains.kotlin.backend.konan.llvm.LlvmDeclarations +import org.jetbrains.kotlin.backend.konan.llvm.verifyModule +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl +import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.ir.util.DumpIrTreeVisitor +import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver import java.lang.System.out +internal class SpecialDescriptorsFactory { + private val outerThisDescriptors = mutableMapOf() + + fun getOuterThisFieldDescriptor(innerClassDescriptor: ClassDescriptor): PropertyDescriptor = + if (!innerClassDescriptor.isInner) throw AssertionError("Class is not inner: $innerClassDescriptor") + else outerThisDescriptors.getOrPut(innerClassDescriptor) { + val outerClassDescriptor = DescriptorUtils.getContainingClass(innerClassDescriptor) ?: + throw AssertionError("No containing class for inner class $innerClassDescriptor") + + val receiver = ReceiverParameterDescriptorImpl(innerClassDescriptor, ImplicitClassReceiver(innerClassDescriptor)) + PropertyDescriptorImpl.create(innerClassDescriptor, Annotations.EMPTY, Modality.FINAL, Visibilities.PRIVATE, + false, "this$0".synthesizedName, CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, + false, false, false, false, false, false).initialize(outerClassDescriptor.defaultType, dispatchReceiverParameter = receiver) + } +} + internal final class Context(val config: KonanConfig) : KonanBackendContext() { var moduleDescriptor: ModuleDescriptor? = null + val specialDescriptorsFactory = SpecialDescriptorsFactory() + // TODO: make lateinit? var irModule: IrModuleFragment? = null set(module: IrModuleFragment?) { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index c7b3ed3aca1..ec5af21dd11 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -20,6 +20,9 @@ internal class KonanLower(val context: Context) { phaser.phase(KonanPhase.LOWER_ENUMS) { EnumClassLowering(context).run(irFile) } + phaser.phase(KonanPhase.LOWER_INNER_CLASSES) { + InnerClassLowering(context).runOnFilePostfix(irFile) + } phaser.phase(KonanPhase.LOWER_DEFAULT_PARAMETER_EXTENT) { DefaultParameterStubGenerator(context).runOnFilePostfix(irFile) DefaultParameterInjector(context).runOnFilePostfix(irFile) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt index dd6c3d07253..b089571033d 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt @@ -19,6 +19,7 @@ enum class KonanPhase(val description: String, /* ... ... */ LOWER_INLINE("Functions inlining"), /* ... ... */ AUTOBOX("Autoboxing of primitive types"), /* ... ... */ LOWER_ENUMS("Enum classes lowering"), + /* ... ... */ LOWER_INNER_CLASSES("Inner classes lowering"), /* ... */ BITCODE("LLVM BitCode Generation"), /* ... ... */ RTTI("RTTI Generation"), /* ... ... */ CODEGEN("Code Generation"), diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index 4106b161ea8..fabd169b0c6 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -134,16 +134,18 @@ internal fun KotlinType.isUnboundCallableReference(): Boolean { internal val CallableDescriptor.allValueParameters: List get() { - val constructorReceiver = if (this is ConstructorDescriptor) { - this.constructedClass.thisAsReceiverParameter - } else { - null - } + val receivers = mutableListOf() - val receivers = listOf( - constructorReceiver, - this.dispatchReceiverParameter, - this.extensionReceiverParameter).filterNotNull() + if (this is ConstructorDescriptor) + receivers.add(this.constructedClass.thisAsReceiverParameter) + + val dispatchReceiverParameter = this.dispatchReceiverParameter + if (dispatchReceiverParameter != null) + receivers.add(dispatchReceiverParameter) + + val extensionReceiverParameter = this.extensionReceiverParameter + if (extensionReceiverParameter != null) + receivers.add(extensionReceiverParameter) return receivers + this.valueParameters } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt index 842477a9551..7b5c5e3e0c3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/VariableManager.kt @@ -27,8 +27,13 @@ internal class VariableManager(val codegen: CodeGenerator) { override fun toString() = "value of ${value} from ${name}" } + data class ScopedVariable private constructor(val descriptor: ValueDescriptor, val context: CodeContext) + { + constructor(scoped: Pair) : this(scoped.first, scoped.second) + } + val variables: ArrayList = arrayListOf() - val contextVariablesToIndex: HashMap, Int> = hashMapOf() + val contextVariablesToIndex: HashMap = hashMapOf() // Clears inner state of variable manager. fun clear() { @@ -52,11 +57,11 @@ internal class VariableManager(val codegen: CodeGenerator) { fun createMutable(scoped: Pair, isVar: Boolean, value: LLVMValueRef? = null) : Int { val descriptor = scoped.first - val scopedVariable = scoped.first.name to scoped.second + val scopedVariable = ScopedVariable(scoped) assert(!contextVariablesToIndex.contains(scopedVariable)) val index = variables.size val type = codegen.getLLVMType(descriptor.type) - val slot = codegen.alloca(type, descriptor.name.asString()) + val slot = codegen.alloca(type, scopedVariable.descriptor.name.asString()) if (value != null) codegen.storeAnyLocal(value, slot) variables.add(SlotRecord(slot, codegen.isObjectType(type), isVar)) @@ -85,21 +90,18 @@ internal class VariableManager(val codegen: CodeGenerator) { } fun createImmutable(scoped: Pair, value: LLVMValueRef) : Int { - val descriptor = scoped.first - val scopedVariable = scoped.first.name to scoped.second + val scopedVariable = ScopedVariable(scoped) + if(contextVariablesToIndex.containsKey(scopedVariable)) + throw Error("${scopedVariable.descriptor} is already defined") assert(!contextVariablesToIndex.containsKey(scopedVariable)) val index = variables.size - variables.add(ValueRecord(value, descriptor.name)) + variables.add(ValueRecord(value, scopedVariable.descriptor.name)) contextVariablesToIndex[scopedVariable] = index return index } fun indexOf(scoped: Pair) : Int { - return indexOfNamed(scoped.first.name to scoped.second) - } - - private fun indexOfNamed(scoped: Pair) : Int { - return contextVariablesToIndex.getOrElse(scoped) { -1 } + return contextVariablesToIndex.getOrElse(ScopedVariable(scoped)) { -1 } } fun addressOf(index: Int): LLVMValueRef { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt index 509cfcf467d..79a2c36380c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultParameterStubGenerator.kt @@ -75,6 +75,18 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): val params = mutableListOf() val variables = mutableMapOf() + val newExtensionReceiver = + if (description.function.extensionReceiverParameter == null) { + null + } else { + IrGetValueImpl( + startOffset = irFunction.startOffset, + endOffset = irFunction.endOffset, + descriptor = description.function.extensionReceiverParameter!!, + origin = null + ) + } + for (valueParameter in functionDescriptor.valueParameters) { val parameterDescriptor = description.function.valueParameters[valueParameter.index] if (valueParameter.hasDefaultValue()) { @@ -92,6 +104,8 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): /* Use previously calculated values in next expression. */ exprBody.expression.transformChildrenVoid(object:IrElementTransformerVoid() { override fun visitGetValue(expression: IrGetValue): IrExpression { + if (expression.descriptor == functionDescriptor.extensionReceiverParameter) + return newExtensionReceiver!! if (!variables.containsKey(expression.descriptor)) return expression return irGet(variables[expression.descriptor] as VariableDescriptor) @@ -114,12 +128,7 @@ class DefaultParameterStubGenerator internal constructor(val context: Context): dispatchReceiver = irThis() } if (functionDescriptor.extensionReceiverParameter != null) { - extensionReceiver = IrGetValueImpl( - startOffset = irFunction.startOffset, - endOffset = irFunction.endOffset, - descriptor = functionDescriptor.extensionReceiverParameter!!, - origin = null - ) + extensionReceiver = newExtensionReceiver } params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InnerClassLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InnerClassLowering.kt new file mode 100644 index 00000000000..fad21920b5f --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InnerClassLowering.kt @@ -0,0 +1,141 @@ +package org.jetbrains.kotlin.backend.konan.lower + +import org.jetbrains.kotlin.backend.common.ClassLoweringPass +import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrConstructor +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl +import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.util.dump +import org.jetbrains.kotlin.ir.util.transformFlat +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitClassReceiver +import org.jetbrains.kotlin.utils.addToStdlib.singletonList + +internal class InnerClassLowering(val context: Context) : ClassLoweringPass { + override fun lower(irClass: IrClass) { + InnerClassTransformer(irClass).lowerInnerClass() + } + + private inner class InnerClassTransformer(val irClass: IrClass) { + val classDescriptor = irClass.descriptor + + lateinit var outerThisFieldDescriptor: PropertyDescriptor + + fun lowerInnerClass() { + if (!irClass.descriptor.isInner) return + + createOuterThisField() + lowerOuterThisReferences() + lowerConstructors() + } + + object DECLARATION_ORIGIN_FIELD_FOR_OUTER_THIS : + IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS") + + private fun createOuterThisField() { + outerThisFieldDescriptor = context.specialDescriptorsFactory.getOuterThisFieldDescriptor(classDescriptor) + + irClass.declarations.add(IrFieldImpl( + irClass.startOffset, irClass.endOffset, + DECLARATION_ORIGIN_FIELD_FOR_OUTER_THIS, + outerThisFieldDescriptor + )) + } + + private fun lowerConstructors() { + irClass.declarations.transformFlat { irMember -> + if (irMember is IrConstructor) + lowerConstructor(irMember).singletonList() + else + null + } + } + + private fun lowerConstructor(irConstructor: IrConstructor): IrConstructor { + val descriptor = irConstructor.descriptor + val startOffset = irConstructor.startOffset + val endOffset = irConstructor.endOffset + + val dispatchReceiver = descriptor.dispatchReceiverParameter!! + + val blockBody = irConstructor.body as? IrBlockBody ?: throw AssertionError("Unexpected constructor body: ${irConstructor.body}") + + val instanceInitializerIndex = blockBody.statements.indexOfFirst { it is IrInstanceInitializerCall } + if (instanceInitializerIndex >= 0) { + // Initializing constructor: initialize 'this.this$0' with '$outer'. + blockBody.statements.add( + instanceInitializerIndex, + IrSetFieldImpl( + startOffset, endOffset, outerThisFieldDescriptor, + IrGetValueImpl(startOffset, endOffset, classDescriptor.thisAsReceiverParameter), + IrGetValueImpl(startOffset, endOffset, dispatchReceiver) + ) + ) + } + else { + // Delegating constructor: invoke old constructor with dispatch receiver '$outer'. + val delegatingConstructorCall = (blockBody.statements.find { it is IrDelegatingConstructorCall } ?: + throw AssertionError("Delegating constructor call expected: ${irConstructor.dump()}") + ) as IrDelegatingConstructorCall + delegatingConstructorCall.dispatchReceiver = IrGetValueImpl( + delegatingConstructorCall.startOffset, delegatingConstructorCall.endOffset, dispatchReceiver + ) + } + + return irConstructor + } + + private fun lowerOuterThisReferences() { + irClass.transformChildrenVoid(object : IrElementTransformerVoid() { + override fun visitGetValue(expression: IrGetValue): IrExpression { + expression.transformChildrenVoid(this) + + val implicitThisClass = expression.descriptor.getClassDescriptorForImplicitThis() ?: + return expression + + if (implicitThisClass == classDescriptor) return expression + + val startOffset = expression.startOffset + val endOffset = expression.endOffset + val origin = expression.origin + + var irThis: IrExpression = IrGetValueImpl(startOffset, endOffset, classDescriptor.thisAsReceiverParameter, origin) + var innerClass = classDescriptor + + while (innerClass != implicitThisClass) { + if (!innerClass.isInner) { + // Captured 'this' unrelated to inner classes nesting hierarchy, leave it as is - + // should be transformed by closures conversion. + return expression + } + + val outerThisField = context.specialDescriptorsFactory.getOuterThisFieldDescriptor(innerClass) + irThis = IrGetFieldImpl(startOffset, endOffset, outerThisField, irThis, origin) + + val outer = classDescriptor.containingDeclaration + innerClass = outer as? ClassDescriptor ?: + throw AssertionError("Unexpected containing declaration for inner class $innerClass: $outer") + } + + return irThis + } + }) + } + + private fun ValueDescriptor.getClassDescriptorForImplicitThis(): ClassDescriptor? { + if (this is ReceiverParameterDescriptor) { + val receiverValue = value + if (receiverValue is ImplicitClassReceiver) { + return receiverValue.classDescriptor + } + } + return null + } + } +} + diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 3e9852323b6..71ef4b7d02d 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -342,6 +342,26 @@ task enum_companionObject(type: RunKonanTest) { source = "codegen/enum/companionObject.kt" } +task innerClass_simple(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/innerClass/simple.kt" +} + +task innerClass_getOuterVal(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/innerClass/getOuterVal.kt" +} + +task innerClass_generic(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/innerClass/generic.kt" +} + +task innerClass_qualifiedThis(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/innerClass/qualifiedThis.kt" +} + task array0(type: RunKonanTest) { goldValue = "5\n6\n7\n8\n9\n10\n11\n12\n13\n" source = "runtime/collections/array0.kt" diff --git a/backend.native/tests/codegen/innerClass/generic.kt b/backend.native/tests/codegen/innerClass/generic.kt new file mode 100644 index 00000000000..776d631f727 --- /dev/null +++ b/backend.native/tests/codegen/innerClass/generic.kt @@ -0,0 +1,15 @@ +class Outer { + inner class Inner(val t: T) { + fun box() = t + } +} + +fun box(): String { + if (Outer().Inner("OK").box() != "OK") return "Fail" + val x: Outer.Inner = Outer().Inner("OK") + return x.box() +} + +fun main(args: Array) { + println(box()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/getOuterVal.kt b/backend.native/tests/codegen/innerClass/getOuterVal.kt new file mode 100644 index 00000000000..eb0c13b1de6 --- /dev/null +++ b/backend.native/tests/codegen/innerClass/getOuterVal.kt @@ -0,0 +1,12 @@ +class Outer(val s: String) { + inner class Inner { + fun box() = s + } +} + +fun box() = Outer("OK").Inner().box() + +fun main(args: Array) +{ + println(box()) +} \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/qualifiedThis.kt b/backend.native/tests/codegen/innerClass/qualifiedThis.kt new file mode 100644 index 00000000000..3c7b395333e --- /dev/null +++ b/backend.native/tests/codegen/innerClass/qualifiedThis.kt @@ -0,0 +1,46 @@ +open class ABase +{ + open fun zzz() = "a_base" +} + +open class BBase +{ + open fun zzz() = "b_base" +} + +class D() { + val z = "d" +} + +class A: ABase() { // implicit label @A + val z = "a" + override fun zzz() = "a" + inner class B: BBase() { // implicit label @B + val z = "b" + override fun zzz() = "b" + fun D.foo() : String { // implicit label @foo + if(this@A.z != "a") return "Fail1" + if(this@B.z != "b") return "Fail2" + + if(super@A.zzz() != "a_base") return "Fail3" + if(super.zzz() != "b_base") return "Fail4" + if(super@B.zzz() != "b_base") return "Fail5" + if(this@A.zzz() != "a") return "Fail6" + if(this@B.zzz() != "b") return "Fail7" + + if(this.z != "d") return "Fail8" + + return "OK" + } + + fun bar(d: D): String { + return d.foo() + } + } +} + +fun box() = A().B().bar(D()) + +fun main(args : Array) { + println(box()) +} diff --git a/backend.native/tests/codegen/innerClass/simple.kt b/backend.native/tests/codegen/innerClass/simple.kt new file mode 100644 index 00000000000..be91e5c99d3 --- /dev/null +++ b/backend.native/tests/codegen/innerClass/simple.kt @@ -0,0 +1,12 @@ +class Outer { + inner class Inner { + fun box() = "OK" + } +} + +fun box() = Outer().Inner().box() + +fun main(args: Array) +{ + println(box()) +} \ No newline at end of file diff --git a/cmd/konanc b/cmd/konanc index b17e994bc25..ecc23b021be 100755 --- a/cmd/konanc +++ b/cmd/konanc @@ -56,7 +56,7 @@ INTEROP_JAR="${KONAN_HOME}/konan/lib/Runtime.jar" NATIVE_LIB="${KONAN_HOME}/konan/nativelib" KONAN_CLASSPATH="$KOTLIN_JAR:$INTEROP_JAR:$KONAN_JAR" KONAN_COMPILER=org.jetbrains.kotlin.cli.bc.K2NativeKt - +JAVA_OPTS=-ea # # KONAN BACKEND INVOCATION From 47a5e13ff398b89fdd82e1af6ac4b72dfa53ad7a Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 30 Jan 2017 15:03:17 +0300 Subject: [PATCH 77/86] STDLIB: konan.internal.ExportForCompiler added annotation to mark symbol exported for generation with compiler --- runtime/src/main/kotlin/konan/internal/Annotations.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runtime/src/main/kotlin/konan/internal/Annotations.kt b/runtime/src/main/kotlin/konan/internal/Annotations.kt index 8d85bd8047e..bc3c46cfee6 100644 --- a/runtime/src/main/kotlin/konan/internal/Annotations.kt +++ b/runtime/src/main/kotlin/konan/internal/Annotations.kt @@ -21,4 +21,11 @@ annotation class HasBackingField */ @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) -annotation class Intrinsic \ No newline at end of file +annotation class Intrinsic + +/** + * Exports symbol for compiler needs. + */ +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR) +@Retention(AnnotationRetention.BINARY) +annotation class ExportForCompiler \ No newline at end of file From 458aa058c02d90ca9abe7c8e7dcc5f72e0210c6e Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 30 Jan 2017 15:04:22 +0300 Subject: [PATCH 78/86] RUNTIME: grant access to symvols marked with konan.internal.ExportForCompiler --- .../jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt index c3f93302941..40cc4fd67e4 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt @@ -33,6 +33,10 @@ internal tailrec fun DeclarationDescriptor.isExported(): Boolean { // Treat any `@ExportForCppRuntime` declaration as exported. return true } + if (this.annotations.hasAnnotation(exportForCompilerAnnotation)){ + return true + } + if (this is ConstructorDescriptor && constructedClass.kind.isSingleton) { // Currently code generator can access the constructor of the singleton, @@ -58,6 +62,8 @@ private val symbolNameAnnotation = FqName("konan.SymbolName") private val exportForCppRuntimeAnnotation = FqName("konan.internal.ExportForCppRuntime") +private val exportForCompilerAnnotation = FqName("konan.internal.ExportForCompiler") + private fun typeToHashString(type: KotlinType): String { if (TypeUtils.isTypeParameter(type)) return "GENERIC" From 4905d2a05688494c3ee7b4cdb3f0663ac365bf1c Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Mon, 30 Jan 2017 15:06:00 +0300 Subject: [PATCH 79/86] STDLIB: internal Array::(Int) obtains konan.internal.ExportForCompiler annotation --- runtime/src/main/kotlin/kotlin/Array.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/src/main/kotlin/kotlin/Array.kt b/runtime/src/main/kotlin/kotlin/Array.kt index 8acea4de9f7..ae4b694176e 100644 --- a/runtime/src/main/kotlin/kotlin/Array.kt +++ b/runtime/src/main/kotlin/kotlin/Array.kt @@ -1,4 +1,5 @@ package kotlin +import konan.internal.ExportForCompiler // TODO: remove that, as RTTI shall be per instantiation. @ExportTypeInfo("theArrayTypeInfo") @@ -11,6 +12,8 @@ public final class Array : Cloneable { index++ } } + + @ExportForCompiler internal constructor(@Suppress("UNUSED_PARAMETER") size: Int) {} public val size: Int From 06c703f840111820c25ac5f7c162e2b61a26f484 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Fri, 13 Jan 2017 12:41:54 +0300 Subject: [PATCH 80/86] IR: lowering for vararg expressions including spread element. --- .../kotlin/backend/konan/KonanLower.kt | 5 + .../kotlin/backend/konan/KonanPhases.kt | 1 + .../backend/konan/lower/VarargLowering.kt | 220 ++++++++++++++++++ 3 files changed, 226 insertions(+) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index ec5af21dd11..e714e9ed2de 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -20,9 +20,14 @@ internal class KonanLower(val context: Context) { phaser.phase(KonanPhase.LOWER_ENUMS) { EnumClassLowering(context).run(irFile) } + phaser.phase(KonanPhase.LOWER_INNER_CLASSES) { InnerClassLowering(context).runOnFilePostfix(irFile) } + + phaser.phase(KonanPhase.LOWER_VARARG) { + VarargInjectionLowering(context).runOnFilePostfix(irFile) + } phaser.phase(KonanPhase.LOWER_DEFAULT_PARAMETER_EXTENT) { DefaultParameterStubGenerator(context).runOnFilePostfix(irFile) DefaultParameterInjector(context).runOnFilePostfix(irFile) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt index b089571033d..f5ba9e52da0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt @@ -11,6 +11,7 @@ enum class KonanPhase(val description: String, /* */ BACKEND("All backend"), /* ... */ LOWER("IR Lowering"), /* ... ... */ LOWER_BUILTIN_OPERATORS("BuiltIn Operators Lowering"), + /* ... ... */ LOWER_VARARG("Vararg lowering"), /* ... ... */ LOWER_DEFAULT_PARAMETER_EXTENT("Default Parameter Extent Lowering"), /* ... ... */ LOWER_TYPE_OPERATORS("Type operators lowering"), /* ... ... */ LOWER_SHARED_VARIABLES("Shared Variable Lowering"), diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt new file mode 100644 index 00000000000..0e7fe7163c2 --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt @@ -0,0 +1,220 @@ +package org.jetbrains.kotlin.backend.konan.lower + +import org.jetbrains.kotlin.backend.common.BodyLoweringPass +import org.jetbrains.kotlin.backend.common.FunctionLoweringPass +import org.jetbrains.kotlin.backend.konan.Context +import org.jetbrains.kotlin.backend.konan.KonanPlatform +import org.jetbrains.kotlin.backend.konan.ir.ir2string +import org.jetbrains.kotlin.backend.konan.lower.VarargInjectionLowering.Companion.kIntType +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.builders.* +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrVariable +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl +import org.jetbrains.kotlin.ir.visitors.* +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.types.KotlinType + + +class VarargInjectionLowering internal constructor(val context: Context): FunctionLoweringPass { + override fun lower(irFunction: IrFunction) { + if (irFunction.body != null) + lower(irFunction.descriptor, irFunction.body!!) + } + + fun noVarargArguments(descriptor: FunctionDescriptor) = descriptor.valueParameters.none { it.varargElementType != null } + val irContext = IrGeneratorContext(context.ir.irModule.irBuiltins) + + private fun lower(owner:FunctionDescriptor, irBody: IrBody) { + irBody.transformChildrenVoid(object: IrElementTransformerVoid(){ + override fun visitCall(expression: IrCall): IrExpression { + super.visitCall(expression) + val functionDescriptor = expression.descriptor as FunctionDescriptor + if (noVarargArguments(functionDescriptor)) + return expression + val varargToBlock = blockPerVararg(expression, owner) + val scope = owner.scope() + offset(expression, scope){ + val originalCall = irCall( + descriptor = expression.descriptor, + typeArguments = expression.descriptor.original.typeParameters.map { it to expression.getTypeArgument(it)!! }.toMap()) + originalCall.dispatchReceiver = expression.dispatchReceiver + originalCall.extensionReceiver = expression.extensionReceiver + var parameterIndex = 0 + expression.acceptChildrenVoid(object:IrElementVisitorVoid{ + override fun visitElement(element: IrElement) { + offset(expression, scope) { + val parameter = if (element is IrVararg && varargToBlock.containsKey(element)) + varargToBlock[element]!! + else element + originalCall.putValueArgument(parameterIndex++, parameter as IrExpression) + } + } + }) + return originalCall + } + } + }) + } + + + private fun blockPerVararg(expression: IrCall, owner: FunctionDescriptor): Map { + val varargArgs = mutableMapOf() + val arrayConstructor = kArrayType.constructors.find { it.valueParameters.size == 1 } + expression.acceptVoid(object : IrElementVisitorVoid { + val scope = owner.scope() + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitVararg(expression: IrVararg) { + offset(expression, scope) { + val hasSpreadElement = hasSpreadElement(expression) + val block = irBlock(kArrayType.defaultType) + if (!hasSpreadElement && expression.elements.all { it is IrConst<*> && KotlinBuiltIns.isString(it.type)}) { + log("skipped vararg expression because it's string array literal") + return + } + + val vars = expression.elements.map { + val initVar = scope.createTemporaryVariable((it as? IrSpreadElement)?.expression ?: it as IrExpression, "__elem\$", true) + block.statements.add(initVar) + it to initVar + }.toMap() + val arrayConstructorCall = irCall( + descriptor = arrayConstructor!!, + typeArguments = mapOf(arrayConstructor.typeParameters[0] to expression.varargElementType)) + arrayConstructorCall.putValueArgument(0, calculateArraySize(hasSpreadElement, scope, expression, vars)) + val arrayTmpVariable = scope.createTemporaryVariable(arrayConstructorCall, "__array\$", true) + val indexTmpVariable = scope.createTemporaryVariable(kIntZero, "__index\$", true) + block.statements.add(arrayTmpVariable) + if (hasSpreadElement) { + block.statements.add(indexTmpVariable) + } + expression.elements.forEachIndexed { i, element -> + offset(expression, scope) { + log("element:$i> ${ir2string(element)}") + val dst = vars[element]!! + if (element !is IrSpreadElement) { + val setArrayElementCall = irCall( + descriptor = kArraySetFunctionDescriptor, + typeArguments = null + ) + setArrayElementCall.dispatchReceiver = irGet(arrayTmpVariable.descriptor) + setArrayElementCall.putValueArgument(0, if (hasSpreadElement) irGet(indexTmpVariable.descriptor) else irConstInt(i)) + setArrayElementCall.putValueArgument(1, irGet(dst.descriptor)) + block.statements.add(setArrayElementCall) + if (hasSpreadElement) { + block.statements.add(incrementVariable(indexTmpVariable.descriptor, kIntOne)) + } + } else { + val arraySizeVariable = scope.createTemporaryVariable(irArraySize(irGet(dst.descriptor)), "__length\$") + block.statements.add(arraySizeVariable) + val copyCall = irCall(kCopyRangeToDescriptor, null).apply { + extensionReceiver = irGet(dst.descriptor) + putValueArgument(0, irGet(arrayTmpVariable.descriptor)) /* destination */ + putValueArgument(1, kIntZero) /* fromIndex */ + putValueArgument(2, irGet(arraySizeVariable.descriptor)) /* toIndex */ + putValueArgument(3, irGet(indexTmpVariable.descriptor)) /* destinationIndex */ + } + block.statements.add(copyCall) + block.statements.add(incrementVariable(indexTmpVariable.descriptor, + irGet(arraySizeVariable.descriptor))) + log("element:$i:spread element> ${ir2string(element.expression)}") + } + } + } + + block.statements.add(irGet(arrayTmpVariable.descriptor)) + varargArgs.put(expression, block) + } + } + }) + return varargArgs + } + + private fun Offset.intPlus() = irCall(kIntPlusDescriptor, null) + private fun Offset.increment(expression: IrExpression, value: IrExpression): IrExpression { + return intPlus().apply { + dispatchReceiver = expression + putValueArgument(0, value) + } + } + + private fun Offset.incrementVariable(descriptor: VariableDescriptor, value: IrExpression): IrExpression { + return irSetVar(descriptor, intPlus().apply { + dispatchReceiver = irGet(descriptor) + putValueArgument(0, value) + }) + } + private fun calculateArraySize(hasSpreadElement: Boolean, scope:Scope, expression: IrVararg, vars: Map): IrExpression? { + offset(expression, scope) { + if (!hasSpreadElement) + return irConstInt(expression.elements.size) + val notSpreadElementCount = expression.elements.filter { it !is IrSpreadElement}.size + val initialValue = irConstInt(notSpreadElementCount) as IrExpression + return vars.filter{it.key is IrSpreadElement}.toList().fold( initial = initialValue) { result, it -> + val arraySize = irArraySize(irGet(it.second.descriptor)) + increment(result, arraySize) + } + } + + } + + private fun Offset.irArraySize(expression: IrExpression): IrExpression { + val arraySize = irCall((kArraySizeFunctionDescriptor as PropertyDescriptor).getter as FunctionDescriptor, null).apply { + dispatchReceiver = expression + } + return arraySize + } + + + private fun hasSpreadElement(expression: IrVararg) = expression.elements.any { it is IrSpreadElement } + + private fun log(msg:String) { + context.log("VARARG-INJECTOR: $msg") + } + + companion object { + val kArrayType = KonanPlatform.builtIns.array + val kCollectionsPackageDescriptor = KonanPlatform.builtIns.builtInsModule.getPackage(FqName("kotlin.collections")).memberScope + val kCopyRangeToDescriptor = DescriptorUtils.getAllDescriptors(kCollectionsPackageDescriptor).filter { + it.name.asString() == "copyRangeTo" + && DescriptorUtils.getClassDescriptorForType((it as FunctionDescriptor).extensionReceiverParameter!!.type) == kArrayType}.first() as CallableDescriptor + val unsubstitutedMemberScope = kArrayType.unsubstitutedMemberScope + val kArraySetFunctionDescriptor = DescriptorUtils.getFunctionByName(unsubstitutedMemberScope, Name.identifier("set")) + val kArraySizeFunctionDescriptor = DescriptorUtils.getAllDescriptors(unsubstitutedMemberScope).find { it.name.asString() == "size" } + val kInt = KonanPlatform.builtIns.int + val kIntType = KonanPlatform.builtIns.intType + val kIntPlusDescriptor = DescriptorUtils.getAllDescriptors(kInt.unsubstitutedMemberScope).find { + it.name.asString() == "plus" + && (it as FunctionDescriptor).valueParameters[0].type == kIntType} as FunctionDescriptor + } + inline internal fun offset(ir:IrElement, scope:Scope, block: Offset.() -> R):R = offset(irContext, scope, ir.startOffset, ir.endOffset, block) +} + +internal class Offset(context:IrGeneratorContext, scope: Scope, startOffset:Int, endOfset:Int) : IrBuilderWithScope(context, scope, startOffset, endOfset) { + val kIntZero = irConstInt(0) + val kIntOne = irConstInt(1) + companion object { + internal inline fun use(context:IrGeneratorContext, scope: Scope, startOffset: Int, endOfset: Int, block: Offset.() -> R):R = Offset(context, scope, startOffset, endOfset).block() + } +} + +internal fun CallableDescriptor.scope() = Scope(this) + +private fun Offset.irConstInt(value: Int): IrConst = irConst(kind = IrConstKind.Int, value = value, type = kIntType) +private fun Offset.irConst(kind: IrConstKind, value: T, type: KotlinType): IrConst = IrConstImpl(startOffset, endOffset,type, kind,value) +private fun Offset.irBlock(type: KotlinType): IrBlock = IrBlockImpl(startOffset, endOffset, type) +private fun Offset.irCall(descriptor: CallableDescriptor, typeArguments: Map?): IrCall = IrCallImpl(startOffset, endOffset, descriptor, typeArguments) +inline internal fun offset(context:IrGeneratorContext, scope: Scope, startOffset: Int, endOffset: Int, block: Offset.() -> R):R { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE") + return Offset.use(context, scope, startOffset, endOffset, block) +} From 6192dc254a2208d189b1fde5329745584676a30c Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Wed, 1 Feb 2017 15:43:28 +0300 Subject: [PATCH 81/86] Fix way how function table is built. Allows to extend Exception class. (#210) --- .../backend/konan/descriptors/DescriptorUtils.kt | 10 +++++++--- backend.native/tests/build.gradle | 5 +++++ backend.native/tests/runtime/exceptions/extend0.kt | 9 +++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 backend.native/tests/runtime/exceptions/extend0.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index fabd169b0c6..47621613eda 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.OverridingUtil import org.jetbrains.kotlin.resolve.descriptorUtil.* import org.jetbrains.kotlin.resolve.scopes.MemberScope @@ -210,8 +211,11 @@ fun ClassDescriptor.vtableIndex(function: FunctionDescriptor): Int { val ClassDescriptor.methodTableEntries: List get() { - assert (!this.isAbstract()) - - return this.contributedMethods.filter { it.isOverridableOrOverrides } + assert(!this.isAbstract()) + return this.contributedMethods.filter { + // We check that either method is open, or one of declarations it overrides + // is open. + it.isOverridable || DescriptorUtils.getAllOverriddenDeclarations(it).any { it.isOverridable } + } // TODO: probably method table should contain all accessible methods to improve binary compatibility } \ No newline at end of file diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 71ef4b7d02d..cc5d5744c31 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -653,6 +653,11 @@ task catch7(type: RunKonanTest) { source = "runtime/exceptions/catch7.kt" } +task extend_exception(type: RunKonanTest) { + goldValue = "OK\n" + source = "runtime/exceptions/extend0.kt" +} + task catch3(type: RunKonanTest) { goldValue = "Before\nCaught Throwable\nDone\n" source = "codegen/try/catch3.kt" diff --git a/backend.native/tests/runtime/exceptions/extend0.kt b/backend.native/tests/runtime/exceptions/extend0.kt new file mode 100644 index 00000000000..071a53363ff --- /dev/null +++ b/backend.native/tests/runtime/exceptions/extend0.kt @@ -0,0 +1,9 @@ +class C : Exception("OK") + +fun main(args: Array) { + try { + throw C() + } catch (e: Throwable) { + println(e.message!!) + } +} \ No newline at end of file From bb43b6ab09b58decf584a819f4825a6c4ad4596b Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Wed, 1 Feb 2017 18:15:11 +0300 Subject: [PATCH 82/86] Fix Any.toString(). --- runtime/src/main/cpp/Natives.cpp | 21 ++++++++------------- runtime/src/main/cpp/ToString.cpp | 8 ++++++++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/runtime/src/main/cpp/Natives.cpp b/runtime/src/main/cpp/Natives.cpp index 3641451cd65..b28137369a2 100644 --- a/runtime/src/main/cpp/Natives.cpp +++ b/runtime/src/main/cpp/Natives.cpp @@ -22,11 +22,6 @@ KInt Kotlin_Any_hashCode(KConstRef thiz) { return reinterpret_cast(thiz); } -OBJ_GETTER(Kotlin_Any_toString, KConstRef thiz) { - // TODO: make it more sensible, such as address and type info. - return nullptr; -} - // io/Console.kt void Kotlin_io_Console_print(KString message) { RuntimeAssert(message->type_info() == theStringTypeInfo, "Must use a string"); @@ -61,8 +56,8 @@ OBJ_GETTER0(Kotlin_io_Console_readLine) { // String.kt KInt Kotlin_String_compareTo(KString thiz, KString other) { return memcmp(ByteArrayAddressOfElementAt(thiz, 0), - ByteArrayAddressOfElementAt(other, 0), - thiz->count_ < other->count_ ? thiz->count_ : other->count_); + ByteArrayAddressOfElementAt(other, 0), + thiz->count_ < other->count_ ? thiz->count_ : other->count_); } KChar Kotlin_String_get(KString thiz, KInt index) { @@ -112,7 +107,7 @@ OBJ_GETTER(Kotlin_String_fromCharArray, KConstRef thiz, KInt start, KInt size) { ArrayHeader* result = ArrayContainer(theStringTypeInfo, size).GetPlace(); for (KInt index = 0; index < size; ++index) { *ByteArrayAddressOfElementAt(result, index) = - *PrimitiveArrayAddressOfElementAt(array, start + index); + *PrimitiveArrayAddressOfElementAt(array, start + index); } RETURN_OBJ(result->obj()); } @@ -123,7 +118,7 @@ OBJ_GETTER(Kotlin_String_toCharArray, KString string) { theCharArrayTypeInfo, string->count_).GetPlace(); for (int index = 0; index < string->count_; ++index) { *PrimitiveArrayAddressOfElementAt(result, index) = - *ByteArrayAddressOfElementAt(string, index); + *ByteArrayAddressOfElementAt(string, index); } RETURN_OBJ(result->obj()); } @@ -156,8 +151,8 @@ KBoolean Kotlin_String_equals(KString thiz, KConstRef other) { if (thiz == otherString) return true; return thiz->count_ == otherString->count_ && memcmp(ByteArrayAddressOfElementAt(thiz, 0), - ByteArrayAddressOfElementAt(otherString, 0), - thiz->count_) == 0; + ByteArrayAddressOfElementAt(otherString, 0), + thiz->count_) == 0; } KInt Kotlin_String_hashCode(KString thiz) { @@ -178,8 +173,8 @@ OBJ_GETTER(Kotlin_String_subSequence, KString thiz, KInt startIndex, KInt endInd KInt length = endIndex - startIndex; ArrayHeader* result = ArrayContainer(theStringTypeInfo, length).GetPlace(); memcpy(ByteArrayAddressOfElementAt(result, 0), - ByteArrayAddressOfElementAt(thiz, startIndex), - length); + ByteArrayAddressOfElementAt(thiz, startIndex), + length); RETURN_OBJ(result->obj()); } diff --git a/runtime/src/main/cpp/ToString.cpp b/runtime/src/main/cpp/ToString.cpp index 89979d1cd4c..313e02bfc47 100644 --- a/runtime/src/main/cpp/ToString.cpp +++ b/runtime/src/main/cpp/ToString.cpp @@ -24,6 +24,14 @@ OBJ_GETTER(makeString, const char* cstring) { extern "C" { +OBJ_GETTER(Kotlin_Any_toString, KConstRef thiz) { + char cstring[80]; + snprintf(cstring, sizeof(cstring), "%s %p type %p", + IsArray(thiz) ? "array" : "object", + thiz, thiz->type_info_); + RETURN_RESULT_OF(makeString, cstring); +} + OBJ_GETTER(Kotlin_Byte_toString, KByte value) { char cstring[8]; snprintf(cstring, sizeof(cstring), "%d", value); From 2479593f447acbb736f297e5e547118b3dc4e3f4 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 1 Feb 2017 16:43:02 +0300 Subject: [PATCH 83/86] IR: using function descriptor valueParameters field instead of visiting children of IrCall code ``` fun foo(vararg x: Any?) {} fun bar() = foo() ``` produce following IR: ``` FUN public fun bar(): kotlin.Unit BLOCK_BODY RETURN type=kotlin.Nothing from='bar(): Unit' CALL 'foo(vararg Any?): Unit' type=kotlin.Unit origin=null x: BLOCK type=kotlin.Array origin=null CALL 'constructor Array(Int)' type=kotlin.Array origin=null : Any? size: CONST Int type=kotlin.Int value='0' ``` --- .../backend/konan/lower/VarargLowering.kt | 152 +++++++++--------- 1 file changed, 75 insertions(+), 77 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt index 0e7fe7163c2..9140613dc43 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/VarargLowering.kt @@ -47,17 +47,9 @@ class VarargInjectionLowering internal constructor(val context: Context): Functi typeArguments = expression.descriptor.original.typeParameters.map { it to expression.getTypeArgument(it)!! }.toMap()) originalCall.dispatchReceiver = expression.dispatchReceiver originalCall.extensionReceiver = expression.extensionReceiver - var parameterIndex = 0 - expression.acceptChildrenVoid(object:IrElementVisitorVoid{ - override fun visitElement(element: IrElement) { - offset(expression, scope) { - val parameter = if (element is IrVararg && varargToBlock.containsKey(element)) - varargToBlock[element]!! - else element - originalCall.putValueArgument(parameterIndex++, parameter as IrExpression) - } - } - }) + functionDescriptor.valueParameters.forEach { + originalCall.putValueArgument(it.index, if (varargToBlock.containsKey(it)) varargToBlock[it] else expression.getValueArgument(it)) + } return originalCall } } @@ -65,78 +57,84 @@ class VarargInjectionLowering internal constructor(val context: Context): Functi } - private fun blockPerVararg(expression: IrCall, owner: FunctionDescriptor): Map { - val varargArgs = mutableMapOf() - val arrayConstructor = kArrayType.constructors.find { it.valueParameters.size == 1 } - expression.acceptVoid(object : IrElementVisitorVoid { - val scope = owner.scope() - override fun visitElement(element: IrElement) { - element.acceptChildrenVoid(this) - } + private fun blockPerVararg(expression: IrCall, owner: FunctionDescriptor): Map { + val varargArgs = mutableMapOf() + val arrayConstructor = kArrayType.constructors.find { it.valueParameters.size == 1 }!! + val scope = owner.scope() + val calleeDescriptor = expression.descriptor + calleeDescriptor.valueParameters + .filter{ it.varargElementType != null && expression.getValueArgument(it) is IrVararg?} + .forEach { + val type = it.varargElementType!! + val parameterExpression = expression.getValueArgument(it) as IrVararg? + offset(expression, scope) { + val hasSpreadElement = hasSpreadElement(parameterExpression) + if (!hasSpreadElement && parameterExpression?.elements?.all { it is IrConst<*> && KotlinBuiltIns.isString(it.type)}?:false) { + log("skipped vararg expression because it's string array literal") + return@forEach + } + val block = irBlock(kArrayType.defaultType) + val arrayConstructorCall = irCall( + descriptor = arrayConstructor, + typeArguments = mapOf(arrayConstructor.typeParameters[0] to type)) - override fun visitVararg(expression: IrVararg) { - offset(expression, scope) { - val hasSpreadElement = hasSpreadElement(expression) - val block = irBlock(kArrayType.defaultType) - if (!hasSpreadElement && expression.elements.all { it is IrConst<*> && KotlinBuiltIns.isString(it.type)}) { - log("skipped vararg expression because it's string array literal") - return - } + if (parameterExpression == null) { + arrayConstructorCall.putValueArgument(0, kIntZero) + block.statements.add(arrayConstructorCall) + varargArgs.put(it, block) + return@forEach + } - val vars = expression.elements.map { - val initVar = scope.createTemporaryVariable((it as? IrSpreadElement)?.expression ?: it as IrExpression, "__elem\$", true) - block.statements.add(initVar) - it to initVar - }.toMap() - val arrayConstructorCall = irCall( - descriptor = arrayConstructor!!, - typeArguments = mapOf(arrayConstructor.typeParameters[0] to expression.varargElementType)) - arrayConstructorCall.putValueArgument(0, calculateArraySize(hasSpreadElement, scope, expression, vars)) - val arrayTmpVariable = scope.createTemporaryVariable(arrayConstructorCall, "__array\$", true) - val indexTmpVariable = scope.createTemporaryVariable(kIntZero, "__index\$", true) - block.statements.add(arrayTmpVariable) - if (hasSpreadElement) { - block.statements.add(indexTmpVariable) - } - expression.elements.forEachIndexed { i, element -> - offset(expression, scope) { - log("element:$i> ${ir2string(element)}") - val dst = vars[element]!! - if (element !is IrSpreadElement) { - val setArrayElementCall = irCall( - descriptor = kArraySetFunctionDescriptor, - typeArguments = null - ) - setArrayElementCall.dispatchReceiver = irGet(arrayTmpVariable.descriptor) - setArrayElementCall.putValueArgument(0, if (hasSpreadElement) irGet(indexTmpVariable.descriptor) else irConstInt(i)) - setArrayElementCall.putValueArgument(1, irGet(dst.descriptor)) - block.statements.add(setArrayElementCall) - if (hasSpreadElement) { - block.statements.add(incrementVariable(indexTmpVariable.descriptor, kIntOne)) - } - } else { - val arraySizeVariable = scope.createTemporaryVariable(irArraySize(irGet(dst.descriptor)), "__length\$") - block.statements.add(arraySizeVariable) - val copyCall = irCall(kCopyRangeToDescriptor, null).apply { - extensionReceiver = irGet(dst.descriptor) - putValueArgument(0, irGet(arrayTmpVariable.descriptor)) /* destination */ - putValueArgument(1, kIntZero) /* fromIndex */ - putValueArgument(2, irGet(arraySizeVariable.descriptor)) /* toIndex */ - putValueArgument(3, irGet(indexTmpVariable.descriptor)) /* destinationIndex */ - } - block.statements.add(copyCall) - block.statements.add(incrementVariable(indexTmpVariable.descriptor, - irGet(arraySizeVariable.descriptor))) - log("element:$i:spread element> ${ir2string(element.expression)}") + val vars = parameterExpression.elements.map { + val initVar = scope.createTemporaryVariable((it as? IrSpreadElement)?.expression ?: it as IrExpression, "__elem\$", true) + block.statements.add(initVar) + it to initVar + }.toMap() + arrayConstructorCall.putValueArgument(0, calculateArraySize(hasSpreadElement, scope, parameterExpression, vars)) + val arrayTmpVariable = scope.createTemporaryVariable(arrayConstructorCall, "__array\$", true) + val indexTmpVariable = scope.createTemporaryVariable(kIntZero, "__index\$", true) + block.statements.add(arrayTmpVariable) + if (hasSpreadElement) { + block.statements.add(indexTmpVariable) + } + parameterExpression.elements.forEachIndexed { i, element -> + offset(parameterExpression, scope) { + log("element:$i> ${ir2string(element)}") + val dst = vars[element]!! + if (element !is IrSpreadElement) { + val setArrayElementCall = irCall( + descriptor = kArraySetFunctionDescriptor, + typeArguments = null + ) + setArrayElementCall.dispatchReceiver = irGet(arrayTmpVariable.descriptor) + setArrayElementCall.putValueArgument(0, if (hasSpreadElement) irGet(indexTmpVariable.descriptor) else irConstInt(i)) + setArrayElementCall.putValueArgument(1, irGet(dst.descriptor)) + block.statements.add(setArrayElementCall) + if (hasSpreadElement) { + block.statements.add(incrementVariable(indexTmpVariable.descriptor, kIntOne)) } + } else { + val arraySizeVariable = scope.createTemporaryVariable(irArraySize(irGet(dst.descriptor)), "__length\$") + block.statements.add(arraySizeVariable) + val copyCall = irCall(kCopyRangeToDescriptor, null).apply { + extensionReceiver = irGet(dst.descriptor) + putValueArgument(0, irGet(arrayTmpVariable.descriptor)) /* destination */ + putValueArgument(1, kIntZero) /* fromIndex */ + putValueArgument(2, irGet(arraySizeVariable.descriptor)) /* toIndex */ + putValueArgument(3, irGet(indexTmpVariable.descriptor)) /* destinationIndex */ + } + block.statements.add(copyCall) + block.statements.add(incrementVariable(indexTmpVariable.descriptor, + irGet(arraySizeVariable.descriptor))) + log("element:$i:spread element> ${ir2string(element.expression)}") } } - - block.statements.add(irGet(arrayTmpVariable.descriptor)) - varargArgs.put(expression, block) } + + block.statements.add(irGet(arrayTmpVariable.descriptor)) + varargArgs.put(it, block) } - }) + } return varargArgs } @@ -176,7 +174,7 @@ class VarargInjectionLowering internal constructor(val context: Context): Functi } - private fun hasSpreadElement(expression: IrVararg) = expression.elements.any { it is IrSpreadElement } + private fun hasSpreadElement(expression: IrVararg?) = expression?.elements?.any { it is IrSpreadElement }?:false private fun log(msg:String) { context.log("VARARG-INJECTOR: $msg") From e7159d364f932e26e1f2b3952ad2b2256fc38dd4 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 1 Feb 2017 16:45:07 +0300 Subject: [PATCH 84/86] TEST: with no parameters to vararg --- backend.native/tests/build.gradle | 4 ++++ backend.native/tests/lower/vararg.kt | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 backend.native/tests/lower/vararg.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index cc5d5744c31..b78b904797b 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -1009,3 +1009,7 @@ task inline3(type: RunKonanTest) { goldValue = "5\n" source = "codegen/inline/inline3.kt" } + +task vararg0(type: RunKonanTest) { + source = "lower/vararg.kt" +} diff --git a/backend.native/tests/lower/vararg.kt b/backend.native/tests/lower/vararg.kt new file mode 100644 index 00000000000..f93ffd02309 --- /dev/null +++ b/backend.native/tests/lower/vararg.kt @@ -0,0 +1,6 @@ +fun foo(vararg x: Any?) {} +fun bar() = foo() + +fun main(arg:Array) { + bar() +} \ No newline at end of file From f960c70c68abfa25429303d175f7025b6224a3fe Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 1 Feb 2017 15:47:46 +0300 Subject: [PATCH 85/86] backend: Copy AbstractClosureRecorder from Kotlin JVM Copied from org.jetbrains.kotlin.backend.common. AbstractClosureAnnotator --- .../backend/common/AbstractClosureRecorder.kt | 107 ++++++++++++++++++ .../common/lower/LocalDeclarationsLowering.kt | 9 +- 2 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt new file mode 100644 index 00000000000..a85fe6878bd --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt @@ -0,0 +1,107 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.backend.common + +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrLocalDelegatedProperty +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid +import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.ir.visitors.acceptVoid +import org.jetbrains.kotlin.resolve.DescriptorUtils +import java.util.* + +abstract class AbstractClosureRecorder : IrElementVisitorVoid { + protected abstract fun recordFunctionClosure(functionDescriptor: FunctionDescriptor, closure: Closure) + protected abstract fun recordClassClosure(classDescriptor: ClassDescriptor, closure: Closure) + + private class ClosureBuilder(val owner: DeclarationDescriptor) { + val capturedValues = mutableSetOf() + + fun buildClosure() = Closure(capturedValues.toList()) + + fun addNested(closure: Closure) { + fillInNestedClosure(capturedValues, closure.capturedValues) + } + + private fun fillInNestedClosure(destination: MutableSet, nested: List) { + nested.filterTo(destination) { + it.containingDeclaration != owner + } + } + } + + private val closuresStack = ArrayDeque() + + override fun visitElement(element: IrElement) { + element.acceptChildrenVoid(this) + } + + override fun visitClass(declaration: IrClass) { + val classDescriptor = declaration.descriptor + val closureBuilder = ClosureBuilder(classDescriptor) + + closuresStack.push(closureBuilder) + declaration.acceptChildrenVoid(this) + closuresStack.pop() + + val closure = closureBuilder.buildClosure() + + if (DescriptorUtils.isLocal(classDescriptor)) { + recordClassClosure(classDescriptor, closure) + } + + closuresStack.peek()?.addNested(closure) + } + + override fun visitFunction(declaration: IrFunction) { + val functionDescriptor = declaration.descriptor + val closureBuilder = ClosureBuilder(functionDescriptor) + + closuresStack.push(closureBuilder) + declaration.acceptChildrenVoid(this) + closuresStack.pop() + + val closure = closureBuilder.buildClosure() + + if (DescriptorUtils.isLocal(functionDescriptor)) { + recordFunctionClosure(functionDescriptor, closure) + } + + closuresStack.peek()?.addNested(closure) + } + + override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) { + // Getter and setter of local delegated properties are special generated functions and don't have closure. + declaration.delegate.initializer?.acceptVoid(this) + } + + override fun visitVariableAccess(expression: IrValueAccessExpression) { + val closureBuilder = closuresStack.peek() ?: return + + val variableDescriptor = expression.descriptor + if (variableDescriptor.containingDeclaration != closureBuilder.owner) { + closureBuilder.capturedValues.add(variableDescriptor) + } + + expression.acceptChildrenVoid(this) + } + +} diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index 906805305b3..9c9ff1d29a9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -16,7 +16,7 @@ package org.jetbrains.kotlin.backend.common.lower -import org.jetbrains.kotlin.backend.common.AbstractClosureAnnotator +import org.jetbrains.kotlin.backend.common.AbstractClosureRecorder import org.jetbrains.kotlin.backend.common.BackendContext import org.jetbrains.kotlin.backend.common.Closure import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass @@ -30,10 +30,7 @@ import org.jetbrains.kotlin.ir.declarations.impl.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.util.transformFlat -import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid -import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid -import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid -import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid +import org.jetbrains.kotlin.ir.visitors.* import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.parents import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf @@ -589,7 +586,7 @@ class LocalDeclarationsLowering(val context: BackendContext): DeclarationContain private fun collectClosures() { - memberFunction.acceptChildrenVoid(object : AbstractClosureAnnotator() { + memberFunction.acceptChildrenVoid(object : AbstractClosureRecorder() { override fun recordFunctionClosure(functionDescriptor: FunctionDescriptor, closure: Closure) { localFunctions[functionDescriptor]?.closure = closure } From b4ee0e86d2890b3aca7eab4e1910a90fedff2b55 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 1 Feb 2017 16:08:46 +0300 Subject: [PATCH 86/86] backend: Fix uninitialized property access in LocalDeclarationsLowering --- .../kotlin/backend/common/AbstractClosureRecorder.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt index a85fe6878bd..7ba8096e676 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/AbstractClosureRecorder.kt @@ -94,11 +94,13 @@ abstract class AbstractClosureRecorder : IrElementVisitorVoid { } override fun visitVariableAccess(expression: IrValueAccessExpression) { - val closureBuilder = closuresStack.peek() ?: return + val closureBuilder = closuresStack.peek() - val variableDescriptor = expression.descriptor - if (variableDescriptor.containingDeclaration != closureBuilder.owner) { - closureBuilder.capturedValues.add(variableDescriptor) + if (closureBuilder != null) { + val variableDescriptor = expression.descriptor + if (variableDescriptor.containingDeclaration != closureBuilder.owner) { + closureBuilder.capturedValues.add(variableDescriptor) + } } expression.acceptChildrenVoid(this)