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