[NI] Fix special case of captured type handling in subtyping
Given the subtyping constraint X <: CapturedType(in Y) we should check only X <: Y if X contains type variables.
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
26cc08be65
commit
9fa3bce73a
+2
-2
@@ -29,8 +29,8 @@ abstract class TypeCheckerContextForConstraintSystem : TypeCheckerContext(errorT
|
||||
abstract fun addUpperConstraint(typeVariable: TypeConstructor, superType: UnwrappedType)
|
||||
abstract fun addLowerConstraint(typeVariable: TypeConstructor, subType: UnwrappedType)
|
||||
|
||||
override fun allowSubtypeViaLowerTypeForCapturedType(subType: SimpleType, superType: NewCapturedType) =
|
||||
!subType.contains { it.anyBound(this::isMyTypeVariable) }
|
||||
override fun shouldCheckOnlyLowerBoundForCapturedType(subType: SimpleType, superType: NewCapturedType) =
|
||||
subType.contains { it.anyBound(this::isMyTypeVariable) }
|
||||
|
||||
/**
|
||||
* todo: possible we should override this method, because otherwise OR in subtyping transformed to AND in constraint system
|
||||
|
||||
Reference in New Issue
Block a user