Minor. Pull up method
This commit is contained in:
-60
@@ -17,23 +17,13 @@
|
|||||||
package org.jetbrains.kotlin.descriptors.impl;
|
package org.jetbrains.kotlin.descriptors.impl;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor;
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.SourceElement;
|
import org.jetbrains.kotlin.descriptors.SourceElement;
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
|
||||||
import org.jetbrains.kotlin.storage.StorageManager;
|
import org.jetbrains.kotlin.storage.StorageManager;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
|
||||||
import org.jetbrains.kotlin.types.TypeConstructor;
|
|
||||||
import org.jetbrains.kotlin.types.Variance;
|
import org.jetbrains.kotlin.types.Variance;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class AbstractLazyTypeParameterDescriptor extends AbstractTypeParameterDescriptor {
|
public abstract class AbstractLazyTypeParameterDescriptor extends AbstractTypeParameterDescriptor {
|
||||||
public AbstractLazyTypeParameterDescriptor(
|
public AbstractLazyTypeParameterDescriptor(
|
||||||
@NotNull StorageManager storageManager,
|
@NotNull StorageManager storageManager,
|
||||||
@@ -47,56 +37,6 @@ public abstract class AbstractLazyTypeParameterDescriptor extends AbstractTypePa
|
|||||||
super(storageManager, containingDeclaration, Annotations.Companion.getEMPTY() /* TODO */, name, variance, isReified, index, source);
|
super(storageManager, containingDeclaration, Annotations.Companion.getEMPTY() /* TODO */, name, variance, isReified, index, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
protected TypeConstructor createTypeConstructor() {
|
|
||||||
return new TypeConstructor() {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Collection<KotlinType> getSupertypes() {
|
|
||||||
return AbstractLazyTypeParameterDescriptor.this.getUpperBounds();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public List<TypeParameterDescriptor> getParameters() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFinal() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDenotable() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ClassifierDescriptor getDeclarationDescriptor() {
|
|
||||||
return AbstractLazyTypeParameterDescriptor.this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Annotations getAnnotations() {
|
|
||||||
return AbstractLazyTypeParameterDescriptor.this.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public KotlinBuiltIns getBuiltIns() {
|
|
||||||
return DescriptorUtilsKt.getBuiltIns(AbstractLazyTypeParameterDescriptor.this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getName().toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
// Not using descriptor renderer to preserve laziness
|
// Not using descriptor renderer to preserve laziness
|
||||||
|
|||||||
+53
-5
@@ -20,9 +20,11 @@ import kotlin.Unit;
|
|||||||
import kotlin.jvm.functions.Function0;
|
import kotlin.jvm.functions.Function0;
|
||||||
import kotlin.jvm.functions.Function1;
|
import kotlin.jvm.functions.Function1;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.LazyScopeAdapter;
|
import org.jetbrains.kotlin.resolve.scopes.LazyScopeAdapter;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.TypeIntersectionScope;
|
import org.jetbrains.kotlin.resolve.scopes.TypeIntersectionScope;
|
||||||
@@ -30,11 +32,10 @@ import org.jetbrains.kotlin.storage.NotNullLazyValue;
|
|||||||
import org.jetbrains.kotlin.storage.StorageManager;
|
import org.jetbrains.kotlin.storage.StorageManager;
|
||||||
import org.jetbrains.kotlin.types.*;
|
import org.jetbrains.kotlin.types.*;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
|
||||||
|
|
||||||
public abstract class AbstractTypeParameterDescriptor extends DeclarationDescriptorNonRootImpl implements TypeParameterDescriptor {
|
public abstract class AbstractTypeParameterDescriptor extends DeclarationDescriptorNonRootImpl implements TypeParameterDescriptor {
|
||||||
public static final List<KotlinType> FALLBACK_UPPER_BOUNDS_ON_RECURSION =
|
public static final List<KotlinType> FALLBACK_UPPER_BOUNDS_ON_RECURSION =
|
||||||
Collections.singletonList(ErrorUtils.createErrorType("Recursion while calculating upper bounds"));
|
Collections.singletonList(ErrorUtils.createErrorType("Recursion while calculating upper bounds"));
|
||||||
@@ -132,6 +133,56 @@ public abstract class AbstractTypeParameterDescriptor extends DeclarationDescrip
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
protected TypeConstructor createTypeConstructor() {
|
||||||
|
return new TypeConstructor() {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Collection<KotlinType> getSupertypes() {
|
||||||
|
return AbstractTypeParameterDescriptor.this.getUpperBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<TypeParameterDescriptor> getParameters() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFinal() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDenotable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClassifierDescriptor getDeclarationDescriptor() {
|
||||||
|
return AbstractTypeParameterDescriptor.this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Annotations getAnnotations() {
|
||||||
|
return AbstractTypeParameterDescriptor.this.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public KotlinBuiltIns getBuiltIns() {
|
||||||
|
return DescriptorUtilsKt.getBuiltIns(AbstractTypeParameterDescriptor.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getName().toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
protected abstract SupertypeLoopChecker getSupertypeLoopChecker();
|
protected abstract SupertypeLoopChecker getSupertypeLoopChecker();
|
||||||
protected abstract void reportCycleError(@NotNull KotlinType type);
|
protected abstract void reportCycleError(@NotNull KotlinType type);
|
||||||
@@ -139,9 +190,6 @@ public abstract class AbstractTypeParameterDescriptor extends DeclarationDescrip
|
|||||||
@NotNull
|
@NotNull
|
||||||
protected abstract List<KotlinType> resolveUpperBounds();
|
protected abstract List<KotlinType> resolveUpperBounds();
|
||||||
|
|
||||||
@NotNull
|
|
||||||
protected abstract TypeConstructor createTypeConstructor();
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Variance getVariance() {
|
public Variance getVariance() {
|
||||||
|
|||||||
Reference in New Issue
Block a user