Fixes after merge
This commit is contained in:
@@ -559,10 +559,12 @@ public class ClassDescriptorResolver {
|
|||||||
|
|
||||||
private static ClassModifiers resolveClassModifiers(@Nullable JetModifierList modifierList) {
|
private static ClassModifiers resolveClassModifiers(@Nullable JetModifierList modifierList) {
|
||||||
if (modifierList == null) return ClassModifiers.DEFAULT_MODIFIERS;
|
if (modifierList == null) return ClassModifiers.DEFAULT_MODIFIERS;
|
||||||
|
boolean abstractModifier = modifierList.hasModifier(JetTokens.ABSTRACT_KEYWORD);
|
||||||
|
boolean traitModifier = modifierList.hasModifier(JetTokens.TRAIT_KEYWORD);
|
||||||
return new ClassModifiers(
|
return new ClassModifiers(
|
||||||
modifierList.hasModifier(JetTokens.ABSTRACT_KEYWORD),
|
abstractModifier || traitModifier,
|
||||||
modifierList.hasModifier(JetTokens.OPEN_KEYWORD) || modifierList.hasModifier(JetTokens.ABSTRACT_KEYWORD),
|
modifierList.hasModifier(JetTokens.OPEN_KEYWORD) || abstractModifier || traitModifier,
|
||||||
modifierList.hasModifier(JetTokens.TRAIT_KEYWORD)
|
traitModifier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ public class TopDownAnalyzer {
|
|||||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||||
JetValueArgumentList valueArgumentList = call.getValueArgumentList();
|
JetValueArgumentList valueArgumentList = call.getValueArgumentList();
|
||||||
ASTNode node = valueArgumentList == null ? call.getNode() : valueArgumentList.getNode();
|
ASTNode node = valueArgumentList == null ? call.getNode() : valueArgumentList.getNode();
|
||||||
if (descriptor.isTrait()) {
|
if (descriptor.getClassModifiers().isTrait()) {
|
||||||
trace.getErrorHandler().genericError(node, "Traits can not initialize supertypes");
|
trace.getErrorHandler().genericError(node, "Traits can not initialize supertypes");
|
||||||
}
|
}
|
||||||
JetTypeReference typeReference = call.getTypeReference();
|
JetTypeReference typeReference = call.getTypeReference();
|
||||||
@@ -664,7 +664,7 @@ public class TopDownAnalyzer {
|
|||||||
recordSupertype(typeReference, supertype);
|
recordSupertype(typeReference, supertype);
|
||||||
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
||||||
if (classDescriptor != null) {
|
if (classDescriptor != null) {
|
||||||
if (classDescriptor.isTrait()) {
|
if (classDescriptor.getClassModifiers().isTrait()) {
|
||||||
trace.getErrorHandler().genericError(node, "A trait may not have a constructor");
|
trace.getErrorHandler().genericError(node, "A trait may not have a constructor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -673,7 +673,7 @@ public class TopDownAnalyzer {
|
|||||||
recordSupertype(typeReference, trace.getBindingContext().get(BindingContext.TYPE, typeReference));
|
recordSupertype(typeReference, trace.getBindingContext().get(BindingContext.TYPE, typeReference));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!descriptor.isTrait()) {
|
else if (!descriptor.getClassModifiers().isTrait()) {
|
||||||
JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, typeReference);
|
JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, typeReference);
|
||||||
recordSupertype(typeReference, supertype);
|
recordSupertype(typeReference, supertype);
|
||||||
|
|
||||||
@@ -692,8 +692,8 @@ public class TopDownAnalyzer {
|
|||||||
if (supertype != null) {
|
if (supertype != null) {
|
||||||
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
||||||
if (classDescriptor != null) {
|
if (classDescriptor != null) {
|
||||||
if (!descriptor.isTrait()) {
|
if (!descriptor.getClassModifiers().isTrait()) {
|
||||||
if (classDescriptor.hasConstructors() && !ErrorUtils.isError(classDescriptor.getTypeConstructor()) && !classDescriptor.isTrait()) {
|
if (classDescriptor.hasConstructors() && !ErrorUtils.isError(classDescriptor.getTypeConstructor()) && !classDescriptor.getClassModifiers().isTrait()) {
|
||||||
trace.getErrorHandler().genericError(specifier.getNode(), "This type has a constructor, and thus must be initialized here");
|
trace.getErrorHandler().genericError(specifier.getNode(), "This type has a constructor, and thus must be initialized here");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,7 +735,7 @@ public class TopDownAnalyzer {
|
|||||||
|
|
||||||
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype);
|
||||||
if (classDescriptor != null) {
|
if (classDescriptor != null) {
|
||||||
if (!classDescriptor.isTrait()) {
|
if (!classDescriptor.getClassModifiers().isTrait()) {
|
||||||
if (classAppeared) {
|
if (classAppeared) {
|
||||||
trace.getErrorHandler().genericError(typeReference.getNode(), "Only one class may appear in a supertype list");
|
trace.getErrorHandler().genericError(typeReference.getNode(), "Only one class may appear in a supertype list");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user