Minor, move out check against no expected type
This commit is contained in:
@@ -368,7 +368,7 @@ public class DelegatedPropertyResolver {
|
||||
if (conventionMethodFound(getMethodResults)) {
|
||||
FunctionDescriptor descriptor = getMethodResults.getResultingDescriptor();
|
||||
KotlinType returnTypeOfGetMethod = descriptor.getReturnType();
|
||||
if (returnTypeOfGetMethod != null) {
|
||||
if (returnTypeOfGetMethod != null && !TypeUtils.noExpectedType(expectedType)) {
|
||||
constraintSystem.addSupertypeConstraint(expectedType, returnTypeOfGetMethod, FROM_COMPLETER.position());
|
||||
}
|
||||
addConstraintForThisValue(constraintSystem, descriptor);
|
||||
|
||||
@@ -147,7 +147,7 @@ public class CallCompleter(
|
||||
}
|
||||
|
||||
val returnType = getCandidateDescriptor().getReturnType()
|
||||
if (returnType != null) {
|
||||
if (returnType != null && !TypeUtils.noExpectedType(expectedType)) {
|
||||
updateSystemIfNeeded { builder ->
|
||||
builder.addSupertypeConstraint(expectedType, returnType, EXPECTED_TYPE_POSITION.position())
|
||||
builder.build()
|
||||
|
||||
-2
@@ -102,8 +102,6 @@ class ConstraintSystemBuilderImpl : ConstraintSystem.Builder {
|
||||
type.getNestedTypeParameters().filter { isMyTypeVariable(it) }
|
||||
|
||||
override fun addSupertypeConstraint(constrainingType: KotlinType?, subjectType: KotlinType, constraintPosition: ConstraintPosition) {
|
||||
if (constrainingType != null && TypeUtils.noExpectedType(constrainingType)) return
|
||||
|
||||
val newSubjectType = descriptorToVariableSubstitutor.substitute(subjectType, Variance.INVARIANT)
|
||||
addConstraint(SUB_TYPE, newSubjectType, constrainingType, ConstraintContext(constraintPosition, initial = true))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user