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 =
ktPrimitiveCompleter.completeResolvedCall(candidate, baseResolvedCall.completedDiagnostic) as ResolvedCall<D>
val resolvedCall = ktPrimitiveCompleter.completeResolvedCall(
candidate, baseResolvedCall.completedDiagnostic(resultSubstitutor)
) as ResolvedCall<D>
forwardCallToInferenceSession(baseResolvedCall, context, resolvedCall, tracingStrategy)
resolvedCall
@@ -7,9 +7,11 @@ package org.jetbrains.kotlin.resolve.calls.model
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.resolve.calls.components.*
import org.jetbrains.kotlin.resolve.calls.inference.buildResultingSubstitutor
import org.jetbrains.kotlin.resolve.calls.components.CallableReferenceCandidate
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.NewTypeSubstitutor
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.TypeVariableForLambdaReturnType
@@ -184,16 +186,14 @@ sealed class CallResolutionResult(
super.setAnalyzedResults(subResolvedAtoms)
}
val completedDiagnostic: List<KotlinCallDiagnostic>
get() {
val substitutor = constraintSystem.buildResultingSubstitutor()
return diagnostics.map {
if (it !is NewConstraintError) return@map it
val lowerType = it.lowerType.safeAs<KotlinType>()?.unwrap() ?: return@map it
val newLowerType = substitutor.safeSubstitute(lowerType)
NewConstraintError(newLowerType, it.upperType, it.position)
}
fun completedDiagnostic(substitutor: NewTypeSubstitutor): List<KotlinCallDiagnostic> {
return diagnostics.map {
if (it !is NewConstraintError) return@map it
val lowerType = it.lowerType.safeAs<KotlinType>()?.unwrap() ?: return@map it
val newLowerType = substitutor.safeSubstitute(lowerType)
NewConstraintError(newLowerType, it.upperType, it.position)
}
}
override val atom: ResolutionAtom? get() = null
@@ -90,12 +90,13 @@ open class TypeApproximatorConfiguration {
object CapturedAndIntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AbstractCapturedTypesApproximation(FROM_EXPRESSION) {
override val integerLiteralType: Boolean get() = true
}
object IntegerLiteralsTypesApproximation : TypeApproximatorConfiguration.AllFlexibleSameValue() {
override val integerLiteralType: Boolean get() = true
override val allFlexible: Boolean get() = true
override val intersection get() = ALLOWED
override val typeVariable: (TypeVariableTypeConstructor) -> Boolean get() = { true }
override val capturedType: (NewCapturedType) -> Boolean get() = { true }
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean = true
}
}