[MPP] Use module's type checker for upper bound checks
The default type checker doesn't have a correct type refinement setup. This can cause false positives in subtyping of upper bounds in edge cases with expect type arguments. See the tests in the intellij repo. KTIJ-22295
This commit is contained in:
committed by
Space
parent
f8462f1b0c
commit
24dcad0d9c
+4
-1
@@ -19,10 +19,13 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.UPPER_BOUND_VIOLAT
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION_BASED_ON_JAVA_ANNOTATIONS
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.getEnhancementDeeply
|
||||
|
||||
// TODO: remove this checker after removing support LV < 1.6
|
||||
class WarningAwareUpperBoundChecker : UpperBoundChecker() {
|
||||
class WarningAwareUpperBoundChecker(
|
||||
typeChecker: KotlinTypeChecker,
|
||||
) : UpperBoundChecker(typeChecker) {
|
||||
override fun checkBoundsOfExpandedTypeAlias(type: KotlinType, expression: KtExpression, trace: BindingTrace) {
|
||||
val typeParameters = type.constructor.parameters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user