Prohibit suspend function type in supertype list
#KT-15391 Fixed
This commit is contained in:
@@ -237,6 +237,7 @@ public interface Errors {
|
||||
DiagnosticFactory2<KtDeclaration, CallableMemberDescriptor, List<CallableMemberDescriptor>> DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> SUPERTYPE_NOT_A_CLASS_OR_INTERFACE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<PsiElement> NO_GENERICS_IN_SUPERTYPE_SPECIFIER = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
|
||||
+1
@@ -544,6 +544,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(MANY_CLASSES_IN_SUPERTYPE_LIST, "Only one class may appear in a supertype list");
|
||||
MAP.put(SUPERTYPE_NOT_A_CLASS_OR_INTERFACE, "Only classes and interfaces may serve as supertypes");
|
||||
MAP.put(SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE, "Extension function type is not allowed as supertypes");
|
||||
MAP.put(SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE, "Suspend function type is not allowed as supertypes");
|
||||
MAP.put(SUPERTYPE_INITIALIZED_IN_INTERFACE, "Interfaces cannot initialize supertypes");
|
||||
MAP.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes");
|
||||
MAP.put(CONSTRUCTOR_IN_INTERFACE, "An interface may not have a constructor");
|
||||
|
||||
@@ -471,6 +471,9 @@ public class BodyResolver {
|
||||
if (FunctionTypesKt.isExtensionFunctionType(supertype)) {
|
||||
trace.report(SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE.on(typeReference));
|
||||
}
|
||||
else if (FunctionTypesKt.isSuspendFunctionType(supertype)) {
|
||||
trace.report(SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE.on(typeReference));
|
||||
}
|
||||
|
||||
if (classDescriptor.getKind() != ClassKind.INTERFACE) {
|
||||
if (supertypeOwner.getKind() == ClassKind.ENUM_CLASS) {
|
||||
|
||||
Reference in New Issue
Block a user