Unite checks around supertypes in FirPrimaryConstructorSuperTypeChecker
This commit is contained in:
committed by
TeamCityServer
parent
221b6bd184
commit
7d4b8587a3
+6
@@ -25,6 +25,12 @@ import org.jetbrains.kotlin.utils.addToStdlib.lastIsInstanceOrNull
|
||||
object FirPrimaryConstructorSuperTypeChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.isInterface) {
|
||||
for (superTypeRef in declaration.superTypeRefs) {
|
||||
val source = superTypeRef.source ?: continue
|
||||
if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.CONSTRUCTOR_CALLEE) {
|
||||
reporter.reportOn(source, FirErrors.SUPERTYPE_INITIALIZED_IN_INTERFACE, context)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
import org.jetbrains.kotlin.fir.declarations.isInterface
|
||||
|
||||
object FirSupertypeInitializedInInterfaceChecker : FirRegularClassChecker() {
|
||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (!declaration.isInterface) {
|
||||
return
|
||||
}
|
||||
|
||||
for (superTypeRef in declaration.superTypeRefs) {
|
||||
val source = superTypeRef.source ?: continue
|
||||
if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.CONSTRUCTOR_CALLEE) {
|
||||
reporter.reportOn(source, FirErrors.SUPERTYPE_INITIALIZED_IN_INTERFACE, context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -58,7 +58,6 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
|
||||
FirManyCompanionObjectsChecker,
|
||||
FirMethodOfAnyImplementedInInterfaceChecker,
|
||||
FirDataClassPrimaryConstructorChecker,
|
||||
FirSupertypeInitializedInInterfaceChecker,
|
||||
FirPrimaryConstructorSuperTypeChecker,
|
||||
FirTypeParametersInObjectChecker,
|
||||
FirMemberFunctionsChecker,
|
||||
|
||||
Reference in New Issue
Block a user