[NI] Don't check type for constants too early to avoid mismatch
This commit is contained in:
+2
@@ -48,4 +48,6 @@ interface KotlinResolutionCallbacks {
|
||||
fun bindStubResolvedCallForCandidate(candidate: ResolvedCallAtom)
|
||||
|
||||
fun createReceiverWithSmartCastInfo(resolvedAtom: ResolvedCallAtom): ReceiverValueWithSmartCastInfo?
|
||||
|
||||
fun isCompileTimeConstant(resolvedAtom: ResolvedCallAtom, expectedType: UnwrappedType): Boolean
|
||||
}
|
||||
+1
-1
@@ -141,7 +141,7 @@ class KotlinCallCompleter(
|
||||
val actualType = withSmartCastInfo?.stableType ?: unsubstitutedReturnType
|
||||
|
||||
val returnType = resolvedCall.substitutor.substituteKeepAnnotations(actualType)
|
||||
if (expectedType != null && !TypeUtils.noExpectedType(expectedType)) {
|
||||
if (expectedType != null && !TypeUtils.noExpectedType(expectedType) && !resolutionCallbacks.isCompileTimeConstant(resolvedCall, expectedType)) {
|
||||
csBuilder.addSubtypeConstraint(returnType, expectedType, ExpectedTypeConstraintPosition(resolvedCall.atom))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user