Fix compilation after rebase

This commit is contained in:
Mikhail Zarechenskiy
2019-04-30 15:34:33 +03:00
parent a79030aa0f
commit 871925ba31
3 changed files with 18 additions and 15 deletions
@@ -132,8 +132,10 @@ class KotlinToResolvedCallTransformer(
} }
} }
@Suppress("UNCHECKED_CAST") val resolvedCall = val resolvedCall = ktPrimitiveCompleter.completeResolvedCall(
ktPrimitiveCompleter.completeResolvedCall(candidate, baseResolvedCall.completedDiagnostic) as ResolvedCall<D> candidate, baseResolvedCall.completedDiagnostic(resultSubstitutor)
) as ResolvedCall<D>
forwardCallToInferenceSession(baseResolvedCall, context, resolvedCall, tracingStrategy) forwardCallToInferenceSession(baseResolvedCall, context, resolvedCall, tracingStrategy)
resolvedCall resolvedCall
@@ -7,9 +7,11 @@ package org.jetbrains.kotlin.resolve.calls.model
import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.resolve.calls.components.* import org.jetbrains.kotlin.resolve.calls.components.CallableReferenceCandidate
import org.jetbrains.kotlin.resolve.calls.inference.buildResultingSubstitutor import org.jetbrains.kotlin.resolve.calls.components.TypeArgumentsToParametersMapper
import org.jetbrains.kotlin.resolve.calls.components.extractInputOutputTypesFromCallableReferenceExpectedType
import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewTypeSubstitutor
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintError import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintError
import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableForLambdaReturnType import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableForLambdaReturnType
@@ -184,16 +186,14 @@ sealed class CallResolutionResult(
super.setAnalyzedResults(subResolvedAtoms) super.setAnalyzedResults(subResolvedAtoms)
} }
val completedDiagnostic: List<KotlinCallDiagnostic> fun completedDiagnostic(substitutor: NewTypeSubstitutor): List<KotlinCallDiagnostic> {
get() { return diagnostics.map {
val substitutor = constraintSystem.buildResultingSubstitutor() if (it !is NewConstraintError) return@map it
return diagnostics.map { val lowerType = it.lowerType.safeAs<KotlinType>()?.unwrap() ?: return@map it
if (it !is NewConstraintError) return@map it val newLowerType = substitutor.safeSubstitute(lowerType)
val lowerType = it.lowerType.safeAs<KotlinType>()?.unwrap() ?: return@map it NewConstraintError(newLowerType, it.upperType, it.position)
val newLowerType = substitutor.safeSubstitute(lowerType)
NewConstraintError(newLowerType, it.upperType, it.position)
}
} }
}
override val atom: ResolutionAtom? get() = null override val atom: ResolutionAtom? get() = null
@@ -90,12 +90,13 @@ open class TypeApproximatorConfiguration {
object CapturedAndIntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) { object CapturedAndIntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) {
override val integerLiteralType: Boolean get() = true override val integerLiteralType: Boolean get() = true
} }
object IntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AllFlexibleSameValue() { object IntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AllFlexibleSameValue() {
override val integerLiteralType: Boolean get() = true override val integerLiteralType: Boolean get() = true
override val allFlexible: Boolean get() = true override val allFlexible: Boolean get() = true
override val intersection get() = ALLOWED override val intersection get() = ALLOWED
override val typeVariable: (TypeVariableTypeConstructor) -> Boolean get() = { true } override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
override val capturedType: (NewCapturedType) -> Boolean get() = { true } override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean = true
} }
} }