From e15878bfe9306770c17b927fa4fd2ebaacceec95 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Mon, 15 May 2017 14:40:26 +0300 Subject: [PATCH] Fresh box tests --- .../arrays/nonLocalReturnArrayConstructor.kt | 47 ++++++++++++- .../bound/equals/nullableReceiverInEquals.kt | 2 +- .../withCoroutines.kt | 1 + .../32defaultParametersInSuspend.kt | 2 +- .../box/coroutines/accessorForSuspend.kt | 2 +- .../codegen/box/coroutines/asyncIterator.kt | 2 +- .../box/coroutines/asyncIteratorToList.kt | 2 +- .../external/codegen/box/coroutines/await.kt | 5 +- .../box/coroutines/beginWithException.kt | 2 +- .../beginWithExceptionNoHandleException.kt | 2 +- .../codegen/box/coroutines/coercionToUnit.kt | 2 +- .../coroutines/controlFlow/breakFinally.kt | 2 +- .../coroutines/controlFlow/breakStatement.kt | 2 +- .../controlFlow/doWhileStatement.kt | 2 +- .../box/coroutines/controlFlow/forContinue.kt | 2 +- .../coroutines/controlFlow/forStatement.kt | 2 +- .../box/coroutines/controlFlow/ifStatement.kt | 2 +- .../coroutines/controlFlow/labeledWhile.kt | 50 +++++++++++++ .../controlFlow/returnFromFinally.kt | 2 +- .../coroutines/controlFlow/switchLikeWhen.kt | 2 +- .../coroutines/controlFlow/throwFromCatch.kt | 2 +- .../controlFlow/throwInTryWithHandleResult.kt | 2 +- .../coroutines/controlFlow/whileStatement.kt | 2 +- .../controllerAccessFromInnerLambda.kt | 2 +- .../box/coroutines/createCoroutineSafe.kt | 2 +- .../createCoroutinesOnManualInstances.kt | 2 +- .../coroutines/defaultParametersInSuspend.kt | 2 +- .../codegen/box/coroutines/dispatchResume.kt | 2 +- .../codegen/box/coroutines/emptyClosure.kt | 2 +- .../box/coroutines/falseUnitCoercion.kt | 2 +- .../destructuringInLambdas.kt | 2 +- .../safeCallOnTwoReceivers.kt | 2 +- .../safeCallOnTwoReceiversLong.kt | 2 +- .../suspendDestructuringInLambdas.kt | 2 +- .../coroutines/featureIntersection/tailrec.kt | 1 + .../codegen/box/coroutines/generate.kt | 2 +- .../codegen/box/coroutines/handleException.kt | 2 +- .../coroutines/handleResultCallEmptyBody.kt | 2 +- .../handleResultNonUnitExpression.kt | 2 +- .../box/coroutines/handleResultSuspended.kt | 2 +- .../codegen/box/coroutines/illegalState.kt | 2 +- .../box/coroutines/inlineSuspendFunction.kt | 1 + .../box/coroutines/inlinedTryCatchFinally.kt | 2 +- .../box/coroutines/innerSuspensionCalls.kt | 2 +- .../box/coroutines/instanceOfContinuation.kt | 1 + .../intLikeVarSpilling/complicatedMerge.kt | 2 +- .../intLikeVarSpilling/i2bResult.kt | 2 +- .../loadFromBooleanArray.kt | 2 +- .../intLikeVarSpilling/loadFromByteArray.kt | 2 +- .../intLikeVarSpilling/noVariableInTable.kt | 2 +- .../intLikeVarSpilling/sameIconst1ManyVars.kt | 2 +- .../intLikeVarSpilling/usedInArrayStore.kt | 2 +- .../intLikeVarSpilling/usedInMethodCall.kt | 2 +- .../intLikeVarSpilling/usedInPutfield.kt | 2 +- .../intLikeVarSpilling/usedInVarStore.kt | 2 +- .../intrinsicSemantics/startCoroutine.kt | 2 +- .../startCoroutineUninterceptedOrReturn.kt | 2 +- ...outineUninterceptedOrReturnInterception.kt | 1 + .../box/coroutines/iterateOverArray.kt | 2 +- .../codegen/box/coroutines/kt12958.kt | 2 +- .../codegen/box/coroutines/kt15016.kt | 2 +- .../codegen/box/coroutines/kt15017.kt | 2 +- .../box/coroutines/lastExpressionIsLoop.kt | 2 +- .../box/coroutines/lastStatementInc.kt | 2 +- .../box/coroutines/lastStementAssignment.kt | 2 +- .../box/coroutines/lastUnitExpression.kt | 2 +- .../box/coroutines/localCallableRef.kt | 1 + .../codegen/box/coroutines/localDelegate.kt | 2 +- .../box/coroutines/mergeNullAndString.kt | 2 +- .../inlineFunctionWithOptionalParam.kt | 4 +- .../box/coroutines/multiModule/simple.kt | 5 +- .../box/coroutines/multipleInvokeCalls.kt | 2 +- .../multipleInvokeCallsInsideInlineLambda1.kt | 2 +- .../multipleInvokeCallsInsideInlineLambda2.kt | 2 +- .../multipleInvokeCallsInsideInlineLambda3.kt | 2 +- .../codegen/box/coroutines/nestedTryCatch.kt | 2 +- .../box/coroutines/noSuspensionPoints.kt | 2 +- .../nonLocalReturnFromInlineLambda.kt | 2 +- .../nonLocalReturnFromInlineLambdaDeep.kt | 2 +- .../box/coroutines/overrideDefaultArgument.kt | 4 +- .../box/coroutines/recursiveSuspend.kt | 4 +- .../codegen/box/coroutines/returnByLabel.kt | 2 +- .../external/codegen/box/coroutines/simple.kt | 2 +- .../codegen/box/coroutines/simpleException.kt | 2 +- .../box/coroutines/simpleWithHandleResult.kt | 2 +- .../coroutines/stackUnwinding/exception.kt | 2 +- .../stackUnwinding/inlineSuspendFunction.kt | 1 + .../box/coroutines/stackUnwinding/simple.kt | 2 +- .../stackUnwinding/suspendInCycle.kt | 2 +- .../coroutines/statementLikeLastExpression.kt | 2 +- .../suspendCoroutineFromStateMachine.kt | 4 +- .../box/coroutines/suspendDefaultImpl.kt | 2 +- .../box/coroutines/suspendDelegation.kt | 2 +- .../box/coroutines/suspendFromInlineLambda.kt | 2 +- .../suspendFunImportedFromObject.kt | 3 +- .../augmentedAssignment.kt | 4 +- .../dispatchResume.kt | 2 +- .../handleException.kt | 2 +- .../suspendFunctionAsCoroutine/inline.kt | 2 +- .../inlineTwoReceivers.kt | 3 +- .../suspendFunctionAsCoroutine/member.kt | 2 +- .../noinlineTwoReceivers.kt | 2 +- .../suspendFunctionAsCoroutine/operators.kt | 2 +- .../privateFunctions.kt | 2 +- .../privateInFile.kt | 2 +- .../returnNoSuspend.kt | 2 +- .../suspendFunctionAsCoroutine/simple.kt | 2 +- .../withVariables.kt | 2 +- .../suspendFunctionTypeCall/localVal.kt | 2 +- .../suspendFunctionTypeCall/manyParameters.kt | 2 +- .../suspendFunctionTypeCall/simple.kt | 2 +- .../codegen/box/coroutines/suspendInCycle.kt | 2 +- .../suspendInTheMiddleOfObjectConstruction.kt | 2 +- .../coroutines/suspensionInsideSafeCall.kt | 2 +- .../suspensionInsideSafeCallWithElvis.kt | 2 +- .../inlineWithStateMachine.kt | 31 ++++++++ .../inlineWithStateMachine.txt | 31 ++++++++ .../inlineWithoutStateMachine.kt | 38 ++++++++++ .../inlineWithoutStateMachine.txt | 32 +++++++++ .../tailCallOptimizations/simple.kt | 28 ++++++++ .../tailCallOptimizations/simple.txt | 20 ++++++ .../tailOperations/suspendWithIf.kt | 2 +- .../tailOperations/suspendWithTryCatch.kt | 2 +- .../tailOperations/suspendWithWhen.kt | 2 +- .../coroutines/tailOperations/tailInlining.kt | 4 +- .../tryCatchFinallyWithHandleResult.kt | 2 +- .../coroutines/tryCatchWithHandleResult.kt | 2 +- .../tryFinallyInsideInlineLambda.kt | 2 +- .../coroutines/tryFinallyWithHandleResult.kt | 2 +- .../unitTypeReturn/coroutineNonLocalReturn.kt | 2 +- .../unitTypeReturn/coroutineReturn.kt | 2 +- .../unitTypeReturn/suspendNonLocalReturn.kt | 3 +- .../unitTypeReturn/suspendReturn.kt | 2 +- .../coroutines/varSpilling/nullSpilling.kt | 2 +- .../coroutines/varValueConflictsWithTable.kt | 2 +- .../varValueConflictsWithTableSameSort.kt | 2 +- .../box/dataClasses/hashCode/boolean.kt | 4 +- .../external/codegen/box/mangling/internal.kt | 37 ++++++++++ .../box/ranges/forInUntil/forInUntilChar.kt | 25 +++++++ .../box/ranges/forInUntil/forInUntilChar0.kt | 10 +++ .../box/ranges/forInUntil/forInUntilInt.kt | 25 +++++++ .../ranges/forInUntil/forInUntilLesserInt.kt | 10 +++ .../box/ranges/forInUntil/forInUntilLong.kt | 43 ++++++++++++ .../box/ranges/forInUntil/forInUntilMaxint.kt | 10 +++ .../box/ranges/forInUntil/forInUntilMinint.kt | 10 +++ .../ranges/forInUntil/forInUntilMinlong.kt | 10 +++ .../forIntInIntUntilSmartcastInt.kt | 21 ++++++ .../signatureOfDeepGenericInner.kt | 23 ++++++ .../genericSignature/signatureOfDeepInner.kt | 22 ++++++ .../signatureOfDeepInnerLastGeneric.kt | 23 ++++++ .../signatureOfGenericInnerGenericOuter.kt | 15 ++++ .../signatureOfGenericInnerSimpleOuter.kt | 15 ++++ .../signatureOfSimpleInnerSimpleOuter.kt | 15 ++++ .../defaultParametersAndLastVararg.kt | 54 ++++++++++++++ .../varargAndDefaultParameters.kt | 54 ++++++++++++++ .../boxInline/defaultValues/kt14564.kt | 36 ++++++++++ .../boxInline/defaultValues/kt14564_2.kt | 33 +++++++++ .../lambdaInlining/defaultLambdaInNoInline.kt | 16 +++++ .../lambdaInlining/functionReference.kt | 18 +++++ .../functionReferenceFromClass.kt | 23 ++++++ .../lambdaInlining/instanceCapuredInClass.kt | 19 +++++ .../instanceCapuredInInterface.kt | 29 ++++++++ .../lambdaInlining/jvmStaticDefault.kt | 20 ++++++ .../defaultValues/lambdaInlining/noInline.kt | 16 +++++ .../nonDefaultInlineInNoInline.kt | 16 +++++ .../defaultValues/lambdaInlining/simple.kt | 16 +++++ .../lambdaInlining/simpleErased.kt | 16 +++++ .../simpleErasedStaticInstance.kt | 16 +++++ .../lambdaInlining/simpleGeneric.kt | 20 ++++++ .../lambdaInlining/simpleStaticInstance.kt | 16 +++++ .../maskElimination/32Parameters.kt | 66 +++++++++++++++++ .../maskElimination/33Parameters.kt | 70 +++++++++++++++++++ .../defaultValues/maskElimination/simple.kt | 36 ++++++++++ .../codegen/boxInline/varargs/kt17653.kt | 18 +++++ .../varargs/varargAndDefaultParameters.kt | 18 +++++ .../varargs/varargAndDefaultParameters2.kt | 18 +++++ backend.native/tests/helpers.kt | 1 + .../org/jetbrains/kotlin/KonanTest.groovy | 1 + gradle.properties | 2 +- 179 files changed, 1378 insertions(+), 135 deletions(-) create mode 100644 backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt create mode 100644 backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt create mode 100644 backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.txt create mode 100644 backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt create mode 100644 backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.txt create mode 100644 backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt create mode 100644 backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.txt create mode 100644 backend.native/tests/external/codegen/box/mangling/internal.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt create mode 100644 backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt create mode 100644 backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt create mode 100644 backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt create mode 100644 backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt create mode 100644 backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt create mode 100644 backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt create mode 100644 backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt create mode 100644 backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt create mode 100644 backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReference.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReferenceFromClass.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt create mode 100644 backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt create mode 100644 backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt create mode 100644 backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt create mode 100644 backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt create mode 100644 backend.native/tests/helpers.kt diff --git a/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt b/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt index 350d4cfe176..3becef59c2a 100644 --- a/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt +++ b/backend.native/tests/external/codegen/box/arrays/nonLocalReturnArrayConstructor.kt @@ -1,6 +1,3 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - fun testArray() { Array(5) { i -> if (i == 3) return @@ -17,8 +14,52 @@ fun testIntArray() { throw AssertionError() } +fun testLongArray() { + LongArray(5) { i -> + if (i == 3) return + i.toLong() + } + throw AssertionError() +} + +fun testBooleanArray() { + BooleanArray(5) { i -> + if (i == 3) return + i % 2 == 0 + } + throw AssertionError() +} + +fun testCharArray() { + CharArray(5) { i -> + if (i == 3) return + i.toChar() + } + throw AssertionError() +} + +fun testFloatArray() { + FloatArray(5) { i -> + if (i == 3) return + i.toFloat() + } + throw AssertionError() +} +fun testDoubleArray() { + DoubleArray(5) { i -> + if (i == 3) return + i.toDouble() + } + throw AssertionError() +} + fun box(): String { testArray() testIntArray() + testLongArray() + testBooleanArray() + testCharArray() + testFloatArray() + testDoubleArray() return "OK" } diff --git a/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt b/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt index f3aa01b2ffb..15824f1f47e 100644 --- a/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt +++ b/backend.native/tests/external/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt @@ -1,5 +1,5 @@ // TODO: investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS // See https://youtrack.jetbrains.com/issue/KT-14938 // WITH_REFLECT diff --git a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt index c1bbf1a27d9..cfe5bee1565 100644 --- a/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt +++ b/backend.native/tests/external/codegen/box/closures/capturedVarsOptimization/withCoroutines.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt index b4db3363660..5fa1cbfede4 100644 --- a/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt +++ b/backend.native/tests/external/codegen/box/coroutines/32defaultParametersInSuspend.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt index 14c07d8753a..038df73732d 100644 --- a/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt +++ b/backend.native/tests/external/codegen/box/coroutines/accessorForSuspend.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt b/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt index 3d296292cde..3207face102 100644 --- a/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt +++ b/backend.native/tests/external/codegen/box/coroutines/asyncIterator.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt b/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt index 76db51566d9..45baabe6c78 100644 --- a/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt +++ b/backend.native/tests/external/codegen/box/coroutines/asyncIteratorToList.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/await.kt b/backend.native/tests/external/codegen/box/coroutines/await.kt index 33c864a53b3..307f949209a 100644 --- a/backend.native/tests/external/codegen/box/coroutines/await.kt +++ b/backend.native/tests/external/codegen/box/coroutines/await.kt @@ -1,7 +1,7 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES // FILE: promise.kt +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -32,7 +32,7 @@ class Promise(private val executor: ((T) -> Unit) -> Unit) { } // FILE: queue.kt - +import helpers.* private val queue = mutableListOf<() -> Unit>() fun postpone(computation: () -> T): Promise { @@ -50,6 +50,7 @@ fun processQueue() { } // FILE: await.kt +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt b/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt index e1bf8a4d75d..5f5b878833e 100644 --- a/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt +++ b/backend.native/tests/external/codegen/box/coroutines/beginWithException.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt b/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt index 0d2871f61b2..faf89dc6cae 100644 --- a/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt +++ b/backend.native/tests/external/codegen/box/coroutines/beginWithExceptionNoHandleException.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* suspend fun suspendHere(): Any = suspendCoroutineOrReturn { x ->} diff --git a/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt b/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt index 2703c04c7df..b3d416e8776 100644 --- a/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt +++ b/backend.native/tests/external/codegen/box/coroutines/coercionToUnit.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt index d0e26cd30a7..272d02615f1 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakFinally.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt index 580979e7978..7898ff7785f 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/breakStatement.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt index a1989513e70..452919efa28 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/doWhileStatement.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt index 769fe1c7ddc..1f2f0fe1544 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forContinue.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt index 91c278f0faf..4ed50a3a673 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/forStatement.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt index ffcfef17c55..3cebc02ee03 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/ifStatement.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt new file mode 100644 index 00000000000..30f5cd8c1d7 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/labeledWhile.kt @@ -0,0 +1,50 @@ +// WITH_RUNTIME +// WITH_COROUTINES +import helpers.* +import kotlin.coroutines.experimental.* +import kotlin.coroutines.experimental.intrinsics.* + +fun builder(c: suspend () -> Unit): Unit { + c.startCoroutine(handleResultContinuation { + finished = true + }) +} + +fun box(): String { + builder { + var i = 0 + var j = 0 + outer@while (i < 10) { + while (j < 10) { + if (i + j > 3) break@outer + log += "$i,$j;" + suspendAndContinue() + j++ + } + log += "i++;" + i++ + } + log += "done;" + suspendAndContinue() + } + + while (!finished) { + log += "@;" + postponed() + } + + if (log != "0,0;@;0,1;@;0,2;@;0,3;@;done;@;") return "fail: $log" + + return "OK" +} + +suspend fun suspendAndContinue(): Unit = suspendCoroutineOrReturn { c -> + postponed = { + c.resume(Unit) + } + COROUTINE_SUSPENDED +} + +var postponed: () -> Unit = {} +var finished = false +var log = "" diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt index 97823f76293..8d2efbbd2e3 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/returnFromFinally.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt index af2096fa147..ab9a7bbeeb5 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/switchLikeWhen.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt index 4ab3972e998..3b58b756534 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwFromCatch.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt index 15f2d1fb3e8..0ed5739fa11 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/throwInTryWithHandleResult.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt b/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt index 0f9c8685e50..4debc5952c4 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controlFlow/whileStatement.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt b/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt index 74dbdf8b23f..5b9aeb1adb1 100644 --- a/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt +++ b/backend.native/tests/external/codegen/box/coroutines/controllerAccessFromInnerLambda.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt b/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt index 6c8f2330304..daed63fe077 100644 --- a/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt +++ b/backend.native/tests/external/codegen/box/coroutines/createCoroutineSafe.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt b/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt index 7b7ebf262ce..1834496d4ad 100644 --- a/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt +++ b/backend.native/tests/external/codegen/box/coroutines/createCoroutinesOnManualInstances.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED diff --git a/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt index 2c05ebcb014..1337341d73b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt +++ b/backend.native/tests/external/codegen/box/coroutines/defaultParametersInSuspend.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt b/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt index 6bcd95ff8e5..4e3eb06ff79 100644 --- a/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt +++ b/backend.native/tests/external/codegen/box/coroutines/dispatchResume.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt b/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt index 8e37d949a66..24e96520a4f 100644 --- a/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt +++ b/backend.native/tests/external/codegen/box/coroutines/emptyClosure.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt b/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt index 39d9f4d74c8..da69fb244b4 100644 --- a/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt +++ b/backend.native/tests/external/codegen/box/coroutines/falseUnitCoercion.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt index df8ef6d64be..719d2e11738 100644 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt +++ b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt index 5a1116ebbf0..02c97d81531 100644 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt +++ b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceivers.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.test.assertEquals diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt index 48f4c56b587..2e50e1f256a 100644 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt +++ b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/safeCallOnTwoReceiversLong.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.test.assertEquals diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt index 06a88fea79d..9cea4eda0fe 100644 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt +++ b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt index 8c0cd42e2f1..7123da47133 100644 --- a/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt +++ b/backend.native/tests/external/codegen/box/coroutines/featureIntersection/tailrec.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES // IGNORE_BACKEND: NATIVE +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.test.assertEquals diff --git a/backend.native/tests/external/codegen/box/coroutines/generate.kt b/backend.native/tests/external/codegen/box/coroutines/generate.kt index 4a525f5e43d..9d769af94b0 100644 --- a/backend.native/tests/external/codegen/box/coroutines/generate.kt +++ b/backend.native/tests/external/codegen/box/coroutines/generate.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // FULL_JDK import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/handleException.kt b/backend.native/tests/external/codegen/box/coroutines/handleException.kt index c8f97aa177c..8e26112b72e 100644 --- a/backend.native/tests/external/codegen/box/coroutines/handleException.kt +++ b/backend.native/tests/external/codegen/box/coroutines/handleException.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt b/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt index 6efb0ecb5ce..d76960c8fb3 100644 --- a/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt +++ b/backend.native/tests/external/codegen/box/coroutines/handleResultCallEmptyBody.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt b/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt index 4b6d8b28f68..29d1a5916f5 100644 --- a/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt +++ b/backend.native/tests/external/codegen/box/coroutines/handleResultNonUnitExpression.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt b/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt index f817b292bd3..194707f6e99 100644 --- a/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt +++ b/backend.native/tests/external/codegen/box/coroutines/handleResultSuspended.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/illegalState.kt b/backend.native/tests/external/codegen/box/coroutines/illegalState.kt index 058c1bbd465..e05d0d5aeb3 100644 --- a/backend.native/tests/external/codegen/box/coroutines/illegalState.kt +++ b/backend.native/tests/external/codegen/box/coroutines/illegalState.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // TARGET_BACKEND: JVM import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt b/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt index f4b068062ae..9930735b6ff 100644 --- a/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt +++ b/backend.native/tests/external/codegen/box/coroutines/inlineSuspendFunction.kt @@ -1,6 +1,7 @@ // IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // WITH_REFLECT // CHECK_NOT_CALLED: suspendInline_61zpoe$ // CHECK_NOT_CALLED: suspendInline_6r51u9$ diff --git a/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt b/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt index 11ab7a0f6b4..1417a30a017 100644 --- a/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt +++ b/backend.native/tests/external/codegen/box/coroutines/inlinedTryCatchFinally.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt b/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt index d6cd8e837b6..9a15bcf4111 100644 --- a/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt +++ b/backend.native/tests/external/codegen/box/coroutines/innerSuspensionCalls.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt b/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt index b0f08652215..b39aed2861b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt +++ b/backend.native/tests/external/codegen/box/coroutines/instanceOfContinuation.kt @@ -1,6 +1,7 @@ // IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // WITH_REFLECT import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt index 52f27d180ed..daf63a1d47b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/complicatedMerge.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt index 8b36e2d2347..d991a7cc85b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt index 29f168d04ea..4aceec9ce80 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt index f3fa12f8f0f..242c5c0ec2a 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/loadFromByteArray.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt index 56d07ff5cde..3f614fd8f35 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/noVariableInTable.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt index 2cf2ea7b57a..8d879ef9b93 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/sameIconst1ManyVars.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt index 760ff0e035d..e93b94f13e7 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInArrayStore.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // TARGET_BACKEND: JVM import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt index ccc22a38043..fbea445b8fa 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInMethodCall.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt index 07a11770dba..404f95df912 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInPutfield.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // TARGET_BACKEND: JVM import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt index 9f340b0f7b8..4afdab1b92f 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intLikeVarSpilling/usedInVarStore.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt index 3f815c14682..ea431a3697c 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutine.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.test.assertEquals diff --git a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt index 01091e8da24..5f91a55d81f 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturn.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.test.assertEquals diff --git a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt index acf58ce553e..6fcb2a1f7a2 100644 --- a/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt +++ b/backend.native/tests/external/codegen/box/coroutines/intrinsicSemantics/startCoroutineUninterceptedOrReturnInterception.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES // IGNORE_BACKEND: NATIVE +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.test.assertEquals diff --git a/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt b/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt index 835ae396dbe..837df4220be 100644 --- a/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt +++ b/backend.native/tests/external/codegen/box/coroutines/iterateOverArray.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/kt12958.kt b/backend.native/tests/external/codegen/box/coroutines/kt12958.kt index a4c3a8dace2..898aa866d02 100644 --- a/backend.native/tests/external/codegen/box/coroutines/kt12958.kt +++ b/backend.native/tests/external/codegen/box/coroutines/kt12958.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // WITH_CONTINUATION import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/kt15016.kt b/backend.native/tests/external/codegen/box/coroutines/kt15016.kt index e3052db6066..b57740e55e7 100644 --- a/backend.native/tests/external/codegen/box/coroutines/kt15016.kt +++ b/backend.native/tests/external/codegen/box/coroutines/kt15016.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn diff --git a/backend.native/tests/external/codegen/box/coroutines/kt15017.kt b/backend.native/tests/external/codegen/box/coroutines/kt15017.kt index f7c1e60f3f2..8833e3c0d33 100644 --- a/backend.native/tests/external/codegen/box/coroutines/kt15017.kt +++ b/backend.native/tests/external/codegen/box/coroutines/kt15017.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.startCoroutine class Controller { diff --git a/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt b/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt index 541742d5fcc..0040d7d273d 100644 --- a/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt +++ b/backend.native/tests/external/codegen/box/coroutines/lastExpressionIsLoop.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt b/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt index 4ac571292f2..01b91ba8a30 100644 --- a/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt +++ b/backend.native/tests/external/codegen/box/coroutines/lastStatementInc.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt b/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt index cb9029d88b5..47bf76f5fa4 100644 --- a/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt +++ b/backend.native/tests/external/codegen/box/coroutines/lastStementAssignment.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt b/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt index c8b48fe0087..d4ebf0b9400 100644 --- a/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt +++ b/backend.native/tests/external/codegen/box/coroutines/lastUnitExpression.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt b/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt index 016fdb06646..a1e04353a0b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt +++ b/backend.native/tests/external/codegen/box/coroutines/localCallableRef.kt @@ -1,5 +1,6 @@ // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt b/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt index 89b337ffee0..c2147c44556 100644 --- a/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt +++ b/backend.native/tests/external/codegen/box/coroutines/localDelegate.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn diff --git a/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt b/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt index 79d2d6aaec0..56eef56af1d 100644 --- a/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt +++ b/backend.native/tests/external/codegen/box/coroutines/mergeNullAndString.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt index 7169206bb51..3675315f0ca 100644 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt +++ b/backend.native/tests/external/codegen/box/coroutines/multiModule/inlineFunctionWithOptionalParam.kt @@ -1,14 +1,14 @@ -// IGNORE_BACKEND: NATIVE // MODULE: lib // FILE: lib.kt inline fun foo(x: String = "OK"): String { return x + x } -// MODULE: main(lib) +// MODULE: main(lib, support) // FILE: main.kt // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt b/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt index e5fdc55d60f..a495e263bf0 100644 --- a/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt +++ b/backend.native/tests/external/codegen/box/coroutines/multiModule/simple.kt @@ -1,9 +1,9 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES -// MODULE: controller +// MODULE: controller(support) // FILE: controller.kt package lib +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -18,6 +18,7 @@ class Controller { // MODULE: main(controller, support) // FILE: main.kt import lib.* +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt index 519cb59c915..236984b79b8 100644 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt +++ b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCalls.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt index 63a8ecc6905..328d8a86bc8 100644 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt +++ b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda1.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt index 748aeb78071..f9966c09e39 100644 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt +++ b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda2.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt index a70e8237c89..261e28bbe76 100644 --- a/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt +++ b/backend.native/tests/external/codegen/box/coroutines/multipleInvokeCallsInsideInlineLambda3.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt b/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt index 2d73e3f4323..00f56d8a33c 100644 --- a/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt +++ b/backend.native/tests/external/codegen/box/coroutines/nestedTryCatch.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt b/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt index a581b1246a8..67f38388a8a 100644 --- a/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt +++ b/backend.native/tests/external/codegen/box/coroutines/noSuspensionPoints.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt b/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt index ebc43368846..e0c9fda657d 100644 --- a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt +++ b/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambda.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt b/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt index ef60c14a4da..a7d30544230 100644 --- a/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt +++ b/backend.native/tests/external/codegen/box/coroutines/nonLocalReturnFromInlineLambdaDeep.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt b/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt index f248d0181de..1ec19b6a9fc 100644 --- a/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt +++ b/backend.native/tests/external/codegen/box/coroutines/overrideDefaultArgument.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -75,4 +75,4 @@ fun asyncSuspend(f: suspend () -> Unit) { var result = "" var proceed: () -> Unit = { } -var finished = false \ No newline at end of file +var finished = false diff --git a/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt index 099cbb57781..c693392c26f 100644 --- a/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt +++ b/backend.native/tests/external/codegen/box/coroutines/recursiveSuspend.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* @@ -39,4 +39,4 @@ fun builder(c: suspend () -> Unit) { var postponed: (() -> Unit)? = { } -var log = "" \ No newline at end of file +var log = "" diff --git a/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt b/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt index a1ca0187b0c..81fa92a38f1 100644 --- a/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt +++ b/backend.native/tests/external/codegen/box/coroutines/returnByLabel.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/simple.kt b/backend.native/tests/external/codegen/box/coroutines/simple.kt index dbfd0f4f439..ae03b0d56af 100644 --- a/backend.native/tests/external/codegen/box/coroutines/simple.kt +++ b/backend.native/tests/external/codegen/box/coroutines/simple.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/simpleException.kt b/backend.native/tests/external/codegen/box/coroutines/simpleException.kt index 2bfb2dd1b69..2307339a201 100644 --- a/backend.native/tests/external/codegen/box/coroutines/simpleException.kt +++ b/backend.native/tests/external/codegen/box/coroutines/simpleException.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt index e3587825778..f8bd4873718 100644 --- a/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt +++ b/backend.native/tests/external/codegen/box/coroutines/simpleWithHandleResult.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt index cc152d0e318..efc497ee9e2 100644 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt +++ b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/exception.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt index a422357400e..6edf9a2358a 100644 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt +++ b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/inlineSuspendFunction.kt @@ -1,6 +1,7 @@ // IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* // WITH_REFLECT // CHECK_NOT_CALLED: suspendInline_61zpoe$ // CHECK_NOT_CALLED: suspendInline_6r51u9$ diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt index deb77541c28..a68cf5d57db 100644 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt +++ b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/simple.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt index 2cc8829dfa9..9e7f00ef2bc 100644 --- a/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt +++ b/backend.native/tests/external/codegen/box/coroutines/stackUnwinding/suspendInCycle.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt b/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt index ce5b968b2b0..6742910c6ac 100644 --- a/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt +++ b/backend.native/tests/external/codegen/box/coroutines/statementLikeLastExpression.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt b/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt index 650eb832356..99d50f8d734 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendCoroutineFromStateMachine.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED @@ -45,4 +45,4 @@ suspend fun wait2(): Unit = suspendCoroutineOrReturn { c -> var postponed: (() -> Unit)? = { } -var log = "" \ No newline at end of file +var log = "" diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt b/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt index 48d5e86af8d..47f3b910a9b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendDefaultImpl.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.startCoroutine import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt b/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt index edd82ac6830..5de17bdedb8 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendDelegation.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt index 8bb1c374599..c4599e8c742 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFromInlineLambda.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt index a0ea8b7a8d0..73233d3b3b6 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunImportedFromObject.kt @@ -1,9 +1,9 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES // FILE: stuff.kt package stuff +import helpers.* import kotlin.coroutines.experimental.intrinsics.* @@ -16,6 +16,7 @@ object Host { // FILE: test.kt +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import stuff.Host.suspendHere diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt index 7cf0c97d532..b57aa353705 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/augmentedAssignment.kt @@ -1,8 +1,8 @@ -// IGNORE_BACKEND: NATIVE +// IGNORE_BACKEND: JVM // WITH_RUNTIME // WITH_COROUTINES +import helpers.* -// TARGET_BACKEND: JS // TODO: looks like this is a bug in JVM backend import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt index 0037fcda1dc..4e2c9a69149 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/dispatchResume.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt index c682cc3bed1..4088d4cc9f2 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt index c7d21c9a645..360e8d70bc1 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inline.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt index 98aaa64a6e7..38629523faa 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/inlineTwoReceivers.kt @@ -1,7 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES -// TARGET_BACKEND: JVM +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt index fc41ba1d09c..f13526f6416 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/member.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt index 469b0f94906..62da22fa57d 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/noinlineTwoReceivers.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED import kotlin.coroutines.experimental.intrinsics.suspendCoroutineOrReturn diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt index cd1d9b497df..2b069d242d6 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/operators.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* import kotlin.reflect.KProperty diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt index 824a558e679..b8d8d409a18 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateFunctions.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt index f0ca5bb02b0..f29775db5f6 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/privateInFile.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt index 8f42616ddca..ba957747645 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/returnNoSuspend.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt index 64f63b458dc..211888c934c 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/simple.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt index c170cfc5d30..7c2d1ca1c86 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionAsCoroutine/withVariables.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt index c2e2bef61a9..a8c381a5e64 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/localVal.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt index 51ffa67e2d2..88c63c02c73 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/manyParameters.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt index 0fd80016b77..eee4b341107 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendFunctionTypeCall/simple.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt b/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt index bf37740dd72..345d7ecbfd5 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendInCycle.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt b/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt index bf256012136..6b567b1e0bf 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspendInTheMiddleOfObjectConstruction.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt b/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt index a9061aa9e1e..91271e456fb 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCall.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt b/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt index 1c0b91b13e7..2d4f6790b9d 100644 --- a/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt +++ b/backend.native/tests/external/codegen/box/coroutines/suspensionInsideSafeCallWithElvis.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt new file mode 100644 index 00000000000..b8f4a5f4a78 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.kt @@ -0,0 +1,31 @@ +// IGNORE_BACKEND: JS +// WITH_RUNTIME +// WITH_COROUTINES +import helpers.* +// CHECK_BYTECODE_LISTING +import kotlin.coroutines.experimental.* +import kotlin.coroutines.experimental.intrinsics.* + +inline suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> + x.resume(v) + COROUTINE_SUSPENDED +} + +// There's no state machine in the suspendHere, since it's inline +inline suspend fun suspendHere(): String = suspendThere("O") + suspendThere("K") +// There should be a state machine for mainSuspend as it has two suspend non-tail calls inlined +suspend fun mainSuspend() = suspendHere() + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = mainSuspend() + } + + return result +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.txt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.txt new file mode 100644 index 00000000000..86c091fb732 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithStateMachine.txt @@ -0,0 +1,31 @@ +@kotlin.Metadata +final class InlineWithStateMachineKt$box$1 { + synthetic final field $result: kotlin.jvm.internal.Ref$ObjectRef + field L$0: java.lang.Object + inner class InlineWithStateMachineKt$box$1 + method (p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.coroutines.experimental.Continuation): void + public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): kotlin.coroutines.experimental.Continuation + public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object + public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public synthetic method invoke(p0: java.lang.Object): java.lang.Object +} + +@kotlin.Metadata +final class InlineWithStateMachineKt$mainSuspend$1 { + field L$0: java.lang.Object + field L$1: java.lang.Object + inner class InlineWithStateMachineKt$mainSuspend$1 + method (p0: kotlin.coroutines.experimental.Continuation): void + public final @org.jetbrains.annotations.Nullable method doResume(): java.lang.Object +} + +@kotlin.Metadata +public final class InlineWithStateMachineKt { + inner class InlineWithStateMachineKt$box$1 + inner class InlineWithStateMachineKt$mainSuspend$1 + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String + public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void + public final static @org.jetbrains.annotations.Nullable method mainSuspend(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + private final static method suspendHere(p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + private final static method suspendThere(p0: java.lang.String, p1: kotlin.coroutines.experimental.Continuation): java.lang.Object +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt new file mode 100644 index 00000000000..845db0b8be0 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.kt @@ -0,0 +1,38 @@ +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME +// WITH_COROUTINES +import helpers.* +// CHECK_BYTECODE_LISTING +import kotlin.coroutines.experimental.* +import kotlin.coroutines.experimental.intrinsics.* + +inline suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> + x.resume(v) + COROUTINE_SUSPENDED +} + +suspend fun suspendHere(): String = suspendThere("O") + +// There is a kind of redundant state machine generated for complexSuspend: +// it's basically has the only suspend call just before return, but there is +// a redundant CHECKCAST String in the run's lambda, so we have to insert the state machine. +// TODO: Think of avoiding such redundant casts +suspend fun complexSuspend(): String { + return run { + suspendThere("K") + } +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = suspendHere() + complexSuspend() + } + + return result +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.txt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.txt new file mode 100644 index 00000000000..c042efb10c9 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/inlineWithoutStateMachine.txt @@ -0,0 +1,32 @@ +@kotlin.Metadata +final class InlineWithoutStateMachineKt$box$1 { + synthetic final field $result: kotlin.jvm.internal.Ref$ObjectRef + field L$0: java.lang.Object + field L$1: java.lang.Object + inner class InlineWithoutStateMachineKt$box$1 + method (p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.coroutines.experimental.Continuation): void + public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): kotlin.coroutines.experimental.Continuation + public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object + public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public synthetic method invoke(p0: java.lang.Object): java.lang.Object +} + +@kotlin.Metadata +final class InlineWithoutStateMachineKt$complexSuspend$1 { + field L$0: java.lang.Object + field L$1: java.lang.Object + inner class InlineWithoutStateMachineKt$complexSuspend$1 + method (p0: kotlin.coroutines.experimental.Continuation): void + public final @org.jetbrains.annotations.Nullable method doResume(): java.lang.Object +} + +@kotlin.Metadata +public final class InlineWithoutStateMachineKt { + inner class InlineWithoutStateMachineKt$box$1 + inner class InlineWithoutStateMachineKt$complexSuspend$1 + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String + public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void + public final static @org.jetbrains.annotations.Nullable method complexSuspend(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + private final static method suspendThere(p0: java.lang.String, p1: kotlin.coroutines.experimental.Continuation): java.lang.Object +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt new file mode 100644 index 00000000000..85f0f44f878 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.kt @@ -0,0 +1,28 @@ +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME +// WITH_COROUTINES +// CHECK_BYTECODE_LISTING +import helpers.* +import kotlin.coroutines.experimental.* +import kotlin.coroutines.experimental.intrinsics.* + +suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x -> + x.resume(v) + COROUTINE_SUSPENDED +} + +suspend fun suspendHere(): String = suspendThere("OK") + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +fun box(): String { + var result = "" + + builder { + result = suspendHere() + } + + return result +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.txt b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.txt new file mode 100644 index 00000000000..18525856960 --- /dev/null +++ b/backend.native/tests/external/codegen/box/coroutines/tailCallOptimizations/simple.txt @@ -0,0 +1,20 @@ +@kotlin.Metadata +final class SimpleKt$box$1 { + synthetic final field $result: kotlin.jvm.internal.Ref$ObjectRef + field L$0: java.lang.Object + inner class SimpleKt$box$1 + method (p0: kotlin.jvm.internal.Ref$ObjectRef, p1: kotlin.coroutines.experimental.Continuation): void + public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): kotlin.coroutines.experimental.Continuation + public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object + public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public synthetic method invoke(p0: java.lang.Object): java.lang.Object +} + +@kotlin.Metadata +public final class SimpleKt { + inner class SimpleKt$box$1 + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String + public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void + public final static @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object + public final static @org.jetbrains.annotations.Nullable method suspendThere(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt index eaffd184b67..1f1fcb98b80 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithIf.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt index 06f4137b619..c3fe2873410 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithTryCatch.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt index 045a0b87aed..5e0dc9747db 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tailOperations/suspendWithWhen.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt b/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt index ac9cce596d1..3dc260dc183 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tailOperations/tailInlining.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* fun box(): String { @@ -50,4 +50,4 @@ fun async(a: suspend () -> Unit) { override val context = EmptyCoroutineContext }) -} \ No newline at end of file +} diff --git a/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt index d27e8595dcf..6736cdbe9e0 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tryCatchFinallyWithHandleResult.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt index 01e4ad5aeff..2c720c010d2 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tryCatchWithHandleResult.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt b/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt index 575dceea708..4a6d7d0bf11 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tryFinallyInsideInlineLambda.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt b/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt index f61dd4924de..9c2d48c87b2 100644 --- a/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt +++ b/backend.native/tests/external/codegen/box/coroutines/tryFinallyWithHandleResult.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt index 5dc6fa0f082..e8dfb09649b 100644 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt +++ b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineNonLocalReturn.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt index cf6c8dc755e..623e3dbb236 100644 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt +++ b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/coroutineReturn.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt index 9d722a8b25f..4b1dbf6ddcc 100644 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt +++ b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendNonLocalReturn.kt @@ -1,6 +1,7 @@ // WITH_RUNTIME // WITH_COROUTINES -// IGNORE_BACKEND: JS, NATIVE +// IGNORE_BACKEND: JS +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt index 00f1db901a6..3430a0d10ad 100644 --- a/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt +++ b/backend.native/tests/external/codegen/box/coroutines/unitTypeReturn/suspendReturn.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt b/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt index 8147ffec376..0f09377dbfa 100644 --- a/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt +++ b/backend.native/tests/external/codegen/box/coroutines/varSpilling/nullSpilling.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt b/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt index c0506126a28..fa02930895c 100644 --- a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt +++ b/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTable.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt b/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt index 295b123c98f..024392c2b04 100644 --- a/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt +++ b/backend.native/tests/external/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt @@ -1,6 +1,6 @@ -// IGNORE_BACKEND: NATIVE // WITH_RUNTIME // WITH_COROUTINES +import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* diff --git a/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt b/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt index afc41bbe2e7..e231e75a57b 100644 --- a/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt +++ b/backend.native/tests/external/codegen/box/dataClasses/hashCode/boolean.kt @@ -1,5 +1,7 @@ data class A(val a: Boolean) fun box() : String { - return if( A(true).hashCode()==1 && A(false).hashCode()==0 ) "OK" else "fail" + if (A(true).hashCode() != 1) return "fail1" + if (A(false).hashCode() !=0) return "fail2" + return "OK" } diff --git a/backend.native/tests/external/codegen/box/mangling/internal.kt b/backend.native/tests/external/codegen/box/mangling/internal.kt new file mode 100644 index 00000000000..1d7db0dd977 --- /dev/null +++ b/backend.native/tests/external/codegen/box/mangling/internal.kt @@ -0,0 +1,37 @@ +// MODULE: lib +// FILE: lib.kt + +package lib + +internal fun foo() = 1 + +internal val bar = 2 + +internal class A { + internal fun baz(a: Int): Int { + return a * 10 + } + + internal val foo = 3 + + internal inner class B { + internal fun foo() = 4 + } +} + +// MODULE: main(lib)(lib) +// FILE: main.kt + +package main + +import lib.* + +fun box(): String { + if (foo() != 1) return "fail 1: ${foo()}" + if (bar != 2) return "fail 2: ${bar}" + val a = A() + if (a.baz(10) != 100) return "fail 3: ${a.baz(10)}" + if (a.foo != 3) return "fail 4: ${a.foo}" + if (a.B().foo() != 4) return "fail 5: ${a.B().foo()}" + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt new file mode 100644 index 00000000000..9ee13af7b5a --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + testChar() + testNullableChar() + return "OK" +} + +private fun testChar() { + var sum = "" + for (ch in '1' until '5') { + sum = sum + ch + } + assertEquals("1234", sum) +} + +private fun testNullableChar() { + var sum = "" + for (ch: Char? in '1' until '5') { + sum = sum + (ch ?: break) + } + assertEquals("1234", sum) +} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt new file mode 100644 index 00000000000..5b7357ba109 --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilChar0.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + for (ch in (-10).toChar() until '\u0000') { + throw AssertionError("This loop shoud not be executed") + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt new file mode 100644 index 00000000000..45e865c4d72 --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilInt.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + testIntInIntUntilInt() + testNullableIntInIntUntilInt() + return "OK" +} + +private fun testIntInIntUntilInt() { + var sum = 0 + for (i in 1 until 5) { + sum = sum * 10 + i + } + assertEquals(1234, sum) +} + +private fun testNullableIntInIntUntilInt() { + var sum = 0 + for (i: Int? in 1 until 5) { + sum = sum * 10 + (i?.toInt() ?: break) + } + assertEquals(1234, sum) +} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt new file mode 100644 index 00000000000..549b8d6fa9a --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLesserInt.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + for (i in 10 until 0) { + throw AssertionError("This loop should not be executed") + } + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt new file mode 100644 index 00000000000..93e0853225b --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilLong.kt @@ -0,0 +1,43 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun testLongInLongUntilLong() { + var sum = 0 + for (i in 1L until 5L) { + sum = sum * 10 + i.toInt() + } + assertEquals(1234, sum) +} + +fun testLongInLongUntilInt() { + var sum = 0 + for (i in 1L until 5.toInt()) { + sum = sum * 10 + i.toInt() + } + assertEquals(1234, sum) +} + +fun testLongInIntUntilLong() { + var sum = 0 + for (i in 1.toInt() until 5L) { + sum = sum * 10 + i.toInt() + } + assertEquals(1234, sum) +} + +fun testNullableLongInIntUntilLong() { + var sum = 0 + for (i: Long? in 1.toInt() until 5L) { + sum = sum * 10 + (i?.toInt() ?: break) + } + assertEquals(1234, sum) +} + +fun box(): String { + testLongInLongUntilLong() + testLongInIntUntilLong() + testLongInLongUntilInt() + testNullableLongInIntUntilLong() + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt new file mode 100644 index 00000000000..bf012c8d0ff --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMaxint.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + for (i in Int.MAX_VALUE until Int.MAX_VALUE) { + throw AssertionError("This loop shoud not be executed") + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt new file mode 100644 index 00000000000..31ae7acede2 --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinint.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + for (i in 0 until Int.MIN_VALUE) { + throw AssertionError("This loop shoud not be executed") + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt new file mode 100644 index 00000000000..b44b7f9f440 --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forInUntilMinlong.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + for (i in 0 until Long.MIN_VALUE) { + throw AssertionError("This loop shoud not be executed") + } + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt b/backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt new file mode 100644 index 00000000000..0cbaf4531ad --- /dev/null +++ b/backend.native/tests/external/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + testIntInIntUntilSmartcastInt() + return "OK" +} + +private fun testIntInIntUntilSmartcastInt() { + var sum = 0 + + val a: Any = 5 + if (a is Int) { + for (i: Int in 1 until a) { + sum = sum * 10 + i + } + } + + assertEquals(1234, sum) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt new file mode 100644 index 00000000000..810db7f3fd9 --- /dev/null +++ b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepGenericInner.kt @@ -0,0 +1,23 @@ +// WITH_REFLECT +// IGNORE_BACKEND: JS, NATIVE + +abstract class Outer { + + inner class FirstInner { + inner class SecondInner { + inner class ThirdInnner { + inner class FourthInner + + fun foo(): FourthInner = TODO() + } + } + } +} + +fun box(): String { + kotlin.test.assertEquals( + "Outer\$FirstInner.Outer\$FirstInner\$SecondInner.ThirdInnner.FourthInner", + Outer.FirstInner.SecondInner.ThirdInnner::class.java.declaredMethods.single().genericReturnType.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt new file mode 100644 index 00000000000..30400feef74 --- /dev/null +++ b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInner.kt @@ -0,0 +1,22 @@ +// WITH_REFLECT +// IGNORE_BACKEND: JS, NATIVE + +abstract class Outer { + + inner class FirstInner { + inner class SecondInner { + inner class ThirdInnner { + inner class FourthInner + + fun foo(): FourthInner = TODO() + } + } + } +} + +fun box(): String { + kotlin.test.assertEquals( + "Outer\$FirstInner.Outer\$FirstInner\$SecondInner.ThirdInnner.FourthInner", + Outer.FirstInner.SecondInner.ThirdInnner::class.java.declaredMethods.single().genericReturnType.toString()) + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt new file mode 100644 index 00000000000..3515cafd88c --- /dev/null +++ b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfDeepInnerLastGeneric.kt @@ -0,0 +1,23 @@ +// WITH_REFLECT +// IGNORE_BACKEND: JS, NATIVE + +abstract class Outer { + + inner class FirstInner { + inner class SecondInner { + inner class ThirdInnner { + inner class FourthInner + + fun foo(): FourthInner = TODO() + } + } + } +} + +fun box(): String { + kotlin.test.assertEquals( + "Outer\$FirstInner\$SecondInner\$ThirdInnner.Outer\$FirstInner\$SecondInner\$ThirdInnner\$FourthInner", + Outer.FirstInner.SecondInner.ThirdInnner::class.java.declaredMethods.single().genericReturnType.toString()) + + return "OK" +} diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt new file mode 100644 index 00000000000..5e1c8338697 --- /dev/null +++ b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerGenericOuter.kt @@ -0,0 +1,15 @@ +// WITH_REFLECT +// IGNORE_BACKEND: JS, NATIVE + +abstract class Outer { + inner class Inner + fun foo(): Inner? = null +} + +fun box(): String { + kotlin.test.assertEquals( + "Outer.Inner", + Outer::class.java.declaredMethods.single().genericReturnType.toString()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt new file mode 100644 index 00000000000..a43c48307fc --- /dev/null +++ b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfGenericInnerSimpleOuter.kt @@ -0,0 +1,15 @@ +// WITH_REFLECT +// IGNORE_BACKEND: JS, NATIVE + +abstract class Outer { + inner class Inner + fun foo(): Inner? = null +} + +fun box(): String { + kotlin.test.assertEquals( + "Outer.Outer\$Inner", + Outer::class.java.declaredMethods.single().genericReturnType.toString()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt new file mode 100644 index 00000000000..76a39f00bdc --- /dev/null +++ b/backend.native/tests/external/codegen/box/reflection/genericSignature/signatureOfSimpleInnerSimpleOuter.kt @@ -0,0 +1,15 @@ +// WITH_REFLECT +// IGNORE_BACKEND: JS, NATIVE + +abstract class Outer { + inner class Inner + fun foo(): Inner? = null +} + +fun box(): String { + kotlin.test.assertEquals( + "class Outer\$Inner", + Outer::class.java.declaredMethods.single().genericReturnType.toString()) + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt new file mode 100644 index 00000000000..0cd491e95c6 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/argumentOrder/defaultParametersAndLastVararg.kt @@ -0,0 +1,54 @@ +// NO_CHECK_LAMBDA_INLINING +// FILE: 1.kt +// WITH_RUNTIME +package test + +open class A(val value: String) + +var invokeOrder = "" + +inline fun inlineFun( + receiver: String = { invokeOrder += " default receiver"; "DEFAULT" }(), + init: String, + vararg constraints: A +): String { + return constraints.map { it.value }.joinToString() + ", " + receiver + ", " + init +} + +// FILE: 2.kt +import test.* + + +var result = "" +fun box(): String { + + result = "" + invokeOrder = "" + result = inlineFun(constraints = { invokeOrder += "constraints";A("C") }(), + receiver = { invokeOrder += " receiver"; "R" }(), + init = { invokeOrder += " init"; "I" }()) + if (result != "C, R, I") return "fail 1: $result" + + //Change test after KT-17691 FIX + if (invokeOrder != " receiver initconstraints") return "fail 2: $invokeOrder" + + result = "" + invokeOrder = "" + result = inlineFun(init = { invokeOrder += "init"; "I" }(), + constraints = { invokeOrder += "constraints";A("C") }(), + receiver = { invokeOrder += " receiver"; "R" }() + ) + if (result != "C, R, I") return "fail 3: $result" + //Change test after KT-17691 FIX + if (invokeOrder != "init receiverconstraints") return "fail 4: $invokeOrder" + + result = "" + invokeOrder = "" + result = inlineFun(init = { invokeOrder += "init"; "I" }(), + constraints = { invokeOrder += " constraints";A("C") }()) + if (result != "C, DEFAULT, I") return "fail 5: $result" + if (invokeOrder != "init constraints default receiver") return "fail 6: $invokeOrder" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt b/backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt new file mode 100644 index 00000000000..6bff7d61719 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/argumentOrder/varargAndDefaultParameters.kt @@ -0,0 +1,54 @@ +// NO_CHECK_LAMBDA_INLINING +// FILE: 1.kt +// WITH_RUNTIME +package test + +open class A(val value: String) + +var invokeOrder = "" + +inline fun inlineFun( + vararg constraints: A, + receiver: String = { invokeOrder += " default receiver"; "DEFAULT" }(), + init: String +): String { + return constraints.map { it.value }.joinToString() + ", " + receiver + ", " + init +} + +// FILE: 2.kt +import test.* + + +var result = "" +fun box(): String { + + result = "" + invokeOrder = "" + result = inlineFun(constraints = { invokeOrder += "constraints";A("C") }(), + receiver = { invokeOrder += " receiver"; "R" }(), + init = { invokeOrder += " init"; "I" }()) + if (result != "C, R, I") return "fail 1: $result" + + //Change test after KT-17691 FIX + if (invokeOrder != " receiver initconstraints") return "fail 2: $invokeOrder" + + result = "" + invokeOrder = "" + result = inlineFun(init = { invokeOrder += "init"; "I" }(), + constraints = { invokeOrder += "constraints";A("C") }(), + receiver = { invokeOrder += " receiver"; "R" }() + ) + if (result != "C, R, I") return "fail 3: $result" + //Change test after KT-17691 FIX + if (invokeOrder != "init receiverconstraints") return "fail 4: $invokeOrder" + + result = "" + invokeOrder = "" + result = inlineFun(init = { invokeOrder += "init"; "I" }(), + constraints = { invokeOrder += " constraints";A("C") }()) + if (result != "C, DEFAULT, I") return "fail 5: $result" + if (invokeOrder != "init constraints default receiver") return "fail 6: $invokeOrder" + + return "OK" +} + diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt new file mode 100644 index 00000000000..c9a422774fc --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564.kt @@ -0,0 +1,36 @@ +// FILE: 1.kt +//NO_CHECK_LAMBDA_INLINING + +package test + +object TimeUtil { + inline fun waitForEx(retryWait: Int = 200, + action: () -> Boolean) { + var now = 1L + if (now++ <= 3) { + action() + } + + } + +} + +// FILE: 2.kt + +import test.* + +var result = "fail" + +fun box(): String { + TimeUtil.waitForEx( + action = { + try { + result = "OK" + true + } + catch (t: Throwable) { + false + } + }) + return result +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt new file mode 100644 index 00000000000..bc0a465bd53 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/kt14564_2.kt @@ -0,0 +1,33 @@ +// FILE: 1.kt + +package test + +var result = "fail" + +object TimeUtil { + + fun waitForAssert(z: String) { + waitForEx( + action = { + result = z + result + }) + } + + inline fun waitForEx(retryWait: Int = 200, + action: () -> String) { + var now = 1L + now++ + action() + } + +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + TimeUtil.waitForAssert("OK") + return result +} diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt new file mode 100644 index 00000000000..4cce7c03858 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/defaultLambdaInNoInline.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(crossinline inlineLambda: () -> String = { "OK" }, noinline noInlineLambda: () -> String = { inlineLambda() }): String { + return noInlineLambda() +} + +// FILE: 2.kt +//NO_CHECK_LAMBDA_INLINING +import test.* + +fun box(): String { + return inlineFun() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReference.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReference.kt new file mode 100644 index 00000000000..0096c923ab8 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReference.kt @@ -0,0 +1,18 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +fun ok() = "OK" + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(lambda: () -> String = ::ok): String { + return lambda() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReferenceFromClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReferenceFromClass.kt new file mode 100644 index 00000000000..7581a0e2e06 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/functionReferenceFromClass.kt @@ -0,0 +1,23 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +fun ok() = "OK" + +class A(val value: String) { + fun ok() = value +} + + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(a: A, lambda: (A) -> String = A::ok): String { + return lambda(a) +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun(A("OK")) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt new file mode 100644 index 00000000000..fcd850a0fed --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInClass.kt @@ -0,0 +1,19 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +class A(val value: String) { + + @Suppress("NOT_YET_SUPPORTED_IN_INLINE") + inline fun inlineFun(lambda: () -> String = { value }): String { + return lambda() + } +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return A("OK").inlineFun() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt new file mode 100644 index 00000000000..4403fc16815 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/instanceCapuredInInterface.kt @@ -0,0 +1,29 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +//problem in test framework +inline fun inlineFunStub(){} + +interface A { + val value: String + + fun test() = inlineFun() + + @Suppress("NOT_YET_SUPPORTED_IN_INLINE") + private inline fun inlineFun(lambda: () -> String = { value }): String { + return lambda() + } +} + +// FILE: 2.kt + +import test.* + +class B : A { + override val value: String = "OK" +} + +fun box(): String { + return B().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt new file mode 100644 index 00000000000..0c9f8c16e1d --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/jvmStaticDefault.kt @@ -0,0 +1,20 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +//WITH_RUNTIME +package test + +object X { + @JvmStatic + @Suppress("NOT_YET_SUPPORTED_IN_INLINE") + inline fun inlineFun(capturedParam: String, lambda: () -> String = { capturedParam }): String { + return lambda() + } +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return X.inlineFun("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt new file mode 100644 index 00000000000..8195603eb01 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/noInline.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +package test + +inline fun inlineFun(capturedParam: String, noinline lambda: () -> String = { capturedParam }): String { + return call(lambda) +} + +fun call(lambda: () -> String ) = lambda() + +// FILE: 2.kt +//NO_CHECK_LAMBDA_INLINING +import test.* + +fun box(): String { + return inlineFun("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt new file mode 100644 index 00000000000..f70777467fe --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/nonDefaultInlineInNoInline.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(crossinline inlineLambda: () -> String, noinline noInlineLambda: () -> String = { inlineLambda() }): String { + return noInlineLambda() +} + +// FILE: 2.kt +//NO_CHECK_LAMBDA_INLINING +import test.* + +fun box(): String { + return inlineFun ({ "OK" }) +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt new file mode 100644 index 00000000000..4a1821c3654 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simple.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(capturedParam: String, lambda: () -> String = { capturedParam }): String { + return lambda() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun("OK") +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt new file mode 100644 index 00000000000..4f0013b2f62 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErased.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(capturedParam: String, lambda: () -> Any = { capturedParam as Any }): Any { + return lambda() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun("OK") as String +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt new file mode 100644 index 00000000000..4833e45f13b --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleErasedStaticInstance.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(lambda: () -> Any = { "OK" as Any }): Any { + return lambda() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun() as String +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt new file mode 100644 index 00000000000..676adcb7f8d --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleGeneric.kt @@ -0,0 +1,20 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +open class A(val value: String) + +class B(value: String): A(value) + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(capturedParam: T, lambda: () -> T = { capturedParam }): T { + return lambda() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun(B("O")).value + inlineFun(A("K")).value +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt new file mode 100644 index 00000000000..85403783e77 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/lambdaInlining/simpleStaticInstance.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +// SKIP_INLINE_CHECK_IN: inlineFun$default +package test + +@Suppress("NOT_YET_SUPPORTED_IN_INLINE") +inline fun inlineFun(lambda: () -> String = { "OK" }): String { + return lambda() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt new file mode 100644 index 00000000000..5ec5e8be2a5 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/32Parameters.kt @@ -0,0 +1,66 @@ +// FILE: 1.kt + +package test + +fun calc() = "OK" + +inline fun test( + p1: String = "1", + p2: String = "2", + p3: String = "3", + p4: String = "4", + p5: String = "5", + p6: String = "6", + p7: String = "7", + p8: String = "8", + p9: String = "9", + p10: String = "10", + p11: String = "11", + p12: String = "12", + p13: String = "13", + p14: String = "14", + p15: String = "15", + p16: String = "16", + p17: String = "17", + p18: String = "18", + p19: String = "19", + p20: String = "20", + p21: String = "21", + p22: String = "22", + p23: String = "23", + p24: String = "24", + p25: String = "25", + p26: String = "26", + p27: String = "27", + p28: String = "28", + p29: String = "29", + p30: String = "30", + p31: String = "31", + p32: String = "32" +): String { + return p1 + " " + p2 + " " + p3 + " " + p4 + " " + p5 + " " + p6 + " " + + p7 + " " + p8 + " " + p9 + " " + p10 + " " + p11 + " " + p12 + " " + p13 + " " + p14 + " " + + p15 + " " + p16 + " " + p17 + " " + p18 + " " + p19 + " " + p20 + " " + p21 + " " + + p22 + " " + p23 + " " + p24 + " " + p25 + " " + p26 + " " + p27 + " " + p28 + " " + + p29 + " " + p30 + " " + p31 + " " + p32 +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + if (test() != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32") + return "fail 1: ${test()}" + + if (test(p20 = "OK") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 OK 21 22 23 24 25 26 27 28 29 30 31 32") + return "fail 2: ${test(p20 = "OK")}" + + if (test(p20 = "O", p22 = "K") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 32") + return "fail 3: ${test(p20 = "O", p22 = "K")}" + + if (test(p20 = "O", p22 = "K", p32 = "23") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 23") + return "fail 4: ${test(p20 = "O", p22 = "K", p32 = "23")}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt new file mode 100644 index 00000000000..70b89a7c6d2 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/33Parameters.kt @@ -0,0 +1,70 @@ +// FILE: 1.kt + +package test + +fun calc() = "OK" + +inline fun test( + p1: String = "1", + p2: String = "2", + p3: String = "3", + p4: String = "4", + p5: String = "5", + p6: String = "6", + p7: String = "7", + p8: String = "8", + p9: String = "9", + p10: String = "10", + p11: String = "11", + p12: String = "12", + p13: String = "13", + p14: String = "14", + p15: String = "15", + p16: String = "16", + p17: String = "17", + p18: String = "18", + p19: String = "19", + p20: String = "20", + p21: String = "21", + p22: String = "22", + p23: String = "23", + p24: String = "24", + p25: String = "25", + p26: String = "26", + p27: String = "27", + p28: String = "28", + p29: String = "29", + p30: String = "30", + p31: String = "31", + p32: String = "32", + p33: String = "33" +): String { + return p1 + " " + p2 + " " + p3 + " " + p4 + " " + p5 + " " + p6 + " " + + p7 + " " + p8 + " " + p9 + " " + p10 + " " + p11 + " " + p12 + " " + p13 + " " + p14 + " " + + p15 + " " + p16 + " " + p17 + " " + p18 + " " + p19 + " " + p20 + " " + p21 + " " + + p22 + " " + p23 + " " + p24 + " " + p25 + " " + p26 + " " + p27 + " " + p28 + " " + + p29 + " " + p30 + " " + p31 + " " + p32 + " " + p33 +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + if (test() != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33") + return "fail 1: ${test()}" + + if (test(p20 = "OK") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 OK 21 22 23 24 25 26 27 28 29 30 31 32 33") + return "fail 2: ${test(p20 = "OK")}" + + if (test(p20 = "O", p22 = "K") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 32 33") + return "fail 3: ${test(p20 = "O", p22 = "K")}" + + if (test(p20 = "O", p22 = "K", p32 = "23") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 23 33") + return "fail 4: ${test(p20 = "O", p22 = "K", p32 = "23")}" + + if (test(p20 = "O", p22 = "K", p32 = "33", p33 ="32") != "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 O 21 K 23 24 25 26 27 28 29 30 31 33 32") + return "fail 4: ${test(p20 = "O", p22 = "K", p32 = "33", p33 ="32")}" + + return "OK" +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt new file mode 100644 index 00000000000..bca4b1fd4a8 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/defaultValues/maskElimination/simple.kt @@ -0,0 +1,36 @@ +// FILE: 1.kt + +package test + +fun calc() = "OK" + +/*open modifier for method handle check in default method*/ +open class A { + inline fun test(p: String = calc()): String { + return p + } + + inline fun String.testExt(p: String = "K"): String { + return this + p + } + + fun callExt(): String { + return "O".testExt() + } + + fun callExt(arg: String): String { + return "O".testExt(arg) + } +} + +// FILE: 2.kt + +import test.* + +fun box() : String { + if (A().callExt() != "OK") return "fail 1: ${A().callExt()}" + if (A().callExt("O") != "OO") return "fail 2: ${A().callExt("O")}" + if (A().test("KK") != "KK") return "fail 3: ${A().test("KK")}" + + return A().test() +} \ No newline at end of file diff --git a/backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt b/backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt new file mode 100644 index 00000000000..c5b4c61339e --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/varargs/kt17653.kt @@ -0,0 +1,18 @@ +// FILE: 1.kt + +package test + +inline fun inlineFun(vararg constraints: String, init: String.() -> String): String { + return "O".init() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun { + this + "K" + } +} + diff --git a/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt b/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt new file mode 100644 index 00000000000..4e4f5cbd8df --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters.kt @@ -0,0 +1,18 @@ +// FILE: 1.kt + +package test + +inline fun inlineFun(vararg constraints: String, receiver: String = "O", init: String.() -> String): String { + return receiver.init() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun { + this + "K" + } +} + diff --git a/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt b/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt new file mode 100644 index 00000000000..3dc7ee6f693 --- /dev/null +++ b/backend.native/tests/external/codegen/boxInline/varargs/varargAndDefaultParameters2.kt @@ -0,0 +1,18 @@ +// FILE: 1.kt +// WITH_RUNTIME + +package test +inline fun inlineFun(vararg constraints: String, receiver: String = "K", init: String.() -> String): String { + return (constraints.joinToString() + receiver).init() +} + +// FILE: 2.kt + +import test.* + +fun box(): String { + return inlineFun("O") { + this + } +} + diff --git a/backend.native/tests/helpers.kt b/backend.native/tests/helpers.kt new file mode 100644 index 00000000000..12668d607f9 --- /dev/null +++ b/backend.native/tests/helpers.kt @@ -0,0 +1 @@ +package helpers \ No newline at end of file diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 5859d20faec..ea7ab2808b3 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -420,6 +420,7 @@ class RunExternalTestGroup extends RunKonanTest { createLauncherFile("$outputDirectory/_launcher.kt", imports) result.add("$outputDirectory/_launcher.kt") result.add(project.file("testUtils.kt")) + result.add(project.file("helpers.kt")) return result } diff --git a/gradle.properties b/gradle.properties index 14b62e4ba30..ab074e19328 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ minMacOsVersion = 10.11 remoteRoot=konan_tests #kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-SNAPSHOT # Download artifacts of https://teamcity.jetbrains.com/viewType.html?buildTypeId=bt345 -testDataVersion=1053418:id +testDataVersion=1067176:id kotlinCompilerRepo=http://dl.bintray.com/jetbrains/kotlin-native-dependencies #kotlinCompilerRepo=http://oss.sonatype.org/content/repositories/snapshots #kotlinCompilerRepo=http://dl.bintray.com/kotlin/kotlin-dev