From ba43ee841074d63108b5f07a8e64208dd31e05ae Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 3 Jun 2020 14:05:01 +0300 Subject: [PATCH] Handle error type in SamType --- .../backend/src/org/jetbrains/kotlin/codegen/SamType.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamType.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamType.java index 63db01fda63..9c3be719007 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamType.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamType.java @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor; import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils; import org.jetbrains.kotlin.resolve.sam.SamConversionResolverImplKt; import org.jetbrains.kotlin.types.KotlinType; +import org.jetbrains.kotlin.types.KotlinTypeKt; import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt; public class SamType { @@ -46,6 +47,10 @@ public class SamType { originalSingleArgumentType = valueParameter.getOriginal().getType(); } + if (KotlinTypeKt.isError(singleArgumentType) || KotlinTypeKt.isError(originalSingleArgumentType)) { + return null; + } + KotlinType originalTypeToUse = // This can be true in case when the value parameter is in the method of a generic type with out-projection. // We approximate Inv to Nothing, while Inv itself can be a SAM interface safe to call here