Minor. Rename TypeUtils.containsSpecialType -> contains
This commit is contained in:
@@ -65,7 +65,7 @@ fun approximateCapturedTypesIfNecessary(typeProjection: TypeProjection?, approxi
|
||||
if (typeProjection.isStarProjection) return typeProjection
|
||||
|
||||
val type = typeProjection.type
|
||||
if (!TypeUtils.containsSpecialType(type, { it.isCaptured() })) {
|
||||
if (!TypeUtils.contains(type, { it.isCaptured() })) {
|
||||
return typeProjection
|
||||
}
|
||||
val howThisTypeIsUsed = typeProjection.projectionKind
|
||||
|
||||
@@ -554,7 +554,7 @@ public class ErrorUtils {
|
||||
}
|
||||
|
||||
public static boolean containsUninferredParameter(@Nullable KotlinType type) {
|
||||
return TypeUtils.containsSpecialType(type, new Function1<KotlinType, Boolean>() {
|
||||
return TypeUtils.contains(type, new Function1<KotlinType, Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke(KotlinType argumentType) {
|
||||
return isUninferredParameter(argumentType);
|
||||
|
||||
@@ -426,8 +426,8 @@ public class TypeUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean containsSpecialType(@Nullable KotlinType type, @NotNull final KotlinType specialType) {
|
||||
return containsSpecialType(type, new Function1<KotlinType, Boolean>() {
|
||||
public static boolean contains(@Nullable KotlinType type, @NotNull final KotlinType specialType) {
|
||||
return contains(type, new Function1<KotlinType, Boolean>() {
|
||||
@Override
|
||||
public Boolean invoke(KotlinType type) {
|
||||
return specialType.equals(type);
|
||||
@@ -435,7 +435,7 @@ public class TypeUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean containsSpecialType(
|
||||
public static boolean contains(
|
||||
@Nullable KotlinType type,
|
||||
@NotNull Function1<KotlinType, Boolean> isSpecialType
|
||||
) {
|
||||
@@ -443,11 +443,11 @@ public class TypeUtils {
|
||||
if (isSpecialType.invoke(type)) return true;
|
||||
Flexibility flexibility = type.getCapability(Flexibility.class);
|
||||
if (flexibility != null
|
||||
&& (containsSpecialType(flexibility.getLowerBound(), isSpecialType) || containsSpecialType(flexibility.getUpperBound(), isSpecialType))) {
|
||||
&& (contains(flexibility.getLowerBound(), isSpecialType) || contains(flexibility.getUpperBound(), isSpecialType))) {
|
||||
return true;
|
||||
}
|
||||
for (TypeProjection projection : type.getArguments()) {
|
||||
if (!projection.isStarProjection() && containsSpecialType(projection.getType(), isSpecialType)) return true;
|
||||
if (!projection.isStarProjection() && contains(projection.getType(), isSpecialType)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,4 +146,4 @@ fun KotlinType.getImmediateSuperclassNotAny(): KotlinType? {
|
||||
}
|
||||
|
||||
fun KotlinType.asTypeProjection(): TypeProjection = TypeProjectionImpl(this)
|
||||
fun KotlinType.containsSpecialType(predicate: (KotlinType) -> Boolean) = TypeUtils.containsSpecialType(this, predicate)
|
||||
fun KotlinType.contains(predicate: (KotlinType) -> Boolean) = TypeUtils.contains(this, predicate)
|
||||
|
||||
Reference in New Issue
Block a user