From e2713501cee70db784846955cd2b2aba924dc657 Mon Sep 17 00:00:00 2001 From: Roman Elizarov Date: Sun, 9 Sep 2018 11:34:31 +0300 Subject: [PATCH] Rename SuccessOrFailure to Result and hide Failure from ABI * The members of Result are isSuccess, isFailure, exceptionOrNull, getOrNull * The rest of API is implemented via inline-only extensions * There are two internal functions to hide detailed mechanics of an internal Result.Failure class: createFailure and throwOnFailure * Result.toString is explicit: either Success(v) or Failure(x) See KT-26538 --- .../codegen/coroutines/CoroutineCodegen.kt | 2 +- .../CoroutineTransformerMethodVisitor.kt | 6 +- .../coroutines/coroutineCodegenUtil.kt | 6 +- .../codegen/state/inlineClassManglingUtils.kt | 3 +- .../kotlin/resolve/jvm/AsmTypes.java | 2 +- .../box/coroutines/debug/debuggerMetadata.kt | 2 +- .../bridgeGenerationCrossinline.kt | 16 +- .../bridgeGenerationNonInline.kt | 16 +- .../box/coroutines/reflect/callSuspend.kt | 2 +- .../box/coroutines/reflect/callSuspendBy.kt | 2 +- .../bridgeGenerationWithInlineClassOverAny.kt | 16 +- .../crossinlineWithInlineClassInParameter.kt | 16 +- .../codegen/box/inlineClasses/kt25771.kt | 16 +- .../callableReference/ordinaryParameter.kt | 2 +- .../callableReference/suspendOfOrdinary.kt | 2 +- .../inlineUsedAsNoinline/inlineOnly.kt | 2 +- .../inlineUsedAsNoinline/simpleNamed.kt | 2 +- .../coroutines/doNotReassignContinuation.kt | 2 +- .../inlineClasses/resultApiDoesntUseBox.kt | 37 + ...successOrFailureApiDoesntUseErasedClass.kt | 36 - .../coroutines/simple.kt | 2 +- .../org/jetbrains/kotlin/coroutineTestUtil.kt | 8 +- .../codegen/BytecodeTextTestGenerated.java | 10 +- .../kotlin/resolve/DescriptorUtils.java | 1 - .../ResultIsResult.html | 8 + .../ResultIsSuccessOrFailure.html | 8 - idea/src/META-INF/plugin.xml | 4 +- idea/src/META-INF/plugin.xml.173 | 4 +- idea/src/META-INF/plugin.xml.181 | 4 +- idea/src/META-INF/plugin.xml.183 | 4 +- idea/src/META-INF/plugin.xml.as31 | 4 +- idea/src/META-INF/plugin.xml.as32 | 4 +- idea/src/META-INF/plugin.xml.as33 | 4 +- .../RedundantRunCatchingInspection.kt | 2 +- ...pection.kt => ResultIsResultInspection.kt} | 8 +- .../tinyApp/src/forTests/coroutines.kt | 2 +- .../inspectionData/expected.xml | 48 +- .../inspectionData/inspections.test | 2 +- .../resultIsSuccessOrFailure/test.kt | 50 +- .../coroutines/redundantRunCatching/simple.kt | 4 +- .../redundantRunCatching/simple.kt.after | 4 +- .../resultIsSuccessOrFailure/.inspection | 2 +- .../resultIsSuccessOrFailure/abstract.kt | 6 +- .../abstract.kt.after | 4 +- .../resultIsSuccessOrFailure/anonymous.kt | 4 +- .../anonymous.kt.after | 4 +- .../resultIsSuccessOrFailure/complexBlock.kt | 22 +- .../complexBlock.kt.after | 20 +- .../resultIsSuccessOrFailure/lambdaSimple.kt | 4 +- .../lambdaSimple.kt.after | 4 +- .../lambdaWithPartialReturn.kt | 6 +- .../lambdaWithPartialReturn.kt.after | 6 +- .../lambdaWithReturn.kt | 4 +- .../lambdaWithReturn.kt.after | 4 +- .../needParentheses.kt | 6 +- .../needParentheses.kt.after | 6 +- .../resultIsSuccessOrFailure/rename.kt | 4 +- .../resultIsSuccessOrFailure/rename.kt.after | 4 +- .../resultIsSuccessOrFailure/simple.kt | 4 +- .../resultIsSuccessOrFailure/simple.kt.after | 4 +- .../resultIsSuccessOrFailure/simpleBlock.kt | 12 +- .../simpleBlock.kt.after | 10 +- .../box/coroutines/localVarOptimization.kt | 2 +- .../box/coroutines/nativeExceptions.kt | 2 +- .../testData/box/incremental/coroutines.kt | 2 +- .../migration/CoroutinesMigration.kt | 2 +- .../common/src/kotlin/CoroutinesH.kt | 2 +- .../kotlin/coroutines/SafeContinuationJs.kt | 4 +- .../coroutines/js/internal/CoroutineImpl.kt | 4 +- .../kotlin/coroutines/SafeContinuationJvm.kt | 4 +- .../coroutines/intrinsics/IntrinsicsJvm.kt | 4 +- .../jvm/internal/ContinuationImpl.kt | 12 +- .../coroutines/jvm/internal/RunSuspend.kt | 4 +- .../coroutines/jvm/test/DebugMetadataTest.kt | 2 +- ...{SuccessOrFailureTest.kt => ResultTest.kt} | 12 +- .../coroutines/jvm/test/TestDispatcher.kt | 2 +- .../stdlib/coroutines/src/kotlin/Result.kt | 328 +++++++++ .../src/kotlin/coroutines/Continuation.kt | 11 +- .../src/kotlin/sequences/SequenceBuilder.kt | 2 +- .../CoroutinesReferenceValuesTest.kt | 2 +- .../kotlin-stdlib-runtime-merged.txt | 666 +++++++++--------- 81 files changed, 968 insertions(+), 612 deletions(-) create mode 100644 compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntUseBox.kt delete mode 100644 compiler/testData/codegen/bytecodeText/inlineClasses/successOrFailureApiDoesntUseErasedClass.kt create mode 100644 idea/resources/inspectionDescriptions/ResultIsResult.html delete mode 100644 idea/resources/inspectionDescriptions/ResultIsSuccessOrFailure.html rename idea/src/org/jetbrains/kotlin/idea/inspections/coroutines/{ResultIsSuccessOrFailureInspection.kt => ResultIsResultInspection.kt} (97%) rename libraries/stdlib/coroutines/jvm/test/{SuccessOrFailureTest.kt => ResultTest.kt} (88%) create mode 100644 libraries/stdlib/coroutines/src/kotlin/Result.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt index 1e59e475bce..11dc5feb640 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt @@ -64,7 +64,7 @@ abstract class AbstractCoroutineCodegen( if (languageVersionSettings.isReleaseCoroutines()) createImplMethod( INVOKE_SUSPEND_METHOD_NAME, - "result" to classDescriptor.module.getSuccessOrFailure(classDescriptor.builtIns.anyType) + "result" to classDescriptor.module.getResult(classDescriptor.builtIns.anyType) ) else createImplMethod( diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt index 7b20fe7ed55..319f12a1706 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -759,11 +759,11 @@ private fun InstructionAdapter.generateResumeWithExceptionCheck(isReleaseCorouti val noExceptionLabel = Label() if (isReleaseCoroutines) { - instanceOf(AsmTypes.SUCCESS_OR_FAILURE_FAILURE) + instanceOf(AsmTypes.RESULT_FAILURE) ifeq(noExceptionLabel) // TODO: do we need this checkcast? - checkcast(AsmTypes.SUCCESS_OR_FAILURE_FAILURE) - getfield(AsmTypes.SUCCESS_OR_FAILURE_FAILURE.internalName, "exception", AsmTypes.JAVA_THROWABLE_TYPE.descriptor) + checkcast(AsmTypes.RESULT_FAILURE) + getfield(AsmTypes.RESULT_FAILURE.internalName, "exception", AsmTypes.JAVA_THROWABLE_TYPE.descriptor) } else { ifnull(noExceptionLabel) } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/coroutineCodegenUtil.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/coroutineCodegenUtil.kt index 6eabe588184..c2e7c90b0f4 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/coroutineCodegenUtil.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/coroutineCodegenUtil.kt @@ -303,16 +303,16 @@ fun D.createCustomCopy( private fun FunctionDescriptor.getContinuationParameterTypeOfSuspendFunction(isReleaseCoroutines: Boolean) = module.getContinuationOfTypeOrAny(returnType!!, if (this.needsExperimentalCoroutinesWrapper()) false else isReleaseCoroutines) -fun ModuleDescriptor.getSuccessOrFailure(kotlinType: KotlinType) = +fun ModuleDescriptor.getResult(kotlinType: KotlinType) = module.resolveTopLevelClass( - DescriptorUtils.SUCCESS_OR_FAILURE_FQ_NAME, + DescriptorUtils.RESULT_FQ_NAME, NoLookupLocation.FROM_BACKEND )?.defaultType?.let { KotlinTypeFactory.simpleType( it, arguments = listOf(kotlinType.asTypeProjection()) ) - } ?: ErrorUtils.createErrorType("For SuccessOrFailure") + } ?: ErrorUtils.createErrorType("For Result") private fun MethodNode.invokeNormalizeContinuation(languageVersionSettings: LanguageVersionSettings) { visitMethodInsn( diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt index e252ddbb164..b9287352729 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/inlineClassManglingUtils.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.codegen.state import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.load.kotlin.getRepresentativeUpperBound import org.jetbrains.kotlin.resolve.DescriptorUtils.RESULT_FQ_NAME -import org.jetbrains.kotlin.resolve.DescriptorUtils.SUCCESS_OR_FAILURE_FQ_NAME import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe @@ -50,7 +49,7 @@ private fun KotlinType.isInlineClassThatRequiresMangling() = isInlineClassType() && !isDontMangleClass(this.constructor.declarationDescriptor as ClassDescriptor) private fun isDontMangleClass(classDescriptor: ClassDescriptor) = - classDescriptor.fqNameSafe == SUCCESS_OR_FAILURE_FQ_NAME || classDescriptor.fqNameSafe == RESULT_FQ_NAME + classDescriptor.fqNameSafe == RESULT_FQ_NAME private fun KotlinType.isTypeParameterWithUpperBoundThatRequiresMangling(): Boolean { val descriptor = constructor.declarationDescriptor as? TypeParameterDescriptor ?: return false diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/AsmTypes.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/AsmTypes.java index 97be4621462..18c72ba64e7 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/AsmTypes.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/AsmTypes.java @@ -36,7 +36,7 @@ public class AsmTypes { public static final Type MUTABLE_PROPERTY_REFERENCE1 = Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference1"); public static final Type MUTABLE_PROPERTY_REFERENCE2 = Type.getObjectType("kotlin/jvm/internal/MutablePropertyReference2"); - public static final Type SUCCESS_OR_FAILURE_FAILURE = Type.getObjectType("kotlin/SuccessOrFailure$Failure"); + public static final Type RESULT_FAILURE = Type.getObjectType("kotlin/Result$Failure"); public static final Type[] PROPERTY_REFERENCE_IMPL = { Type.getObjectType("kotlin/jvm/internal/PropertyReference0Impl"), diff --git a/compiler/testData/codegen/box/coroutines/debug/debuggerMetadata.kt b/compiler/testData/codegen/box/coroutines/debug/debuggerMetadata.kt index 35e682104fc..9c57a5325ce 100644 --- a/compiler/testData/codegen/box/coroutines/debug/debuggerMetadata.kt +++ b/compiler/testData/codegen/box/coroutines/debug/debuggerMetadata.kt @@ -99,7 +99,7 @@ fun box(): String { if (res != "first") { return "" + res } - continuation!!.resumeWith(SuccessOrFailure.success(Unit)) + continuation!!.resumeWith(Result.success(Unit)) res = (continuation!! as BaseContinuationImpl).getSpilledVariableFieldMapping()!!.toMap()["I$0"] ?: "multipleLocalsInOneSlot fail 2" if (res != "second") { return "" + res diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt index aeec4a2f8a3..4c3c5750863 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationCrossinline.kt @@ -10,30 +10,30 @@ fun builder(c: suspend () -> Unit) { } @Suppress("UNSUPPORTED_FEATURE") -inline class SuccessOrFailure(val a: Any?) { +inline class Result(val a: Any?) { fun getOrThrow(): T = a as T } -abstract class SuccessOrFailureReceiver { - abstract suspend fun receive(result: SuccessOrFailure) +abstract class ResultReceiver { + abstract suspend fun receive(result: Result) } -inline fun SuccessOrFailureReceiver(crossinline f: (SuccessOrFailure) -> Unit): SuccessOrFailureReceiver = - object : SuccessOrFailureReceiver() { - override suspend fun receive(result: SuccessOrFailure) { +inline fun ResultReceiver(crossinline f: (Result) -> Unit): ResultReceiver = + object : ResultReceiver() { + override suspend fun receive(result: Result) { f(result) } } fun test() { var invoked = false - val receiver = SuccessOrFailureReceiver { result -> + val receiver = ResultReceiver { result -> val intResult = result.getOrThrow() invoked = true } builder { - receiver.receive(SuccessOrFailure("42")) + receiver.receive(Result("42")) } if (!invoked) { throw RuntimeException("Fail") diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationNonInline.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationNonInline.kt index efbeb8bcfd3..070c4da52e6 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationNonInline.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/bridgeGenerationNonInline.kt @@ -10,30 +10,30 @@ fun builder(c: suspend () -> Unit) { } @Suppress("UNSUPPORTED_FEATURE") -inline class SuccessOrFailure(val a: Any?) { +inline class Result(val a: Any?) { fun getOrThrow(): T = a as T } -abstract class SuccessOrFailureReceiver { - abstract suspend fun receive(result: SuccessOrFailure) +abstract class ResultReceiver { + abstract suspend fun receive(result: Result) } -fun SuccessOrFailureReceiver(f: (SuccessOrFailure) -> Unit): SuccessOrFailureReceiver = - object : SuccessOrFailureReceiver() { - override suspend fun receive(result: SuccessOrFailure) { +fun ResultReceiver(f: (Result) -> Unit): ResultReceiver = + object : ResultReceiver() { + override suspend fun receive(result: Result) { f(result) } } fun test() { var invoked = false - val receiver = SuccessOrFailureReceiver { result -> + val receiver = ResultReceiver { result -> val intResult = result.getOrThrow() invoked = true } builder { - receiver.receive(SuccessOrFailure(42)) + receiver.receive(Result(42)) } if (!invoked) { throw RuntimeException("Fail") diff --git a/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt b/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt index dedb3fa3788..d601edcc481 100644 --- a/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt @@ -30,7 +30,7 @@ var proceed = {} suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn { cont -> proceed = { - cont.resumeWith(SuccessOrFailure.success(Unit)) + cont.resumeWith(Result.success(Unit)) } COROUTINE_SUSPENDED } diff --git a/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt b/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt index 361c3f35481..4d8c0cab99f 100644 --- a/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt +++ b/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt @@ -32,7 +32,7 @@ var proceed = {} suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn { cont -> proceed = { - cont.resumeWith(SuccessOrFailure.success(Unit)) + cont.resumeWith(Result.success(Unit)) } COROUTINE_SUSPENDED } diff --git a/compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt b/compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt index d634f1948dd..bb42b7ea1b6 100644 --- a/compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt +++ b/compiler/testData/codegen/box/inlineClasses/bridgeGenerationWithInlineClassOverAny.kt @@ -1,29 +1,29 @@ // !LANGUAGE: +InlineClasses // IGNORE_BACKEND: JVM_IR -inline class SuccessOrFailure(val a: Any?) { +inline class Result(val a: Any?) { fun getOrThrow(): T = a as T } -abstract class SuccessOrFailureReceiver { - abstract fun receive(result: SuccessOrFailure) +abstract class ResultReceiver { + abstract fun receive(result: Result) } -fun SuccessOrFailureReceiver(f: (SuccessOrFailure) -> Unit): SuccessOrFailureReceiver = - object : SuccessOrFailureReceiver() { - override fun receive(result: SuccessOrFailure) { +fun ResultReceiver(f: (Result) -> Unit): ResultReceiver = + object : ResultReceiver() { + override fun receive(result: Result) { f(result) } } fun test() { var invoked = false - val receiver = SuccessOrFailureReceiver { result -> + val receiver = ResultReceiver { result -> val intResult = result.getOrThrow() invoked = true } - receiver.receive(SuccessOrFailure(42)) + receiver.receive(Result(42)) if (!invoked) { throw RuntimeException("Fail") } diff --git a/compiler/testData/codegen/box/inlineClasses/crossinlineWithInlineClassInParameter.kt b/compiler/testData/codegen/box/inlineClasses/crossinlineWithInlineClassInParameter.kt index cc1c678f7d4..ad8edb41e95 100644 --- a/compiler/testData/codegen/box/inlineClasses/crossinlineWithInlineClassInParameter.kt +++ b/compiler/testData/codegen/box/inlineClasses/crossinlineWithInlineClassInParameter.kt @@ -1,29 +1,29 @@ // !LANGUAGE: +InlineClasses // IGNORE_BACKEND: JVM_IR -inline class SuccessOrFailure(val a: Any?) { +inline class Result(val a: Any?) { fun getOrThrow(): T = a as T } -abstract class SuccessOrFailureReceiver { - abstract fun receive(result: SuccessOrFailure) +abstract class ResultReceiver { + abstract fun receive(result: Result) } -inline fun SuccessOrFailureReceiver(crossinline f: (SuccessOrFailure) -> Unit): SuccessOrFailureReceiver = - object : SuccessOrFailureReceiver() { - override fun receive(result: SuccessOrFailure) { +inline fun ResultReceiver(crossinline f: (Result) -> Unit): ResultReceiver = + object : ResultReceiver() { + override fun receive(result: Result) { f(result) } } fun test() { var invoked = false - val receiver = SuccessOrFailureReceiver { result -> + val receiver = ResultReceiver { result -> val intResult = result.getOrThrow() invoked = true } - receiver.receive(SuccessOrFailure("42")) + receiver.receive(Result("42")) if (!invoked) { throw RuntimeException("Fail") } diff --git a/compiler/testData/codegen/box/inlineClasses/kt25771.kt b/compiler/testData/codegen/box/inlineClasses/kt25771.kt index 413f4d8af91..a28531295da 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt25771.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt25771.kt @@ -1,15 +1,15 @@ // !LANGUAGE: +InlineClasses // IGNORE_BACKEND: JVM_IR -inline class SuccessOrFailure(val value: Any?) { +inline class Result(val value: Any?) { val isFailure: Boolean get() = value is Failure public companion object { - public inline fun success(value: T): SuccessOrFailure = - SuccessOrFailure(value) + public inline fun success(value: T): Result = + Result(value) - public inline fun failure(exception: Throwable): SuccessOrFailure = - SuccessOrFailure(Failure(exception)) + public inline fun failure(exception: Throwable): Result = + Result(Failure(exception)) } class Failure ( @@ -17,11 +17,11 @@ inline class SuccessOrFailure(val value: Any?) { ) } -inline fun runCatching(block: () -> R): SuccessOrFailure { +inline fun runCatching(block: () -> R): Result { return try { - SuccessOrFailure.success(block()) + Result.success(block()) } catch (e: Throwable) { - SuccessOrFailure.failure(e) + Result.failure(e) } } diff --git a/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt b/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt index ffd6e77190c..bad96cdc9f4 100644 --- a/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt +++ b/compiler/testData/codegen/boxInline/suspend/callableReference/ordinaryParameter.kt @@ -20,7 +20,7 @@ fun builder(c: suspend () -> Unit) { override val context: CoroutineContext get() = EmptyCoroutineContext - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { result.getOrThrow() } }) diff --git a/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt b/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt index d7ca7853543..ed26a580728 100644 --- a/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt +++ b/compiler/testData/codegen/boxInline/suspend/callableReference/suspendOfOrdinary.kt @@ -18,7 +18,7 @@ fun builder(c: suspend () -> Unit) { override val context: CoroutineContext get() = EmptyCoroutineContext - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { result.getOrThrow() } }) diff --git a/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/inlineOnly.kt b/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/inlineOnly.kt index 83d8e5db404..1665a044e12 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/inlineOnly.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/inlineOnly.kt @@ -38,7 +38,7 @@ fun builder(c: suspend () -> Unit) { override val context: CoroutineContext get() = EmptyCoroutineContext - override fun resumeWith(r: SuccessOrFailure) { + override fun resumeWith(r: Result) { r.getOrThrow() proceed = { result = "OK" diff --git a/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/simpleNamed.kt b/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/simpleNamed.kt index 7b4ba8c4ba9..017bb7f2d52 100644 --- a/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/simpleNamed.kt +++ b/compiler/testData/codegen/boxInline/suspend/inlineUsedAsNoinline/simpleNamed.kt @@ -36,7 +36,7 @@ fun builder(c: suspend () -> Unit) { override val context: CoroutineContext get() = EmptyCoroutineContext - override fun resumeWith(r: SuccessOrFailure) { + override fun resumeWith(r: Result) { r.getOrThrow() proceed = { result = "OK" diff --git a/compiler/testData/codegen/bytecodeText/coroutines/doNotReassignContinuation.kt b/compiler/testData/codegen/bytecodeText/coroutines/doNotReassignContinuation.kt index a36647eeb77..89836858a15 100644 --- a/compiler/testData/codegen/bytecodeText/coroutines/doNotReassignContinuation.kt +++ b/compiler/testData/codegen/bytecodeText/coroutines/doNotReassignContinuation.kt @@ -4,7 +4,7 @@ import kotlin.coroutines.* import kotlin.coroutines.intrinsics.* suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x -> - x.resumeWith(SuccessOrFailure.success("OK")) + x.resumeWith(Result.success("OK")) } suspend fun suspendThere(param: Int, param2: String, param3: Long): String { diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntUseBox.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntUseBox.kt new file mode 100644 index 00000000000..b1d3652d673 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntUseBox.kt @@ -0,0 +1,37 @@ +// WITH_COROUTINES +// FILE: test.kt +fun test() { + val result = Result.success("yes!") + val failure = Result.failure(Exception()) + + if (result.isSuccess) println("success") + if (result.isFailure) println("failure") + println(result.getOrThrow()) + println(failure.getOrNull()) + println(failure.exceptionOrNull()) + + val other = Result.success("nope") + if (result == other) println("==") + if (result != other) println("!=") + if (result.equals(other)) println("equals") + if (!result.equals(other)) println("!equals") + + println(result.hashCode()) + println(result.toString()) + println("$result") + + val ans1 = runCatching { 42 } + println(ans1) + + val ans2 = 42.runCatching { this } + println(ans2) + + println(result.getOrElse { "oops" }) + println(result.getOrDefault("oops")) +} + +// @TestKt.class: +// 0 INVOKESTATIC Result.box-impl +// 0 INVOKESTATIC Result.unbox-impl +// 0 Result\$Failure +// 53 Result \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/successOrFailureApiDoesntUseErasedClass.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/successOrFailureApiDoesntUseErasedClass.kt deleted file mode 100644 index 58c68a51411..00000000000 --- a/compiler/testData/codegen/bytecodeText/inlineClasses/successOrFailureApiDoesntUseErasedClass.kt +++ /dev/null @@ -1,36 +0,0 @@ -// WITH_COROUTINES -// FILE: test.kt -fun testSoF() { - val sof = SuccessOrFailure.success("yes!") - val failure = SuccessOrFailure.failure(Exception()) - - if (sof.isSuccess) println("success") - if (sof.isFailure) println("failure") - println(sof.getOrThrow()) - println(failure.getOrNull()) - println(failure.exceptionOrNull()) - - val other = SuccessOrFailure.success("nope") - if (sof == other) println("==") - if (sof != other) println("!=") - if (sof.equals(other)) println("equals") - if (!sof.equals(other)) println("!equals") - - println(sof.hashCode()) - println(sof.toString()) - println("$sof") - - val ans1 = runCatching { 42 } - println(ans1) - - val ans2 = 42.runCatching { this } - println(ans2) - - println(sof.getOrElse { "oops" }) - println(sof.getOrDefault("oops")) -} - -// @TestKt.class: -// 0 SuccessOrFailure\$Erased -// 0 SuccessOrFailure\-Erased -// 58 SuccessOrFailure \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstKotlin/coroutines/simple.kt b/compiler/testData/compileKotlinAgainstKotlin/coroutines/simple.kt index d8f8182426f..f78daed0d4f 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/coroutines/simple.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/coroutines/simple.kt @@ -19,7 +19,7 @@ fun builder(x: suspend () -> Unit) { x.startCoroutine(object : Continuation { override val context: CoroutineContext = EmptyCoroutineContext - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { result.getOrThrow() } }) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/coroutineTestUtil.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/coroutineTestUtil.kt index 9d37fbd2c4b..9bde13729dc 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/coroutineTestUtil.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/coroutineTestUtil.kt @@ -17,7 +17,7 @@ fun createTextForHelpers(isReleaseCoroutines: Boolean): String { val emptyContinuationBody = if (isReleaseCoroutines) """ - |override fun resumeWith(result: SuccessOrFailure) { + |override fun resumeWith(result: Result) { | result.getOrThrow() |} """.trimMargin() @@ -30,7 +30,7 @@ fun createTextForHelpers(isReleaseCoroutines: Boolean): String { val handleResultContinuationBody = if (isReleaseCoroutines) """ - |override fun resumeWith(result: SuccessOrFailure) { + |override fun resumeWith(result: Result) { | x(result.getOrThrow()) |} """.trimMargin() @@ -46,7 +46,7 @@ fun createTextForHelpers(isReleaseCoroutines: Boolean): String { val handleExceptionContinuationBody = if (isReleaseCoroutines) """ - |override fun resumeWith(result: SuccessOrFailure) { + |override fun resumeWith(result: Result) { | result.exceptionOrNull()?.let(x) |} """.trimMargin() @@ -62,7 +62,7 @@ fun createTextForHelpers(isReleaseCoroutines: Boolean): String { val continuationAdapterBody = if (isReleaseCoroutines) """ - |override fun resumeWith(result: SuccessOrFailure) { + |override fun resumeWith(result: Result) { | if (result.isSuccess) { | resume(result.getOrThrow()) | } else { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java index 06a39a6ed02..626a0820868 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeTextTestGenerated.java @@ -2168,16 +2168,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { runTest("compiler/testData/codegen/bytecodeText/inlineClasses/propertySetterWithInlineClassTypeArgument.kt"); } + @TestMetadata("resultApiDoesntUseBox.kt") + public void testResultApiDoesntUseBox() throws Exception { + runTest("compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntUseBox.kt"); + } + @TestMetadata("skipCallToUnderlyingValueOfInlineClass.kt") public void testSkipCallToUnderlyingValueOfInlineClass() throws Exception { runTest("compiler/testData/codegen/bytecodeText/inlineClasses/skipCallToUnderlyingValueOfInlineClass.kt"); } - @TestMetadata("successOrFailureApiDoesntUseErasedClass.kt") - public void testSuccessOrFailureApiDoesntUseErasedClass() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/inlineClasses/successOrFailureApiDoesntUseErasedClass.kt"); - } - @TestMetadata("toStringIsCalledByInlineClass.kt") public void testToStringIsCalledByInlineClass() throws Exception { runTest("compiler/testData/codegen/bytecodeText/inlineClasses/toStringIsCalledByInlineClass.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java index a5eb8d315c5..0dcbb446779 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java @@ -44,7 +44,6 @@ public class DescriptorUtils { COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.child(Name.identifier("Continuation")); public static final FqName CONTINUATION_INTERFACE_FQ_NAME_RELEASE = COROUTINES_PACKAGE_FQ_NAME_RELEASE.child(Name.identifier("Continuation")); - public static final FqName SUCCESS_OR_FAILURE_FQ_NAME = new FqName("kotlin.SuccessOrFailure"); public static final FqName RESULT_FQ_NAME = new FqName("kotlin.Result"); // This JVM-specific class FQ name is declared here only because it's used in MainFunctionDetector which is in frontend diff --git a/idea/resources/inspectionDescriptions/ResultIsResult.html b/idea/resources/inspectionDescriptions/ResultIsResult.html new file mode 100644 index 00000000000..1b83236778f --- /dev/null +++ b/idea/resources/inspectionDescriptions/ResultIsResult.html @@ -0,0 +1,8 @@ + + +This inspection reports functions with Result result. + +Result should never be used as return type. +Throw exception, or use nullable type, or use domain-specific result class to indicate failure. + + \ No newline at end of file diff --git a/idea/resources/inspectionDescriptions/ResultIsSuccessOrFailure.html b/idea/resources/inspectionDescriptions/ResultIsSuccessOrFailure.html deleted file mode 100644 index a5707e1053f..00000000000 --- a/idea/resources/inspectionDescriptions/ResultIsSuccessOrFailure.html +++ /dev/null @@ -1,8 +0,0 @@ - - -This inspection reports functions with SuccessOrFailure result. - -SuccessOrFailure should never be used as return type. -Throw exception, or use nullable type, or use domain-specific result class to indicate failure. - - \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 420d1fce527..a7baa478cf3 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -3021,8 +3021,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. language="kotlin" /> - - - - - - - { companion object : EmptyContinuation() - override fun resumeWith(result: SuccessOrFailure) { result.getOrThrow() } + override fun resumeWith(result: Result) { result.getOrThrow() } } diff --git a/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/expected.xml b/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/expected.xml index b1b4be9224b..3c28c7e6a4e 100644 --- a/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/expected.xml +++ b/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/expected.xml @@ -5,8 +5,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -14,8 +14,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -23,8 +23,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function 'incorrectCatching' returning 'SuccessOrFailure<Double>' without the corresponding function 'incorrect' returning 'Double' + Function returning Result + Function 'incorrectCatching' returning 'Result<Double>' without the corresponding function 'incorrect' returning 'Double' test.kt @@ -32,8 +32,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function 'strangeCatching' returning 'SuccessOrFailure<Boolean>' without the corresponding function 'strange' returning 'Boolean' + Function returning Result + Function 'strangeCatching' returning 'Result<Boolean>' without the corresponding function 'strange' returning 'Boolean' test.kt @@ -41,8 +41,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -50,8 +50,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -59,8 +59,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function 'classIncorrectCatching' returning 'SuccessOrFailure<Double>' without the corresponding function 'classIncorrect' returning 'Double' + Function returning Result + Function 'classIncorrectCatching' returning 'Result<Double>' without the corresponding function 'classIncorrect' returning 'Double' test.kt @@ -68,8 +68,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -77,8 +77,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -86,8 +86,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function returning SuccessOrFailure with a name that does not end with Catching + Function returning Result + Function returning Result with a name that does not end with Catching test.kt @@ -95,8 +95,8 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function 'calcComplexCatching' returning 'SuccessOrFailure<Double>' without the corresponding function 'calcComplex' returning 'Double' + Function returning Result + Function 'calcComplexCatching' returning 'Result<Double>' without the corresponding function 'calcComplex' returning 'Double' test.kt @@ -104,7 +104,7 @@ light_idea_test_case <default> - Function returning SuccessOrFailure - Function 'extensionActCatching' returning 'SuccessOrFailure<Int>' without the corresponding function 'extensionAct' returning 'Int' + Function returning Result + Function 'extensionActCatching' returning 'Result<Int>' without the corresponding function 'extensionAct' returning 'Int' \ No newline at end of file diff --git a/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/inspections.test b/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/inspections.test index df31c1167b7..8593daf400f 100644 --- a/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/inspections.test +++ b/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/inspectionData/inspections.test @@ -1 +1 @@ -// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.coroutines.ResultIsSuccessOrFailureInspection +// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.coroutines.ResultIsResultInspection diff --git a/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/test.kt b/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/test.kt index 0d127ea1e7c..c3e3107aae8 100644 --- a/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/test.kt +++ b/idea/testData/inspections/coroutines/resultIsSuccessOrFailure/test.kt @@ -1,67 +1,67 @@ package kotlin // NO (constructor) -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } // YES fun getSuccess() = success() // YES -fun getSuccessExplicit(): SuccessOrFailure = SuccessOrFailure(456) +fun getSuccessExplicit(): Result = Result(456) // NO (not catching 'correct' available) -fun correctCatching() = SuccessOrFailure(true) -// NO (not SuccessOrFailure) +fun correctCatching() = Result(true) +// NO (not Result) fun correct() = true // YES -fun incorrectCatching() = SuccessOrFailure(3.14) +fun incorrectCatching() = Result(3.14) // YES fun strangeCatching() = runCatching { false } -// NO (not SuccessOrFailure) +// NO (not Result) fun strange() = 1 class Container { // YES - fun classGetSuccess() = SuccessOrFailure("123") + fun classGetSuccess() = Result("123") // YES - fun classGetSuccessExplicit(): SuccessOrFailure = SuccessOrFailure(456) + fun classGetSuccessExplicit(): Result = Result(456) // NO (not catching 'classCorrect' available) - fun classCorrectCatching() = SuccessOrFailure(true) - // NO (not SuccessOrFailure) + fun classCorrectCatching() = Result(true) + // NO (not Result) fun classCorrect() = true // YES - fun classIncorrectCatching() = SuccessOrFailure(3.14) + fun classIncorrectCatching() = Result(3.14) } fun test() { // YES - fun localGetSuccess() = SuccessOrFailure("123") + fun localGetSuccess() = Result("123") // YES - val anonymous = fun() = SuccessOrFailure(45) + val anonymous = fun() = Result(45) // YES - val lambda = { SuccessOrFailure(true) } + val lambda = { Result(true) } // NO yet (we do not report local *catching functions) - fun localCatching() = SuccessOrFailure(2.72) + fun localCatching() = Result(2.72) } // NO (stdlib) -fun success() = SuccessOrFailure(true) +fun success() = Result(true) // NO (stdlib) -fun failure() = SuccessOrFailure(false) +fun failure() = Result(false) // NO (stdlib) -fun runCatching(block: () -> T) = SuccessOrFailure(block()) +fun runCatching(block: () -> T) = Result(block()) // NO (stdlib) -fun SuccessOrFailure.id() = this +fun Result.id() = this class ClassWithExtension() { - // NO (not SuccessOrFailure) + // NO (not Result) fun calc() = 12345 - // NO (not SuccessOrFailure) + // NO (not Result) fun calcComplex(arg1: Int, arg2: Double): Double = arg1 + arg2 // YES (different parameters) - fun calcComplexCatching() = SuccessOrFailure(0.0) + fun calcComplexCatching() = Result(0.0) } // NO (extension to calc) -fun ClassWithExtension.calcCatching() = SuccessOrFailure(calc()) -// NO (not SuccessOrFailure) +fun ClassWithExtension.calcCatching() = Result(calc()) +// NO (not Result) fun Container.extensionAct() = 42 // YES (different extension receiver) -fun ClassWithExtension.extensionActCatching() = SuccessOrFailure(42) \ No newline at end of file +fun ClassWithExtension.extensionActCatching() = Result(42) \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt b/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt index 57ca33eb0eb..31b0297a26e 100644 --- a/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt +++ b/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt @@ -2,10 +2,10 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun runCatching(block: () -> T) = SuccessOrFailure(block()) +fun runCatching(block: () -> T) = Result(block()) fun correct(arg: Boolean) = runCatching { if (arg) throw AssertionError("") else 12 }.getOrThrow() diff --git a/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt.after b/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt.after index 152c1daa6d6..08774304918 100644 --- a/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/redundantRunCatching/simple.kt.after @@ -2,10 +2,10 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun runCatching(block: () -> T) = SuccessOrFailure(block()) +fun runCatching(block: () -> T) = Result(block()) fun correct(arg: Boolean) = run { if (arg) throw AssertionError("") else 12 } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/.inspection b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/.inspection index 2bc61e77d26..2472e3b1763 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/.inspection +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/.inspection @@ -1 +1 @@ -org.jetbrains.kotlin.idea.inspections.coroutines.ResultIsSuccessOrFailureInspection +org.jetbrains.kotlin.idea.inspections.coroutines.ResultIsResultInspection diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt index 3c3db3c7f7b..eca0fa2cc49 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt @@ -1,10 +1,10 @@ -// FIX: Unwrap 'SuccessOrFailure' return type (breaks use-sites!) +// FIX: Unwrap 'Result' return type (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } abstract class Abstract { - abstract fun foo(): SuccessOrFailure + abstract fun foo(): Result } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt.after index 6e5fc1805e0..298ec69dc8f 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/abstract.kt.after @@ -1,7 +1,7 @@ -// FIX: Unwrap 'SuccessOrFailure' return type (breaks use-sites!) +// FIX: Unwrap 'Result' return type (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt index ede7661c6bc..18e1d1fef52 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt @@ -1,9 +1,9 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test() { - val x = fun() = SuccessOrFailure("123") + val x = fun() = Result("123") } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt.after index cf4844c9ea7..0ed75a0da15 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/anonymous.kt.after @@ -1,9 +1,9 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test() { - val x = fun() = SuccessOrFailure("123").getOrThrow() + val x = fun() = Result("123").getOrThrow() } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt index 0f4d7455fc1..7d9fbc896e1 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt @@ -3,28 +3,28 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun incorrectBlock(arg: Boolean, arg2: Boolean?): SuccessOrFailure { +fun incorrectBlock(arg: Boolean, arg2: Boolean?): Result { if (arg) { class Local { - fun foo(): SuccessOrFailure { - return SuccessOrFailure("NO") + fun foo(): Result { + return Result("NO") } } - return SuccessOrFailure(1) + return Result(1) } else { when (arg2) { true -> { - val x = fun(): SuccessOrFailure { - return SuccessOrFailure(false) + val x = fun(): Result { + return Result(false) } if (x().getOrThrow()) { - return SuccessOrFailure(2) + return Result(2) } else { - return SuccessOrFailure(0) + return Result(0) } } else -> { @@ -32,9 +32,9 @@ fun incorrectBlock(arg: Boolean, arg2: Boolean?): SuccessOrFailure { listOf(1, 2, 3).forEach { if (it == 2) return@forEach } - return SuccessOrFailure(3) + return Result(3) } - return SuccessOrFailure(4) + return Result(4) } } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt.after index a52b32cf2f5..272921fd2f4 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/complexBlock.kt.after @@ -3,28 +3,28 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun incorrectBlock(arg: Boolean, arg2: Boolean?): Int { if (arg) { class Local { - fun foo(): SuccessOrFailure { - return SuccessOrFailure("NO") + fun foo(): Result { + return Result("NO") } } - return SuccessOrFailure(1).getOrThrow() + return Result(1).getOrThrow() } else { when (arg2) { true -> { - val x = fun(): SuccessOrFailure { - return SuccessOrFailure(false) + val x = fun(): Result { + return Result(false) } if (x().getOrThrow()) { - return SuccessOrFailure(2).getOrThrow() + return Result(2).getOrThrow() } else { - return SuccessOrFailure(0).getOrThrow() + return Result(0).getOrThrow() } } else -> { @@ -32,9 +32,9 @@ fun incorrectBlock(arg: Boolean, arg2: Boolean?): Int { listOf(1, 2, 3).forEach { if (it == 2) return@forEach } - return SuccessOrFailure(3).getOrThrow() + return Result(3).getOrThrow() } - return SuccessOrFailure(4).getOrThrow() + return Result(4).getOrThrow() } } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt index 60c6bef699a..054a6d60da8 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt @@ -1,9 +1,9 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test() { - val x = { SuccessOrFailure(true) } + val x = { Result(true) } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt.after index c5c14cdf36e..40720e00bf4 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaSimple.kt.after @@ -1,9 +1,9 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test() { - val x = { SuccessOrFailure(true).getOrThrow() } + val x = { Result(true).getOrThrow() } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt index 3c2004237e9..b41a5bcaa70 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt @@ -1,15 +1,15 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test(arg: Boolean) { val x = foo@{ if (!arg) { - return@foo SuccessOrFailure(true) + return@foo Result(true) } else { - SuccessOrFailure(false) + Result(false) } } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt.after index a8eb84d5c92..130de70bf80 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithPartialReturn.kt.after @@ -1,15 +1,15 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test(arg: Boolean) { val x = foo@{ (if (!arg) { - return@foo SuccessOrFailure(true).getOrThrow() + return@foo Result(true).getOrThrow() } else { - SuccessOrFailure(false) + Result(false) }).getOrThrow() } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt index 331a8c5295b..980f2e9966b 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt @@ -1,9 +1,9 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test() { - val x = foo@{ return@foo SuccessOrFailure(true) } + val x = foo@{ return@foo Result(true) } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt.after index af0958bb741..e7b645afe21 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/lambdaWithReturn.kt.after @@ -1,9 +1,9 @@ package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun test() { - val x = foo@{ return@foo SuccessOrFailure(true).getOrThrow() } + val x = foo@{ return@foo Result(true).getOrThrow() } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt index 2f0c2434e1a..c84a0006e72 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt @@ -1,10 +1,10 @@ // FIX: Add '.getOrThrow()' to function result (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") - operator fun plus(other: SuccessOrFailure) = other + operator fun plus(other: Result) = other } -fun incorrect() = SuccessOrFailure("123") + SuccessOrFailure("456") +fun incorrect() = Result("123") + Result("456") diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt.after index 465d66ebf0a..e60c1a75f6b 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/needParentheses.kt.after @@ -1,10 +1,10 @@ // FIX: Add '.getOrThrow()' to function result (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") - operator fun plus(other: SuccessOrFailure) = other + operator fun plus(other: Result) = other } -fun incorrect() = (SuccessOrFailure("123") + SuccessOrFailure("456")).getOrThrow() +fun incorrect() = (Result("123") + Result("456")).getOrThrow() diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt index 1128e002515..c3ca9a4eefd 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt @@ -1,8 +1,8 @@ // FIX: Rename to 'incorrectCatching' package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun incorrect() = SuccessOrFailure("123") +fun incorrect() = Result("123") diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt.after index e8d10496ddb..cb49ccf7263 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/rename.kt.after @@ -1,8 +1,8 @@ // FIX: Rename to 'incorrectCatching' package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun incorrectCatching() = SuccessOrFailure("123") +fun incorrectCatching() = Result("123") diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt index 728fef4971c..7b87764cfcf 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt @@ -1,8 +1,8 @@ // FIX: Add '.getOrThrow()' to function result (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun incorrect() = SuccessOrFailure("123") +fun incorrect() = Result("123") diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt.after index 7a8e2795d11..936cd9048d5 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simple.kt.after @@ -1,8 +1,8 @@ // FIX: Add '.getOrThrow()' to function result (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun incorrect() = SuccessOrFailure("123").getOrThrow() +fun incorrect() = Result("123").getOrThrow() diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt index b1b09e1904c..471d2dee293 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt @@ -1,21 +1,21 @@ // FIX: Add '.getOrThrow()' to function result (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } -fun incorrectBlock(arg: Boolean, arg2: Boolean?): SuccessOrFailure { +fun incorrectBlock(arg: Boolean, arg2: Boolean?): Result { if (arg) { - return SuccessOrFailure(1) + return Result(1) } else { when (arg2) { - true -> return SuccessOrFailure(2) + true -> return Result(2) else -> { if (arg2 == false) { - return SuccessOrFailure(3) + return Result(3) } - return SuccessOrFailure(4) + return Result(4) } } } diff --git a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt.after b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt.after index ed2f4fb131c..a077719ec33 100644 --- a/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt.after +++ b/idea/testData/inspectionsLocal/coroutines/resultIsSuccessOrFailure/simpleBlock.kt.after @@ -1,21 +1,21 @@ // FIX: Add '.getOrThrow()' to function result (breaks use-sites!) package kotlin -class SuccessOrFailure(val value: T?) { +class Result(val value: T?) { fun getOrThrow(): T = value ?: throw AssertionError("") } fun incorrectBlock(arg: Boolean, arg2: Boolean?): Int { if (arg) { - return SuccessOrFailure(1).getOrThrow() + return Result(1).getOrThrow() } else { when (arg2) { - true -> return SuccessOrFailure(2).getOrThrow() + true -> return Result(2).getOrThrow() else -> { if (arg2 == false) { - return SuccessOrFailure(3).getOrThrow() + return Result(3).getOrThrow() } - return SuccessOrFailure(4).getOrThrow() + return Result(4).getOrThrow() } } } diff --git a/js/js.translator/testData/box/coroutines/localVarOptimization.kt b/js/js.translator/testData/box/coroutines/localVarOptimization.kt index 36539299c6c..c58e0a8462f 100644 --- a/js/js.translator/testData/box/coroutines/localVarOptimization.kt +++ b/js/js.translator/testData/box/coroutines/localVarOptimization.kt @@ -19,7 +19,7 @@ fun build(x: suspend () -> Unit) { x.startCoroutine(object : Continuation { override val context = EmptyCoroutineContext - override fun resumeWith(x: SuccessOrFailure) { + override fun resumeWith(x: Result) { complete = true } }) diff --git a/js/js.translator/testData/box/coroutines/nativeExceptions.kt b/js/js.translator/testData/box/coroutines/nativeExceptions.kt index c2851e2de03..5e39c5fbd4a 100644 --- a/js/js.translator/testData/box/coroutines/nativeExceptions.kt +++ b/js/js.translator/testData/box/coroutines/nativeExceptions.kt @@ -12,7 +12,7 @@ suspend fun delay(): Unit = suspendCoroutine { c -> fun build(c: suspend () -> Unit) { c.startCoroutine(object : Continuation { - override fun resumeWith(x: SuccessOrFailure) { + override fun resumeWith(x: Result) { stopped = true } diff --git a/js/js.translator/testData/box/incremental/coroutines.kt b/js/js.translator/testData/box/incremental/coroutines.kt index c8f719e1725..d7c196a5498 100644 --- a/js/js.translator/testData/box/incremental/coroutines.kt +++ b/js/js.translator/testData/box/incremental/coroutines.kt @@ -21,7 +21,7 @@ fun builder(c: suspend () -> Unit) { c.startCoroutine(object : Continuation { override val context = EmptyCoroutineContext - override fun resumeWith(result: SuccessOrFailure) {} + override fun resumeWith(result: Result) {} }) } diff --git a/libraries/stdlib/coroutines-experimental/jvm/src/kotlin/coroutines/experimental/migration/CoroutinesMigration.kt b/libraries/stdlib/coroutines-experimental/jvm/src/kotlin/coroutines/experimental/migration/CoroutinesMigration.kt index 9d2e388526c..62135995aba 100644 --- a/libraries/stdlib/coroutines-experimental/jvm/src/kotlin/coroutines/experimental/migration/CoroutinesMigration.kt +++ b/libraries/stdlib/coroutines-experimental/jvm/src/kotlin/coroutines/experimental/migration/CoroutinesMigration.kt @@ -79,7 +79,7 @@ private class ExperimentalContinuationMigration(val continuation: Continuatio private class ContinuationMigration(val continuation: ExperimentalContinuation): Continuation { override val context: CoroutineContext = continuation.context.toCoroutineContext() - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { result .onSuccess { continuation.resume(it) } .onFailure { continuation.resumeWithException(it) } diff --git a/libraries/stdlib/coroutines/common/src/kotlin/CoroutinesH.kt b/libraries/stdlib/coroutines/common/src/kotlin/CoroutinesH.kt index c368bc79750..26e707dfa0f 100644 --- a/libraries/stdlib/coroutines/common/src/kotlin/CoroutinesH.kt +++ b/libraries/stdlib/coroutines/common/src/kotlin/CoroutinesH.kt @@ -17,5 +17,5 @@ internal expect class SafeContinuation : Continuation { internal fun getOrThrow(): Any? override val context: CoroutineContext - override fun resumeWith(result: SuccessOrFailure): Unit + override fun resumeWith(result: Result): Unit } diff --git a/libraries/stdlib/coroutines/js/src/kotlin/coroutines/SafeContinuationJs.kt b/libraries/stdlib/coroutines/js/src/kotlin/coroutines/SafeContinuationJs.kt index 64876f83cba..07e95125113 100644 --- a/libraries/stdlib/coroutines/js/src/kotlin/coroutines/SafeContinuationJs.kt +++ b/libraries/stdlib/coroutines/js/src/kotlin/coroutines/SafeContinuationJs.kt @@ -23,7 +23,7 @@ internal actual constructor( private var result: Any? = initialResult - public actual override fun resumeWith(result: SuccessOrFailure) { + public actual override fun resumeWith(result: Result) { val cur = this.result when { cur === UNDECIDED -> { @@ -46,7 +46,7 @@ internal actual constructor( val result = this.result return when { result === RESUMED -> COROUTINE_SUSPENDED // already called continuation, indicate COROUTINE_SUSPENDED upstream - result is SuccessOrFailure.Failure -> throw result.exception + result is Result.Failure -> throw result.exception else -> result // either COROUTINE_SUSPENDED or data } } diff --git a/libraries/stdlib/coroutines/js/src/kotlin/coroutines/js/internal/CoroutineImpl.kt b/libraries/stdlib/coroutines/js/src/kotlin/coroutines/js/internal/CoroutineImpl.kt index 310f95a6316..429e0258499 100644 --- a/libraries/stdlib/coroutines/js/src/kotlin/coroutines/js/internal/CoroutineImpl.kt +++ b/libraries/stdlib/coroutines/js/src/kotlin/coroutines/js/internal/CoroutineImpl.kt @@ -25,7 +25,7 @@ internal abstract class CoroutineImpl(private val resultContinuation: Continuati ?: (context[ContinuationInterceptor]?.interceptContinuation(this) ?: this) .also { intercepted_ = it } - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { var current = this var currentResult: Any? = result.getOrNull() var currentException: Throwable? = result.exceptionOrNull() @@ -84,7 +84,7 @@ internal object CompletedContinuation : Continuation { override val context: CoroutineContext get() = error("This continuation is already complete") - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { error("This continuation is already complete") } diff --git a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/SafeContinuationJvm.kt b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/SafeContinuationJvm.kt index 8e95ee257a2..d51151f151a 100644 --- a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/SafeContinuationJvm.kt +++ b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/SafeContinuationJvm.kt @@ -34,7 +34,7 @@ internal actual constructor( ) } - public actual override fun resumeWith(result: SuccessOrFailure) { + public actual override fun resumeWith(result: Result) { while (true) { // lock-free loop val cur = this.result // atomic read when { @@ -57,7 +57,7 @@ internal actual constructor( } return when { result === RESUMED -> COROUTINE_SUSPENDED // already called continuation, indicate COROUTINE_SUSPENDED upstream - result is SuccessOrFailure.Failure -> throw result.exception + result is Result.Failure -> throw result.exception else -> result // either COROUTINE_SUSPENDED or data } } diff --git a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/intrinsics/IntrinsicsJvm.kt b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/intrinsics/IntrinsicsJvm.kt index d7f9f616065..c04626c1a61 100644 --- a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/intrinsics/IntrinsicsJvm.kt +++ b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/intrinsics/IntrinsicsJvm.kt @@ -162,7 +162,7 @@ private inline fun createCoroutineFromSuspendFunction( object : RestrictedContinuationImpl(completion as Continuation) { private var label = 0 - override fun invokeSuspend(result: SuccessOrFailure): Any? = + override fun invokeSuspend(result: Result): Any? = when (label) { 0 -> { label = 1 @@ -180,7 +180,7 @@ private inline fun createCoroutineFromSuspendFunction( object : ContinuationImpl(completion as Continuation, context) { private var label = 0 - override fun invokeSuspend(result: SuccessOrFailure): Any? = + override fun invokeSuspend(result: Result): Any? = when (label) { 0 -> { label = 1 diff --git a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt index 2bd632769a5..9d8c2eb1e8f 100644 --- a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt +++ b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt @@ -18,7 +18,7 @@ internal abstract class BaseContinuationImpl( public val completion: Continuation? ) : Continuation, CoroutineStackFrame, Serializable { // This implementation is final. This fact is used to unroll resumeWith recursion. - public final override fun resumeWith(result: SuccessOrFailure) { + public final override fun resumeWith(result: Result) { // Invoke "resume" debug probe only once, even if previous frames are "resumed" in the loop below, too probeCoroutineResumed(this) // This loop unrolls recursion in current.resumeWith(param) to make saner and shorter stack traces on resume @@ -27,13 +27,13 @@ internal abstract class BaseContinuationImpl( while (true) { with(current) { val completion = completion!! // fail fast when trying to resume continuation without completion - val outcome: SuccessOrFailure = + val outcome: Result = try { val outcome = invokeSuspend(param) if (outcome === COROUTINE_SUSPENDED) return - SuccessOrFailure.success(outcome) + Result.success(outcome) } catch (exception: Throwable) { - SuccessOrFailure.failure(exception) + Result.failure(exception) } releaseIntercepted() // this state machine instance is terminating if (completion is BaseContinuationImpl) { @@ -49,7 +49,7 @@ internal abstract class BaseContinuationImpl( } } - protected abstract fun invokeSuspend(result: SuccessOrFailure): Any? + protected abstract fun invokeSuspend(result: Result): Any? protected open fun releaseIntercepted() { // does nothing here, overridden in ContinuationImpl @@ -124,7 +124,7 @@ internal object CompletedContinuation : Continuation { override val context: CoroutineContext get() = error("This continuation is already complete") - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { error("This continuation is already complete") } diff --git a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/RunSuspend.kt b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/RunSuspend.kt index a2ff089cada..7e6986fb00c 100644 --- a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/RunSuspend.kt +++ b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/RunSuspend.kt @@ -24,9 +24,9 @@ private class RunSuspend : Continuation { override val context: CoroutineContext get() = EmptyCoroutineContext - var result: SuccessOrFailure? = null + var result: Result? = null - override fun resumeWith(result: SuccessOrFailure) = synchronized(this) { + override fun resumeWith(result: Result) = synchronized(this) { this.result = result (this as Object).notifyAll() } diff --git a/libraries/stdlib/coroutines/jvm/test/DebugMetadataTest.kt b/libraries/stdlib/coroutines/jvm/test/DebugMetadataTest.kt index 364ea717eb9..55f0027368d 100644 --- a/libraries/stdlib/coroutines/jvm/test/DebugMetadataTest.kt +++ b/libraries/stdlib/coroutines/jvm/test/DebugMetadataTest.kt @@ -33,7 +33,7 @@ private class MyContinuation : BaseContinuationImpl(null) { var label = 0 - override fun invokeSuspend(result: SuccessOrFailure): Any? = null + override fun invokeSuspend(result: Result): Any? = null } class DebugMetadataTest { diff --git a/libraries/stdlib/coroutines/jvm/test/SuccessOrFailureTest.kt b/libraries/stdlib/coroutines/jvm/test/ResultTest.kt similarity index 88% rename from libraries/stdlib/coroutines/jvm/test/SuccessOrFailureTest.kt rename to libraries/stdlib/coroutines/jvm/test/ResultTest.kt index 94952a3002c..55fad3ade27 100644 --- a/libraries/stdlib/coroutines/jvm/test/SuccessOrFailureTest.kt +++ b/libraries/stdlib/coroutines/jvm/test/ResultTest.kt @@ -7,7 +7,7 @@ package test.kotlin import kotlin.test.* -class SuccessOrFailureTest { +class ResultTest { @Test fun testRunCatchingSuccess() { val ok = runCatching { "OK" } @@ -22,17 +22,17 @@ class SuccessOrFailureTest { @Test fun testConstructedSuccess() { - val ok = SuccessOrFailure.success("OK") + val ok = Result.success("OK") checkSuccess(ok, "OK", true) } @Test fun testConstructedFailure() { - val fail = SuccessOrFailure.failure(IllegalStateException("F")) + val fail = Result.failure(IllegalStateException("F")) checkFailure(fail, "F", true) } - private fun checkSuccess(ok: SuccessOrFailure, v: T, topLevel: Boolean = false) { + private fun checkSuccess(ok: Result, v: T, topLevel: Boolean = false) { assertTrue(ok.isSuccess) assertFalse(ok.isFailure) assertEquals(v, ok.getOrThrow()) @@ -44,7 +44,7 @@ class SuccessOrFailureTest { assertEquals("V:$v", ok.fold({ "V:$it" }, { "EX:$it" })) assertEquals(null, ok.exceptionOrNull()) assertEquals(null, ok.fold(onSuccess = { null }, onFailure = { it })) - assertEquals(v.toString(), ok.toString()) + assertEquals("Success($v)", ok.toString()) assertEquals(ok, ok) if (topLevel) { checkSuccess(ok.map { 42 }, 42) @@ -62,7 +62,7 @@ class SuccessOrFailureTest { assertEquals(0, fCnt) } - private fun checkFailure(fail: SuccessOrFailure, msg: String, topLevel: Boolean = false) { + private fun checkFailure(fail: Result, msg: String, topLevel: Boolean = false) { assertFalse(fail.isSuccess) assertTrue(fail.isFailure) assertFails { fail.getOrThrow() } diff --git a/libraries/stdlib/coroutines/jvm/test/TestDispatcher.kt b/libraries/stdlib/coroutines/jvm/test/TestDispatcher.kt index 5b2f5d481ef..41ccf8f2235 100644 --- a/libraries/stdlib/coroutines/jvm/test/TestDispatcher.kt +++ b/libraries/stdlib/coroutines/jvm/test/TestDispatcher.kt @@ -41,7 +41,7 @@ class TestDispatcher( inner class DispatchedContinuation(val delegate: Continuation) : Continuation { override val context: CoroutineContext = delegate.context - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { executor.execute { delegate.resumeWith(result) } diff --git a/libraries/stdlib/coroutines/src/kotlin/Result.kt b/libraries/stdlib/coroutines/src/kotlin/Result.kt new file mode 100644 index 00000000000..e794ff5e9fb --- /dev/null +++ b/libraries/stdlib/coroutines/src/kotlin/Result.kt @@ -0,0 +1,328 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("UNCHECKED_CAST", "RedundantVisibilityModifier") + +package kotlin + +import kotlin.contracts.* +import kotlin.internal.InlineOnly +import kotlin.jvm.JvmField + +/** + * A discriminated union that encapsulates successful outcome with a value of type [T] + * or a failure with an arbitrary [Throwable] exception. + */ +@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") +public inline class Result @PublishedApi internal constructor( + @PublishedApi + internal val value: Any? +) : Serializable { + // discovery + + /** + * Returns `true` if this instance represents successful outcome. + * In this case [isFailure] returns `false`. + */ + public val isSuccess: Boolean get() = value !is Failure + + /** + * Returns `true` if this instance represents failed outcome. + * In this case [isSuccess] returns `false`. + */ + public val isFailure: Boolean get() = value is Failure + + // value & exception retrieval + + /** + * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or `null` + * if it is [failure][Result.isFailure]. + * + * This function is shorthand for `getOrElse { null }` (see [getOrElse]) or + * `fold(onSuccess = { it }, onFailure = { null })` (see [fold]). + */ + public fun getOrNull(): T? = + when (value) { + is Failure -> null + else -> value as T + } + + /** + * Returns the encapsulated exception if this instance represents [failure][isFailure] or `null` + * if it is [success][isSuccess]. + * + * This function is shorthand for `fold(onSuccess = { null }, onFailure = { it })` (see [fold]). + */ + public fun exceptionOrNull(): Throwable? = + when (value) { + is Failure -> value.exception + else -> null + } + + /** + * Returns a string `Success(v)` if this instance represents [success][Result.isSuccess] + * where `v` is a string representation of the value or a string `Failure(x)` if + * it is [failure][isFailure] where `x` is a string representation of the exception. + */ + public override fun toString(): String = + when (value) { + is Failure -> value.toString() // "Failure($exception)" + else -> "Success($value)" + } + + // companion with constructors + + /** + * Companion object for [Result] class that contains its constructor functions + * [success] and [failure]. + */ + public companion object { + /** + * Returns an instance that encapsulates the given [value] as successful value. + */ + @InlineOnly public inline fun success(value: T): Result = + Result(value) + + /** + * Returns an instance that encapsulates the given [exception] as failure. + */ + @InlineOnly public inline fun failure(exception: Throwable): Result = + Result(createFailure(exception)) + } + + internal class Failure( + @JvmField + val exception: Throwable + ) : Serializable { + override fun equals(other: Any?): Boolean = other is Failure && exception == other.exception + override fun hashCode(): Int = exception.hashCode() + override fun toString(): String = "Failure($exception)" + } +} + +/** + * Creates an instance of internal marker [Result.Failure] class to + * make sure that this class is not exposed in ABI. + */ +@PublishedApi +internal fun createFailure(exception: Throwable): Any = + Result.Failure(exception) + +/** + * Throws exception if the result is failure. This internal function minimizes + * inlined bytecode for [getOrThrow] and makes sure that in the future we can + * add some exception-augmenting logic here (if needed). + */ +@PublishedApi +internal fun Result<*>.throwOnFailure() { + if (value is Result.Failure) throw value.exception +} + +/** + * Calls the specified function [block] and returns its encapsulated result if invocation was successful, + * catching and encapsulating any thrown exception as a failure. + */ +@InlineOnly +public inline fun runCatching(block: () -> R): Result { + contract { + callsInPlace(block, InvocationKind.EXACTLY_ONCE) + } + return try { + Result.success(block()) + } catch (e: Throwable) { + Result.failure(e) + } +} + +/** + * Calls the specified function [block] with `this` value as its receiver and returns its encapsulated result + * if invocation was successful, catching and encapsulating any thrown exception as a failure. + */ +@InlineOnly +public inline fun T.runCatching(block: T.() -> R): Result { + contract { + callsInPlace(block, InvocationKind.EXACTLY_ONCE) + } + return try { + Result.success(block()) + } catch (e: Throwable) { + Result.failure(e) + } +} + +// -- extensions --- + +/** + * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or throws the encapsulated exception + * if it is [failure][Result.isFailure]. + * + * This function is shorthand for `getOrElse { throw it }` (see [getOrElse]). + */ +@InlineOnly +public inline fun Result.getOrThrow(): T { + throwOnFailure() + return value as T +} + +/** + * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or the + * result of [onFailure] function for encapsulated exception if it is [failure][Result.isFailure]. + * + * Note, that an exception thrown by [onFailure] function is rethrown by this function. + * + * This function is shorthand for `fold(onSuccess = { it }, onFailure = onFailure)` (see [fold]). + */ +@InlineOnly +public inline fun Result.getOrElse(onFailure: (exception: Throwable) -> R): R { + contract { + callsInPlace(onFailure, InvocationKind.AT_MOST_ONCE) + } + return when(val exception = exceptionOrNull()) { + null -> value as T + else -> onFailure(exception) + } +} + +/** + * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or the + * [defaultValue] if it is [failure][Result.isFailure]. + * + * This function is shorthand for `getOrElse { defaultValue }` (see [getOrElse]). + */ +@InlineOnly +public inline fun Result.getOrDefault(defaultValue: R): R { + if (isFailure) return defaultValue + return value as T +} + +/** + * Returns the the result of [onSuccess] for encapsulated value if this instance represents [success][Result.isSuccess] + * or the result of [onFailure] function for encapsulated exception if it is [failure][Result.isFailure]. + * + * Note, that an exception thrown by [onSuccess] or by [onFailure] function is rethrown by this function. + */ +@InlineOnly +public inline fun Result.fold( + onSuccess: (value: T) -> R, + onFailure: (exception: Throwable) -> R +): R { + contract { + callsInPlace(onSuccess, InvocationKind.AT_MOST_ONCE) + callsInPlace(onFailure, InvocationKind.AT_MOST_ONCE) + } + return when(val exception = exceptionOrNull()) { + null -> onSuccess(value as T) + else -> onFailure(exception) + } +} + +// transformation + +/** + * Returns the encapsulated result of the given [transform] function applied to encapsulated value + * if this instance represents [success][Result.isSuccess] or the + * original encapsulated exception if it is [failure][Result.isFailure]. + * + * Note, that an exception thrown by [transform] function is rethrown by this function. + * See [mapCatching] for an alternative that encapsulates exceptions. + */ +@InlineOnly +public inline fun Result.map(transform: (value: T) -> R): Result { + contract { + callsInPlace(transform, InvocationKind.AT_MOST_ONCE) + } + return when(val exception = exceptionOrNull()) { + null -> Result.success(transform(value as T)) + else -> Result(value) + } +} + +/** + * Returns the encapsulated result of the given [transform] function applied to encapsulated value + * if this instance represents [success][Result.isSuccess] or the + * original encapsulated exception if it is [failure][Result.isFailure]. + * + * Any exception thrown by [transform] function is caught, encapsulated as a failure and returned by this function. + * See [map] for an alternative that rethrows exceptions. + */ +@InlineOnly +public inline fun Result.mapCatching(transform: (value: T) -> R): Result { + contract { + callsInPlace(transform, InvocationKind.AT_MOST_ONCE) + } + return when(val exception = exceptionOrNull()) { + null -> runCatching { transform(value as T) } + else -> Result(value) + } +} + +/** + * Returns the encapsulated result of the given [transform] function applied to encapsulated exception + * if this instance represents [failure][Result.isFailure] or the + * original encapsulated value if it is [success][Result.isSuccess]. + * + * Note, that an exception thrown by [transform] function is rethrown by this function. + * See [recoverCatching] for an alternative that encapsulates exceptions. + */ +@InlineOnly +public inline fun Result.recover(transform: (exception: Throwable) -> R): Result { + contract { + callsInPlace(transform, InvocationKind.AT_MOST_ONCE) + } + return when(val exception = exceptionOrNull()) { + null -> this + else -> Result.success(transform(exception)) + } +} + +/** + * Returns the encapsulated result of the given [transform] function applied to encapsulated exception + * if this instance represents [failure][Result.isFailure] or the + * original encapsulated value if it is [success][Result.isSuccess]. + * + * Any exception thrown by [transform] function is caught, encapsulated as a failure and returned by this function. + * See [recover] for an alternative that rethrows exceptions. + */ +@InlineOnly +public inline fun Result.recoverCatching(transform: (exception: Throwable) -> R): Result { + contract { + callsInPlace(transform, InvocationKind.AT_MOST_ONCE) + } + val value = value // workaround for inline classes BE bug + return when(val exception = exceptionOrNull()) { + null -> this + else -> runCatching { transform(exception) } + } +} + +// "peek" onto value/exception and pipe + +/** + * Performs the given [action] on encapsulated value if this instance represents [success][Result.isSuccess]. + * Returns the original `Result` unchanged. + */ +@InlineOnly +public inline fun Result.onFailure(action: (exception: Throwable) -> Unit): Result { + contract { + callsInPlace(action, InvocationKind.AT_MOST_ONCE) + } + exceptionOrNull()?.let { action(it) } + return this +} + +/** + * Performs the given [action] on encapsulated exception if this instance represents [failure][Result.isFailure]. + * Returns the original `Result` unchanged. + */ +@InlineOnly +public inline fun Result.onSuccess(action: (value: T) -> Unit): Result { + contract { + callsInPlace(action, InvocationKind.AT_MOST_ONCE) + } + if (isSuccess) action(value as T) + return this +} + +// ------------------- \ No newline at end of file diff --git a/libraries/stdlib/coroutines/src/kotlin/coroutines/Continuation.kt b/libraries/stdlib/coroutines/src/kotlin/coroutines/Continuation.kt index b2c3a9a84a9..8af4ffbb2fa 100644 --- a/libraries/stdlib/coroutines/src/kotlin/coroutines/Continuation.kt +++ b/libraries/stdlib/coroutines/src/kotlin/coroutines/Continuation.kt @@ -7,6 +7,7 @@ package kotlin.coroutines import kotlin.coroutines.intrinsics.* import kotlin.internal.InlineOnly +import kotlin.jvm.JvmName /** * Interface representing a continuation after a suspension point that returns value of type `T`. @@ -23,7 +24,7 @@ public interface Continuation { * Resumes the execution of the corresponding coroutine passing successful or failed [result] as the * return value of the last suspension point. */ - public fun resumeWith(result: SuccessOrFailure) + public fun resumeWith(result: Result) } /** @@ -41,7 +42,7 @@ public annotation class RestrictsSuspension */ @SinceKotlin("1.3") @InlineOnly public inline fun Continuation.resume(value: T): Unit = - resumeWith(SuccessOrFailure.success(value)) + resumeWith(Result.success(value)) /** * Resumes the execution of the corresponding coroutine so that the [exception] is re-thrown right after the @@ -49,7 +50,7 @@ public annotation class RestrictsSuspension */ @SinceKotlin("1.3") @InlineOnly public inline fun Continuation.resumeWithException(exception: Throwable): Unit = - resumeWith(SuccessOrFailure.failure(exception)) + resumeWith(Result.failure(exception)) /** @@ -58,13 +59,13 @@ public annotation class RestrictsSuspension @SinceKotlin("1.3") @InlineOnly public inline fun Continuation( context: CoroutineContext, - crossinline resumeWith: (SuccessOrFailure) -> Unit + crossinline resumeWith: (Result) -> Unit ): Continuation = object : Continuation { override val context: CoroutineContext get() = context - override fun resumeWith(result: SuccessOrFailure) = + override fun resumeWith(result: Result) = resumeWith(result) } diff --git a/libraries/stdlib/coroutines/src/kotlin/sequences/SequenceBuilder.kt b/libraries/stdlib/coroutines/src/kotlin/sequences/SequenceBuilder.kt index e7956fa4aa8..095a8bdc3a2 100644 --- a/libraries/stdlib/coroutines/src/kotlin/sequences/SequenceBuilder.kt +++ b/libraries/stdlib/coroutines/src/kotlin/sequences/SequenceBuilder.kt @@ -172,7 +172,7 @@ private class SequenceBuilderIterator : SequenceBuilder(), Iterator, Co } // Completion continuation implementation - override fun resumeWith(result: SuccessOrFailure) { + override fun resumeWith(result: Result) { result.getOrThrow() // just rethrow exception if it is there state = State_Done } diff --git a/libraries/stdlib/test/coroutines/CoroutinesReferenceValuesTest.kt b/libraries/stdlib/test/coroutines/CoroutinesReferenceValuesTest.kt index 35d10562495..2790d0fb152 100644 --- a/libraries/stdlib/test/coroutines/CoroutinesReferenceValuesTest.kt +++ b/libraries/stdlib/test/coroutines/CoroutinesReferenceValuesTest.kt @@ -45,7 +45,7 @@ class CoroutinesReferenceValuesTest { bad.startCoroutine(object : Continuation { override val context: CoroutineContext = EmptyCoroutineContext - override fun resumeWith(result_: SuccessOrFailure) { + override fun resumeWith(result_: Result) { assertTrue(result == null) result = result_.getOrThrow() } diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt index b787dc1b230..a807a00f008 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt @@ -141,27 +141,53 @@ public abstract interface annotation class kotlin/ReplaceWith : java/lang/annota public abstract fun imports ()[Ljava/lang/String; } +public final class kotlin/Result : java/io/Serializable { + public static final field Companion Lkotlin/Result$Companion; + public static final synthetic fun box-impl (Ljava/lang/Object;)Lkotlin/Result; + public static fun constructor-impl (Ljava/lang/Object;)Ljava/lang/Object; + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (Ljava/lang/Object;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Ljava/lang/Object;Ljava/lang/Object;)Z + public static final fun exceptionOrNull-impl (Ljava/lang/Object;)Ljava/lang/Throwable; + public static final fun getOrNull-impl (Ljava/lang/Object;)Ljava/lang/Object; + public fun hashCode ()I + public static fun hashCode-impl (Ljava/lang/Object;)I + public static final fun isFailure-impl (Ljava/lang/Object;)Z + public static final fun isSuccess-impl (Ljava/lang/Object;)Z + public fun toString ()Ljava/lang/String; + public static fun toString-impl (Ljava/lang/Object;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Ljava/lang/Object; +} + +public final class kotlin/Result$Companion { +} + +public final class kotlin/ResultKt { + public static final fun createFailure (Ljava/lang/Throwable;)Ljava/lang/Object; + public static final fun throwOnFailure (Ljava/lang/Object;)V +} + public abstract interface annotation class kotlin/SinceKotlin : java/lang/annotation/Annotation { public abstract fun version ()Ljava/lang/String; } public final class kotlin/SuccessOrFailure : java/io/Serializable { public static final field Companion Lkotlin/SuccessOrFailure$Companion; - public synthetic fun (Ljava/lang/Object;)V - public static final fun box (Ljava/lang/Object;)Lkotlin/SuccessOrFailure; - public static fun constructor (Ljava/lang/Object;)Ljava/lang/Object; + public static final synthetic fun box-impl (Ljava/lang/Object;)Lkotlin/SuccessOrFailure; + public static fun constructor-impl (Ljava/lang/Object;)Ljava/lang/Object; public fun equals (Ljava/lang/Object;)Z - public static fun equals (Ljava/lang/Object;Ljava/lang/Object;)Z - public static final fun exceptionOrNull (Ljava/lang/Object;)Ljava/lang/Throwable; - public static final fun getOrNull (Ljava/lang/Object;)Ljava/lang/Object; - public static final fun getOrThrow (Ljava/lang/Object;)Ljava/lang/Object; + public static fun equals-impl (Ljava/lang/Object;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Ljava/lang/Object;Ljava/lang/Object;)Z + public static final fun exceptionOrNull-impl (Ljava/lang/Object;)Ljava/lang/Throwable; + public static final fun getOrNull-impl (Ljava/lang/Object;)Ljava/lang/Object; + public static final fun getOrThrow-impl (Ljava/lang/Object;)Ljava/lang/Object; public fun hashCode ()I - public static fun hashCode (Ljava/lang/Object;)I - public static final fun isFailure (Ljava/lang/Object;)Z - public static final fun isSuccess (Ljava/lang/Object;)Z + public static fun hashCode-impl (Ljava/lang/Object;)I + public static final fun isFailure-impl (Ljava/lang/Object;)Z + public static final fun isSuccess-impl (Ljava/lang/Object;)Z public fun toString ()Ljava/lang/String; - public static fun toString (Ljava/lang/Object;)Ljava/lang/String; - public final fun unbox ()Ljava/lang/Object; + public static fun toString-impl (Ljava/lang/Object;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Ljava/lang/Object; } public final class kotlin/SuccessOrFailure$Companion { @@ -175,10 +201,6 @@ public final class kotlin/SuccessOrFailure$Failure : java/io/Serializable { public fun toString ()Ljava/lang/String; } -public final class kotlin/SuccessOrFailureKt { - public static final fun getOrDefault (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; -} - public abstract interface annotation class kotlin/Suppress : java/lang/annotation/Annotation { public abstract fun names ()[Ljava/lang/String; } @@ -215,97 +237,98 @@ public final class kotlin/UByte : java/lang/Comparable { public static final field MIN_VALUE B public static final field SIZE_BITS I public static final field SIZE_BYTES I - public static final fun and-d0xlk1d1 (BB)B - public static final fun box (B)Lkotlin/UByte; + public static final fun and-7apg3OU (BB)B + public static final synthetic fun box-impl (B)Lkotlin/UByte; public synthetic fun compareTo (Ljava/lang/Object;)I - public static final fun compareTo-4n0qz0s4 (BJ)I - public static final fun compareTo-4wtlwgkb (BI)I - public static final fun compareTo-av578izg (BS)I - public fun compareTo-d0xlk1d1 (B)I - public static fun compareTo-d0xlk1d1 (BB)I - public static fun constructor (B)B - public static final fun dec (B)B - public static final fun div-4n0qz0s4 (BJ)J - public static final fun div-4wtlwgkb (BI)I - public static final fun div-av578izg (BS)I - public static final fun div-d0xlk1d1 (BB)I - public static fun equals (BLjava/lang/Object;)Z + public fun compareTo-7apg3OU (B)I + public static fun compareTo-7apg3OU (BB)I + public static final fun compareTo-VKZWuLQ (BJ)I + public static final fun compareTo-WZ4Q5Ns (BI)I + public static final fun compareTo-xj2QHRw (BS)I + public static fun constructor-impl (B)B + public static final fun dec-impl (B)B + public static final fun div-7apg3OU (BB)I + public static final fun div-VKZWuLQ (BJ)J + public static final fun div-WZ4Q5Ns (BI)I + public static final fun div-xj2QHRw (BS)I public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (BLjava/lang/Object;)Z + public static final fun equals-impl0 (BB)Z public fun hashCode ()I - public static fun hashCode (B)I - public static final fun inc (B)B - public static final fun inv (B)B - public static final fun minus-4n0qz0s4 (BJ)J - public static final fun minus-4wtlwgkb (BI)I - public static final fun minus-av578izg (BS)I - public static final fun minus-d0xlk1d1 (BB)I - public static final fun or-d0xlk1d1 (BB)B - public static final fun plus-4n0qz0s4 (BJ)J - public static final fun plus-4wtlwgkb (BI)I - public static final fun plus-av578izg (BS)I - public static final fun plus-d0xlk1d1 (BB)I - public static final fun rangeTo-d0xlk1d1 (BB)Lkotlin/ranges/UIntRange; - public static final fun rem-4n0qz0s4 (BJ)J - public static final fun rem-4wtlwgkb (BI)I - public static final fun rem-av578izg (BS)I - public static final fun rem-d0xlk1d1 (BB)I - public static final fun times-4n0qz0s4 (BJ)J - public static final fun times-4wtlwgkb (BI)I - public static final fun times-av578izg (BS)I - public static final fun times-d0xlk1d1 (BB)I - public static final fun toByte (B)B - public static final fun toInt (B)I - public static final fun toLong (B)J - public static final fun toShort (B)S + public static fun hashCode-impl (B)I + public static final fun inc-impl (B)B + public static final fun inv-impl (B)B + public static final fun minus-7apg3OU (BB)I + public static final fun minus-VKZWuLQ (BJ)J + public static final fun minus-WZ4Q5Ns (BI)I + public static final fun minus-xj2QHRw (BS)I + public static final fun or-7apg3OU (BB)B + public static final fun plus-7apg3OU (BB)I + public static final fun plus-VKZWuLQ (BJ)J + public static final fun plus-WZ4Q5Ns (BI)I + public static final fun plus-xj2QHRw (BS)I + public static final fun rangeTo-7apg3OU (BB)Lkotlin/ranges/UIntRange; + public static final fun rem-7apg3OU (BB)I + public static final fun rem-VKZWuLQ (BJ)J + public static final fun rem-WZ4Q5Ns (BI)I + public static final fun rem-xj2QHRw (BS)I + public static final fun times-7apg3OU (BB)I + public static final fun times-VKZWuLQ (BJ)J + public static final fun times-WZ4Q5Ns (BI)I + public static final fun times-xj2QHRw (BS)I + public static final fun toByte-impl (B)B + public static final fun toInt-impl (B)I + public static final fun toLong-impl (B)J + public static final fun toShort-impl (B)S public fun toString ()Ljava/lang/String; - public static fun toString (B)Ljava/lang/String; - public static final fun toUByte (B)B - public static final fun toUInt (B)I - public static final fun toULong (B)J - public static final fun toUShort (B)S - public final fun unbox ()B - public static final fun xor-d0xlk1d1 (BB)B + public static fun toString-impl (B)Ljava/lang/String; + public static final fun toUByte-impl (B)B + public static final fun toUInt-impl (B)I + public static final fun toULong-impl (B)J + public static final fun toUShort-impl (B)S + public final synthetic fun unbox-impl ()B + public static final fun xor-7apg3OU (BB)B } public final class kotlin/UByte$Companion { } public final class kotlin/UByteArray : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker { - public synthetic fun ([B)V public synthetic fun add (Ljava/lang/Object;)Z - public fun add-d0xlk1d1 (B)Z + public fun add-7apg3OU (B)Z public fun addAll (Ljava/util/Collection;)Z - public static final fun box ([B)Lkotlin/UByteArray; + public static final synthetic fun box-impl ([B)Lkotlin/UByteArray; public fun clear ()V - public static fun constructor (I)[B - public static fun constructor ([B)[B + public static fun constructor-impl (I)[B + public static fun constructor-impl ([B)[B public final fun contains (Ljava/lang/Object;)Z - public fun contains-d0xlk1d1 (B)Z - public static fun contains-d0xlk1d1 ([BB)Z + public fun contains-7apg3OU (B)Z + public static fun contains-7apg3OU ([BB)Z public fun containsAll (Ljava/util/Collection;)Z - public static fun containsAll ([BLjava/util/Collection;)Z + public static fun containsAll-impl ([BLjava/util/Collection;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals ([BLjava/lang/Object;)Z - public static final fun get ([BI)B + public static fun equals-impl ([BLjava/lang/Object;)Z + public static final fun equals-impl0 ([B[B)Z + public static final fun get-impl ([BI)B public fun getSize ()I - public static fun getSize ([B)I + public static fun getSize-impl ([B)I public fun hashCode ()I - public static fun hashCode ([B)I + public static fun hashCode-impl ([B)I public fun isEmpty ()Z - public static fun isEmpty ([B)Z + public static fun isEmpty-impl ([B)Z public synthetic fun iterator ()Ljava/util/Iterator; public fun iterator ()Lkotlin/collections/UByteIterator; - public static fun iterator ([B)Lkotlin/collections/UByteIterator; + public static fun iterator-impl ([B)Lkotlin/collections/UByteIterator; public fun remove (Ljava/lang/Object;)Z public fun removeAll (Ljava/util/Collection;)Z public fun retainAll (Ljava/util/Collection;)Z - public static final fun set-4rhu7tbx ([BIB)V + public static final fun set-VurrAj0 ([BIB)V public final fun size ()I public fun toArray ()[Ljava/lang/Object; public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; public fun toString ()Ljava/lang/String; - public static fun toString ([B)Ljava/lang/String; - public final fun unbox ()[B + public static fun toString-impl ([B)Ljava/lang/String; + public final synthetic fun unbox-impl ()[B } public final class kotlin/UByteKt { @@ -321,99 +344,100 @@ public final class kotlin/UInt : java/lang/Comparable { public static final field MIN_VALUE I public static final field SIZE_BITS I public static final field SIZE_BYTES I - public static final fun and-4wtlwgkb (II)I - public static final fun box (I)Lkotlin/UInt; + public static final fun and-WZ4Q5Ns (II)I + public static final synthetic fun box-impl (I)Lkotlin/UInt; public synthetic fun compareTo (Ljava/lang/Object;)I - public static final fun compareTo-4n0qz0s4 (IJ)I - public fun compareTo-4wtlwgkb (I)I - public static fun compareTo-4wtlwgkb (II)I - public static final fun compareTo-av578izg (IS)I - public static final fun compareTo-d0xlk1d1 (IB)I - public static fun constructor (I)I - public static final fun dec (I)I - public static final fun div-4n0qz0s4 (IJ)J - public static final fun div-4wtlwgkb (II)I - public static final fun div-av578izg (IS)I - public static final fun div-d0xlk1d1 (IB)I - public static fun equals (ILjava/lang/Object;)Z + public static final fun compareTo-7apg3OU (IB)I + public static final fun compareTo-VKZWuLQ (IJ)I + public fun compareTo-WZ4Q5Ns (I)I + public static fun compareTo-WZ4Q5Ns (II)I + public static final fun compareTo-xj2QHRw (IS)I + public static fun constructor-impl (I)I + public static final fun dec-impl (I)I + public static final fun div-7apg3OU (IB)I + public static final fun div-VKZWuLQ (IJ)J + public static final fun div-WZ4Q5Ns (II)I + public static final fun div-xj2QHRw (IS)I public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (ILjava/lang/Object;)Z + public static final fun equals-impl0 (II)Z public fun hashCode ()I - public static fun hashCode (I)I - public static final fun inc (I)I - public static final fun inv (I)I - public static final fun minus-4n0qz0s4 (IJ)J - public static final fun minus-4wtlwgkb (II)I - public static final fun minus-av578izg (IS)I - public static final fun minus-d0xlk1d1 (IB)I - public static final fun or-4wtlwgkb (II)I - public static final fun plus-4n0qz0s4 (IJ)J - public static final fun plus-4wtlwgkb (II)I - public static final fun plus-av578izg (IS)I - public static final fun plus-d0xlk1d1 (IB)I - public static final fun rangeTo-4wtlwgkb (II)Lkotlin/ranges/UIntRange; - public static final fun rem-4n0qz0s4 (IJ)J - public static final fun rem-4wtlwgkb (II)I - public static final fun rem-av578izg (IS)I - public static final fun rem-d0xlk1d1 (IB)I - public static final fun shl (II)I - public static final fun shr (II)I - public static final fun times-4n0qz0s4 (IJ)J - public static final fun times-4wtlwgkb (II)I - public static final fun times-av578izg (IS)I - public static final fun times-d0xlk1d1 (IB)I - public static final fun toByte (I)B - public static final fun toInt (I)I - public static final fun toLong (I)J - public static final fun toShort (I)S + public static fun hashCode-impl (I)I + public static final fun inc-impl (I)I + public static final fun inv-impl (I)I + public static final fun minus-7apg3OU (IB)I + public static final fun minus-VKZWuLQ (IJ)J + public static final fun minus-WZ4Q5Ns (II)I + public static final fun minus-xj2QHRw (IS)I + public static final fun or-WZ4Q5Ns (II)I + public static final fun plus-7apg3OU (IB)I + public static final fun plus-VKZWuLQ (IJ)J + public static final fun plus-WZ4Q5Ns (II)I + public static final fun plus-xj2QHRw (IS)I + public static final fun rangeTo-WZ4Q5Ns (II)Lkotlin/ranges/UIntRange; + public static final fun rem-7apg3OU (IB)I + public static final fun rem-VKZWuLQ (IJ)J + public static final fun rem-WZ4Q5Ns (II)I + public static final fun rem-xj2QHRw (IS)I + public static final fun shl-impl (II)I + public static final fun shr-impl (II)I + public static final fun times-7apg3OU (IB)I + public static final fun times-VKZWuLQ (IJ)J + public static final fun times-WZ4Q5Ns (II)I + public static final fun times-xj2QHRw (IS)I + public static final fun toByte-impl (I)B + public static final fun toInt-impl (I)I + public static final fun toLong-impl (I)J + public static final fun toShort-impl (I)S public fun toString ()Ljava/lang/String; - public static fun toString (I)Ljava/lang/String; - public static final fun toUByte (I)B - public static final fun toUInt (I)I - public static final fun toULong (I)J - public static final fun toUShort (I)S - public final fun unbox ()I - public static final fun xor-4wtlwgkb (II)I + public static fun toString-impl (I)Ljava/lang/String; + public static final fun toUByte-impl (I)B + public static final fun toUInt-impl (I)I + public static final fun toULong-impl (I)J + public static final fun toUShort-impl (I)S + public final synthetic fun unbox-impl ()I + public static final fun xor-WZ4Q5Ns (II)I } public final class kotlin/UInt$Companion { } public final class kotlin/UIntArray : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker { - public synthetic fun ([I)V public synthetic fun add (Ljava/lang/Object;)Z - public fun add-4wtlwgkb (I)Z + public fun add-WZ4Q5Ns (I)Z public fun addAll (Ljava/util/Collection;)Z - public static final fun box ([I)Lkotlin/UIntArray; + public static final synthetic fun box-impl ([I)Lkotlin/UIntArray; public fun clear ()V - public static fun constructor (I)[I - public static fun constructor ([I)[I + public static fun constructor-impl (I)[I + public static fun constructor-impl ([I)[I public final fun contains (Ljava/lang/Object;)Z - public fun contains-4wtlwgkb (I)Z - public static fun contains-4wtlwgkb ([II)Z + public fun contains-WZ4Q5Ns (I)Z + public static fun contains-WZ4Q5Ns ([II)Z public fun containsAll (Ljava/util/Collection;)Z - public static fun containsAll ([ILjava/util/Collection;)Z + public static fun containsAll-impl ([ILjava/util/Collection;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals ([ILjava/lang/Object;)Z - public static final fun get ([II)I + public static fun equals-impl ([ILjava/lang/Object;)Z + public static final fun equals-impl0 ([I[I)Z + public static final fun get-impl ([II)I public fun getSize ()I - public static fun getSize ([I)I + public static fun getSize-impl ([I)I public fun hashCode ()I - public static fun hashCode ([I)I + public static fun hashCode-impl ([I)I public fun isEmpty ()Z - public static fun isEmpty ([I)Z + public static fun isEmpty-impl ([I)Z public synthetic fun iterator ()Ljava/util/Iterator; public fun iterator ()Lkotlin/collections/UIntIterator; - public static fun iterator ([I)Lkotlin/collections/UIntIterator; + public static fun iterator-impl ([I)Lkotlin/collections/UIntIterator; public fun remove (Ljava/lang/Object;)Z public fun removeAll (Ljava/util/Collection;)Z public fun retainAll (Ljava/util/Collection;)Z - public static final fun set-4olz5s4v ([III)V + public static final fun set-VXSXFK8 ([III)V public final fun size ()I public fun toArray ()[Ljava/lang/Object; public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; public fun toString ()Ljava/lang/String; - public static fun toString ([I)Ljava/lang/String; - public final fun unbox ()[I + public static fun toString-impl ([I)Ljava/lang/String; + public final synthetic fun unbox-impl ()[I } public final class kotlin/UIntKt { @@ -429,99 +453,100 @@ public final class kotlin/ULong : java/lang/Comparable { public static final field MIN_VALUE J public static final field SIZE_BITS I public static final field SIZE_BYTES I - public static final fun and-4n0qz0s4 (JJ)J - public static final fun box (J)Lkotlin/ULong; + public static final fun and-VKZWuLQ (JJ)J + public static final synthetic fun box-impl (J)Lkotlin/ULong; public synthetic fun compareTo (Ljava/lang/Object;)I - public fun compareTo-4n0qz0s4 (J)I - public static fun compareTo-4n0qz0s4 (JJ)I - public static final fun compareTo-4wtlwgkb (JI)I - public static final fun compareTo-av578izg (JS)I - public static final fun compareTo-d0xlk1d1 (JB)I - public static fun constructor (J)J - public static final fun dec (J)J - public static final fun div-4n0qz0s4 (JJ)J - public static final fun div-4wtlwgkb (JI)J - public static final fun div-av578izg (JS)J - public static final fun div-d0xlk1d1 (JB)J - public static fun equals (JLjava/lang/Object;)Z + public static final fun compareTo-7apg3OU (JB)I + public fun compareTo-VKZWuLQ (J)I + public static fun compareTo-VKZWuLQ (JJ)I + public static final fun compareTo-WZ4Q5Ns (JI)I + public static final fun compareTo-xj2QHRw (JS)I + public static fun constructor-impl (J)J + public static final fun dec-impl (J)J + public static final fun div-7apg3OU (JB)J + public static final fun div-VKZWuLQ (JJ)J + public static final fun div-WZ4Q5Ns (JI)J + public static final fun div-xj2QHRw (JS)J public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (JLjava/lang/Object;)Z + public static final fun equals-impl0 (JJ)Z public fun hashCode ()I - public static fun hashCode (J)I - public static final fun inc (J)J - public static final fun inv (J)J - public static final fun minus-4n0qz0s4 (JJ)J - public static final fun minus-4wtlwgkb (JI)J - public static final fun minus-av578izg (JS)J - public static final fun minus-d0xlk1d1 (JB)J - public static final fun or-4n0qz0s4 (JJ)J - public static final fun plus-4n0qz0s4 (JJ)J - public static final fun plus-4wtlwgkb (JI)J - public static final fun plus-av578izg (JS)J - public static final fun plus-d0xlk1d1 (JB)J - public static final fun rangeTo-4n0qz0s4 (JJ)Lkotlin/ranges/ULongRange; - public static final fun rem-4n0qz0s4 (JJ)J - public static final fun rem-4wtlwgkb (JI)J - public static final fun rem-av578izg (JS)J - public static final fun rem-d0xlk1d1 (JB)J - public static final fun shl (JI)J - public static final fun shr (JI)J - public static final fun times-4n0qz0s4 (JJ)J - public static final fun times-4wtlwgkb (JI)J - public static final fun times-av578izg (JS)J - public static final fun times-d0xlk1d1 (JB)J - public static final fun toByte (J)B - public static final fun toInt (J)I - public static final fun toLong (J)J - public static final fun toShort (J)S + public static fun hashCode-impl (J)I + public static final fun inc-impl (J)J + public static final fun inv-impl (J)J + public static final fun minus-7apg3OU (JB)J + public static final fun minus-VKZWuLQ (JJ)J + public static final fun minus-WZ4Q5Ns (JI)J + public static final fun minus-xj2QHRw (JS)J + public static final fun or-VKZWuLQ (JJ)J + public static final fun plus-7apg3OU (JB)J + public static final fun plus-VKZWuLQ (JJ)J + public static final fun plus-WZ4Q5Ns (JI)J + public static final fun plus-xj2QHRw (JS)J + public static final fun rangeTo-VKZWuLQ (JJ)Lkotlin/ranges/ULongRange; + public static final fun rem-7apg3OU (JB)J + public static final fun rem-VKZWuLQ (JJ)J + public static final fun rem-WZ4Q5Ns (JI)J + public static final fun rem-xj2QHRw (JS)J + public static final fun shl-impl (JI)J + public static final fun shr-impl (JI)J + public static final fun times-7apg3OU (JB)J + public static final fun times-VKZWuLQ (JJ)J + public static final fun times-WZ4Q5Ns (JI)J + public static final fun times-xj2QHRw (JS)J + public static final fun toByte-impl (J)B + public static final fun toInt-impl (J)I + public static final fun toLong-impl (J)J + public static final fun toShort-impl (J)S public fun toString ()Ljava/lang/String; - public static fun toString (J)Ljava/lang/String; - public static final fun toUByte (J)B - public static final fun toUInt (J)I - public static final fun toULong (J)J - public static final fun toUShort (J)S - public final fun unbox ()J - public static final fun xor-4n0qz0s4 (JJ)J + public static fun toString-impl (J)Ljava/lang/String; + public static final fun toUByte-impl (J)B + public static final fun toUInt-impl (J)I + public static final fun toULong-impl (J)J + public static final fun toUShort-impl (J)S + public final synthetic fun unbox-impl ()J + public static final fun xor-VKZWuLQ (JJ)J } public final class kotlin/ULong$Companion { } public final class kotlin/ULongArray : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker { - public synthetic fun ([J)V public synthetic fun add (Ljava/lang/Object;)Z - public fun add-4n0qz0s4 (J)Z + public fun add-VKZWuLQ (J)Z public fun addAll (Ljava/util/Collection;)Z - public static final fun box ([J)Lkotlin/ULongArray; + public static final synthetic fun box-impl ([J)Lkotlin/ULongArray; public fun clear ()V - public static fun constructor (I)[J - public static fun constructor ([J)[J + public static fun constructor-impl (I)[J + public static fun constructor-impl ([J)[J public final fun contains (Ljava/lang/Object;)Z - public fun contains-4n0qz0s4 (J)Z - public static fun contains-4n0qz0s4 ([JJ)Z + public fun contains-VKZWuLQ (J)Z + public static fun contains-VKZWuLQ ([JJ)Z public fun containsAll (Ljava/util/Collection;)Z - public static fun containsAll ([JLjava/util/Collection;)Z + public static fun containsAll-impl ([JLjava/util/Collection;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals ([JLjava/lang/Object;)Z - public static final fun get ([JI)J + public static fun equals-impl ([JLjava/lang/Object;)Z + public static final fun equals-impl0 ([J[J)Z + public static final fun get-impl ([JI)J public fun getSize ()I - public static fun getSize ([J)I + public static fun getSize-impl ([J)I public fun hashCode ()I - public static fun hashCode ([J)I + public static fun hashCode-impl ([J)I public fun isEmpty ()Z - public static fun isEmpty ([J)Z + public static fun isEmpty-impl ([J)Z public synthetic fun iterator ()Ljava/util/Iterator; public fun iterator ()Lkotlin/collections/ULongIterator; - public static fun iterator ([J)Lkotlin/collections/ULongIterator; + public static fun iterator-impl ([J)Lkotlin/collections/ULongIterator; public fun remove (Ljava/lang/Object;)Z public fun removeAll (Ljava/util/Collection;)Z public fun retainAll (Ljava/util/Collection;)Z - public static final fun set-83j4ar8e ([JIJ)V + public static final fun set-k8EXiF4 ([JIJ)V public final fun size ()I public fun toArray ()[Ljava/lang/Object; public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; public fun toString ()Ljava/lang/String; - public static fun toString ([J)Ljava/lang/String; - public final fun unbox ()[J + public static fun toString-impl ([J)Ljava/lang/String; + public final synthetic fun unbox-impl ()[J } public final class kotlin/ULongKt { @@ -537,97 +562,98 @@ public final class kotlin/UShort : java/lang/Comparable { public static final field MIN_VALUE S public static final field SIZE_BITS I public static final field SIZE_BYTES I - public static final fun and-av578izg (SS)S - public static final fun box (S)Lkotlin/UShort; + public static final fun and-xj2QHRw (SS)S + public static final synthetic fun box-impl (S)Lkotlin/UShort; public synthetic fun compareTo (Ljava/lang/Object;)I - public static final fun compareTo-4n0qz0s4 (SJ)I - public static final fun compareTo-4wtlwgkb (SI)I - public fun compareTo-av578izg (S)I - public static fun compareTo-av578izg (SS)I - public static final fun compareTo-d0xlk1d1 (SB)I - public static fun constructor (S)S - public static final fun dec (S)S - public static final fun div-4n0qz0s4 (SJ)J - public static final fun div-4wtlwgkb (SI)I - public static final fun div-av578izg (SS)I - public static final fun div-d0xlk1d1 (SB)I + public static final fun compareTo-7apg3OU (SB)I + public static final fun compareTo-VKZWuLQ (SJ)I + public static final fun compareTo-WZ4Q5Ns (SI)I + public fun compareTo-xj2QHRw (S)I + public static fun compareTo-xj2QHRw (SS)I + public static fun constructor-impl (S)S + public static final fun dec-impl (S)S + public static final fun div-7apg3OU (SB)I + public static final fun div-VKZWuLQ (SJ)J + public static final fun div-WZ4Q5Ns (SI)I + public static final fun div-xj2QHRw (SS)I public fun equals (Ljava/lang/Object;)Z - public static fun equals (SLjava/lang/Object;)Z + public static fun equals-impl (SLjava/lang/Object;)Z + public static final fun equals-impl0 (SS)Z public fun hashCode ()I - public static fun hashCode (S)I - public static final fun inc (S)S - public static final fun inv (S)S - public static final fun minus-4n0qz0s4 (SJ)J - public static final fun minus-4wtlwgkb (SI)I - public static final fun minus-av578izg (SS)I - public static final fun minus-d0xlk1d1 (SB)I - public static final fun or-av578izg (SS)S - public static final fun plus-4n0qz0s4 (SJ)J - public static final fun plus-4wtlwgkb (SI)I - public static final fun plus-av578izg (SS)I - public static final fun plus-d0xlk1d1 (SB)I - public static final fun rangeTo-av578izg (SS)Lkotlin/ranges/UIntRange; - public static final fun rem-4n0qz0s4 (SJ)J - public static final fun rem-4wtlwgkb (SI)I - public static final fun rem-av578izg (SS)I - public static final fun rem-d0xlk1d1 (SB)I - public static final fun times-4n0qz0s4 (SJ)J - public static final fun times-4wtlwgkb (SI)I - public static final fun times-av578izg (SS)I - public static final fun times-d0xlk1d1 (SB)I - public static final fun toByte (S)B - public static final fun toInt (S)I - public static final fun toLong (S)J - public static final fun toShort (S)S + public static fun hashCode-impl (S)I + public static final fun inc-impl (S)S + public static final fun inv-impl (S)S + public static final fun minus-7apg3OU (SB)I + public static final fun minus-VKZWuLQ (SJ)J + public static final fun minus-WZ4Q5Ns (SI)I + public static final fun minus-xj2QHRw (SS)I + public static final fun or-xj2QHRw (SS)S + public static final fun plus-7apg3OU (SB)I + public static final fun plus-VKZWuLQ (SJ)J + public static final fun plus-WZ4Q5Ns (SI)I + public static final fun plus-xj2QHRw (SS)I + public static final fun rangeTo-xj2QHRw (SS)Lkotlin/ranges/UIntRange; + public static final fun rem-7apg3OU (SB)I + public static final fun rem-VKZWuLQ (SJ)J + public static final fun rem-WZ4Q5Ns (SI)I + public static final fun rem-xj2QHRw (SS)I + public static final fun times-7apg3OU (SB)I + public static final fun times-VKZWuLQ (SJ)J + public static final fun times-WZ4Q5Ns (SI)I + public static final fun times-xj2QHRw (SS)I + public static final fun toByte-impl (S)B + public static final fun toInt-impl (S)I + public static final fun toLong-impl (S)J + public static final fun toShort-impl (S)S public fun toString ()Ljava/lang/String; - public static fun toString (S)Ljava/lang/String; - public static final fun toUByte (S)B - public static final fun toUInt (S)I - public static final fun toULong (S)J - public static final fun toUShort (S)S - public final fun unbox ()S - public static final fun xor-av578izg (SS)S + public static fun toString-impl (S)Ljava/lang/String; + public static final fun toUByte-impl (S)B + public static final fun toUInt-impl (S)I + public static final fun toULong-impl (S)J + public static final fun toUShort-impl (S)S + public final synthetic fun unbox-impl ()S + public static final fun xor-xj2QHRw (SS)S } public final class kotlin/UShort$Companion { } public final class kotlin/UShortArray : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker { - public synthetic fun ([S)V public synthetic fun add (Ljava/lang/Object;)Z - public fun add-av578izg (S)Z + public fun add-xj2QHRw (S)Z public fun addAll (Ljava/util/Collection;)Z - public static final fun box ([S)Lkotlin/UShortArray; + public static final synthetic fun box-impl ([S)Lkotlin/UShortArray; public fun clear ()V - public static fun constructor (I)[S - public static fun constructor ([S)[S + public static fun constructor-impl (I)[S + public static fun constructor-impl ([S)[S public final fun contains (Ljava/lang/Object;)Z - public fun contains-av578izg (S)Z - public static fun contains-av578izg ([SS)Z + public fun contains-xj2QHRw (S)Z + public static fun contains-xj2QHRw ([SS)Z public fun containsAll (Ljava/util/Collection;)Z - public static fun containsAll ([SLjava/util/Collection;)Z + public static fun containsAll-impl ([SLjava/util/Collection;)Z public fun equals (Ljava/lang/Object;)Z - public static fun equals ([SLjava/lang/Object;)Z - public static final fun get ([SI)S + public static fun equals-impl ([SLjava/lang/Object;)Z + public static final fun equals-impl0 ([S[S)Z + public static final fun get-impl ([SI)S public fun getSize ()I - public static fun getSize ([S)I + public static fun getSize-impl ([S)I public fun hashCode ()I - public static fun hashCode ([S)I + public static fun hashCode-impl ([S)I public fun isEmpty ()Z - public static fun isEmpty ([S)Z + public static fun isEmpty-impl ([S)Z public synthetic fun iterator ()Ljava/util/Iterator; public fun iterator ()Lkotlin/collections/UShortIterator; - public static fun iterator ([S)Lkotlin/collections/UShortIterator; + public static fun iterator-impl ([S)Lkotlin/collections/UShortIterator; public fun remove (Ljava/lang/Object;)Z public fun removeAll (Ljava/util/Collection;)Z public fun retainAll (Ljava/util/Collection;)Z - public static final fun set-bky83bo1 ([SIS)V + public static final fun set-01HTLdE ([SIS)V public final fun size ()I public fun toArray ()[Ljava/lang/Object; public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; public fun toString ()Ljava/lang/String; - public static fun toString ([S)Ljava/lang/String; - public final fun unbox ()[S + public static fun toString-impl ([S)Ljava/lang/String; + public final synthetic fun unbox-impl ()[S } public final class kotlin/UShortKt { @@ -2460,26 +2486,26 @@ public abstract class kotlin/collections/ShortIterator : java/util/Iterator, kot } public final class kotlin/collections/UArraysKt { - public static final fun contentEquals-6ajjrs7m ([I[I)Z - public static final fun contentEquals-7zqa7xiz ([B[B)Z - public static final fun contentEquals-8f7oupw0 ([S[S)Z - public static final fun contentEquals-a8l8huwo ([J[J)Z - public static final fun contentHashCode-1biuymyp ([B)I - public static final fun contentHashCode-3o8tnvbt ([J)I - public static final fun contentHashCode-9gu3s6ig ([S)I - public static final fun contentHashCode-doljm8k0 ([I)I - public static final fun contentToString-1biuymyp ([B)Ljava/lang/String; - public static final fun contentToString-3o8tnvbt ([J)Ljava/lang/String; - public static final fun contentToString-9gu3s6ig ([S)Ljava/lang/String; - public static final fun contentToString-doljm8k0 ([I)Ljava/lang/String; - public static final fun random-25eqzsg0 ([JLkotlin/random/Random;)J - public static final fun random-8tx9e8n3 ([BLkotlin/random/Random;)B - public static final fun random-9uc5g3in ([SLkotlin/random/Random;)S - public static final fun random-bunzpqo3 ([ILkotlin/random/Random;)I - public static final fun toTypedArray-1biuymyp ([B)[Lkotlin/UByte; - public static final fun toTypedArray-3o8tnvbt ([J)[Lkotlin/ULong; - public static final fun toTypedArray-9gu3s6ig ([S)[Lkotlin/UShort; - public static final fun toTypedArray-doljm8k0 ([I)[Lkotlin/UInt; + public static final fun contentEquals-ctEhBpI ([I[I)Z + public static final fun contentEquals-kdPth3s ([B[B)Z + public static final fun contentEquals-mazbYpA ([S[S)Z + public static final fun contentEquals-us8wMrg ([J[J)Z + public static final fun contentHashCode--ajY-9A ([I)I + public static final fun contentHashCode-GBYM_sE ([B)I + public static final fun contentHashCode-QwZRm1k ([J)I + public static final fun contentHashCode-rL5Bavg ([S)I + public static final fun contentToString--ajY-9A ([I)Ljava/lang/String; + public static final fun contentToString-GBYM_sE ([B)Ljava/lang/String; + public static final fun contentToString-QwZRm1k ([J)Ljava/lang/String; + public static final fun contentToString-rL5Bavg ([S)Ljava/lang/String; + public static final fun random-2D5oskM ([ILkotlin/random/Random;)I + public static final fun random-JzugnMA ([JLkotlin/random/Random;)J + public static final fun random-oSF2wD8 ([BLkotlin/random/Random;)B + public static final fun random-s5X_as8 ([SLkotlin/random/Random;)S + public static final fun toTypedArray--ajY-9A ([I)[Lkotlin/UInt; + public static final fun toTypedArray-GBYM_sE ([B)[Lkotlin/UByte; + public static final fun toTypedArray-QwZRm1k ([J)[Lkotlin/ULong; + public static final fun toTypedArray-rL5Bavg ([S)[Lkotlin/UShort; } public abstract class kotlin/collections/UByteIterator : java/util/Iterator, kotlin/jvm/internal/markers/KMappedMarker { @@ -2841,8 +2867,8 @@ public final class kotlin/internal/ProgressionUtilKt { } public final class kotlin/internal/UProgressionUtilKt { - public static final fun getProgressionLastElement-2z3rwsob (III)I - public static final fun getProgressionLastElement-d1k1ewy0 (JJJ)J + public static final fun getProgressionLastElement-7ftBX0g (JJJ)J + public static final fun getProgressionLastElement-Nkh28Cs (III)I } public final class kotlin/io/AccessDeniedException : kotlin/io/FileSystemException { @@ -3907,17 +3933,17 @@ public final class kotlin/random/RandomKt { public static final fun Random (I)Lkotlin/random/Random; public static final fun Random (J)Lkotlin/random/Random; public static final fun nextUBytes (Lkotlin/random/Random;I)[B - public static final fun nextUBytes-4zielkbi (Lkotlin/random/Random;[BII)[B - public static synthetic fun nextUBytes-4zielkbi$default (Lkotlin/random/Random;[BIIILjava/lang/Object;)[B - public static final fun nextUBytes-y7z55vk (Lkotlin/random/Random;[B)[B + public static final fun nextUBytes-EVgfTAA (Lkotlin/random/Random;[B)[B + public static final fun nextUBytes-Wvrt4B4 (Lkotlin/random/Random;[BII)[B + public static synthetic fun nextUBytes-Wvrt4B4$default (Lkotlin/random/Random;[BIIILjava/lang/Object;)[B public static final fun nextUInt (Lkotlin/random/Random;)I public static final fun nextUInt (Lkotlin/random/Random;Lkotlin/ranges/UIntRange;)I - public static final fun nextUInt-5wlsgfq1 (Lkotlin/random/Random;II)I - public static final fun nextUInt-97rx7kg5 (Lkotlin/random/Random;I)I + public static final fun nextUInt-a8DCA5k (Lkotlin/random/Random;II)I + public static final fun nextUInt-qCasIEU (Lkotlin/random/Random;I)I public static final fun nextULong (Lkotlin/random/Random;)J public static final fun nextULong (Lkotlin/random/Random;Lkotlin/ranges/ULongRange;)J - public static final fun nextULong-4sbioyd2 (Lkotlin/random/Random;J)J - public static final fun nextULong-7szwbobr (Lkotlin/random/Random;JJ)J + public static final fun nextULong-V1Xi4fY (Lkotlin/random/Random;J)J + public static final fun nextULong-jmpaW-c (Lkotlin/random/Random;JJ)J } public class kotlin/ranges/CharProgression : java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker { @@ -4157,6 +4183,7 @@ public final class kotlin/ranges/RangesKt { public class kotlin/ranges/UIntProgression : java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker { public static final field Companion Lkotlin/ranges/UIntProgression$Companion; + public synthetic fun (IIILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun equals (Ljava/lang/Object;)Z public final fun getFirst ()I public final fun getLast ()I @@ -4169,14 +4196,14 @@ public class kotlin/ranges/UIntProgression : java/lang/Iterable, kotlin/jvm/inte } public final class kotlin/ranges/UIntProgression$Companion { - public final fun fromClosedRange-2z3rwsob (III)Lkotlin/ranges/UIntProgression; + public final fun fromClosedRange-Nkh28Cs (III)Lkotlin/ranges/UIntProgression; } public final class kotlin/ranges/UIntRange : kotlin/ranges/UIntProgression, kotlin/ranges/ClosedRange { public static final field Companion Lkotlin/ranges/UIntRange$Companion; - public fun (II)V + public synthetic fun (IILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun contains (Ljava/lang/Comparable;)Z - public fun contains-4wtlwgkb (I)Z + public fun contains-WZ4Q5Ns (I)Z public fun equals (Ljava/lang/Object;)Z public synthetic fun getEndInclusive ()Ljava/lang/Comparable; public fun getEndInclusive ()Lkotlin/UInt; @@ -4193,6 +4220,7 @@ public final class kotlin/ranges/UIntRange$Companion { public class kotlin/ranges/ULongProgression : java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker { public static final field Companion Lkotlin/ranges/ULongProgression$Companion; + public synthetic fun (JJJLkotlin/jvm/internal/DefaultConstructorMarker;)V public fun equals (Ljava/lang/Object;)Z public final fun getFirst ()J public final fun getLast ()J @@ -4205,14 +4233,14 @@ public class kotlin/ranges/ULongProgression : java/lang/Iterable, kotlin/jvm/int } public final class kotlin/ranges/ULongProgression$Companion { - public final fun fromClosedRange-d1k1ewy0 (JJJ)Lkotlin/ranges/ULongProgression; + public final fun fromClosedRange-7ftBX0g (JJJ)Lkotlin/ranges/ULongProgression; } public final class kotlin/ranges/ULongRange : kotlin/ranges/ULongProgression, kotlin/ranges/ClosedRange { public static final field Companion Lkotlin/ranges/ULongRange$Companion; - public fun (JJ)V + public synthetic fun (JJLkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun contains (Ljava/lang/Comparable;)Z - public fun contains-4n0qz0s4 (J)Z + public fun contains-VKZWuLQ (J)Z public fun equals (Ljava/lang/Object;)Z public synthetic fun getEndInclusive ()Ljava/lang/Comparable; public fun getEndInclusive ()Lkotlin/ULong; @@ -4228,20 +4256,20 @@ public final class kotlin/ranges/ULongRange$Companion { } public final class kotlin/ranges/URangesKt { - public static final fun downTo-25l8n7yt (II)Lkotlin/ranges/UIntProgression; - public static final fun downTo-2ccbonl2 (BB)Lkotlin/ranges/UIntProgression; - public static final fun downTo-6o7e3yo2 (JJ)Lkotlin/ranges/ULongProgression; - public static final fun downTo-cjsx449s (SS)Lkotlin/ranges/UIntProgression; + public static final fun downTo-5PvTz6A (SS)Lkotlin/ranges/UIntProgression; + public static final fun downTo-J1ME1BU (II)Lkotlin/ranges/UIntProgression; + public static final fun downTo-Kr8caGY (BB)Lkotlin/ranges/UIntProgression; + public static final fun downTo-eb3DHEI (JJ)Lkotlin/ranges/ULongProgression; public static final fun random (Lkotlin/ranges/UIntRange;Lkotlin/random/Random;)I public static final fun random (Lkotlin/ranges/ULongRange;Lkotlin/random/Random;)J public static final fun reversed (Lkotlin/ranges/UIntProgression;)Lkotlin/ranges/UIntProgression; public static final fun reversed (Lkotlin/ranges/ULongProgression;)Lkotlin/ranges/ULongProgression; public static final fun step (Lkotlin/ranges/UIntProgression;I)Lkotlin/ranges/UIntProgression; public static final fun step (Lkotlin/ranges/ULongProgression;J)Lkotlin/ranges/ULongProgression; - public static final fun until-25l8n7yt (II)Lkotlin/ranges/UIntRange; - public static final fun until-2ccbonl2 (BB)Lkotlin/ranges/UIntRange; - public static final fun until-6o7e3yo2 (JJ)Lkotlin/ranges/ULongRange; - public static final fun until-cjsx449s (SS)Lkotlin/ranges/UIntRange; + public static final fun until-5PvTz6A (SS)Lkotlin/ranges/UIntRange; + public static final fun until-J1ME1BU (II)Lkotlin/ranges/UIntRange; + public static final fun until-Kr8caGY (BB)Lkotlin/ranges/UIntRange; + public static final fun until-eb3DHEI (JJ)Lkotlin/ranges/ULongRange; } public abstract interface class kotlin/reflect/KAnnotatedElement { @@ -5137,10 +5165,10 @@ public final class kotlin/text/Typography { } public final class kotlin/text/UStringNumberConversionsKt { - public static final fun toString-21alb53h (JI)Ljava/lang/String; - public static final fun toString-2kxm18v2 (BI)Ljava/lang/String; - public static final fun toString-4t3x8z9q (II)Ljava/lang/String; - public static final fun toString-8wantzby (SI)Ljava/lang/String; + public static final fun toString-JSWoG40 (JI)Ljava/lang/String; + public static final fun toString-LxnNnR4 (BI)Ljava/lang/String; + public static final fun toString-V7xB4Y4 (II)Ljava/lang/String; + public static final fun toString-olVBNx4 (SI)Ljava/lang/String; public static final fun toUByte (Ljava/lang/String;)B public static final fun toUByte (Ljava/lang/String;I)B public static final fun toUByteOrNull (Ljava/lang/String;)Lkotlin/UByte;