ClassDescriptor is now a super-interface for ClassConstructorDescriptor and TypeAliasConstructorDescriptor.

This commit is contained in:
Dmitry Petrov
2016-09-15 17:47:43 +03:00
committed by Dmitry Petrov
parent 7d214c6e58
commit 796d11c860
71 changed files with 307 additions and 243 deletions
@@ -169,7 +169,7 @@ public class AnnotationResolver {
if (!ErrorUtils.isError(descriptor)) {
if (descriptor instanceof ConstructorDescriptor) {
ConstructorDescriptor constructor = (ConstructorDescriptor)descriptor;
ClassDescriptor classDescriptor = constructor.getContainingDeclaration();
ClassDescriptor classDescriptor = constructor.getConstructedClass();
if (classDescriptor.getKind() != ClassKind.ANNOTATION_CLASS) {
trace.report(NOT_AN_ANNOTATION_CLASS.on(entryElement, classDescriptor));
}
@@ -221,7 +221,7 @@ public interface BindingContext {
*/
WritableSlice<PsiElement, SimpleFunctionDescriptor> FUNCTION = Slices.createSimpleSlice();
WritableSlice<PsiElement, ConstructorDescriptor> CONSTRUCTOR = Slices.createSimpleSlice();
WritableSlice<ConstructorDescriptor, ResolvedCall<ConstructorDescriptor>> CONSTRUCTOR_RESOLVED_DELEGATION_CALL =
WritableSlice<ConstructorDescriptor, ResolvedCall<ClassConstructorDescriptor>> CONSTRUCTOR_RESOLVED_DELEGATION_CALL =
Slices.createSimpleSlice();
WritableSlice<PsiElement, VariableDescriptor> VARIABLE = Slices.createSimpleSlice();
WritableSlice<KtParameter, VariableDescriptor> VALUE_PARAMETER = Slices.createSimpleSlice();
@@ -222,7 +222,7 @@ public class BindingContextUtils {
}
@Nullable
public static ResolvedCall<ConstructorDescriptor> getDelegationConstructorCall(
public static ResolvedCall<ClassConstructorDescriptor> getDelegationConstructorCall(
@NotNull BindingContext bindingContext,
@NotNull ConstructorDescriptor constructorDescriptor
) {
@@ -38,7 +38,7 @@ public interface BodiesResolveContext {
@Mutable
Map<KtAnonymousInitializer, ClassDescriptorWithResolutionScopes> getAnonymousInitializers();
@Mutable
Map<KtSecondaryConstructor, ConstructorDescriptor> getSecondaryConstructors();
Map<KtSecondaryConstructor, ClassConstructorDescriptor> getSecondaryConstructors();
@Mutable
Map<KtScript, LazyScriptDescriptor> getScripts();
@@ -122,14 +122,14 @@ public class BodyResolver {
}
private void resolveSecondaryConstructors(@NotNull BodiesResolveContext c) {
for (Map.Entry<KtSecondaryConstructor, ConstructorDescriptor> entry : c.getSecondaryConstructors().entrySet()) {
for (Map.Entry<KtSecondaryConstructor, ClassConstructorDescriptor> entry : c.getSecondaryConstructors().entrySet()) {
LexicalScope declaringScope = c.getDeclaringScope(entry.getKey());
assert declaringScope != null : "Declaring scope should be registered before body resolve";
resolveSecondaryConstructorBody(c.getOuterDataFlowInfo(), trace, entry.getKey(), entry.getValue(), declaringScope);
}
if (c.getSecondaryConstructors().isEmpty()) return;
Set<ConstructorDescriptor> visitedConstructors = Sets.newHashSet();
for (Map.Entry<KtSecondaryConstructor, ConstructorDescriptor> entry : c.getSecondaryConstructors().entrySet()) {
for (Map.Entry<KtSecondaryConstructor, ClassConstructorDescriptor> entry : c.getSecondaryConstructors().entrySet()) {
checkCyclicConstructorDelegationCall(entry.getValue(), visitedConstructors);
}
}
@@ -138,7 +138,7 @@ public class BodyResolver {
@NotNull final DataFlowInfo outerDataFlowInfo,
@NotNull final BindingTrace trace,
@NotNull final KtSecondaryConstructor constructor,
@NotNull final ConstructorDescriptor descriptor,
@NotNull final ClassConstructorDescriptor descriptor,
@NotNull LexicalScope declaringScope
) {
ForceResolveUtil.forceResolveAllContents(descriptor.getAnnotations());
@@ -167,7 +167,7 @@ public class BodyResolver {
@NotNull BindingTrace trace,
@NotNull LexicalScope scope,
@NotNull KtSecondaryConstructor constructor,
@NotNull ConstructorDescriptor descriptor
@NotNull ClassConstructorDescriptor descriptor
) {
OverloadResolutionResults<?> results = callResolver.resolveConstructorDelegationCall(
trace, scope, outerDataFlowInfo,
@@ -231,7 +231,7 @@ public class BodyResolver {
@Nullable
private ConstructorDescriptor getDelegatedConstructor(@NotNull ConstructorDescriptor constructor) {
ResolvedCall<ConstructorDescriptor> call = trace.get(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor);
ResolvedCall<ClassConstructorDescriptor> call = trace.get(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor);
return call == null || !call.getStatus().isSuccess() ? null : call.getResultingDescriptor().getOriginal();
}
@@ -430,7 +430,7 @@ public class BodyResolver {
@NotNull ResolvedCall<?> call
) {
//noinspection unchecked
trace.record(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor, (ResolvedCall<ConstructorDescriptor>) call);
trace.record(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor, (ResolvedCall<ClassConstructorDescriptor>) call);
}
private void checkSupertypeList(
@@ -217,7 +217,7 @@ class DeclarationsChecker(
TypeAliasExpander(reportStrategy).expandWithoutAbbreviation(typeAliasExpansion, Annotations.EMPTY)
}
private fun checkConstructorDeclaration(constructorDescriptor: ConstructorDescriptor, declaration: KtDeclaration) {
private fun checkConstructorDeclaration(constructorDescriptor: ClassConstructorDescriptor, declaration: KtDeclaration) {
declaration.checkTypeReferences()
modifiersChecker.checkModifiersForDeclaration(declaration, constructorDescriptor)
identifierChecker.checkDeclaration(declaration, trace)
@@ -225,7 +225,7 @@ class DeclarationsChecker(
checkConstructorVisibility(constructorDescriptor, declaration)
}
private fun checkConstructorVisibility(constructorDescriptor: ConstructorDescriptor, declaration: KtDeclaration) {
private fun checkConstructorVisibility(constructorDescriptor: ClassConstructorDescriptor, declaration: KtDeclaration) {
val visibilityModifier = declaration.visibilityModifier()
if (visibilityModifier != null && visibilityModifier.node?.elementType != KtTokens.PRIVATE_KEYWORD) {
val classDescriptor = constructorDescriptor.containingDeclaration
@@ -396,12 +396,12 @@ public class DescriptorResolver {
}
@NotNull
public static ConstructorDescriptorImpl createAndRecordPrimaryConstructorForObject(
public static ClassConstructorDescriptorImpl createAndRecordPrimaryConstructorForObject(
@Nullable KtClassOrObject object,
@NotNull ClassDescriptor classDescriptor,
@NotNull BindingTrace trace
) {
ConstructorDescriptorImpl constructorDescriptor =
ClassConstructorDescriptorImpl constructorDescriptor =
DescriptorFactory.createPrimaryConstructorForObject(classDescriptor, KotlinSourceElementKt.toSourceElement(object));
if (object != null) {
KtPrimaryConstructor primaryConstructor = object.getPrimaryConstructor();
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.builtins.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.FunctionExpressionDescriptor
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
@@ -239,7 +239,7 @@ class FunctionDescriptorResolver(
classDescriptor: ClassDescriptor,
classElement: KtClassOrObject,
trace: BindingTrace
): ConstructorDescriptorImpl? {
): ClassConstructorDescriptorImpl? {
if (classDescriptor.getKind() == ClassKind.ENUM_ENTRY || !classElement.hasPrimaryConstructor()) return null
return createConstructorDescriptor(
scope,
@@ -257,7 +257,7 @@ class FunctionDescriptorResolver(
classDescriptor: ClassDescriptor,
constructor: KtSecondaryConstructor,
trace: BindingTrace
): ConstructorDescriptorImpl {
): ClassConstructorDescriptorImpl {
return createConstructorDescriptor(
scope,
classDescriptor,
@@ -277,8 +277,8 @@ class FunctionDescriptorResolver(
declarationToTrace: KtDeclaration,
valueParameters: List<KtParameter>,
trace: BindingTrace
): ConstructorDescriptorImpl {
val constructorDescriptor = ConstructorDescriptorImpl.create(
): ClassConstructorDescriptorImpl {
val constructorDescriptor = ClassConstructorDescriptorImpl.create(
classDescriptor,
annotationResolver.resolveAnnotationsWithoutArguments(scope, modifierList, trace),
isPrimary,
@@ -147,7 +147,7 @@ class LazyTopDownAnalyzer(
}
override fun visitSecondaryConstructor(constructor: KtSecondaryConstructor) {
c.secondaryConstructors.put(constructor, lazyDeclarationResolver.resolveToDescriptor(constructor) as ConstructorDescriptor)
c.secondaryConstructors.put(constructor, lazyDeclarationResolver.resolveToDescriptor(constructor) as ClassConstructorDescriptor)
}
override fun visitEnumEntry(enumEntry: KtEnumEntry) {
@@ -40,7 +40,7 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
private final Map<KtClassOrObject, ClassDescriptorWithResolutionScopes> classes = Maps.newLinkedHashMap();
private final Map<KtAnonymousInitializer, ClassDescriptorWithResolutionScopes> anonymousInitializers = Maps.newLinkedHashMap();
private final Set<KtFile> files = new LinkedHashSet<KtFile>();
private final Map<KtSecondaryConstructor, ConstructorDescriptor> secondaryConstructors = Maps.newLinkedHashMap();
private final Map<KtSecondaryConstructor, ClassConstructorDescriptor> secondaryConstructors = Maps.newLinkedHashMap();
private final Map<KtNamedFunction, SimpleFunctionDescriptor> functions = Maps.newLinkedHashMap();
private final Map<KtProperty, PropertyDescriptor> properties = Maps.newLinkedHashMap();
@@ -101,7 +101,7 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
}
@Override
public Map<KtSecondaryConstructor, ConstructorDescriptor> getSecondaryConstructors() {
public Map<KtSecondaryConstructor, ClassConstructorDescriptor> getSecondaryConstructors() {
return secondaryConstructors;
}
@@ -280,7 +280,7 @@ public class CallResolver {
DeclarationDescriptor container = context.scope.getOwnerDescriptor();
assert container instanceof ConstructorDescriptor : "Trying to resolve JetConstructorDelegationCall not in constructor. scope.ownerDescriptor = " + container;
return (OverloadResolutionResults) resolveConstructorDelegationCall(context, delegationCall, (KtConstructorDelegationReferenceExpression) calleeExpression,
(ConstructorDescriptor) container);
(ClassConstructorDescriptor) container);
}
else if (calleeExpression == null) {
return checkArgumentTypesAndFail(context);
@@ -308,7 +308,7 @@ public class CallResolver {
return resolveCallForInvoke(context.replaceCall(call), tracingForInvoke);
}
private OverloadResolutionResults<ConstructorDescriptor> resolveCallForConstructor(
private OverloadResolutionResults<ClassConstructorDescriptor> resolveCallForConstructor(
@NotNull BasicCallResolutionContext context,
@NotNull KtConstructorCalleeExpression expression
) {
@@ -335,25 +335,25 @@ public class CallResolver {
ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor;
Collection<ConstructorDescriptor> constructors = classDescriptor.getConstructors();
Collection<ClassConstructorDescriptor> constructors = classDescriptor.getConstructors();
if (constructors.isEmpty()) {
context.trace.report(NO_CONSTRUCTOR.on(CallUtilKt.getValueArgumentListOrElement(context.call)));
return checkArgumentTypesAndFail(context);
}
Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
Pair<Collection<ResolutionCandidate<ClassConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
prepareCandidatesAndContextForConstructorCall(constructedType, context);
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
Collection<ResolutionCandidate<ClassConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
context = candidatesAndContext.getSecond();
return computeTasksFromCandidatesAndResolvedCall(context, functionReference, candidates);
}
@Nullable
public OverloadResolutionResults<ConstructorDescriptor> resolveConstructorDelegationCall(
public OverloadResolutionResults<ClassConstructorDescriptor> resolveConstructorDelegationCall(
@NotNull BindingTrace trace, @NotNull LexicalScope scope, @NotNull DataFlowInfo dataFlowInfo,
@NotNull ConstructorDescriptor constructorDescriptor,
@NotNull ClassConstructorDescriptor constructorDescriptor,
@NotNull KtConstructorDelegationCall call
) {
// Method returns `null` when there is nothing to resolve in trivial cases like `null` call expression or
@@ -368,7 +368,7 @@ public class CallResolver {
if (call.getCalleeExpression() == null) return checkArgumentTypesAndFail(context);
if (constructorDescriptor.getContainingDeclaration().getKind() == ClassKind.ENUM_CLASS && call.isImplicit()) {
if (constructorDescriptor.getConstructedClass().getKind() == ClassKind.ENUM_CLASS && call.isImplicit()) {
return null;
}
@@ -381,11 +381,11 @@ public class CallResolver {
}
@NotNull
private OverloadResolutionResults<ConstructorDescriptor> resolveConstructorDelegationCall(
private OverloadResolutionResults<ClassConstructorDescriptor> resolveConstructorDelegationCall(
@NotNull BasicCallResolutionContext context,
@NotNull KtConstructorDelegationCall call,
@NotNull KtConstructorDelegationReferenceExpression calleeExpression,
@NotNull ConstructorDescriptor calleeConstructor
@NotNull ClassConstructorDescriptor calleeConstructor
) {
context.trace.record(BindingContext.LEXICAL_SCOPE, call, context.scope);
@@ -399,7 +399,7 @@ public class CallResolver {
ClassDescriptor delegateClassDescriptor = isThisCall ? currentClassDescriptor :
DescriptorUtilsKt.getSuperClassOrAny(currentClassDescriptor);
Collection<ConstructorDescriptor> constructors = delegateClassDescriptor.getConstructors();
Collection<ClassConstructorDescriptor> constructors = delegateClassDescriptor.getConstructors();
if (!isThisCall && currentClassDescriptor.getUnsubstitutedPrimaryConstructor() != null) {
if (DescriptorUtils.canHaveDeclaredConstructors(currentClassDescriptor)) {
@@ -421,9 +421,9 @@ public class CallResolver {
calleeConstructor.getContainingDeclaration().getDefaultType() :
DescriptorUtils.getSuperClassType(currentClassDescriptor);
Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
Pair<Collection<ResolutionCandidate<ClassConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
prepareCandidatesAndContextForConstructorCall(superType, context);
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
Collection<ResolutionCandidate<ClassConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
context = candidatesAndContext.getSecond();
TracingStrategy tracing = call.isImplicit() ?
@@ -442,13 +442,13 @@ public class CallResolver {
}
@NotNull
private static Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> prepareCandidatesAndContextForConstructorCall(
private static Pair<Collection<ResolutionCandidate<ClassConstructorDescriptor>>, BasicCallResolutionContext> prepareCandidatesAndContextForConstructorCall(
@NotNull KotlinType superType,
@NotNull BasicCallResolutionContext context
) {
if (!(superType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) {
return new Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext>(
Collections.<ResolutionCandidate<ConstructorDescriptor>>emptyList(), context);
return new Pair<Collection<ResolutionCandidate<ClassConstructorDescriptor>>, BasicCallResolutionContext>(
Collections.<ResolutionCandidate<ClassConstructorDescriptor>>emptyList(), context);
}
ClassDescriptor superClass = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
@@ -463,10 +463,10 @@ public class CallResolver {
context = context.replaceExpectedType(superType);
}
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates =
Collection<ResolutionCandidate<ClassConstructorDescriptor>> candidates =
CallResolverUtilKt.createResolutionCandidatesForConstructors(context.scope, context.call, superClass, knownTypeParametersSubstitutor);
return new Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext>(candidates, context);
return new Pair<Collection<ResolutionCandidate<ClassConstructorDescriptor>>, BasicCallResolutionContext>(candidates, context);
}
private static boolean anyConstructorHasDeclaredTypeParameters(@Nullable ClassifierDescriptor classDescriptor) {
@@ -202,7 +202,7 @@ fun createResolutionCandidatesForConstructors(
call: Call,
classWithConstructors: ClassDescriptor,
knownSubstitutor: TypeSubstitutor? = null
): Collection<ResolutionCandidate<ConstructorDescriptor>> {
): Collection<ResolutionCandidate<ClassConstructorDescriptor>> {
val constructors = classWithConstructors.constructors
if (constructors.isEmpty()) return emptyList()
@@ -240,7 +240,7 @@ class CandidateResolver(
val dispatchReceiver = candidateCall.dispatchReceiver
if (dispatchReceiver != null) {
var nestedClass: ClassDescriptor? = null
if (candidateDescriptor is ConstructorDescriptor
if (candidateDescriptor is ClassConstructorDescriptor
&& DescriptorUtils.isStaticNestedClass(candidateDescriptor.containingDeclaration)
) {
nestedClass = candidateDescriptor.containingDeclaration
@@ -285,7 +285,7 @@ class CandidateResolver(
if (expression is KtSimpleNameExpression) {
// 'B' in 'class A: B()' is JetConstructorCalleeExpression
if (descriptor is ConstructorDescriptor) {
val modality = descriptor.containingDeclaration.modality
val modality = descriptor.constructedClass.modality
if (modality == Modality.ABSTRACT) {
tracing.instantiationOfAbstractClass(trace)
}
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.resolve.calls.checkers
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
import org.jetbrains.kotlin.diagnostics.Errors
@@ -47,7 +48,7 @@ object ConstructorHeaderCallChecker : CallChecker {
if (context.scope.parentsWithSelf.any { scope ->
scope is LexicalScope && scope.kind == LexicalScopeKind.CONSTRUCTOR_HEADER &&
(scope.ownerDescriptor as ConstructorDescriptor).containingDeclaration in classes
(scope.ownerDescriptor as ClassConstructorDescriptor).containingDeclaration in classes
}) {
context.trace.report(Errors.INSTANCE_ACCESS_BEFORE_SUPER_CALL.on(reportOn, resolvedCall.resultingDescriptor))
}
@@ -625,7 +625,7 @@ private class ConstantExpressionEvaluatorVisitor(
// Ann()
if (resultingDescriptor is ConstructorDescriptor) {
val classDescriptor: ClassDescriptor = resultingDescriptor.containingDeclaration
val classDescriptor: ClassDescriptor = resultingDescriptor.constructedClass
if (DescriptorUtils.isAnnotationClass(classDescriptor)) {
val descriptor = AnnotationDescriptorImpl(
classDescriptor.defaultType,
@@ -160,7 +160,7 @@ public class InlineUtil {
public static boolean isArrayConstructorWithLambda(@NotNull CallableDescriptor descriptor) {
return descriptor.getValueParameters().size() == 2 &&
descriptor instanceof ConstructorDescriptor &&
KotlinBuiltIns.isArrayOrPrimitiveArray(((ConstructorDescriptor) descriptor).getContainingDeclaration());
KotlinBuiltIns.isArrayOrPrimitiveArray(((ConstructorDescriptor) descriptor).getConstructedClass());
}
@Nullable
@@ -376,12 +376,12 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@NotNull
@Override
public Collection<ConstructorDescriptor> getConstructors() {
public Collection<ClassConstructorDescriptor> getConstructors() {
return unsubstitutedMemberScope.getConstructors();
}
@Override
public ConstructorDescriptor getUnsubstitutedPrimaryConstructor() {
public ClassConstructorDescriptor getUnsubstitutedPrimaryConstructor() {
return unsubstitutedMemberScope.getPrimaryConstructor();
}
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERRIDE
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.incremental.components.LookupLocation
@@ -88,7 +88,7 @@ open class LazyClassMemberScope(
fun extract(extractFrom: KotlinType, name: Name): Collection<T>
}
private val primaryConstructor: NullableLazyValue<ConstructorDescriptor>
private val primaryConstructor: NullableLazyValue<ClassConstructorDescriptor>
= c.storageManager.createNullableLazyValue { resolvePrimaryConstructor() }
override fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration): LexicalScope {
@@ -292,18 +292,18 @@ open class LazyClassMemberScope(
result.addAll(getContributedFunctions(Name.identifier("copy"), location))
}
private val secondaryConstructors: NotNullLazyValue<Collection<ConstructorDescriptor>>
private val secondaryConstructors: NotNullLazyValue<Collection<ClassConstructorDescriptor>>
= c.storageManager.createLazyValue { resolveSecondaryConstructors() }
fun getConstructors(): Collection<ConstructorDescriptor> {
fun getConstructors(): Collection<ClassConstructorDescriptor> {
val result = secondaryConstructors()
val primaryConstructor = getPrimaryConstructor()
return if (primaryConstructor == null) result else result + primaryConstructor
}
fun getPrimaryConstructor(): ConstructorDescriptor? = primaryConstructor()
fun getPrimaryConstructor(): ClassConstructorDescriptor? = primaryConstructor()
protected open fun resolvePrimaryConstructor(): ConstructorDescriptor? {
protected open fun resolvePrimaryConstructor(): ClassConstructorDescriptor? {
val ownerInfo = declarationProvider.getOwnerInfo()
val classOrObject = ownerInfo.correspondingClassOrObject ?: return null
@@ -324,7 +324,7 @@ open class LazyClassMemberScope(
}
}
private fun resolveSecondaryConstructors(): Collection<ConstructorDescriptor> {
private fun resolveSecondaryConstructors(): Collection<ClassConstructorDescriptor> {
val classOrObject = declarationProvider.getOwnerInfo().correspondingClassOrObject ?: return emptyList()
return classOrObject.getSecondaryConstructors().map { constructor ->
@@ -336,7 +336,7 @@ open class LazyClassMemberScope(
}
}
protected fun setDeferredReturnType(descriptor: ConstructorDescriptorImpl) {
protected fun setDeferredReturnType(descriptor: ClassConstructorDescriptorImpl) {
descriptor.returnType = DeferredType.create(c.storageManager, trace, { thisDescriptor.getDefaultType() })
}
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.resolve.lazy.descriptors
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.incremental.components.LookupLocation
@@ -37,8 +37,8 @@ class LazyScriptClassMemberScope(
trace: BindingTrace)
: LazyClassMemberScope(resolveSession, declarationProvider, scriptDescriptor, trace) {
override fun resolvePrimaryConstructor(): ConstructorDescriptor? {
val constructor = ConstructorDescriptorImpl.create(
override fun resolvePrimaryConstructor(): ClassConstructorDescriptor? {
val constructor = ClassConstructorDescriptorImpl.create(
scriptDescriptor,
Annotations.EMPTY,
true,
@@ -52,7 +52,7 @@ class LazyScriptClassMemberScope(
return constructor
}
private fun createScriptParameters(constructor: ConstructorDescriptorImpl): List<ValueParameterDescriptor> {
private fun createScriptParameters(constructor: ClassConstructorDescriptorImpl): List<ValueParameterDescriptor> {
return scriptDescriptor.scriptDefinition.getScriptParameters(scriptDescriptor).mapIndexed { index, scriptParameter ->
ValueParameterDescriptorImpl(
constructor, null, index, Annotations.EMPTY, scriptParameter.name, scriptParameter.type,