Change Function Signature Fix: Prefer argument's smartcast (if any) over its original type

#KT-8775 Fixed
This commit is contained in:
Alexey Sedunov
2015-09-08 17:37:53 +03:00
parent 670bb1a27d
commit aa1de706c1
@@ -95,7 +95,9 @@ public class AddFunctionParametersFix(
if (i < parameters.size()) {
validator.addName(parameters.get(i).name.asString())
val argumentType = expression?.let { bindingContext.getType(it) }
val argumentType = expression?.let {
bindingContext[BindingContext.SMARTCAST, it] ?: bindingContext.getType(it)
}
val parameterType = parameters.get(i).type
if (argumentType != null && !JetTypeChecker.DEFAULT.isSubtypeOf(argumentType, parameterType)) {