KT-13264 IAE: Argument for @NotNull parameter 'errorClass' createErrorTypeConstructorWithCustomDebugName must not be null

#KT-13264 Fixed
This commit is contained in:
Stanislav Erokhin
2016-07-28 18:42:07 +03:00
parent 19e4dbc37c
commit aa91b5a1b0
2 changed files with 12 additions and 12 deletions
@@ -28,12 +28,12 @@ abstract class AbstractTypeConstructor(storageManager: StorageManager) : TypeCon
private class Supertypes(
val allSupertypes: Collection<KotlinType>) {
// 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(
{ Supertypes(computeSupertypes()) },
{ Supertypes(listOf(ERROR_TYPE)) },
{ Supertypes(listOf(ErrorUtils.ERROR_TYPE_FOR_LOOP_IN_SUPERTYPES)) },
{ supertypes ->
// 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
@@ -51,20 +51,17 @@ abstract class AbstractTypeConstructor(storageManager: StorageManager) : TypeCon
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 val supertypeLoopChecker: SupertypeLoopChecker
protected open fun reportSupertypeLoopError(type: KotlinType) {}
protected open fun getAdditionalNeighboursInSupertypeGraph(): Collection<KotlinType> = emptyList()
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);
}
// 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 PropertyDescriptor ERROR_PROPERTY = createErrorProperty();