Move DeclarationDescriptor.substitute to separate interface Substitutable
To get rid of pointless/confusing implementations in ModuleDescriptor, PackageViewDescriptor, TypeParameterDescriptor and others. Note that there are still implementations that do not make sense, for example in those subclasses of VariableDescriptor which are not also subclasses of CallableMemberDescriptor (e.g. ValueParameterDescriptor). Those can be removed by making CallableMemberDescriptor (instead of CallableDescriptor) inherit from Substitutable. However, that would require more changes in the compiler because CallableDescriptor is used rather often in places where in fact only CallableMemberDescriptor instances can appear. Explicit return types and casts are required in some places now because there's no single non-trivial supertype for ClassifierDescriptorWithTypeParameters and CallableDescriptor. Previously it was DeclarationDescriptorWithVisibility, now it's both that and Substitutable<...>
This commit is contained in:
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorVisitor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
|
||||
public class RootContext extends CodegenContext<RootContext.FakeDescriptor> {
|
||||
private final GenerationState state;
|
||||
@@ -56,11 +55,6 @@ public class RootContext extends CodegenContext<RootContext.FakeDescriptor> {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {
|
||||
throw new IllegalStateException();
|
||||
|
||||
Reference in New Issue
Block a user