KT-13264 IAE: Argument for @NotNull parameter 'errorClass' createErrorTypeConstructorWithCustomDebugName must not be null
#KT-13264 Fixed
This commit is contained in:
@@ -28,12 +28,12 @@ abstract class AbstractTypeConstructor(storageManager: StorageManager) : TypeCon
|
|||||||
private class Supertypes(
|
private class Supertypes(
|
||||||
val allSupertypes: Collection<KotlinType>) {
|
val allSupertypes: Collection<KotlinType>) {
|
||||||
// initializer is only needed as a stub for case when 'getSupertypes' is called while 'supertypes' are being calculated
|
// initializer is only needed as a stub for case when 'getSupertypes' is called while 'supertypes' are being calculated
|
||||||
var supertypesWithoutCycles: List<KotlinType> = listOf(ERROR_TYPE)
|
var supertypesWithoutCycles: List<KotlinType> = listOf(ErrorUtils.ERROR_TYPE_FOR_LOOP_IN_SUPERTYPES)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val supertypes = storageManager.createLazyValueWithPostCompute(
|
private val supertypes = storageManager.createLazyValueWithPostCompute(
|
||||||
{ Supertypes(computeSupertypes()) },
|
{ Supertypes(computeSupertypes()) },
|
||||||
{ Supertypes(listOf(ERROR_TYPE)) },
|
{ Supertypes(listOf(ErrorUtils.ERROR_TYPE_FOR_LOOP_IN_SUPERTYPES)) },
|
||||||
{ supertypes ->
|
{ supertypes ->
|
||||||
// It's important that loops disconnection begins in post-compute phase, because it guarantees that
|
// It's important that loops disconnection begins in post-compute phase, because it guarantees that
|
||||||
// when we start calculation supertypes of supertypes (for computing neighbours), they start their disconnection loop process
|
// when we start calculation supertypes of supertypes (for computing neighbours), they start their disconnection loop process
|
||||||
@@ -51,20 +51,17 @@ abstract class AbstractTypeConstructor(storageManager: StorageManager) : TypeCon
|
|||||||
supertypes.supertypesWithoutCycles = (resultWithoutCycles as? List<KotlinType>) ?: resultWithoutCycles.toList()
|
supertypes.supertypesWithoutCycles = (resultWithoutCycles as? List<KotlinType>) ?: resultWithoutCycles.toList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
private fun TypeConstructor.computeNeighbours(): Collection<KotlinType> =
|
||||||
|
(this as? AbstractTypeConstructor)?.let {
|
||||||
|
abstractClassifierDescriptor ->
|
||||||
|
abstractClassifierDescriptor.supertypes().allSupertypes +
|
||||||
|
abstractClassifierDescriptor.getAdditionalNeighboursInSupertypeGraph()
|
||||||
|
} ?: supertypes
|
||||||
|
|
||||||
protected abstract fun computeSupertypes(): Collection<KotlinType>
|
protected abstract fun computeSupertypes(): Collection<KotlinType>
|
||||||
protected abstract val supertypeLoopChecker: SupertypeLoopChecker
|
protected abstract val supertypeLoopChecker: SupertypeLoopChecker
|
||||||
protected open fun reportSupertypeLoopError(type: KotlinType) {}
|
protected open fun reportSupertypeLoopError(type: KotlinType) {}
|
||||||
protected open fun getAdditionalNeighboursInSupertypeGraph(): Collection<KotlinType> = emptyList()
|
protected open fun getAdditionalNeighboursInSupertypeGraph(): Collection<KotlinType> = emptyList()
|
||||||
protected open fun defaultSupertypeIfEmpty(): KotlinType? = null
|
protected open fun defaultSupertypeIfEmpty(): KotlinType? = null
|
||||||
|
|
||||||
private companion object {
|
|
||||||
val ERROR_TYPE = ErrorUtils.createErrorType("Loop in supertypes")
|
|
||||||
|
|
||||||
fun TypeConstructor.computeNeighbours(): Collection<KotlinType> =
|
|
||||||
(this as? AbstractTypeConstructor)?.let {
|
|
||||||
abstractClassifierDescriptor ->
|
|
||||||
abstractClassifierDescriptor.supertypes().allSupertypes +
|
|
||||||
abstractClassifierDescriptor.getAdditionalNeighboursInSupertypeGraph()
|
|
||||||
} ?: supertypes
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,6 +330,9 @@ public class ErrorUtils {
|
|||||||
return new ErrorScope(debugMessage);
|
return new ErrorScope(debugMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not move it into AbstractTypeConstructor.Companion because of cycle in initialization(see KT-13264)
|
||||||
|
public static final SimpleType ERROR_TYPE_FOR_LOOP_IN_SUPERTYPES = createErrorType("<LOOP IN SUPERTYPES>");
|
||||||
|
|
||||||
private static final KotlinType ERROR_PROPERTY_TYPE = createErrorType("<ERROR PROPERTY TYPE>");
|
private static final KotlinType ERROR_PROPERTY_TYPE = createErrorType("<ERROR PROPERTY TYPE>");
|
||||||
private static final PropertyDescriptor ERROR_PROPERTY = createErrorProperty();
|
private static final PropertyDescriptor ERROR_PROPERTY = createErrorProperty();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user