refactoring: moved method
This commit is contained in:
@@ -568,8 +568,8 @@ public class CandidateResolver {
|
|||||||
}
|
}
|
||||||
constraintSystem.registerTypeVariables(typeVariables);
|
constraintSystem.registerTypeVariables(typeVariables);
|
||||||
|
|
||||||
TypeSubstitutor substituteDontCare = ConstraintsUtil
|
TypeSubstitutor substituteDontCare =
|
||||||
.makeConstantSubstitutor(candidateWithFreshVariables.getTypeParameters(), DONT_CARE);
|
makeConstantSubstitutor(candidateWithFreshVariables.getTypeParameters(), DONT_CARE);
|
||||||
|
|
||||||
// Value parameters
|
// Value parameters
|
||||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : candidateCall.getValueArguments().entrySet()) {
|
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : candidateCall.getValueArguments().entrySet()) {
|
||||||
|
|||||||
-23
@@ -111,27 +111,4 @@ public class ConstraintsUtil {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TypeSubstitutor makeConstantSubstitutor(Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type) {
|
|
||||||
final Set<TypeConstructor> constructors = Sets.newHashSet();
|
|
||||||
for (TypeParameterDescriptor typeParameterDescriptor : typeParameterDescriptors) {
|
|
||||||
constructors.add(typeParameterDescriptor.getTypeConstructor());
|
|
||||||
}
|
|
||||||
final TypeProjection projection = new TypeProjection(type);
|
|
||||||
|
|
||||||
return TypeSubstitutor.create(new TypeSubstitution() {
|
|
||||||
@Override
|
|
||||||
public TypeProjection get(TypeConstructor key) {
|
|
||||||
if (constructors.contains(key)) {
|
|
||||||
return projection;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -707,4 +707,27 @@ public class TypeUtils {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TypeSubstitutor makeConstantSubstitutor(Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type) {
|
||||||
|
final Set<TypeConstructor> constructors = Sets.newHashSet();
|
||||||
|
for (TypeParameterDescriptor typeParameterDescriptor : typeParameterDescriptors) {
|
||||||
|
constructors.add(typeParameterDescriptor.getTypeConstructor());
|
||||||
|
}
|
||||||
|
final TypeProjection projection = new TypeProjection(type);
|
||||||
|
|
||||||
|
return TypeSubstitutor.create(new TypeSubstitution() {
|
||||||
|
@Override
|
||||||
|
public TypeProjection get(TypeConstructor key) {
|
||||||
|
if (constructors.contains(key)) {
|
||||||
|
return projection;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user