Dont show warning for KT-21515 with LV>=1.3

This commit is contained in:
Dmitry Savvinov
2020-09-15 14:01:17 +03:00
parent 57ceb0fa20
commit 6a55475392
9 changed files with 41 additions and 32 deletions
@@ -97,11 +97,13 @@ abstract class AbstractTypeConstructor(storageManager: StorageManager) : TypeCon
// We also check if there are a loop with additional edges going from owner of companion to
// the companion itself.
// Note that we use already disconnected types to not report two diagnostics on cyclic supertypes
supertypeLoopChecker.findLoopsInSupertypesAndDisconnect(
this, resultWithoutCycles,
{ it.computeNeighbours(useCompanions = true) },
{ reportScopesLoopError(it) }
)
if (shouldReportCyclicScopeWithCompanionWarning) {
supertypeLoopChecker.findLoopsInSupertypesAndDisconnect(
this, resultWithoutCycles,
{ it.computeNeighbours(useCompanions = true) },
{ reportScopesLoopError(it) }
)
}
supertypes.supertypesWithoutCycles = (resultWithoutCycles as? List<KotlinType>) ?: resultWithoutCycles.toList()
})
@@ -118,6 +120,7 @@ abstract class AbstractTypeConstructor(storageManager: StorageManager) : TypeCon
// TODO: overload in AbstractTypeParameterDescriptor?
protected open fun reportScopesLoopError(type: KotlinType) {}
protected open val shouldReportCyclicScopeWithCompanionWarning: Boolean = false
protected open fun getAdditionalNeighboursInSupertypeGraph(useCompanions: Boolean): Collection<KotlinType> = emptyList()
protected open fun defaultSupertypeIfEmpty(): KotlinType? = null