Completion: bold members from immediate class

This commit is contained in:
Valentin Kipyatkov
2014-11-14 23:06:09 +03:00
parent 79cfe2bac4
commit d061c3d771
21 changed files with 251 additions and 24 deletions
@@ -18,6 +18,8 @@ package org.jetbrains.jet.lang.resolve.calls.smartcasts;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import kotlin.Function1;
import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetExpression;
@@ -65,6 +67,26 @@ public class SmartCastUtils {
return variants;
}
@NotNull
public static List<JetType> getSmartCastVariantsWithLessSpecificExcluded(
@NotNull ReceiverValue receiverToCast,
@NotNull BindingContext bindingContext,
@NotNull DataFlowInfo dataFlowInfo
) {
final List<JetType> variants = getSmartCastVariants(receiverToCast, bindingContext, dataFlowInfo);
return KotlinPackage.filter(variants, new Function1<JetType, Boolean>() {
@Override
public Boolean invoke(final JetType type) {
return !KotlinPackage.any(variants, new Function1<JetType, Boolean>() {
@Override
public Boolean invoke(JetType another) {
return another != type && JetTypeChecker.DEFAULT.isSubtypeOf(another, type);
}
});
}
});
}
/**
* @return variants @param receiverToCast may be cast to according to @param dataFlowInfo, @param receiverToCast itself is NOT included
*/