Handle error type in SamType
This commit is contained in:
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
|||||||
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils;
|
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils;
|
||||||
import org.jetbrains.kotlin.resolve.sam.SamConversionResolverImplKt;
|
import org.jetbrains.kotlin.resolve.sam.SamConversionResolverImplKt;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
|
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
||||||
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
|
||||||
|
|
||||||
public class SamType {
|
public class SamType {
|
||||||
@@ -46,6 +47,10 @@ public class SamType {
|
|||||||
originalSingleArgumentType = valueParameter.getOriginal().getType();
|
originalSingleArgumentType = valueParameter.getOriginal().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (KotlinTypeKt.isError(singleArgumentType) || KotlinTypeKt.isError(originalSingleArgumentType)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
KotlinType originalTypeToUse =
|
KotlinType originalTypeToUse =
|
||||||
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
||||||
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
||||||
|
|||||||
Reference in New Issue
Block a user