FIR: avoid cast exception in Candidate.prepareExpectedType

This commit is contained in:
Jinseong Jeon
2020-07-06 22:37:07 -07:00
committed by Mikhail Glukhikh
parent a5f34a880c
commit 50b2ea7053
2 changed files with 2 additions and 2 deletions
@@ -308,7 +308,8 @@ internal fun Candidate.resolveArgument(
private fun Candidate.prepareExpectedType(session: FirSession, argument: FirExpression, parameter: FirValueParameter?): ConeKotlinType? {
if (parameter == null) return null
if (parameter.returnTypeRef is FirILTTypeRefPlaceHolder) return argument.resultType.coneType
if (parameter.returnTypeRef is FirILTTypeRefPlaceHolder && argument.resultType is FirResolvedTypeRef)
return argument.resultType.coneType
val basicExpectedType = argument.getExpectedType(session, parameter/*, LanguageVersionSettings*/)
val expectedType = getExpectedTypeWithSAMConversion(session, argument, basicExpectedType) ?: basicExpectedType
return this.substitutor.substituteOrSelf(expectedType)
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
public inline fun Int.times(body : () -> Unit) {
var count = this;