Introduce ClassDescriptor.declaredTypeParameters

Should be a subset of type constructor's parameters
This commit is contained in:
Denis Zharkov
2015-11-03 13:56:04 +03:00
parent 57094954a3
commit c9aa75259b
26 changed files with 130 additions and 70 deletions
@@ -166,7 +166,7 @@ class BasicLookupElementFactory(
}
is ClassDescriptor -> {
val typeParams = descriptor.getTypeConstructor().getParameters()
val typeParams = descriptor.declaredTypeParameters
if (includeClassTypeArguments && typeParams.isNotEmpty()) {
element = element.appendTailText(typeParams.map { it.getName().asString() }.joinToString(", ", "<", ">"), true)
}
@@ -295,7 +295,7 @@ class TypeInstantiationItems(
private val freeParameters: Collection<TypeParameterDescriptor>,
private val tail: Tail?) : InheritanceItemsSearcher {
private val baseHasTypeArgs = classDescriptor.typeConstructor.parameters.isNotEmpty()
private val baseHasTypeArgs = classDescriptor.declaredTypeParameters.isNotEmpty()
private val expectedType = KotlinTypeImpl.create(Annotations.EMPTY, classDescriptor, false, typeArgs)
private val expectedFuzzyType = FuzzyType(expectedType, freeParameters)
@@ -309,7 +309,7 @@ class TypeInstantiationItems(
if (!visibilityFilter(descriptor)) continue
var inheritorFuzzyType = FuzzyType(descriptor.defaultType, descriptor.typeConstructor.parameters)
val hasTypeArgs = descriptor.getTypeConstructor().getParameters().isNotEmpty()
val hasTypeArgs = descriptor.declaredTypeParameters.isNotEmpty()
if (hasTypeArgs || baseHasTypeArgs) {
val substitutor = inheritorFuzzyType.checkIsSubtypeOf(expectedFuzzyType) ?: continue
if (!substitutor.isEmpty) {