Minor. Change predicate type from KotlinType to UnwrappedType.
This commit is contained in:
@@ -566,9 +566,9 @@ public class ErrorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean containsUninferredParameter(@Nullable KotlinType type) {
|
public static boolean containsUninferredParameter(@Nullable KotlinType type) {
|
||||||
return TypeUtils.contains(type, new Function1<KotlinType, Boolean>() {
|
return TypeUtils.contains(type, new Function1<UnwrappedType, Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean invoke(KotlinType argumentType) {
|
public Boolean invoke(UnwrappedType argumentType) {
|
||||||
return isUninferredParameter(argumentType);
|
return isUninferredParameter(argumentType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -377,9 +377,9 @@ public class TypeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean contains(@Nullable KotlinType type, @NotNull final KotlinType specialType) {
|
public static boolean contains(@Nullable KotlinType type, @NotNull final KotlinType specialType) {
|
||||||
return contains(type, new Function1<KotlinType, Boolean>() {
|
return contains(type, new Function1<UnwrappedType, Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean invoke(KotlinType type) {
|
public Boolean invoke(UnwrappedType type) {
|
||||||
return specialType.equals(type);
|
return specialType.equals(type);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -387,12 +387,13 @@ public class TypeUtils {
|
|||||||
|
|
||||||
public static boolean contains(
|
public static boolean contains(
|
||||||
@Nullable KotlinType type,
|
@Nullable KotlinType type,
|
||||||
@NotNull Function1<KotlinType, Boolean> isSpecialType
|
@NotNull Function1<UnwrappedType, Boolean> isSpecialType
|
||||||
) {
|
) {
|
||||||
if (type == null) return false;
|
if (type == null) return false;
|
||||||
if (isSpecialType.invoke(type)) return true;
|
|
||||||
|
|
||||||
UnwrappedType unwrappedType = type.unwrap();
|
UnwrappedType unwrappedType = type.unwrap();
|
||||||
|
if (isSpecialType.invoke(unwrappedType)) return true;
|
||||||
|
|
||||||
FlexibleType flexibleType = unwrappedType instanceof FlexibleType ? (FlexibleType) unwrappedType : null;
|
FlexibleType flexibleType = unwrappedType instanceof FlexibleType ? (FlexibleType) unwrappedType : null;
|
||||||
if (flexibleType != null
|
if (flexibleType != null
|
||||||
&& (contains(flexibleType.getLowerBound(), isSpecialType) || contains(flexibleType.getUpperBound(), isSpecialType))) {
|
&& (contains(flexibleType.getLowerBound(), isSpecialType) || contains(flexibleType.getUpperBound(), isSpecialType))) {
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ fun KotlinType.getImmediateSuperclassNotAny(): KotlinType? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun KotlinType.asTypeProjection(): TypeProjection = TypeProjectionImpl(this)
|
fun KotlinType.asTypeProjection(): TypeProjection = TypeProjectionImpl(this)
|
||||||
fun KotlinType.contains(predicate: (KotlinType) -> Boolean) = TypeUtils.contains(this, predicate)
|
fun KotlinType.contains(predicate: (UnwrappedType) -> Boolean) = TypeUtils.contains(this, predicate)
|
||||||
|
|
||||||
fun KotlinType.replaceArgumentsWithStarProjections(): KotlinType {
|
fun KotlinType.replaceArgumentsWithStarProjections(): KotlinType {
|
||||||
val unwrapped = unwrap()
|
val unwrapped = unwrap()
|
||||||
|
|||||||
Reference in New Issue
Block a user