From ea2d95fa79171ef482ad7adc3f9643057e17e3dd Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Tue, 16 Aug 2016 15:56:06 +0300 Subject: [PATCH] Minor. Change predicate type from KotlinType to UnwrappedType. --- .../src/org/jetbrains/kotlin/types/ErrorUtils.java | 4 ++-- .../src/org/jetbrains/kotlin/types/TypeUtils.java | 9 +++++---- .../src/org/jetbrains/kotlin/types/TypeUtils.kt | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java index cf2724eee11..fe32885a0aa 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java @@ -566,9 +566,9 @@ public class ErrorUtils { } public static boolean containsUninferredParameter(@Nullable KotlinType type) { - return TypeUtils.contains(type, new Function1() { + return TypeUtils.contains(type, new Function1() { @Override - public Boolean invoke(KotlinType argumentType) { + public Boolean invoke(UnwrappedType argumentType) { return isUninferredParameter(argumentType); } }); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java index 700717876f8..ad7b4eccb18 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java @@ -377,9 +377,9 @@ public class TypeUtils { } public static boolean contains(@Nullable KotlinType type, @NotNull final KotlinType specialType) { - return contains(type, new Function1() { + return contains(type, new Function1() { @Override - public Boolean invoke(KotlinType type) { + public Boolean invoke(UnwrappedType type) { return specialType.equals(type); } }); @@ -387,12 +387,13 @@ public class TypeUtils { public static boolean contains( @Nullable KotlinType type, - @NotNull Function1 isSpecialType + @NotNull Function1 isSpecialType ) { if (type == null) return false; - if (isSpecialType.invoke(type)) return true; UnwrappedType unwrappedType = type.unwrap(); + if (isSpecialType.invoke(unwrappedType)) return true; + FlexibleType flexibleType = unwrappedType instanceof FlexibleType ? (FlexibleType) unwrappedType : null; if (flexibleType != null && (contains(flexibleType.getLowerBound(), isSpecialType) || contains(flexibleType.getUpperBound(), isSpecialType))) { diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt index 564acbfc672..669f22d3fd4 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt @@ -161,7 +161,7 @@ fun KotlinType.getImmediateSuperclassNotAny(): KotlinType? { } 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 { val unwrapped = unwrap()