[FIR] Update dummy checker in allopen plugin
This commit is contained in:
committed by
TeamCityServer
parent
84dab9230e
commit
e87f7c5cb4
+14
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.plugin.checkers
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.SourceElementPositioningStrategies
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.warning1
|
||||
|
||||
object AllOpenErrors {
|
||||
val FUNCTION_WITH_DUMMY_NAME by warning1<PsiElement, String>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
||||
}
|
||||
+3
-2
@@ -14,8 +14,9 @@ import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||
|
||||
object DummyNameChecker : FirSimpleFunctionChecker() {
|
||||
override fun check(declaration: FirSimpleFunction, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.name.asString() == "dummy") {
|
||||
reporter.reportOn(declaration.source, FirErrors.SYNTAX, context)
|
||||
val name = declaration.name.asString()
|
||||
if (name == "dummy") {
|
||||
reporter.reportOn(declaration.source, AllOpenErrors.FUNCTION_WITH_DUMMY_NAME, name, context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!SYNTAX_ERROR!>fun dummy(x: Int) {
|
||||
fun <!FUNCTION_WITH_DUMMY_NAME!>dummy<!>(x: Int) {
|
||||
|
||||
}<!>
|
||||
}
|
||||
|
||||
class A {
|
||||
<!SYNTAX_ERROR!>fun dummy() {
|
||||
fun <!FUNCTION_WITH_DUMMY_NAME!>dummy<!>() {
|
||||
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
val dummy: Int = 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user