Implement inlining of default parameters in JS BE

Fix KT-17910
This commit is contained in:
Alexey Andreev
2017-05-24 19:57:01 +03:00
parent 40bbf82a41
commit 0e31c14a86
24 changed files with 421 additions and 8 deletions
@@ -1,3 +1,6 @@
// There's no String?.plus implementation in JS stdlib
// IGNORE_BACKEND: JS
// FILE: 1.kt
package test
@@ -9,6 +9,7 @@ inline fun inlineFun(crossinline inlineLambda: () -> String = { "OK" }, noinline
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
import test.*
fun box(): String {
@@ -14,6 +14,7 @@ class A(val value: String) {
import test.*
// CHECK_CONTAINS_NO_CALLS: box
fun box(): String {
return A("OK").inlineFun()
}
@@ -1,6 +1,7 @@
// FILE: 1.kt
// LANGUAGE_VERSION: 1.2
// SKIP_INLINE_CHECK_IN: inlineFun$default
// CHECK_CONTAINS_NO_CALLS: test
package test
//problem in test framework
@@ -1,6 +1,7 @@
// FILE: 1.kt
// LANGUAGE_VERSION: 1.2
// SKIP_INLINE_CHECK_IN: inlineFun$default
// IGNORE_BACKEND: JS
//WITH_RUNTIME
package test
@@ -9,6 +9,8 @@ fun call(lambda: () -> String ) = lambda()
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
// CHECK_CALLED_IN_SCOPE: function=call_h4ejuu$ scope=box
import test.*
fun box(): String {
@@ -9,6 +9,7 @@ inline fun inlineFun(crossinline inlineLambda: () -> String, noinline noInlineLa
// FILE: 2.kt
//NO_CHECK_LAMBDA_INLINING
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=inlineFun
import test.*
fun box(): String {
@@ -10,6 +10,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { this }): String
}
// FILE: 2.kt
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
import test.*
@@ -10,7 +10,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String, crossinline dlambd
}
// FILE: 2.kt
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=test
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=test
import test.*
fun String.test(): String = "INLINE".inlineFun({ this })
@@ -14,6 +14,8 @@ class A(val value: String) {
// FILE: 2.kt
//WITH_RUNTIME
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
import test.*
fun box(): String {
@@ -14,6 +14,8 @@ class A(val value: String) {
// FILE: 2.kt
//WIH_RUNTIME
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=test
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=test
import test.*
fun String.test(): String = with(A("VALUE")) { "INLINE".inlineFun({ this@test }) }
@@ -8,6 +8,7 @@ inline fun inlineFun(capturedParam: String, lambda: () -> String = { capturedPar
}
// FILE: 2.kt
// CHECK_CONTAINS_NO_CALLS: box
import test.*
@@ -8,6 +8,7 @@ inline fun inlineFun(capturedParam: String, lambda: () -> Any = { capturedParam
}
// FILE: 2.kt
// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType
import test.*
@@ -8,6 +8,7 @@ inline fun inlineFun(lambda: () -> Any = { "OK" as Any }): Any {
}
// FILE: 2.kt
// CHECK_CONTAINS_NO_CALLS: box except=throwCCE;isType
import test.*
@@ -8,6 +8,7 @@ inline fun inlineFun(param: String, lambda: String.() -> String = { this }): Str
}
// FILE: 2.kt
// CHECK_CONTAINS_NO_CALLS: box
import test.*
@@ -12,6 +12,7 @@ inline fun <T : A> inlineFun(capturedParam: T, lambda: () -> T = { capturedParam
}
// FILE: 2.kt
// CHECK_CONTAINS_NO_CALLS: box
import test.*
@@ -8,6 +8,7 @@ inline fun inlineFun(lambda: () -> String = { "OK" }): String {
}
// FILE: 2.kt
// CHECK_CONTAINS_NO_CALLS: box
import test.*
@@ -12,6 +12,8 @@ inline fun String.inlineFun(crossinline lambda: () -> String = { { this }() }):
}
// FILE: 2.kt
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
import test.*
@@ -15,6 +15,8 @@ class A(val value: String) {
// FILE: 2.kt
//WITH_RUNTIME
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f scope=box
// CHECK_CALLED_IN_SCOPE: function=inlineFun$f_0 scope=box
import test.*
fun box(): String {
@@ -1377,6 +1377,10 @@ fun main(args: Array<String>) {
model("codegen/boxInline/enum/", targetBackend = TargetBackend.JS)
}
testClass<AbstractInlineDefaultValuesTests> {
model("codegen/boxInline/defaultValues/", targetBackend = TargetBackend.JS)
}
testClass<AbstractJsTypedArraysBoxTest> {
model("codegen/box/arrays", targetBackend = TargetBackend.JS)
}
@@ -18,18 +18,16 @@ package org.jetbrains.kotlin.js.inline.clean
import org.jetbrains.kotlin.js.backend.ast.*
import org.jetbrains.kotlin.js.backend.ast.metadata.hasDefaultValue
import org.jetbrains.kotlin.js.inline.util.toIdentitySet
import org.jetbrains.kotlin.js.backend.ast.metadata.staticRef
import org.jetbrains.kotlin.js.inline.util.zipWithDefault
import org.jetbrains.kotlin.js.translate.context.Namer
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils.decomposeAssignmentToVariable
import org.jetbrains.kotlin.js.translate.utils.JsAstUtils.flattenStatement
/**
* Removes initializers for default parameters with defined arguments given
* Expands initializers for default parameters with undefined arguments given
*
* @see isInitializer
*/
fun removeDefaultInitializers(arguments: List<JsExpression>, parameters: List<JsParameter>, body: JsBlock) {
val toRemove = getDefaultParamsNames(arguments, parameters, initialized = true)
@@ -45,8 +43,11 @@ fun removeDefaultInitializers(arguments: List<JsExpression>, parameters: List<Js
when {
name != null && name in toRemove ->
listOf<JsStatement>()
name != null && name in toExpand ->
flattenStatement((it as JsIf).thenStatement)
name != null && name in toExpand -> {
val thenStatement = (it as JsIf).thenStatement
markAssignmentAsStaticRef(name, thenStatement)
flattenStatement(thenStatement)
}
else ->
listOf(it)
}
@@ -56,6 +57,19 @@ fun removeDefaultInitializers(arguments: List<JsExpression>, parameters: List<Js
statements.addAll(newStatements)
}
private fun markAssignmentAsStaticRef(name: JsName, node: JsNode) {
node.accept(object : RecursiveJsVisitor() {
override fun visitBinaryExpression(x: JsBinaryOperation) {
decomposeAssignmentToVariable(x)?.let { (assignmentTarget, assignmentExpr) ->
if (assignmentTarget == name) {
assignmentTarget.staticRef = assignmentExpr
}
}
super.visitBinaryExpression(x)
}
})
}
private fun getNameFromInitializer(statement: JsStatement): JsName? {
val ifStmt = (statement as? JsIf)
val testExpr = ifStmt?.ifExpression
@@ -118,6 +132,6 @@ private fun getDefaultParamsNames(
.filter { initialized == !JsAstUtils.isUndefinedExpression(it.first) }
val names = relevantParams.map { it.second.name }
return names.toIdentitySet()
return names.toSet()
}
@@ -44,6 +44,7 @@ fun aliasArgumentsIfNeeded(
for (defaultParam in defaultParams) {
val paramName = defaultParam.name
val freshName = JsScope.declareTemporaryName(paramName.ident)
freshName.copyMetadataFrom(paramName)
context.newVar(freshName)
context.replaceName(paramName, freshName.makeRef())
@@ -0,0 +1,365 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.js.test.semantics;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxInline/defaultValues")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class InlineDefaultValuesTestsGenerated extends AbstractInlineDefaultValuesTests {
public void testAllFilesPresentInDefaultValues() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/defaultValues"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("defaultInExtension.kt")
public void testDefaultInExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/defaultInExtension.kt");
doTest(fileName);
}
@TestMetadata("defaultMethod.kt")
public void testDefaultMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/defaultMethod.kt");
doTest(fileName);
}
@TestMetadata("defaultMethodInClass.kt")
public void testDefaultMethodInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/defaultMethodInClass.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("defaultParamRemapping.kt")
public void testDefaultParamRemapping() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/defaultParamRemapping.kt");
doTest(fileName);
}
@TestMetadata("inlineInDefaultParameter.kt")
public void testInlineInDefaultParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/inlineInDefaultParameter.kt");
doTest(fileName);
}
@TestMetadata("inlineLambdaInNoInlineDefault.kt")
public void testInlineLambdaInNoInlineDefault() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/inlineLambdaInNoInlineDefault.kt");
doTest(fileName);
}
@TestMetadata("kt11479.kt")
public void testKt11479() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt11479.kt");
doTest(fileName);
}
@TestMetadata("kt11479InlinedDefaultParameter.kt")
public void testKt11479InlinedDefaultParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt11479InlinedDefaultParameter.kt");
doTest(fileName);
}
@TestMetadata("kt14564.kt")
public void testKt14564() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt14564.kt");
doTest(fileName);
}
@TestMetadata("kt14564_2.kt")
public void testKt14564_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt14564_2.kt");
doTest(fileName);
}
@TestMetadata("kt5685.kt")
public void testKt5685() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt5685.kt");
doTest(fileName);
}
@TestMetadata("simpleDefaultMethod.kt")
public void testSimpleDefaultMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/simpleDefaultMethod.kt");
doTest(fileName);
}
@TestMetadata("varArgNoInline.kt")
public void testVarArgNoInline() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/varArgNoInline.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class LambdaInlining extends AbstractInlineDefaultValuesTests {
public void testAllFilesPresentInLambdaInlining() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("defaultLambdaInNoInline.kt")
public void testDefaultLambdaInNoInline() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt");
doTest(fileName);
}
@TestMetadata("instanceCapuredInClass.kt")
public void testInstanceCapuredInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt");
doTest(fileName);
}
@TestMetadata("instanceCapuredInInterface.kt")
public void testInstanceCapuredInInterface() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt");
doTest(fileName);
}
@TestMetadata("jvmStaticDefault.kt")
public void testJvmStaticDefault() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("noInline.kt")
public void testNoInline() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt");
doTest(fileName);
}
@TestMetadata("nonDefaultInlineInNoInline.kt")
public void testNonDefaultInlineInNoInline() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt");
doTest(fileName);
}
@TestMetadata("receiverClash.kt")
public void testReceiverClash() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash.kt");
doTest(fileName);
}
@TestMetadata("receiverClash2.kt")
public void testReceiverClash2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt");
doTest(fileName);
}
@TestMetadata("receiverClashInClass.kt")
public void testReceiverClashInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass.kt");
doTest(fileName);
}
@TestMetadata("receiverClashInClass2.kt")
public void testReceiverClashInClass2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClashInClass2.kt");
doTest(fileName);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simple.kt");
doTest(fileName);
}
@TestMetadata("simpleErased.kt")
public void testSimpleErased() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt");
doTest(fileName);
}
@TestMetadata("simpleErasedStaticInstance.kt")
public void testSimpleErasedStaticInstance() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt");
doTest(fileName);
}
@TestMetadata("simpleExtension.kt")
public void testSimpleExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleExtension.kt");
doTest(fileName);
}
@TestMetadata("simpleGeneric.kt")
public void testSimpleGeneric() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt");
doTest(fileName);
}
@TestMetadata("simpleStaticInstance.kt")
public void testSimpleStaticInstance() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt");
doTest(fileName);
}
@TestMetadata("thisClash.kt")
public void testThisClash() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClash.kt");
doTest(fileName);
}
@TestMetadata("thisClashInClass.kt")
public void testThisClashInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/thisClashInClass.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CallableReferences extends AbstractInlineDefaultValuesTests {
public void testAllFilesPresentInCallableReferences() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("boundFunctionReference.kt")
public void testBoundFunctionReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundFunctionReference.kt");
doTest(fileName);
}
@TestMetadata("boundPropertyReference.kt")
public void testBoundPropertyReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/boundPropertyReference.kt");
doTest(fileName);
}
@TestMetadata("constuctorReference.kt")
public void testConstuctorReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/constuctorReference.kt");
doTest(fileName);
}
@TestMetadata("functionImportedFromObject.kt")
public void testFunctionImportedFromObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionImportedFromObject.kt");
doTest(fileName);
}
@TestMetadata("functionReference.kt")
public void testFunctionReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReference.kt");
doTest(fileName);
}
@TestMetadata("functionReferenceFromClass.kt")
public void testFunctionReferenceFromClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromClass.kt");
doTest(fileName);
}
@TestMetadata("functionReferenceFromObject.kt")
public void testFunctionReferenceFromObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/functionReferenceFromObject.kt");
doTest(fileName);
}
@TestMetadata("innerClassConstuctorReference.kt")
public void testInnerClassConstuctorReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/innerClassConstuctorReference.kt");
doTest(fileName);
}
@TestMetadata("privateFunctionReference.kt")
public void testPrivateFunctionReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privateFunctionReference.kt");
doTest(fileName);
}
@TestMetadata("privatePropertyReference.kt")
public void testPrivatePropertyReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/privatePropertyReference.kt");
doTest(fileName);
}
@TestMetadata("propertyImportedFromObject.kt")
public void testPropertyImportedFromObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyImportedFromObject.kt");
doTest(fileName);
}
@TestMetadata("propertyReference.kt")
public void testPropertyReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReference.kt");
doTest(fileName);
}
@TestMetadata("propertyReferenceFromClass.kt")
public void testPropertyReferenceFromClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromClass.kt");
doTest(fileName);
}
@TestMetadata("propertyReferenceFromObject.kt")
public void testPropertyReferenceFromObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/callableReferences/propertyReferenceFromObject.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/boxInline/defaultValues/maskElimination")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class MaskElimination extends AbstractInlineDefaultValuesTests {
@TestMetadata("32Parameters.kt")
public void test32Parameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt");
doTest(fileName);
}
@TestMetadata("33Parameters.kt")
public void test33Parameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt");
doTest(fileName);
}
public void testAllFilesPresentInMaskElimination() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/defaultValues/maskElimination"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/maskElimination/simple.kt");
doTest(fileName);
}
}
}
@@ -37,6 +37,8 @@ abstract class AbstractCallableReferenceInlineTests : BorrowedInlineTest("callab
abstract class AbstractEnumValuesInlineTests : BorrowedInlineTest("enum/")
abstract class AbstractInlineDefaultValuesTests : BorrowedInlineTest("defaultValues/")
abstract class AbstractBoxJsTest : BasicBoxTest(
BasicBoxTest.TEST_DATA_DIR_PATH + "box/",
BasicBoxTest.TEST_DATA_DIR_PATH + "out/box/"