Minor: cleanup + support variance in ErrorListDiagnosticListRenderer
1. Support variance in ErrorListDiagnosticListRenderer. I will make some diagnostics to have covariant type arguments in the next commits 2. Drop unused code Review: https://jetbrains.team/p/kt/reviews/12750/timeline
This commit is contained in:
+6
@@ -13,6 +13,7 @@ import java.io.File
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.KTypeProjection
|
||||
import kotlin.reflect.KVariance
|
||||
|
||||
object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
||||
const val BASE_PACKAGE = "org.jetbrains.kotlin.fir.analysis.diagnostics"
|
||||
@@ -116,6 +117,11 @@ object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
||||
if (typeArgumentType == null) {
|
||||
print("*")
|
||||
} else {
|
||||
when (typeArgument.variance) {
|
||||
KVariance.INVARIANT, null -> {}
|
||||
KVariance.IN -> print("in ")
|
||||
KVariance.OUT -> print("out ")
|
||||
}
|
||||
printType(typeArgumentType)
|
||||
}
|
||||
}
|
||||
|
||||
-8
@@ -105,11 +105,3 @@ val ExpectActualCompatibility<*>.isCompatibleOrWeaklyIncompatible: Boolean
|
||||
|
||||
val ExpectActualCompatibility<*>.compatible: Boolean
|
||||
get() = this == ExpectActualCompatibility.Compatible
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun ExpectActualCompatibility<*>.isIncompatible(): Boolean {
|
||||
contract {
|
||||
returns(true) implies (this@isIncompatible is ExpectActualCompatibility.Incompatible<*>)
|
||||
}
|
||||
return !compatible
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user