From 65d40c225333e61cac848c733b21642f493983dc Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Mon, 4 Oct 2021 20:44:06 +0300 Subject: [PATCH] [JS IR] Make tests that use directives pass with IR BE --- .../inlineWithoutStateMachine.kt | 3 +- .../box/when/enumOptimization/bigEnum.kt | 12 +- .../when/enumOptimization/duplicatingItems.kt | 6 +- .../enumOptimization/enumInsideClassObject.kt | 3 +- .../box/when/enumOptimization/expression.kt | 9 +- .../functionLiteralInTopLevel.kt | 3 +- .../box/when/enumOptimization/kt14597.kt | 6 +- .../box/when/enumOptimization/kt14597_full.kt | 6 +- .../box/when/enumOptimization/kt14802.kt | 6 +- .../box/when/enumOptimization/kt15806.kt | 6 +- .../enumOptimization/manyWhensWithinClass.kt | 9 +- .../box/when/enumOptimization/subjectAny.kt | 3 +- .../box/when/enumOptimization/withoutElse.kt | 12 +- .../stringOptimization/duplicatingItems.kt | 3 +- .../when/stringOptimization/nullability.kt | 6 +- .../switchOptimizationSingleStatementCase.kt | 15 ++- .../box/when/switchOptimizationTypes.kt | 9 +- .../box/when/switchOptimizationWithGap.kt | 6 +- .../lambdaInlining/defaultLambdaInNoInline.kt | 3 +- .../instanceCapturedInInterface.kt | 3 +- .../defaultValues/lambdaInlining/noInline.kt | 3 +- .../nonDefaultInlineInNoInline.kt | 2 +- .../lambdaInlining/receiverClash.kt | 4 +- .../lambdaInlining/receiverClash2.kt | 4 +- .../lambdaInlining/receiverClashInClass.kt | 4 +- .../lambdaInlining/receiverClashInClass2.kt | 4 +- .../lambdaInlining/simpleErased.kt | 3 +- .../simpleErasedStaticInstance.kt | 3 +- .../lambdaInlining/simpleGeneric.kt | 3 +- .../defaultValues/lambdaInlining/thisClash.kt | 4 +- .../lambdaInlining/thisClashInClass.kt | 4 +- .../testData/box/coroutines/debugStatement.kt | 3 +- .../box/coroutines/localVarOptimization.kt | 11 +- .../secondaryConstructorTemporaryVars.kt | 3 +- .../singleComponentDestructuring.kt | 3 +- .../expression/for/overCollectionWithIndex.kt | 3 +- .../box/expression/for/rangeOptimization.kt | 2 +- .../box/incremental/multipleExport.kt | 2 +- .../testData/box/inline/astCopy.kt | 2 +- .../testData/box/inline/callFunction.kt | 3 +- .../testData/box/inline/callableReference.kt | 7 +- .../inline/expressionBodyWithLambdaCall.kt | 2 +- .../box/inline/extensionWithManyArguments.kt | 6 +- .../box/inline/inlineCapturingThis.kt | 3 +- .../box/inline/inlineLambdaWithCapture.kt | 2 +- .../testData/box/inline/inlineMethod.kt | 6 +- .../testData/box/inline/inlineNoReturn.kt | 2 +- .../testData/box/inline/inlineOrder.kt | 2 +- .../testData/box/inline/invokeOnField.kt | 4 +- .../testData/box/inline/jsCode.kt | 4 +- .../testData/box/inline/jsCodeVarDeclared.kt | 4 +- .../inline/localInlineExtensionFunction.kt | 4 +- .../box/inline/localInlineFunction.kt | 2 +- .../box/inline/localInlineFunctionComplex.kt | 6 +- .../localInlineFunctionDeclaredInLambda.kt | 2 +- .../inline/localInlineFunctionNameClash.kt | 6 +- .../box/inline/metadataForPublicFunction.kt | 15 ++- .../testData/box/inline/operators.kt | 48 +++++-- .../testData/box/inline/privateProperty.kt | 121 +++++++++++++----- .../argumentOfInlineCall.kt | 2 +- .../testData/box/inlineMultiFile/trait.kt | 2 +- .../box/inlineMultiModule/callFunction.kt | 2 +- .../inlineMultiModule/callableReference.kt | 7 +- .../inlineMultiModule/importObjectInstance.kt | 5 +- .../testData/box/inlineMultiModule/kt16144.kt | 2 +- .../testData/box/inlineMultiModule/kt16160.kt | 2 +- .../box/inlineMultiModule/operators.kt | 9 +- .../box/inlineMultiModule/property.kt | 4 +- .../box/inlineMultiModule/repeatedImport.kt | 2 +- .../box/inlineSizeReduction/inlineOrder.kt | 11 +- .../box/inlineSizeReduction/lastBreak.kt | 3 +- .../multiModuleDefaultArgsCleanup.kt | 4 +- .../noDuplicateVariableDeclaration.kt | 3 +- .../inlineSizeReduction/oneTopLevelReturn.kt | 6 +- .../propertyReassignment.kt | 8 +- ...opertyReferenceDoesNotProduceSideEffect.kt | 4 +- .../simpleReturnFunction.kt | 4 +- .../inlineSizeReduction/ternaryConditional.kt | 7 +- .../testData/box/inlineSizeReduction/this.kt | 4 +- .../inlineSizeReduction/varargTemporaryVar.kt | 8 +- .../box/inlineStdlib/closureNested.kt | 2 +- .../box/inlineStdlib/thisInExtension.kt | 4 +- .../box/jsModule/importCountCommonJS.kt | 3 +- .../testData/box/jsModule/importCountUmd.kt | 3 +- .../testData/box/labels/labelOnExpression.kt | 4 +- .../box/labels/nestedLabelsInlinedClashing.kt | 2 +- .../testData/box/labels/siblingLabels.kt | 4 +- .../box/labels/siblingLabelsInlined.kt | 4 +- .../labels/siblingLabelsInlinedClashing.kt | 4 +- .../box/multiModule/publishedApiMangling.kt | 9 +- .../inlineFromModuleWithNonIdentifierName.kt | 2 +- .../inlineFromModuleWithNonIdentifierName.kt | 3 +- .../box/nameClashes/constructorsCrossFile.kt | 4 +- .../box/number/constantPropagation.kt | 12 +- .../testData/box/number/incDecOptimization.kt | 2 +- .../privatePropertyAccessFromMethod.kt | 4 +- .../box/range/numberRangesOptimized.kt | 10 +- .../testData/box/reified/isTNullable.kt | 3 +- .../testData/box/reified/vararg.kt | 4 +- .../box/reified/withInlineTurnedOff.kt | 2 +- .../testData/box/standardClasses/any.kt | 3 +- 101 files changed, 415 insertions(+), 217 deletions(-) diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt index dcc818fb856..21af4ceaee7 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt @@ -2,7 +2,8 @@ // WITH_COROUTINES // CHECK_BYTECODE_LISTING // CHECK_NEW_COUNT: function=suspendHere count=0 -// CHECK_NEW_COUNT: function=complexSuspend count=0 +// FIXME: Coroutine inlining +// CHECK_NEW_COUNT: function=complexSuspend count=0 TARGET_BACKENDS=JS import helpers.* import kotlin.coroutines.* import kotlin.coroutines.intrinsics.* diff --git a/compiler/testData/codegen/box/when/enumOptimization/bigEnum.kt b/compiler/testData/codegen/box/when/enumOptimization/bigEnum.kt index 629b6d1a32a..7f9a6e600ae 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/bigEnum.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/bigEnum.kt @@ -1,8 +1,12 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=bar1 count=6 -// CHECK_IF_COUNT: function=bar1 count=0 -// CHECK_CASES_COUNT: function=bar2 count=6 -// CHECK_IF_COUNT: function=bar2 count=0 +// CHECK_CASES_COUNT: function=bar1 count=6 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar1 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar1 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar1 count=2 IGNORED_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar2 count=6 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar2 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar2 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar2 count=3 IGNORED_BACKENDS=JS import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/enumOptimization/duplicatingItems.kt b/compiler/testData/codegen/box/when/enumOptimization/duplicatingItems.kt index 0df6b309bf6..73e20014331 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/duplicatingItems.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/duplicatingItems.kt @@ -1,6 +1,8 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=bar count=3 -// CHECK_IF_COUNT: function=bar count=0 +// CHECK_CASES_COUNT: function=bar count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar count=2 IGNORED_BACKENDS=JS import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/enumOptimization/enumInsideClassObject.kt b/compiler/testData/codegen/box/when/enumOptimization/enumInsideClassObject.kt index 1ce3c8075a0..c04fea4afab 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/enumInsideClassObject.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/enumInsideClassObject.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=foo count=3 +// CHECK_CASES_COUNT: function=foo count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=foo count=0 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=foo count=0 import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/enumOptimization/expression.kt b/compiler/testData/codegen/box/when/enumOptimization/expression.kt index 418f1860d09..c1aa6c0100c 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/expression.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/expression.kt @@ -1,8 +1,11 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=bar1 count=3 +// CHECK_CASES_COUNT: function=bar1 count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar1 count=0 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=bar1 count=0 -// CHECK_CASES_COUNT: function=bar2 count=4 -// CHECK_IF_COUNT: function=bar2 count=0 +// CHECK_CASES_COUNT: function=bar2 count=4 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar2 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar2 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar2 count=3 IGNORED_BACKENDS=JS import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt b/compiler/testData/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt index 2266ce69a30..75b8e707d78 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt @@ -1,5 +1,6 @@ // CHECK_CASES_COUNT: function=box$lambda count=0 -// CHECK_IF_COUNT: function=box$lambda count=1 +// CHECK_IF_COUNT: function=box$lambda count=1 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=box$lambda count=0 IGNORED_BACKENDS=JS enum class Season { WINTER, diff --git a/compiler/testData/codegen/box/when/enumOptimization/kt14597.kt b/compiler/testData/codegen/box/when/enumOptimization/kt14597.kt index 7af0d40883e..1a8906cd280 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/kt14597.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/kt14597.kt @@ -1,5 +1,7 @@ -// CHECK_CASES_COUNT: function=box count=6 -// CHECK_IF_COUNT: function=box count=1 +// CHECK_CASES_COUNT: function=box count=6 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=box count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=box count=1 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=box count=7 IGNORED_BACKENDS=JS enum class En { A, B, C } diff --git a/compiler/testData/codegen/box/when/enumOptimization/kt14597_full.kt b/compiler/testData/codegen/box/when/enumOptimization/kt14597_full.kt index 2926f787c9e..54a38bb67f6 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/kt14597_full.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/kt14597_full.kt @@ -1,5 +1,7 @@ -// CHECK_CASES_COUNT: function=box count=18 -// CHECK_IF_COUNT: function=box count=3 +// CHECK_CASES_COUNT: function=box count=18 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=box count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=box count=3 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=box count=21 IGNORED_BACKENDS=JS enum class En { A, B, C } diff --git a/compiler/testData/codegen/box/when/enumOptimization/kt14802.kt b/compiler/testData/codegen/box/when/enumOptimization/kt14802.kt index b2fd2b389c6..aeae43bf5c9 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/kt14802.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/kt14802.kt @@ -1,5 +1,7 @@ -// CHECK_CASES_COUNT: function=crash count=2 -// CHECK_IF_COUNT: function=crash count=1 +// CHECK_CASES_COUNT: function=crash count=2 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=crash count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=crash count=1 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=crash count=3 IGNORED_BACKENDS=JS class EncapsulatedEnum>(val value: T) diff --git a/compiler/testData/codegen/box/when/enumOptimization/kt15806.kt b/compiler/testData/codegen/box/when/enumOptimization/kt15806.kt index 54d4d6c5cd9..0d9c08d158b 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/kt15806.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/kt15806.kt @@ -1,5 +1,7 @@ -// CHECK_CASES_COUNT: function=doTheThing count=2 -// CHECK_IF_COUNT: function=doTheThing count=2 +// CHECK_CASES_COUNT: function=doTheThing count=2 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=doTheThing count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=doTheThing count=2 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=doTheThing count=4 IGNORED_BACKENDS=JS private fun Any?.doTheThing(): String { when (this) { diff --git a/compiler/testData/codegen/box/when/enumOptimization/manyWhensWithinClass.kt b/compiler/testData/codegen/box/when/enumOptimization/manyWhensWithinClass.kt index 35b69efcfdd..ee6b7063db0 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/manyWhensWithinClass.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/manyWhensWithinClass.kt @@ -1,7 +1,10 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=bar1_u51tkt$ count=3 -// CHECK_IF_COUNT: function=bar1_u51tkt$ count=0 -// CHECK_CASES_COUNT: function=A$bar2$lambda count=3 +// CHECK_CASES_COUNT: function=bar1_u51tkt$ count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar1_eni42q_k$ count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar1_u51tkt$ count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar1_eni42q_k$ count=3 IGNORED_BACKENDS=JS +// CHECK_CASES_COUNT: function=A$bar2$lambda count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=A$bar2$lambda count=0 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=A$bar2$lambda count=0 import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/enumOptimization/subjectAny.kt b/compiler/testData/codegen/box/when/enumOptimization/subjectAny.kt index 1a18c698481..62bf187d5bd 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/subjectAny.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/subjectAny.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // CHECK_CASES_COUNT: function=foo count=0 -// CHECK_IF_COUNT: function=foo count=3 +// CHECK_IF_COUNT: function=foo count=3 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=foo count=0 IGNORED_BACKENDS=JS import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/enumOptimization/withoutElse.kt b/compiler/testData/codegen/box/when/enumOptimization/withoutElse.kt index a1f39c321ec..5e761bd1ba7 100644 --- a/compiler/testData/codegen/box/when/enumOptimization/withoutElse.kt +++ b/compiler/testData/codegen/box/when/enumOptimization/withoutElse.kt @@ -1,8 +1,12 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=bar1 count=3 -// CHECK_IF_COUNT: function=bar1 count=0 -// CHECK_CASES_COUNT: function=bar2 count=4 -// CHECK_IF_COUNT: function=bar2 count=0 +// CHECK_CASES_COUNT: function=bar1 count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar1 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar1 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar1 count=3 IGNORED_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar2 count=4 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=bar2 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=bar2 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=bar2 count=4 IGNORED_BACKENDS=JS import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/stringOptimization/duplicatingItems.kt b/compiler/testData/codegen/box/when/stringOptimization/duplicatingItems.kt index 1d400ddcb4d..79beb895666 100644 --- a/compiler/testData/codegen/box/when/stringOptimization/duplicatingItems.kt +++ b/compiler/testData/codegen/box/when/stringOptimization/duplicatingItems.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=foo count=3 +// CHECK_CASES_COUNT: function=foo count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=foo count=4 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=foo count=0 import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/box/when/stringOptimization/nullability.kt b/compiler/testData/codegen/box/when/stringOptimization/nullability.kt index c325a7bef61..c331eb9e2eb 100644 --- a/compiler/testData/codegen/box/when/stringOptimization/nullability.kt +++ b/compiler/testData/codegen/box/when/stringOptimization/nullability.kt @@ -1,6 +1,8 @@ // WITH_RUNTIME -// CHECK_CASES_COUNT: function=foo1 count=2 -// CHECK_IF_COUNT: function=foo1 count=1 +// CHECK_CASES_COUNT: function=foo1 count=2 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=foo1 count=5 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=foo1 count=1 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=foo1 count=0 IGNORED_BACKENDS=JS // CHECK_CASES_COUNT: function=foo2 count=4 // CHECK_IF_COUNT: function=foo2 count=0 diff --git a/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt b/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt index 50447ed814d..5e9b30a7ed2 100644 --- a/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt +++ b/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt @@ -1,9 +1,14 @@ -// CHECK_CASES_COUNT: function=test1 count=2 -// CHECK_IF_COUNT: function=test1 count=0 -// CHECK_BREAKS_COUNT: function=test1 count=1 +// CHECK_CASES_COUNT: function=test1 count=2 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=test1 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=test1 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=test1 count=1 IGNORED_BACKENDS=JS +// CHECK_BREAKS_COUNT: function=test1 count=1 TARGET_BACKENDS=JS +// CHECK_BREAKS_COUNT: function=test1 count=0 IGNORED_BACKENDS=JS -// CHECK_CASES_COUNT: function=test2 count=2 -// CHECK_IF_COUNT: function=test2 count=0 +// CHECK_CASES_COUNT: function=test2 count=2 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=test2 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=test2 count=0 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=test2 count=1 IGNORED_BACKENDS=JS // CHECK_BREAKS_COUNT: function=test2 count=1 fun test1(v: Int) { diff --git a/compiler/testData/codegen/box/when/switchOptimizationTypes.kt b/compiler/testData/codegen/box/when/switchOptimizationTypes.kt index 6f0137bd7cf..0804a637ace 100644 --- a/compiler/testData/codegen/box/when/switchOptimizationTypes.kt +++ b/compiler/testData/codegen/box/when/switchOptimizationTypes.kt @@ -2,11 +2,14 @@ // WITH_RUNTIME // CHECK_CASES_COUNT: function=intFoo count=3 // CHECK_IF_COUNT: function=intFoo count=0 -// CHECK_CASES_COUNT: function=shortFoo count=3 +// CHECK_CASES_COUNT: function=shortFoo count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=shortFoo count=0 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=shortFoo count=0 -// CHECK_CASES_COUNT: function=byteFoo count=3 +// CHECK_CASES_COUNT: function=byteFoo count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=byteFoo count=0 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=byteFoo count=0 -// CHECK_CASES_COUNT: function=charFoo count=3 +// CHECK_CASES_COUNT: function=charFoo count=3 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=charFoo count=0 IGNORED_BACKENDS=JS // CHECK_IF_COUNT: function=charFoo count=0 fun intFoo(x: Int): Int { diff --git a/compiler/testData/codegen/box/when/switchOptimizationWithGap.kt b/compiler/testData/codegen/box/when/switchOptimizationWithGap.kt index 8e22f547c87..6e7fb6f46b7 100644 --- a/compiler/testData/codegen/box/when/switchOptimizationWithGap.kt +++ b/compiler/testData/codegen/box/when/switchOptimizationWithGap.kt @@ -1,7 +1,9 @@ // KJS_WITH_FULL_RUNTIME // WITH_RUNTIME -// CHECK_CASES_COUNT: function=foo count=4 -// CHECK_IF_COUNT: function=foo count=1 +// CHECK_CASES_COUNT: function=foo count=4 TARGET_BACKENDS=JS +// CHECK_CASES_COUNT: function=foo count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=foo count=1 TARGET_BACKENDS=JS +// CHECK_IF_COUNT: function=foo count=0 IGNORED_BACKENDS=JS var log = "" diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt index bfebf8d7b28..f7077d79057 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt @@ -8,7 +8,8 @@ inline fun inlineFun(crossinline inlineLambda: () -> String = { "OK" }, noinline } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=box$lambda scope=box IGNORED_BACKENDS=JS import test.* fun box(): String { diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/instanceCapturedInInterface.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/instanceCapturedInInterface.kt index 3ebc7165c81..3e0b6541a9d 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/instanceCapturedInInterface.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/instanceCapturedInInterface.kt @@ -1,6 +1,7 @@ // SKIP_INLINE_CHECK_IN: inlineFun$default // FILE: 1.kt -// CHECK_CONTAINS_NO_CALLS: test +// CHECK_CONTAINS_NO_CALLS: test TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: test_0_k$ except=_get_value__0_k$ IGNORED_BACKENDS=JS package test //problem in test framework diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt index 7e2a4620c07..fbd60d336e2 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt @@ -9,7 +9,8 @@ inline fun inlineFun(capturedParam: String, noinline lambda: () -> String = { ca fun call(lambda: () -> String ) = lambda() // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=box$lambda scope=box IGNORED_BACKENDS=JS // CHECK_CALLED_IN_SCOPE: function=call scope=box import test.* diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt index 3ad8d956d3a..55aa3a6ed95 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt @@ -8,7 +8,7 @@ inline fun inlineFun(crossinline inlineLambda: () -> String, noinline noInlineLa } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=inlineFun +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=inlineFun TARGET_BACKENDS=JS import test.* fun box(): String { diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt index 1d509a34873..fa7546a6ec0 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt @@ -9,8 +9,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box TARGET_BACKENDS=JS import test.* diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt index eb1aaacfa86..010f23532a5 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt @@ -9,8 +9,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambd } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=test -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=test +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=test TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=test TARGET_BACKENDS=JS import test.* fun String.test(): String = "INLINE".inlineFun({ this }) diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt index cf8b2298fc6..65046f87eda 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt @@ -13,8 +13,8 @@ class A(val value: String) { } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box +// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box TARGET_BACKENDS=JS import test.* fun box(): String { diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt index d2d45f33b9f..dc997cf42f7 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt @@ -13,8 +13,8 @@ class A(val value: String) { // FILE: 2.kt //WIH_RUNTIME -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=test -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=test +// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=test TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=test TARGET_BACKENDS=JS import test.* fun String.test(): String = with(A("VALUE")) { "INLINE".inlineFun({ this@test }) } diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt index 04e288789b3..a57f12f61e9 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt @@ -7,7 +7,8 @@ inline fun inlineFun(capturedParam: String, lambda: () -> Any = { capturedParam } // FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType +// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: box except=THROW_CCE;isObject IGNORED_BACKENDS=JS import test.* diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt index 80c1829de84..2dd2059bebc 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt @@ -7,7 +7,8 @@ inline fun inlineFun(lambda: () -> Any = { "OK" as Any }): Any { } // FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType +// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: box except=THROW_CCE;isObject IGNORED_BACKENDS=JS import test.* diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt index 6859fe86654..585f0515753 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt @@ -11,7 +11,8 @@ inline fun inlineFun(capturedParam: T, lambda: () -> T = { capturedParam } // FILE: 2.kt -// CHECK_CONTAINS_NO_CALLS: box +// CHECK_CONTAINS_NO_CALLS: box TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: box except=_get_value__0_k$ IGNORED_BACKENDS=JS import test.* diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt index 58da56c9a72..7dc67f06c84 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt @@ -11,8 +11,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { { this }() }): } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=inlineFun$lambda_0 scope=box TARGET_BACKENDS=JS import test.* diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt index e29ff68c7ca..938dd0df42c 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt @@ -14,8 +14,8 @@ class A(val value: String) { } // FILE: 2.kt -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box -// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box +// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=A$inlineFun$lambda_0 scope=box TARGET_BACKENDS=JS import test.* fun box(): String { diff --git a/js/js.translator/testData/box/coroutines/debugStatement.kt b/js/js.translator/testData/box/coroutines/debugStatement.kt index 8a6c40ae4cc..7085f45aeec 100644 --- a/js/js.translator/testData/box/coroutines/debugStatement.kt +++ b/js/js.translator/testData/box/coroutines/debugStatement.kt @@ -1,6 +1,7 @@ // KJS_WITH_FULL_RUNTIME // EXPECTED_REACHABLE_NODES: 1292 -// CHECK_DEBUGGER_COUNT: function=doResume count=1 +// CHECK_DEBUGGER_COUNT: function=doResume count=1 TARGET_BACKENDS=JS +// CHECK_DEBUGGER_COUNT: function=doResume_0_k$ count=1 IGNORED_BACKENDS=JS fun foo(f: suspend () -> Unit) { } diff --git a/js/js.translator/testData/box/coroutines/localVarOptimization.kt b/js/js.translator/testData/box/coroutines/localVarOptimization.kt index c34eba0df54..386477c3bbe 100644 --- a/js/js.translator/testData/box/coroutines/localVarOptimization.kt +++ b/js/js.translator/testData/box/coroutines/localVarOptimization.kt @@ -1,9 +1,10 @@ // EXPECTED_REACHABLE_NODES: 1401 -// DECLARES_VARIABLE: function=doResume name=k -// PROPERTY_READ_COUNT: name=local$o count=1 -// PROPERTY_WRITE_COUNT: name=local$o count=2 - -// Unmute when JS_IR supports release coroutines +// DECLARES_VARIABLE: function=doResume name=k TARGET_BACKENDS=JS +// DECLARES_VARIABLE: function=doResume_0_k$ name=k IGNORED_BACKENDS=JS +// PROPERTY_READ_COUNT: name=local$o count=1 TARGET_BACKENDS=JS +// PROPERTY_READ_COUNT: name=_o0 count=1 IGNORED_BACKENDS=JS +// PROPERTY_WRITE_COUNT: name=local$o count=2 TARGET_BACKENDS=JS +// PROPERTY_WRITE_COUNT: name=_o0 count=1 IGNORED_BACKENDS=JS import kotlin.coroutines.* diff --git a/js/js.translator/testData/box/expression/evaluationOrder/secondaryConstructorTemporaryVars.kt b/js/js.translator/testData/box/expression/evaluationOrder/secondaryConstructorTemporaryVars.kt index 8d286c8d827..16391f3f3c0 100644 --- a/js/js.translator/testData/box/expression/evaluationOrder/secondaryConstructorTemporaryVars.kt +++ b/js/js.translator/testData/box/expression/evaluationOrder/secondaryConstructorTemporaryVars.kt @@ -1,5 +1,6 @@ // EXPECTED_REACHABLE_NODES: 1285 -// HAS_NO_CAPTURED_VARS: function=A_init except=Kotlin;A;equals +// HAS_NO_CAPTURED_VARS: function=A_init except=Kotlin;A;equals TARGET_BACKENDS=JS +// TODO: Enable this when KT-***** is resolved. // HAS_NO_CAPTURED_VARS: function=A_init_$Init$ except=A;equals IGNORED_BACKENDS=JS class A() { var y: String? = null diff --git a/js/js.translator/testData/box/expression/evaluationOrder/singleComponentDestructuring.kt b/js/js.translator/testData/box/expression/evaluationOrder/singleComponentDestructuring.kt index 4aa4238dded..0163277500c 100644 --- a/js/js.translator/testData/box/expression/evaluationOrder/singleComponentDestructuring.kt +++ b/js/js.translator/testData/box/expression/evaluationOrder/singleComponentDestructuring.kt @@ -1,6 +1,7 @@ // KJS_WITH_FULL_RUNTIME // EXPECTED_REACHABLE_NODES: 1283 -// CHECK_VARS_COUNT: function=test count=2 +// CHECK_VARS_COUNT: function=test count=2 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test_1 count=4 IGNORED_BACKENDS=JS var log = "" fun test() { diff --git a/js/js.translator/testData/box/expression/for/overCollectionWithIndex.kt b/js/js.translator/testData/box/expression/for/overCollectionWithIndex.kt index 1e9e78904e2..621113bbde3 100644 --- a/js/js.translator/testData/box/expression/for/overCollectionWithIndex.kt +++ b/js/js.translator/testData/box/expression/for/overCollectionWithIndex.kt @@ -3,7 +3,8 @@ // CHECK_NOT_CALLED_IN_SCOPE: function=component1 scope=test1 // CHECK_NOT_CALLED_IN_SCOPE: function=component1 scope=test2 // CHECK_NOT_CALLED_IN_SCOPE: function=component1 scope=test3 -// CHECK_CONTAINS_NO_CALLS: test4 except=toString +// CHECK_CONTAINS_NO_CALLS: test4 except=toString TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: test4 except=_get_size__0_k$ IGNORED_BACKENDS=JS fun test1(a: Sequence): String { var s = "" diff --git a/js/js.translator/testData/box/expression/for/rangeOptimization.kt b/js/js.translator/testData/box/expression/for/rangeOptimization.kt index cd1fd2deca5..bf776c354ed 100644 --- a/js/js.translator/testData/box/expression/for/rangeOptimization.kt +++ b/js/js.translator/testData/box/expression/for/rangeOptimization.kt @@ -3,7 +3,7 @@ // CHECK_CONTAINS_NO_CALLS: testRangeToFunction // CHECK_CONTAINS_NO_CALLS: testUntil // CHECK_CONTAINS_NO_CALLS: testDownTo -// CHECK_CONTAINS_NO_CALLS: testStep +// CHECK_CONTAINS_NO_CALLS: testStep TARGET_BACKENDS=JS // CHECK_CONTAINS_NO_CALLS: testEmptyRange // CHECK_CONTAINS_NO_CALLS: testRangeToParams except=from;to diff --git a/js/js.translator/testData/box/incremental/multipleExport.kt b/js/js.translator/testData/box/incremental/multipleExport.kt index 087c73400b8..dd097bf6c8b 100644 --- a/js/js.translator/testData/box/incremental/multipleExport.kt +++ b/js/js.translator/testData/box/incremental/multipleExport.kt @@ -1,5 +1,5 @@ // EXPECTED_REACHABLE_NODES: 1281 -// PROPERTY_WRITE_COUNT: name=foo_61zpoe$ count=1 +// PROPERTY_WRITE_COUNT: name=foo_61zpoe$ count=1 TARGET_BACKENDS=JS // FILE: a.kt fun foo(x: String): String = x diff --git a/js/js.translator/testData/box/inline/astCopy.kt b/js/js.translator/testData/box/inline/astCopy.kt index 1ca2f6bd9d2..559df55634f 100644 --- a/js/js.translator/testData/box/inline/astCopy.kt +++ b/js/js.translator/testData/box/inline/astCopy.kt @@ -2,7 +2,7 @@ // EXPECTED_REACHABLE_NODES: 1281 package foo -// CHECK_FUNCTIONS_HAVE_SAME_LINES: syntaxTestInline syntaxTest +// CHECK_FUNCTIONS_HAVE_SAME_LINES: syntaxTestInline syntaxTest TARGET_BACKENDS=JS inline fun syntaxTestInline() { var result: Int = -0 diff --git a/js/js.translator/testData/box/inline/callFunction.kt b/js/js.translator/testData/box/inline/callFunction.kt index f5b8b9321da..7c4bb3fa8b7 100644 --- a/js/js.translator/testData/box/inline/callFunction.kt +++ b/js/js.translator/testData/box/inline/callFunction.kt @@ -1,5 +1,6 @@ // EXPECTED_REACHABLE_NODES: 1288 -// CHECK_CONTAINS_NO_CALLS: box except=equals;Baz_getInstance;callLocal;callLocalExtension +// CHECK_CONTAINS_NO_CALLS: box except=equals;Baz_getInstance;callLocal;callLocalExtension TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: box except=Foo_getInstance;Bar;Baz_getInstance;callLocal;callLocalExtension IGNORED_BACKENDS=JS // CHECK_CONTAINS_NO_CALLS: callLocal // CHECK_CONTAINS_NO_CALLS: callLocalExtension diff --git a/js/js.translator/testData/box/inline/callableReference.kt b/js/js.translator/testData/box/inline/callableReference.kt index fd5ed8f40f4..3a24ee37971 100644 --- a/js/js.translator/testData/box/inline/callableReference.kt +++ b/js/js.translator/testData/box/inline/callableReference.kt @@ -1,7 +1,12 @@ // EXPECTED_REACHABLE_NODES: 1284 package foo -// CHECK_CONTAINS_NO_CALLS: multiplyInline except=imul +// CHECK_CONTAINS_NO_CALLS: multiplyInline except=imul TARGET_BACKENDS=JS + +// FIXME: Not inlined on IR BE +// CHECK_CONTAINS_NO_CALLS: multiplyInline except=multiply_0 IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: runNoinline // CHECK_NOT_CALLED: runNoinline internal inline fun multiply(a: Int, b: Int) = a * b diff --git a/js/js.translator/testData/box/inline/expressionBodyWithLambdaCall.kt b/js/js.translator/testData/box/inline/expressionBodyWithLambdaCall.kt index f684fc6775c..b95750302b5 100644 --- a/js/js.translator/testData/box/inline/expressionBodyWithLambdaCall.kt +++ b/js/js.translator/testData/box/inline/expressionBodyWithLambdaCall.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1283 package foo -// CHECK_CONTAINS_NO_CALLS: test +// CHECK_CONTAINS_NO_CALLS: test except=Unit_getInstance // A copy of stdlib run function. // Copied to not to depend on run implementation. diff --git a/js/js.translator/testData/box/inline/extensionWithManyArguments.kt b/js/js.translator/testData/box/inline/extensionWithManyArguments.kt index 5d8b60c0cd1..31fe9e15904 100644 --- a/js/js.translator/testData/box/inline/extensionWithManyArguments.kt +++ b/js/js.translator/testData/box/inline/extensionWithManyArguments.kt @@ -1,16 +1,16 @@ // EXPECTED_REACHABLE_NODES: 1285 package foo -// CHECK_NOT_CALLED_IN_SCOPE: scope=multiply function=multiply$lambda +// CHECK_CONTAINS_NO_CALLS: myMultiply except=A;imul internal class A(val a: Int) internal inline fun with2(receiver: T, arg1: R, arg2: R, f: T.(R, R) -> R): R = receiver.f(arg1, arg2) -internal fun multiply(a: Int, b: Int, c: Int): Int = with2(A(a), b, c) { x, y -> a*x*y } +internal fun myMultiply(a: Int, b: Int, c: Int): Int = with2(A(a), b, c) { x, y -> a*x*y } fun box(): String { - assertEquals(105, multiply(3, 5, 7)) + assertEquals(105, myMultiply(3, 5, 7)) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/box/inline/inlineCapturingThis.kt b/js/js.translator/testData/box/inline/inlineCapturingThis.kt index 314e0150eeb..74cdf595514 100644 --- a/js/js.translator/testData/box/inline/inlineCapturingThis.kt +++ b/js/js.translator/testData/box/inline/inlineCapturingThis.kt @@ -1,7 +1,8 @@ // EXPECTED_REACHABLE_NODES: 1286 package foo -// CHECK_CONTAINS_NO_CALLS: test +// CHECK_CONTAINS_NO_CALLS: test TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: test_0_k$ except=Unit_getInstance IGNORED_BACKENDS=JS inline fun block(p: () -> Unit) = p() diff --git a/js/js.translator/testData/box/inline/inlineLambdaWithCapture.kt b/js/js.translator/testData/box/inline/inlineLambdaWithCapture.kt index 0a8850e0e37..e0b0268e8d7 100644 --- a/js/js.translator/testData/box/inline/inlineLambdaWithCapture.kt +++ b/js/js.translator/testData/box/inline/inlineLambdaWithCapture.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1292 package foo -// CHECK_CONTAINS_NO_CALLS: maxBySquare except=imul +// CHECK_CONTAINS_NO_CALLS: maxBySquare except=imul;Unit_getInstance internal data class Result(var value: Int = 0, var invocationCount: Int = 0) diff --git a/js/js.translator/testData/box/inline/inlineMethod.kt b/js/js.translator/testData/box/inline/inlineMethod.kt index 03ba11bf84e..10a81a16e6d 100644 --- a/js/js.translator/testData/box/inline/inlineMethod.kt +++ b/js/js.translator/testData/box/inline/inlineMethod.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1296 package foo -// CHECK_CONTAINS_NO_CALLS: add +// CHECK_CONTAINS_NO_CALLS: myAdd internal data class IntPair(public var fst: Int, public var snd: Int) { inline public fun getFst(): Int { return fst } @@ -11,7 +11,7 @@ internal data class IntPair(public var fst: Int, public var snd: Int) { inline public fun setSnd(v: Int) { this.snd = v } } -internal fun add(p: IntPair, toFst: Int, toSnd: Int) { +internal fun myAdd(p: IntPair, toFst: Int, toSnd: Int) { val fst = p.getFst() p.setFst(fst + toFst) @@ -21,7 +21,7 @@ internal fun add(p: IntPair, toFst: Int, toSnd: Int) { fun box(): String { val p = IntPair(0, 0) - add(p, 1, 2) + myAdd(p, 1, 2) assertEquals(IntPair(1, 2), p) return "OK" diff --git a/js/js.translator/testData/box/inline/inlineNoReturn.kt b/js/js.translator/testData/box/inline/inlineNoReturn.kt index 4a15e709d36..5e1d3dd7aa8 100644 --- a/js/js.translator/testData/box/inline/inlineNoReturn.kt +++ b/js/js.translator/testData/box/inline/inlineNoReturn.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1286 package foo -// CHECK_CONTAINS_NO_CALLS: factAbsNoInline1 except=imul +// CHECK_CONTAINS_NO_CALLS: factAbsNoInline1 except=imul;Unit_getInstance internal class State(value: Int) { public var value: Int = value diff --git a/js/js.translator/testData/box/inline/inlineOrder.kt b/js/js.translator/testData/box/inline/inlineOrder.kt index 80ce2ebcf0b..bdc44f61e35 100644 --- a/js/js.translator/testData/box/inline/inlineOrder.kt +++ b/js/js.translator/testData/box/inline/inlineOrder.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1284 package foo -// CHECK_FUNCTIONS_HAVE_SAME_LINES: declaredBefore declaredAfter match=(h|g)1 replace=$1 +// CHECK_FUNCTIONS_HAVE_SAME_LINES: declaredBefore declaredAfter match=(h|g)1 replace=$1 TARGET_BACKENDS=JS fun declaredBefore(): Int { val a = g() + h() diff --git a/js/js.translator/testData/box/inline/invokeOnField.kt b/js/js.translator/testData/box/inline/invokeOnField.kt index 535bda77480..c4c6bf3c8e7 100644 --- a/js/js.translator/testData/box/inline/invokeOnField.kt +++ b/js/js.translator/testData/box/inline/invokeOnField.kt @@ -1,6 +1,6 @@ // EXPECTED_REACHABLE_NODES: 1375 -// CHECK_CONTAINS_NO_CALLS: testDispatch -// CHECK_CONTAINS_NO_CALLS: testExtension +// CHECK_CONTAINS_NO_CALLS: testDispatch except=Unit_getInstance +// CHECK_CONTAINS_NO_CALLS: testExtension except=Unit_getInstance class Bar { inline operator fun invoke(f: () -> String) { f() } } diff --git a/js/js.translator/testData/box/inline/jsCode.kt b/js/js.translator/testData/box/inline/jsCode.kt index 1288a6f4960..3934fabf3fa 100644 --- a/js/js.translator/testData/box/inline/jsCode.kt +++ b/js/js.translator/testData/box/inline/jsCode.kt @@ -1,7 +1,9 @@ // EXPECTED_REACHABLE_NODES: 1283 package foo -// CHECK_CONTAINS_NO_CALLS: test +// In the IR backend the injected JS code is outlined. +// CHECK_CONTAINS_NO_CALLS: test TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=sum scope=test internal inline fun sum(x: Int, y: Int): Int = js("x + y") diff --git a/js/js.translator/testData/box/inline/jsCodeVarDeclared.kt b/js/js.translator/testData/box/inline/jsCodeVarDeclared.kt index f01e5e69c1b..febe2cc3f74 100644 --- a/js/js.translator/testData/box/inline/jsCodeVarDeclared.kt +++ b/js/js.translator/testData/box/inline/jsCodeVarDeclared.kt @@ -1,7 +1,9 @@ // EXPECTED_REACHABLE_NODES: 1283 package foo -// CHECK_CONTAINS_NO_CALLS: test +// In the IR backend the injected JS code is outlined. +// CHECK_CONTAINS_NO_CALLS: test TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=sum scope=test internal inline fun sum(x: Int, y: Int): Int = js("var a = x; a + y") diff --git a/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt b/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt index a63c9ce3046..5ed95807161 100644 --- a/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt +++ b/js/js.translator/testData/box/inline/localInlineExtensionFunction.kt @@ -1,8 +1,8 @@ // EXPECTED_REACHABLE_NODES: 1292 package foo -// CHECK_CONTAINS_NO_CALLS: capturedInLambda -// CHECK_CONTAINS_NO_CALLS: declaredInLambda +// CHECK_CONTAINS_NO_CALLS: capturedInLambda except=Unit_getInstance +// CHECK_CONTAINS_NO_CALLS: declaredInLambda except=Unit_getInstance internal data class State(var count: Int = 0) diff --git a/js/js.translator/testData/box/inline/localInlineFunction.kt b/js/js.translator/testData/box/inline/localInlineFunction.kt index 46084b94e64..4dbadfea061 100644 --- a/js/js.translator/testData/box/inline/localInlineFunction.kt +++ b/js/js.translator/testData/box/inline/localInlineFunction.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1284 package foo -// CHECK_CONTAINS_NO_CALLS: localWithCapture +// CHECK_CONTAINS_NO_CALLS: localWithCapture except=Unit_getInstance // CHECK_CONTAINS_NO_CALLS: localWithoutCapture internal inline fun repeatAction(times: Int, action: () -> Unit) { diff --git a/js/js.translator/testData/box/inline/localInlineFunctionComplex.kt b/js/js.translator/testData/box/inline/localInlineFunctionComplex.kt index fd941898363..8ea5dd24f49 100644 --- a/js/js.translator/testData/box/inline/localInlineFunctionComplex.kt +++ b/js/js.translator/testData/box/inline/localInlineFunctionComplex.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1291 package foo -// CHECK_CONTAINS_NO_CALLS: add +// CHECK_CONTAINS_NO_CALLS: addToState internal data class State(var count: Int = 0) @@ -11,7 +11,7 @@ internal inline fun repeatAction(times: Int, action: () -> Unit) { } } -internal fun add(state: State, a: Int, b: Int): Int { +internal fun addToState(state: State, a: Int, b: Int): Int { inline fun inc(a: Int): Int { return a + 1 } @@ -38,7 +38,7 @@ internal fun add(state: State, a: Int, b: Int): Int { } fun box(): String { - assertEquals(20, add(State(), 4, 5)) + assertEquals(20, addToState(State(), 4, 5)) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/box/inline/localInlineFunctionDeclaredInLambda.kt b/js/js.translator/testData/box/inline/localInlineFunctionDeclaredInLambda.kt index 821eb5021e7..70688bf651b 100644 --- a/js/js.translator/testData/box/inline/localInlineFunctionDeclaredInLambda.kt +++ b/js/js.translator/testData/box/inline/localInlineFunctionDeclaredInLambda.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1284 package foo -// CHECK_CONTAINS_NO_CALLS: localWithCapture +// CHECK_CONTAINS_NO_CALLS: localWithCapture except=Unit_getInstance // CHECK_CONTAINS_NO_CALLS: localWithoutCapture internal inline fun repeatAction(times: Int, action: () -> Unit) { diff --git a/js/js.translator/testData/box/inline/localInlineFunctionNameClash.kt b/js/js.translator/testData/box/inline/localInlineFunctionNameClash.kt index 301918a5af5..261334a0014 100644 --- a/js/js.translator/testData/box/inline/localInlineFunctionNameClash.kt +++ b/js/js.translator/testData/box/inline/localInlineFunctionNameClash.kt @@ -1,13 +1,13 @@ // EXPECTED_REACHABLE_NODES: 1283 package foo -// CHECK_CONTAINS_NO_CALLS: add +// CHECK_CONTAINS_NO_CALLS: myAdd internal inline fun run(action: () -> Int): Int { return action() } -internal fun add(a: Int, b: Int): Int { +internal fun myAdd(a: Int, b: Int): Int { var sum = a + b inline fun getSum(): Int { @@ -25,7 +25,7 @@ internal fun add(a: Int, b: Int): Int { } fun box(): String { - assertEquals(3, add(1, 2)) + assertEquals(3, myAdd(1, 2)) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/box/inline/metadataForPublicFunction.kt b/js/js.translator/testData/box/inline/metadataForPublicFunction.kt index 02360d4b464..fad21ca4d09 100644 --- a/js/js.translator/testData/box/inline/metadataForPublicFunction.kt +++ b/js/js.translator/testData/box/inline/metadataForPublicFunction.kt @@ -4,13 +4,14 @@ package foo // CHECK_CONTAINS_NO_CALLS: test1 except=imul // CHECK_CONTAINS_NO_CALLS: test2 except=imul // CHECK_CONTAINS_NO_CALLS: test3 except=imul -// CHECK_CONTAINS_NO_CALLS: test4_buocd8$ except=imul -// CHECK_CONTAINS_NO_CALLS: test5 except=imul -// CHECK_HAS_INLINE_METADATA: apply -// CHECK_HAS_INLINE_METADATA: applyL_h43q6c$ -// CHECK_HAS_INLINE_METADATA: applyM_h43q6c$ -// CHECK_HAS_INLINE_METADATA: applyN_h43q6c$ -// CHECK_HAS_NO_INLINE_METADATA: applyO_h43q6c$ +// CHECK_CONTAINS_NO_CALLS: test4_buocd8$ except=imul TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: test4_o4gm63_k$ except=imul IGNORED_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: test5 except=imul;OInner_getInstance +// CHECK_HAS_INLINE_METADATA: apply TARGET_BACKENDS=JS +// CHECK_HAS_INLINE_METADATA: applyL_h43q6c$ TARGET_BACKENDS=JS +// CHECK_HAS_INLINE_METADATA: applyM_h43q6c$ TARGET_BACKENDS=JS +// CHECK_HAS_INLINE_METADATA: applyN_h43q6c$ TARGET_BACKENDS=JS +// CHECK_HAS_NO_INLINE_METADATA: applyO_h43q6c$ TARGET_BACKENDS=JS inline public fun apply(arg: T, func: (T)->T): T = func(arg) diff --git a/js/js.translator/testData/box/inline/operators.kt b/js/js.translator/testData/box/inline/operators.kt index 768b5d523f5..a843a3ec6ad 100644 --- a/js/js.translator/testData/box/inline/operators.kt +++ b/js/js.translator/testData/box/inline/operators.kt @@ -1,12 +1,44 @@ // EXPECTED_REACHABLE_NODES: 1301 -// CHECK_NOT_CALLED_IN_SCOPE: function=plus_za3lpa$ scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=plus scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=invoke scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=get_za3lpa$ scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_vux9f0$ scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=dec scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=minus_za3lpa$ scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=invoke_dqglrj$ scope=test + +// CHECK_FUNCTION_EXISTS: plus_za3lpa$ TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus_za3lpa$ scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: plus_ha5a7z_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus_ha5a7z_k$ scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: plus TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: plus_0 IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus_0 scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: invoke TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=invoke scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: invoke_0_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=invoke_0_k$ scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: get_za3lpa$ TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_za3lpa$ scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: get_ha5a7z_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_ha5a7z_k$ scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: set_vux9f0$ TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_vux9f0$ scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_rvwcgf_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_rvwcgf_k$ scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: dec TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=dec scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: dec_0_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=dec_0_k$ scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: minus_za3lpa$ TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=minus_za3lpa$ scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: minus_ha5a7z_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=minus_ha5a7z_k$ scope=box IGNORED_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: invoke_dqglrj$ TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=invoke_dqglrj$ scope=test TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: invoke_tg9lle_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=invoke_tg9lle_k$ scope=test_0_k$ IGNORED_BACKENDS=JS class A { inline operator fun plus(a: Int) = a + 10 diff --git a/js/js.translator/testData/box/inline/privateProperty.kt b/js/js.translator/testData/box/inline/privateProperty.kt index d3765e1efea..802e4f9ea45 100644 --- a/js/js.translator/testData/box/inline/privateProperty.kt +++ b/js/js.translator/testData/box/inline/privateProperty.kt @@ -3,64 +3,100 @@ package test var a = 0 -// CHECK_NOT_CALLED_IN_SCOPE: function=get_p1 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p1 scope=box +// CHECK_FUNCTION_EXISTS: get_p1 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_p1 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p1 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p1 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _get_p1_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_get_p1_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p1_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p1_ scope=box IGNORED_BACKENDS=JS private inline var p1: Int get() = a + 10000 set(v) { a = v + 100 } -// CHECK_NOT_CALLED_IN_SCOPE: function=get_p2 scope=box -// CHECK_CALLED_IN_SCOPE: function=set_p2 scope=box +// CHECK_FUNCTION_EXISTS: get_p2 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_p2 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=set_p2 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _get_p2_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_get_p2_ scope=box IGNORED_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_set_p2_ scope=box IGNORED_BACKENDS=JS private var p2: Int inline get() = a + 20000 set(v) { a = v + 200 } -// CHECK_CALLED_IN_SCOPE: function=get_p3 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p3 scope=box +// CHECK_CALLED_IN_SCOPE: function=get_p3 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p3 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p3 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_get_p3_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p3_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p3_ scope=box IGNORED_BACKENDS=JS var p3: Int get() = a + 30000 private inline set(v) { a = v + 300 } -// CHECK_CALLED_IN_SCOPE: function=get_p4 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p4 scope=box +// CHECK_CALLED_IN_SCOPE: function=get_p4 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p4 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p4 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_get_p4_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p4_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p4_ scope=box IGNORED_BACKENDS=JS private var p4: Int get() = a + 40000 inline set(v) { a = v + 400 } -// CHECK_NOT_CALLED_IN_SCOPE: function=get_p5 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p5 scope=box +// CHECK_FUNCTION_EXISTS: get_p5 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_p5 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p5 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p5 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _get_p5_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_get_p5_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p5_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p5_ scope=box IGNORED_BACKENDS=JS private inline var Int.p5: Int get() = this * 100 + a + 50000 set(v) { a = this + v + 500 } -// CHECK_NOT_CALLED_IN_SCOPE: function=get_p6 scope=box -// CHECK_CALLED_IN_SCOPE: function=set_p6 scope=box +// CHECK_FUNCTION_EXISTS: get_p6 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_p6 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=set_p6 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _get_p6_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_get_p6_ scope=box IGNORED_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_set_p6_ scope=box IGNORED_BACKENDS=JS private var Int.p6: Int inline get() = this * 100 + a + 60000 set(v) { a = this + v + 600 } -// CHECK_CALLED_IN_SCOPE: function=get_p7 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p7 scope=box +// CHECK_CALLED_IN_SCOPE: function=get_p7 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p7 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p7 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_get_p7_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p7_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p7_ scope=box IGNORED_BACKENDS=JS var Int.p7: Int get() = this * 100 + a + 70000 private inline set(v) { a = this + v + 700 } -// CHECK_CALLED_IN_SCOPE: function=get_p8 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p8 scope=box +// CHECK_CALLED_IN_SCOPE: function=get_p8 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p8 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p8 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_get_p8_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p8_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p8_ scope=box IGNORED_BACKENDS=JS private var Int.p8: Int get() = this * 100 + a + 80000 inline set(v) { @@ -90,24 +126,38 @@ private class A { a = v + 1100 } - // CHECK_NOT_CALLED_IN_SCOPE: function=get_p12_s8ev3n$ scope=box - // CHECK_NOT_CALLED_IN_SCOPE: function=set_p12_dqglrj$ scope=box + // CHECK_FUNCTION_EXISTS: get_p12_s8ev3n$ TARGET_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=get_p12_s8ev3n$ scope=box TARGET_BACKENDS=JS + // CHECK_FUNCTION_EXISTS: set_p12_dqglrj$ TARGET_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=set_p12_dqglrj$ scope=box TARGET_BACKENDS=JS + // CHECK_FUNCTION_EXISTS: _get_p12__quadv7_k$ IGNORED_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=_get_p12__quadv7_k$ scope=box IGNORED_BACKENDS=JS + // CHECK_FUNCTION_EXISTS: _set_p12__e5dl2b_k$ IGNORED_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=_set_p12__e5dl2b_k$ scope=box IGNORED_BACKENDS=JS inline var Int.p12: Int get() = this * 100 + a + 120000 set(v) { a = this + v + 1200 } - // CHECK_NOT_CALLED_IN_SCOPE: function=get_p13_s8ev3n$ scope=box - // CHECK_CALLED_IN_SCOPE: function=set_p13_dqglrj$ scope=box + // CHECK_FUNCTION_EXISTS: get_p13_s8ev3n$ TARGET_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=get_p13_s8ev3n$ scope=box TARGET_BACKENDS=JS + // CHECK_CALLED_IN_SCOPE: function=set_p13_dqglrj$ scope=box TARGET_BACKENDS=JS + // CHECK_FUNCTION_EXISTS: _get_p13__quadv7_k$ IGNORED_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=_get_p13__quadv7_k$ scope=box IGNORED_BACKENDS=JS + // CHECK_CALLED_IN_SCOPE: function=_set_p13__e5dl2b_k$ scope=box IGNORED_BACKENDS=JS var Int.p13: Int inline get() = this * 100 + a + 130000 set(v) { a = this + v + 1300 } - // CHECK_CALLED_IN_SCOPE: function=get_p14_s8ev3n$ scope=box - // CHECK_NOT_CALLED_IN_SCOPE: function=set_p14_dqglrj$ scope=box + // CHECK_CALLED_IN_SCOPE: function=get_p14_s8ev3n$ scope=box TARGET_BACKENDS=JS + // CHECK_FUNCTION_EXISTS: set_p14_dqglrj$ TARGET_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=set_p14_dqglrj$ scope=box TARGET_BACKENDS=JS + // CHECK_CALLED_IN_SCOPE: function=_get_p14__quadv7_k$ scope=box IGNORED_BACKENDS=JS + // CHECK_FUNCTION_EXISTS: _set_p14__e5dl2b_k$ IGNORED_BACKENDS=JS + // CHECK_NOT_CALLED_IN_SCOPE: function=_set_p14__e5dl2b_k$ scope=box IGNORED_BACKENDS=JS var Int.p14: Int get() = this * 100 + a + 140000 inline set(v) { @@ -115,25 +165,38 @@ private class A { } } - -// CHECK_NOT_CALLED_IN_SCOPE: function=get_p15 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p15 scope=box +// CHECK_FUNCTION_EXISTS: get_p15 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_p15 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p15 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p15 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _get_p15_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_get_p15_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p15_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p15_ scope=box IGNORED_BACKENDS=JS private inline var A.p15: Int get() = a + 150000 set(v) { a = v + 1500 } -// CHECK_NOT_CALLED_IN_SCOPE: function=get_p16 scope=box -// CHECK_CALLED_IN_SCOPE: function=set_p16 scope=box +// CHECK_FUNCTION_EXISTS: get_p16 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=get_p16 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=set_p16 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _get_p16_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_get_p16_ scope=box IGNORED_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_set_p16_ scope=box IGNORED_BACKENDS=JS private var A.p16: Int inline get() = a + 160000 set(v) { a = v + 1600 } -// CHECK_CALLED_IN_SCOPE: function=get_p17 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=set_p17 scope=box +// CHECK_CALLED_IN_SCOPE: function=get_p17 scope=box TARGET_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: set_p17 TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=set_p17 scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=_get_p17_ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: _set_p17_ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=_set_p17_ scope=box IGNORED_BACKENDS=JS private var A.p17: Int get() = a + 170000 inline set(v) { diff --git a/js/js.translator/testData/box/inlineEvaluationOrder/argumentOfInlineCall.kt b/js/js.translator/testData/box/inlineEvaluationOrder/argumentOfInlineCall.kt index 90954d8922b..77668a1bd8d 100644 --- a/js/js.translator/testData/box/inlineEvaluationOrder/argumentOfInlineCall.kt +++ b/js/js.translator/testData/box/inlineEvaluationOrder/argumentOfInlineCall.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1286 package foo -// CHECK_NOT_CALLED: max +// CHECK_NOT_CALLED_IN_SCOPE: function=max scope=box inline fun max(a: Int, b: Int): Int { log("max($a, $b)") diff --git a/js/js.translator/testData/box/inlineMultiFile/trait.kt b/js/js.translator/testData/box/inlineMultiFile/trait.kt index fdb39e67604..cf3a9e5c18a 100644 --- a/js/js.translator/testData/box/inlineMultiFile/trait.kt +++ b/js/js.translator/testData/box/inlineMultiFile/trait.kt @@ -9,7 +9,7 @@ package foo import test.* -// CHECK_CONTAINS_NO_CALLS: testClassObject +// CHECK_CONTAINS_NO_CALLS: testClassObject except=Companion_getInstance_18 internal fun testFinalInline(): String { return Z().finalInline({"final"}) diff --git a/js/js.translator/testData/box/inlineMultiModule/callFunction.kt b/js/js.translator/testData/box/inlineMultiModule/callFunction.kt index bd50b432bd7..3afe622c5c3 100644 --- a/js/js.translator/testData/box/inlineMultiModule/callFunction.kt +++ b/js/js.translator/testData/box/inlineMultiModule/callFunction.kt @@ -22,7 +22,7 @@ inline fun Baz.call(a: Int) = "Baz.call($a)" // MODULE: main(lib) // FILE: main.kt -// CHECK_CONTAINS_NO_CALLS: box except=equals +// CHECK_CONTAINS_NO_CALLS: box except=equals TARGET_BACKENDS=JS fun box(): String { var result = call(1) diff --git a/js/js.translator/testData/box/inlineMultiModule/callableReference.kt b/js/js.translator/testData/box/inlineMultiModule/callableReference.kt index 879ff5794c1..39f8ae914db 100644 --- a/js/js.translator/testData/box/inlineMultiModule/callableReference.kt +++ b/js/js.translator/testData/box/inlineMultiModule/callableReference.kt @@ -13,7 +13,10 @@ public fun apply(x: T, fn: (T)->R): R = import utils.* -// CHECK_CONTAINS_NO_CALLS: test except=imul +// CHECK_CONTAINS_NO_CALLS: test except=imul TARGET_BACKENDS=JS + +// FIXME: Not inlined on IR BE +// CHECK_CONTAINS_NO_CALLS: test except=multiplyBy2 IGNORED_BACKENDS=JS internal inline fun multiplyBy2(x: Int): Int = x * 2 @@ -23,4 +26,4 @@ fun box(): String { assertEquals(6, test(3)) return "OK" -} \ No newline at end of file +} diff --git a/js/js.translator/testData/box/inlineMultiModule/importObjectInstance.kt b/js/js.translator/testData/box/inlineMultiModule/importObjectInstance.kt index ccb877d5c55..df602fb156d 100644 --- a/js/js.translator/testData/box/inlineMultiModule/importObjectInstance.kt +++ b/js/js.translator/testData/box/inlineMultiModule/importObjectInstance.kt @@ -10,6 +10,7 @@ inline fun foo() = O.bar() // MODULE: main(lib) // FILE: main.kt -// CHECK_CONTAINS_NO_CALLS: box except=bar +// CHECK_CONTAINS_NO_CALLS: box except=bar TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: box except=bar_0_k$;O_getInstance; IGNORED_BACKENDS=JS -fun box() = foo() \ No newline at end of file +fun box() = foo() diff --git a/js/js.translator/testData/box/inlineMultiModule/kt16144.kt b/js/js.translator/testData/box/inlineMultiModule/kt16144.kt index 309c31e2ee1..50e89bf5e7c 100644 --- a/js/js.translator/testData/box/inlineMultiModule/kt16144.kt +++ b/js/js.translator/testData/box/inlineMultiModule/kt16144.kt @@ -28,7 +28,7 @@ class M1 : M2(), M3 // MODULE: main(m1, m2, m3) // FILE: main.kt -// CHECK_CONTAINS_NO_CALLS: box except=equals;getKClass +// CHECK_CONTAINS_NO_CALLS: box except=equals;getKClass TARGET_BACKENDS=JS fun box(): String { if (M1().foo() != 1) return "fail" diff --git a/js/js.translator/testData/box/inlineMultiModule/kt16160.kt b/js/js.translator/testData/box/inlineMultiModule/kt16160.kt index 18ebf172472..7feb69f4861 100644 --- a/js/js.translator/testData/box/inlineMultiModule/kt16160.kt +++ b/js/js.translator/testData/box/inlineMultiModule/kt16160.kt @@ -2,7 +2,7 @@ // MODULE: main(module2) // FILE: main.kt -// CHECK_CONTAINS_NO_CALLS: box except=foo;bar;toString +// CHECK_CONTAINS_NO_CALLS: box except=foo;bar;toString TARGET_BACKENDS=JS import A.test diff --git a/js/js.translator/testData/box/inlineMultiModule/operators.kt b/js/js.translator/testData/box/inlineMultiModule/operators.kt index b8d3fa3cb64..143a0ad8b5a 100644 --- a/js/js.translator/testData/box/inlineMultiModule/operators.kt +++ b/js/js.translator/testData/box/inlineMultiModule/operators.kt @@ -13,8 +13,13 @@ inline operator fun B.plus(b: Int) = b + 20 // MODULE: main(lib) // FILE: main.kt -// CHECK_NOT_CALLED_IN_SCOPE: function=plus_za3lpa$ scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=plus scope=box +// CHECK_NOT_CALLED_IN_SCOPE: function=plus_za3lpa$ scope=box TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus scope=box TARGET_BACKENDS=JS + +// CHECK_FUNCTION_EXISTS: plus_ha5a7z_k$ IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus_ha5a7z_k$ scope=box IGNORED_BACKENDS=JS +// CHECK_FUNCTION_EXISTS: plus_0 IGNORED_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=plus_0 scope=box IGNORED_BACKENDS=JS fun box(): String { var result = A() + 1 diff --git a/js/js.translator/testData/box/inlineMultiModule/property.kt b/js/js.translator/testData/box/inlineMultiModule/property.kt index c603579b640..02b2d4d20a8 100644 --- a/js/js.translator/testData/box/inlineMultiModule/property.kt +++ b/js/js.translator/testData/box/inlineMultiModule/property.kt @@ -100,8 +100,8 @@ var A.p15: Int // MODULE: main(lib) // FILE: main.kt -// PROPERTY_NOT_USED: p1 -// PROPERTY_NOT_READ_FROM: p2 +// PROPERTY_NOT_USED: p1 scope=box +// PROPERTY_NOT_READ_FROM: p2 scope=box // PROPERTY_NOT_WRITTEN_TO: p3 // CHECK_NOT_CALLED: imported$get_p4 // CHECK_NOT_CALLED: imported$set_p4 diff --git a/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt b/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt index 8f8bc77c521..cc0f5bd4df8 100644 --- a/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt +++ b/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt @@ -9,7 +9,7 @@ inline fun baz(x: String) = "baz(${foo(x)})" // MODULE: main(lib) // FILE: a.kt -// PROPERTY_READ_COUNT: name=foo_61zpoe$ count=1 +// PROPERTY_READ_COUNT: name=foo_61zpoe$ count=1 TARGET_BACKENDS=JS fun test1() = bar("q") // FILE: b.kt diff --git a/js/js.translator/testData/box/inlineSizeReduction/inlineOrder.kt b/js/js.translator/testData/box/inlineSizeReduction/inlineOrder.kt index ab952b7d638..d219eb924b5 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/inlineOrder.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/inlineOrder.kt @@ -1,11 +1,12 @@ // EXPECTED_REACHABLE_NODES: 1292 package foo -// CHECK_VARS_COUNT: function=test1 count=0 -// CHECK_VARS_COUNT: function=test2 count=0 -// CHECK_VARS_COUNT: function=test3 count=0 -// CHECK_VARS_COUNT: function=test4 count=0 -// CHECK_VARS_COUNT: function=test5 count=2 +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test1 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test2 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test3 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test4 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test5 count=2 TARGET_BACKENDS=JS var global = "" var globalNum = 1 diff --git a/js/js.translator/testData/box/inlineSizeReduction/lastBreak.kt b/js/js.translator/testData/box/inlineSizeReduction/lastBreak.kt index 2067ef27d15..5e91fe245c2 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/lastBreak.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/lastBreak.kt @@ -4,7 +4,8 @@ package foo // CHECK_NOT_CALLED: f1 // CHECK_NOT_CALLED: f2 -// CHECK_BREAKS_COUNT: function=test count=3 +// CHECK_BREAKS_COUNT: function=test count=3 TARGET_BACKENDS=JS +// CHECK_BREAKS_COUNT: function=test_1 count=6 IGNORED_BACKENDS=JS internal var even = arrayListOf() internal var odd = arrayListOf() diff --git a/js/js.translator/testData/box/inlineSizeReduction/multiModuleDefaultArgsCleanup.kt b/js/js.translator/testData/box/inlineSizeReduction/multiModuleDefaultArgsCleanup.kt index 4a3ac014af4..3f6c5d6fef9 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/multiModuleDefaultArgsCleanup.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/multiModuleDefaultArgsCleanup.kt @@ -5,7 +5,9 @@ inline fun foo(x: String = "x", y: String = "y") = x + y // MODULE: main(lib) // FILE: main.kt -// CHECK_VARS_COUNT: function=test count=0 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test count=0 TARGET_BACKENDS=JS fun test() = foo() + ";" + foo(x = "X") + ";" + foo(y = "Y") + ";" + foo(x = "X", y = "Y") diff --git a/js/js.translator/testData/box/inlineSizeReduction/noDuplicateVariableDeclaration.kt b/js/js.translator/testData/box/inlineSizeReduction/noDuplicateVariableDeclaration.kt index 64cd02b08c4..65a19bc83d8 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/noDuplicateVariableDeclaration.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/noDuplicateVariableDeclaration.kt @@ -1,7 +1,8 @@ // EXPECTED_REACHABLE_NODES: 1281 package foo -// CHECK_VARS_COUNT: function=test count=3 +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test count=3 TARGET_BACKENDS=JS inline fun if1(f: (Int) -> Int, a: Int, b: Int, c: Int): Int { val result = f(a) diff --git a/js/js.translator/testData/box/inlineSizeReduction/oneTopLevelReturn.kt b/js/js.translator/testData/box/inlineSizeReduction/oneTopLevelReturn.kt index a2e93d59d79..250f53a855b 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/oneTopLevelReturn.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/oneTopLevelReturn.kt @@ -3,8 +3,10 @@ package foo // CHECK_CONTAINS_NO_CALLS: test1 // CHECK_CONTAINS_NO_CALLS: test2 -// CHECK_VARS_COUNT: function=test1 count=0 -// CHECK_VARS_COUNT: function=test2 count=1 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test1 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test2 count=1 TARGET_BACKENDS=JS var log = "" diff --git a/js/js.translator/testData/box/inlineSizeReduction/propertyReassignment.kt b/js/js.translator/testData/box/inlineSizeReduction/propertyReassignment.kt index 8e7be543945..77a28e68d42 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/propertyReassignment.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/propertyReassignment.kt @@ -1,7 +1,9 @@ // EXPECTED_REACHABLE_NODES: 1289 -// CHECK_VARS_COUNT: function=test1 count=0 -// CHECK_VARS_COUNT: function=test2 count=1 -// CHECK_VARS_COUNT: function=test3 count=0 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test1 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test2 count=1 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test3 count=0 TARGET_BACKENDS=JS class A { var result = 1 diff --git a/js/js.translator/testData/box/inlineSizeReduction/propertyReferenceDoesNotProduceSideEffect.kt b/js/js.translator/testData/box/inlineSizeReduction/propertyReferenceDoesNotProduceSideEffect.kt index da4a4163942..b5102a7958a 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/propertyReferenceDoesNotProduceSideEffect.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/propertyReferenceDoesNotProduceSideEffect.kt @@ -1,5 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1287 -// CHECK_VARS_COUNT: function=box count=1 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=box count=1 TARGET_BACKENDS=JS package foo diff --git a/js/js.translator/testData/box/inlineSizeReduction/simpleReturnFunction.kt b/js/js.translator/testData/box/inlineSizeReduction/simpleReturnFunction.kt index 83f120bc72b..a49722f782f 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/simpleReturnFunction.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/simpleReturnFunction.kt @@ -2,7 +2,9 @@ package foo // CHECK_CONTAINS_NO_CALLS: test except=imul -// CHECK_VARS_COUNT: function=test count=0 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test count=0 TARGET_BACKENDS=JS // A copy of stdlib run function. // Copied to not to depend on run implementation. diff --git a/js/js.translator/testData/box/inlineSizeReduction/ternaryConditional.kt b/js/js.translator/testData/box/inlineSizeReduction/ternaryConditional.kt index 5d157c99de5..a9b19b48621 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/ternaryConditional.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/ternaryConditional.kt @@ -1,9 +1,10 @@ // EXPECTED_REACHABLE_NODES: 1288 package foo -// CHECK_VARS_COUNT: function=test1 count=0 -// CHECK_VARS_COUNT: function=test2 count=1 -// CHECK_VARS_COUNT: function=test3 count=0 +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test1 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test2 count=1 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test3 count=0 TARGET_BACKENDS=JS inline fun a(x: Int) = b(x) diff --git a/js/js.translator/testData/box/inlineSizeReduction/this.kt b/js/js.translator/testData/box/inlineSizeReduction/this.kt index dc3c6617899..d0d49e9b713 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/this.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/this.kt @@ -2,7 +2,9 @@ package foo // CHECK_CONTAINS_NO_CALLS: test -// CHECK_VARS_COUNT: function=test count=0 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test count=0 TARGET_BACKENDS=JS internal class A(val x: Int) { inline fun f(): Int = x diff --git a/js/js.translator/testData/box/inlineSizeReduction/varargTemporaryVar.kt b/js/js.translator/testData/box/inlineSizeReduction/varargTemporaryVar.kt index cc90f28ff18..32fd3d05f01 100644 --- a/js/js.translator/testData/box/inlineSizeReduction/varargTemporaryVar.kt +++ b/js/js.translator/testData/box/inlineSizeReduction/varargTemporaryVar.kt @@ -1,7 +1,9 @@ // EXPECTED_REACHABLE_NODES: 1283 -// CHECK_VARS_COUNT: function=test1 count=0 -// CHECK_VARS_COUNT: function=test2 count=0 -// CHECK_VARS_COUNT: function=test3 count=1 + +// FIXME: The IR backend generates a lot of redundant vars +// CHECK_VARS_COUNT: function=test1 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test2 count=0 TARGET_BACKENDS=JS +// CHECK_VARS_COUNT: function=test3 count=1 TARGET_BACKENDS=JS inline fun foo(vararg x: String) = x.size diff --git a/js/js.translator/testData/box/inlineStdlib/closureNested.kt b/js/js.translator/testData/box/inlineStdlib/closureNested.kt index d4f87ef7e2c..284602a0f49 100644 --- a/js/js.translator/testData/box/inlineStdlib/closureNested.kt +++ b/js/js.translator/testData/box/inlineStdlib/closureNested.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1283 package foo -// CHECK_CONTAINS_NO_CALLS: test +// CHECK_CONTAINS_NO_CALLS: test except=Unit_getInstance internal fun test(a: Int, b: Int): Int { var res = 0 diff --git a/js/js.translator/testData/box/inlineStdlib/thisInExtension.kt b/js/js.translator/testData/box/inlineStdlib/thisInExtension.kt index 18b68d948ec..1929e878640 100644 --- a/js/js.translator/testData/box/inlineStdlib/thisInExtension.kt +++ b/js/js.translator/testData/box/inlineStdlib/thisInExtension.kt @@ -1,8 +1,8 @@ // EXPECTED_REACHABLE_NODES: 1286 package foo -// CHECK_CONTAINS_NO_CALLS: testImplicitThis -// CHECK_CONTAINS_NO_CALLS: testExplicitThis +// CHECK_CONTAINS_NO_CALLS: testImplicitThis except=Unit_getInstance +// CHECK_CONTAINS_NO_CALLS: testExplicitThis except=Unit_getInstance internal class A(var value: Int) diff --git a/js/js.translator/testData/box/jsModule/importCountCommonJS.kt b/js/js.translator/testData/box/jsModule/importCountCommonJS.kt index 34a9aa15b54..c1307910de9 100644 --- a/js/js.translator/testData/box/jsModule/importCountCommonJS.kt +++ b/js/js.translator/testData/box/jsModule/importCountCommonJS.kt @@ -1,6 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1283 // MODULE_KIND: COMMON_JS -// FUNCTION_CALLED_TIMES: require count=2 +// FUNCTION_CALLED_TIMES: require count=2 TARGET_BACKENDS=JS +// FUNCTION_CALLED_TIMES: require count=3 IGNORED_BACKENDS=JS @JsModule("lib") external fun f(x: Int): String diff --git a/js/js.translator/testData/box/jsModule/importCountUmd.kt b/js/js.translator/testData/box/jsModule/importCountUmd.kt index ac6642ce5b3..a535b36c594 100644 --- a/js/js.translator/testData/box/jsModule/importCountUmd.kt +++ b/js/js.translator/testData/box/jsModule/importCountUmd.kt @@ -1,7 +1,8 @@ // EXPECTED_REACHABLE_NODES: 1285 // MODULE_KIND: UMD // NO_JS_MODULE_SYSTEM -// FUNCTION_CALLED_TIMES: require count=3 +// FUNCTION_CALLED_TIMES: require count=3 TARGET_BACKENDS=JS +// FUNCTION_CALLED_TIMES: require count=2 IGNORED_BACKENDS=JS @JsModule("lib") @JsNonModule diff --git a/js/js.translator/testData/box/labels/labelOnExpression.kt b/js/js.translator/testData/box/labels/labelOnExpression.kt index 9e5242efced..d3ac9bd10f9 100644 --- a/js/js.translator/testData/box/labels/labelOnExpression.kt +++ b/js/js.translator/testData/box/labels/labelOnExpression.kt @@ -1,8 +1,8 @@ // EXPECTED_REACHABLE_NODES: 1292 // CHECK_LABELS_COUNT: function=test0 count=0 -// CHECK_LABELS_COUNT: function=test1 count=0 +// CHECK_LABELS_COUNT: function=test1 count=0 TARGET_BACKENDS=JS // CHECK_LABELS_COUNT: function=test2 count=0 -// CHECK_LABELS_COUNT: function=test3 count=0 +// CHECK_LABELS_COUNT: function=test3 count=0 TARGET_BACKENDS=JS package foo diff --git a/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt b/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt index cfec2c4e3d1..d42b261d044 100644 --- a/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt +++ b/js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt @@ -1,7 +1,7 @@ // EXPECTED_REACHABLE_NODES: 1285 package foo -// CHECK_CONTAINS_NO_CALLS: test +// CHECK_CONTAINS_NO_CALLS: test except=Unit_getInstance // CHECK_LABELS_COUNT: function=test name=loop count=1 // CHECK_LABELS_COUNT: function=test name=loop_0 count=1 // CHECK_LABELS_COUNT: function=test name=loop_1 count=1 diff --git a/js/js.translator/testData/box/labels/siblingLabels.kt b/js/js.translator/testData/box/labels/siblingLabels.kt index 04d588ae842..11587743974 100644 --- a/js/js.translator/testData/box/labels/siblingLabels.kt +++ b/js/js.translator/testData/box/labels/siblingLabels.kt @@ -1,7 +1,9 @@ // EXPECTED_REACHABLE_NODES: 1283 package foo -// CHECK_LABELS_COUNT: function=test name=loop count=2 +// CHECK_LABELS_COUNT: function=test name=loop count=2 TARGET_BACKENDS=JS +// CHECK_LABELS_COUNT: function=test name=loop count=1 IGNORED_BACKENDS=JS +// CHECK_LABELS_COUNT: function=test name=loop_0 count=1 IGNORED_BACKENDS=JS fun test() { var i = 0 diff --git a/js/js.translator/testData/box/labels/siblingLabelsInlined.kt b/js/js.translator/testData/box/labels/siblingLabelsInlined.kt index 4eec6c406cd..8ad49356ba4 100644 --- a/js/js.translator/testData/box/labels/siblingLabelsInlined.kt +++ b/js/js.translator/testData/box/labels/siblingLabelsInlined.kt @@ -2,7 +2,9 @@ package foo // CHECK_NOT_CALLED: testInline -// CHECK_LABELS_COUNT: function=testNoinline name=loop count=2 +// CHECK_LABELS_COUNT: function=testNoinline name=loop count=2 TARGET_BACKENDS=JS +// CHECK_LABELS_COUNT: function=testNoinline name=loop count=1 IGNORED_BACKENDS=JS +// CHECK_LABELS_COUNT: function=testNoinline name=loop_0 count=1 IGNORED_BACKENDS=JS inline fun testInline(): Int { var c = 0 diff --git a/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt b/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt index f1bf8fb91f7..0d117b15397 100644 --- a/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt +++ b/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt @@ -3,7 +3,9 @@ package foo // CHECK_NOT_CALLED: testLabelInline // CHECK_LABELS_COUNT: function=testLabel name=loop count=1 -// CHECK_LABELS_COUNT: function=testLabel name=loop_0 count=2 +// CHECK_LABELS_COUNT: function=testLabel name=loop_0 count=2 TARGET_BACKENDS=JS +// CHECK_LABELS_COUNT: function=testLabel name=loop_0 count=1 IGNORED_BACKENDS=JS +// CHECK_LABELS_COUNT: function=testLabel name=loop_1 count=1 IGNORED_BACKENDS=JS inline fun testLabelInline(): Int { var a = 0 diff --git a/js/js.translator/testData/box/multiModule/publishedApiMangling.kt b/js/js.translator/testData/box/multiModule/publishedApiMangling.kt index 784247dfe81..3377fa174fa 100644 --- a/js/js.translator/testData/box/multiModule/publishedApiMangling.kt +++ b/js/js.translator/testData/box/multiModule/publishedApiMangling.kt @@ -1,8 +1,9 @@ // KJS_WITH_FULL_RUNTIME // EXPECTED_REACHABLE_NODES: 1280 -// PROPERTY_WRITE_COUNT: name=publishedTopLevel_61zpoe$ count=1 -// PROPERTY_WRITE_COUNT: name=published_61zpoe$ count=1 -// PROPERTY_WRITE_COUNT: name=B count=1 +// PROPERTY_WRITE_COUNT: name=publishedTopLevel_61zpoe$ count=1 TARGET_BACKENDS=JS +// PROPERTY_WRITE_COUNT: name=published_61zpoe$ count=1 TARGET_BACKENDS=JS +// PROPERTY_WRITE_COUNT: name=published_6wfw3l_k$ count=1 IGNORED_BACKENDS=JS +// PROPERTY_WRITE_COUNT: name=B count=1 TARGET_BACKENDS=JS class A { @PublishedApi internal fun published(x: String) = "${x}K" @@ -20,4 +21,4 @@ internal class B(val x: String) : I { override fun test() = x + "K" } -fun box(): String = "OK" \ No newline at end of file +fun box(): String = "OK" diff --git a/js/js.translator/testData/box/multiModuleWrappers/common_js/inlineFromModuleWithNonIdentifierName.kt b/js/js.translator/testData/box/multiModuleWrappers/common_js/inlineFromModuleWithNonIdentifierName.kt index fc62afbc76a..d4b29dae2ef 100644 --- a/js/js.translator/testData/box/multiModuleWrappers/common_js/inlineFromModuleWithNonIdentifierName.kt +++ b/js/js.translator/testData/box/multiModuleWrappers/common_js/inlineFromModuleWithNonIdentifierName.kt @@ -14,7 +14,7 @@ inline fun boo() = "boo" // MODULE: main(#my-libr@ry) // FILE: box.kt // MODULE_KIND: COMMON_JS -// CHECK_CONTAINS_NO_CALLS: box except=assertEquals +// CHECK_CONTAINS_NO_CALLS: box except=assertEquals;assertEquals$default fun box(): String { assertEquals("foo", foo()) diff --git a/js/js.translator/testData/box/multiModuleWrappers/plain/inlineFromModuleWithNonIdentifierName.kt b/js/js.translator/testData/box/multiModuleWrappers/plain/inlineFromModuleWithNonIdentifierName.kt index e031bc897f0..f503e03b5a3 100644 --- a/js/js.translator/testData/box/multiModuleWrappers/plain/inlineFromModuleWithNonIdentifierName.kt +++ b/js/js.translator/testData/box/multiModuleWrappers/plain/inlineFromModuleWithNonIdentifierName.kt @@ -14,7 +14,8 @@ inline fun boo() = "boo" // MODULE: main(#my-libr@ry) // FILE: box.kt // MODULE_KIND: PLAIN -// CHECK_CONTAINS_NO_CALLS: box except=assertEquals +// CHECK_CONTAINS_NO_CALLS: box except=assertEquals TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: box except=assertEquals$default IGNORED_BACKENDS=JS fun box(): String { assertEquals("foo", foo()) diff --git a/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt b/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt index e375f38649d..8b2f9771150 100644 --- a/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt +++ b/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt @@ -20,8 +20,8 @@ inline fun ok() = A("O").s + A('K').s // TODO add directives for primary constructor invocations -// CHECK_CALLED_IN_SCOPE: function=A_init_0 scope=box -// CHECK_NOT_CALLED_IN_SCOPE: function=A_init scope=box +// CHECK_CALLED_IN_SCOPE: function=A_init_0 scope=box TARGET_BACKENDS=JS +// CHECK_NOT_CALLED_IN_SCOPE: function=A_init scope=box TARGET_BACKENDS=JS fun box(): String { if (A("O").s + A('K').s != "OK") return "fail" diff --git a/js/js.translator/testData/box/number/constantPropagation.kt b/js/js.translator/testData/box/number/constantPropagation.kt index c4dbd54d62a..93b22f01982 100644 --- a/js/js.translator/testData/box/number/constantPropagation.kt +++ b/js/js.translator/testData/box/number/constantPropagation.kt @@ -268,12 +268,12 @@ fun testLib2() { // FILE: main.kt package foo -// PROPERTY_READ_COUNT: name=longConst count=1 scope=testImportedLongConstInlinedFromOtherModule -// PROPERTY_READ_COUNT: name=L42 count=1 scope=testImportedLongConstInlinedFromOtherModule -// PROPERTY_READ_COUNT: name=L_42 count=4 scope=testImportedLongConstInlinedFromOtherModule -// PROPERTY_READ_COUNT: name=L84 count=2 scope=testImportedLongConstInlinedFromOtherModule -// PROPERTY_READ_COUNT: name=bigLongConst count=1 scope=testImportedLongConstInlinedFromOtherModule -// PROPERTY_READ_COUNT: name=L123456789012345 count=1 scope=testImportedLongConstInlinedFromOtherModule +// PROPERTY_READ_COUNT: name=longConst count=1 scope=testImportedLongConstInlinedFromOtherModule TARGET_BACKENDS=JS +// PROPERTY_READ_COUNT: name=L42 count=1 scope=testImportedLongConstInlinedFromOtherModule TARGET_BACKENDS=JS +// PROPERTY_READ_COUNT: name=L_42 count=4 scope=testImportedLongConstInlinedFromOtherModule TARGET_BACKENDS=JS +// PROPERTY_READ_COUNT: name=L84 count=2 scope=testImportedLongConstInlinedFromOtherModule TARGET_BACKENDS=JS +// PROPERTY_READ_COUNT: name=bigLongConst count=1 scope=testImportedLongConstInlinedFromOtherModule TARGET_BACKENDS=JS +// PROPERTY_READ_COUNT: name=L123456789012345 count=1 scope=testImportedLongConstInlinedFromOtherModule TARGET_BACKENDS=JS fun testImportedLongConstInlinedFromOtherModule() { testImportedLongConstInlineFun() } diff --git a/js/js.translator/testData/box/number/incDecOptimization.kt b/js/js.translator/testData/box/number/incDecOptimization.kt index f27224ae373..0c2225c1346 100644 --- a/js/js.translator/testData/box/number/incDecOptimization.kt +++ b/js/js.translator/testData/box/number/incDecOptimization.kt @@ -1,5 +1,5 @@ // EXPECTED_REACHABLE_NODES: 1283 -// CHECK_VARS_COUNT: function=test count=1 +// CHECK_VARS_COUNT: function=test count=1 TARGET_BACKENDS=JS class A { var i = 23 diff --git a/js/js.translator/testData/box/propertyAccess/privatePropertyAccessFromMethod.kt b/js/js.translator/testData/box/propertyAccess/privatePropertyAccessFromMethod.kt index 921bf936801..58ae2265169 100644 --- a/js/js.translator/testData/box/propertyAccess/privatePropertyAccessFromMethod.kt +++ b/js/js.translator/testData/box/propertyAccess/privatePropertyAccessFromMethod.kt @@ -1,5 +1,5 @@ // EXPECTED_REACHABLE_NODES: 1286 -// ONLY_THIS_QUALIFIED_REFERENCES: foo_0 +// ONLY_THIS_QUALIFIED_REFERENCES: foo_0 TARGET_BACKENDS=JS package foo @@ -15,4 +15,4 @@ fun box(): String { var result = A.bar() if (result != 23) return "failed: ${result}" return "OK" -} \ No newline at end of file +} diff --git a/js/js.translator/testData/box/range/numberRangesOptimized.kt b/js/js.translator/testData/box/range/numberRangesOptimized.kt index ac670a9cf4a..7bc1550eb3a 100644 --- a/js/js.translator/testData/box/range/numberRangesOptimized.kt +++ b/js/js.translator/testData/box/range/numberRangesOptimized.kt @@ -2,12 +2,12 @@ // CHECK_CONTAINS_NO_CALLS: inRange // CHECK_CONTAINS_NO_CALLS: inRange2 // CHECK_CONTAINS_NO_CALLS: inRange3 -// CHECK_CONTAINS_NO_CALLS: inRange4 +// CHECK_CONTAINS_NO_CALLS: inRange4 TARGET_BACKENDS=JS -// CHECK_CONTAINS_NO_CALLS: inLongRange except=lessThanOrEqual;lessThan;fromInt -// CHECK_CONTAINS_NO_CALLS: inLongRange2 except=lessThanOrEqual;lessThan;fromInt -// CHECK_CONTAINS_NO_CALLS: inLongRange3 except=lessThanOrEqual;lessThan;fromInt -// CHECK_CONTAINS_NO_CALLS: inLongRange4 except=lessThanOrEqual;lessThan;fromInt +// CHECK_CONTAINS_NO_CALLS: inLongRange except=lessThanOrEqual;lessThan;fromInt TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: inLongRange2 except=lessThanOrEqual;lessThan;fromInt TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: inLongRange3 except=lessThanOrEqual;lessThan;fromInt TARGET_BACKENDS=JS +// CHECK_CONTAINS_NO_CALLS: inLongRange4 except=lessThanOrEqual;lessThan;fromInt TARGET_BACKENDS=JS // CHECK_VARS_COUNT: function=inLongRange count=0 // CHECK_VARS_COUNT: function=inLongRange2 count=0 // CHECK_VARS_COUNT: function=inLongRange3 count=0 diff --git a/js/js.translator/testData/box/reified/isTNullable.kt b/js/js.translator/testData/box/reified/isTNullable.kt index 01183a62e1a..b3532f33f6d 100644 --- a/js/js.translator/testData/box/reified/isTNullable.kt +++ b/js/js.translator/testData/box/reified/isTNullable.kt @@ -2,7 +2,8 @@ package foo // CHECK_NOT_CALLED: isTypeOfOrNull -// CHECK_NULLS_COUNT: function=box count=10 +// CHECK_NULLS_COUNT: function=box count=10 TARGET_BACKENDS=JS +// CHECK_NULLS_COUNT: function=box count=6 IGNORED_BACKENDS=JS inline fun Any?.isTypeOfOrNull() = this is T? diff --git a/js/js.translator/testData/box/reified/vararg.kt b/js/js.translator/testData/box/reified/vararg.kt index 57c9dfe6bcc..fe847244279 100644 --- a/js/js.translator/testData/box/reified/vararg.kt +++ b/js/js.translator/testData/box/reified/vararg.kt @@ -2,7 +2,7 @@ // EXPECTED_REACHABLE_NODES: 1682 package foo -// CHECK_NOT_CALLED: test +// CHECK_NOT_CALLED_IN_SCOPE: function=test scope=box class A(val x: Int) class B(val x: Int) @@ -32,4 +32,4 @@ fun box(): String { assertEquals(listOf(b2, b4), test(a1, a3, *objects, a3, b4), "test(a1, a3, *objects, a3, b4)") return "OK" -} \ No newline at end of file +} diff --git a/js/js.translator/testData/box/reified/withInlineTurnedOff.kt b/js/js.translator/testData/box/reified/withInlineTurnedOff.kt index 44717f69c2f..dcc227c1bd9 100644 --- a/js/js.translator/testData/box/reified/withInlineTurnedOff.kt +++ b/js/js.translator/testData/box/reified/withInlineTurnedOff.kt @@ -2,7 +2,7 @@ package foo // NO_INLINE -// CHECK_CALLED_IN_SCOPE: scope=box function=isInstanceOf +// CHECK_CALLED_IN_SCOPE: scope=box function=isInstanceOf TARGET_BACKENDS=JS class A class B diff --git a/js/js.translator/testData/box/standardClasses/any.kt b/js/js.translator/testData/box/standardClasses/any.kt index 454b3ed5d04..7fb71144b36 100644 --- a/js/js.translator/testData/box/standardClasses/any.kt +++ b/js/js.translator/testData/box/standardClasses/any.kt @@ -1,5 +1,6 @@ // EXPECTED_REACHABLE_NODES: 1285 -// CHECK_CALLED_IN_SCOPE: function=isType scope=box +// CHECK_CALLED_IN_SCOPE: function=isType scope=box TARGET_BACKENDS=JS +// CHECK_CALLED_IN_SCOPE: function=isObject scope=box IGNORED_BACKENDS=JS package foo class A : Any()