Don't write any COERCION_STRATEGY for Unit to Unit return types

This commit is contained in:
Mikhail Zarechenskiy
2020-05-31 23:34:58 +03:00
parent 03358c61d4
commit 684dfb959c

View File

@@ -334,7 +334,11 @@ class CallableReferencesCandidateFactory(
// lower(Unit!) = Unit
val returnExpectedType = inputOutputTypes.outputType
val coercion = if (returnExpectedType.isUnit()) CoercionStrategy.COERCION_TO_UNIT else CoercionStrategy.NO_COERCION
val coercion =
if (returnExpectedType.isUnit() && descriptor.returnType?.isUnit() == false)
CoercionStrategy.COERCION_TO_UNIT
else
CoercionStrategy.NO_COERCION
val adaptedArguments =
if (expectedType != null && ReflectionTypes.isBaseTypeForNumberedReferenceTypes(expectedType))