Minor. Extract function
This commit is contained in:
@@ -74,8 +74,9 @@ public fun getJvmSignatureDiagnostics(element: PsiElement, otherDiagnostics: Dia
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun forElement(psiElement: PsiElement): Collection<Diagnostic> {
|
override fun forElement(psiElement: PsiElement): Collection<Diagnostic> {
|
||||||
val jvmDiagnostics = setOf(CONFLICTING_JVM_DECLARATIONS, ACCIDENTAL_OVERRIDE)
|
val jvmDiagnosticFactories = setOf(CONFLICTING_JVM_DECLARATIONS, ACCIDENTAL_OVERRIDE)
|
||||||
val (conflicting, other) = result.forElement(element).partition { it.getFactory() in jvmDiagnostics }
|
fun Diagnostic.data() = cast(this, jvmDiagnosticFactories).getA()
|
||||||
|
val (conflicting, other) = result.forElement(element).partition { it.getFactory() in jvmDiagnosticFactories }
|
||||||
if (alreadyReported(psiElement)) {
|
if (alreadyReported(psiElement)) {
|
||||||
// CONFLICTING_OVERLOADS already reported, no need to duplicate it
|
// CONFLICTING_OVERLOADS already reported, no need to duplicate it
|
||||||
return other
|
return other
|
||||||
@@ -83,7 +84,7 @@ public fun getJvmSignatureDiagnostics(element: PsiElement, otherDiagnostics: Dia
|
|||||||
|
|
||||||
val filtered = arrayListOf<Diagnostic>()
|
val filtered = arrayListOf<Diagnostic>()
|
||||||
conflicting.groupBy {
|
conflicting.groupBy {
|
||||||
cast(it, jvmDiagnostics).getA().signature.name
|
it.data().signature.name
|
||||||
}.forEach {
|
}.forEach {
|
||||||
val diagnostics = it.getValue()
|
val diagnostics = it.getValue()
|
||||||
if (diagnostics.size <= 1) {
|
if (diagnostics.size <= 1) {
|
||||||
@@ -99,7 +100,7 @@ public fun getJvmSignatureDiagnostics(element: PsiElement, otherDiagnostics: Dia
|
|||||||
// in case of implementation copied from a super trait there will be both diagnostics on the same signature
|
// in case of implementation copied from a super trait there will be both diagnostics on the same signature
|
||||||
me.getFactory() == ACCIDENTAL_OVERRIDE && other.getFactory() == CONFLICTING_JVM_DECLARATIONS
|
me.getFactory() == ACCIDENTAL_OVERRIDE && other.getFactory() == CONFLICTING_JVM_DECLARATIONS
|
||||||
// there are paris of corresponding signatures that frequently clash simultaneously: package facade & part, trait and trait-impl
|
// there are paris of corresponding signatures that frequently clash simultaneously: package facade & part, trait and trait-impl
|
||||||
|| cast(other, jvmDiagnostics).getA() higherThan cast(me, jvmDiagnostics).getA()
|
|| other.data() higherThan me.data()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user