[FIR] Return error type from common super type if it present
This commit is contained in:
+2
@@ -28,6 +28,8 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext,
|
||||
|
||||
val symbolProvider: FirSymbolProvider get() = session.service()
|
||||
|
||||
override val isErrorTypeAllowed: Boolean get() = false
|
||||
|
||||
override fun nullableNothingType(): SimpleTypeMarker {
|
||||
return StandardClassIds.Nothing(symbolProvider).constructType(emptyArray(), true)
|
||||
}
|
||||
|
||||
+5
@@ -778,6 +778,11 @@ private fun inferenceComponents(session: FirSession, returnTypeCalculator: Retur
|
||||
override fun KotlinTypeMarker.removeExactAnnotation(): KotlinTypeMarker {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.toErrorType(): SimpleTypeMarker {
|
||||
require(this is ErrorTypeConstructor)
|
||||
return ConeClassErrorType(reason)
|
||||
}
|
||||
}, session, returnTypeCalculator, scopeSession)
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.types.AbstractTypeCheckerContext
|
||||
import org.jetbrains.kotlin.types.checker.convertVariance
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
|
||||
class ErrorTypeConstructor(reason: String) : TypeConstructorMarker
|
||||
class ErrorTypeConstructor(val reason: String) : TypeConstructorMarker
|
||||
|
||||
interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, TypeCheckerProviderContext {
|
||||
val session: FirSession
|
||||
@@ -417,6 +417,10 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
// TODO: Intersection types
|
||||
return false
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.isError(): Boolean {
|
||||
return this is ErrorTypeConstructor
|
||||
}
|
||||
}
|
||||
|
||||
class ConeTypeCheckerContext(override val isErrorTypeEqualsToAnything: Boolean, override val session: FirSession) :
|
||||
|
||||
Reference in New Issue
Block a user