Take into account SimpleTypeWithEnhancement and subtyping related places
^KT-47854 Fixed
This commit is contained in:
committed by
teamcityserver
parent
6ab632f6ad
commit
3eaa452f9e
@@ -33,7 +33,7 @@ class SimpleTypeWithEnhancement(
|
||||
) : DelegatingSimpleType(),
|
||||
TypeWithEnhancement {
|
||||
|
||||
override val origin: UnwrappedType get() = delegate
|
||||
override val origin get() = delegate
|
||||
|
||||
override fun replaceAnnotations(newAnnotations: Annotations): SimpleType =
|
||||
origin.replaceAnnotations(newAnnotations).wrapEnhancement(enhancement) as SimpleType
|
||||
|
||||
@@ -142,7 +142,7 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
|
||||
override fun SimpleTypeMarker.asCapturedType(): CapturedTypeMarker? {
|
||||
require(this is SimpleType, this::errorMessage)
|
||||
return this as? NewCapturedType
|
||||
return if (this is SimpleTypeWithEnhancement) origin.asCapturedType() else this as? NewCapturedType
|
||||
}
|
||||
|
||||
override fun SimpleTypeMarker.asDefinitelyNotNullType(): DefinitelyNotNullTypeMarker? {
|
||||
@@ -326,9 +326,12 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
require(this is SimpleType, this::errorMessage)
|
||||
return !isError &&
|
||||
constructor.declarationDescriptor !is TypeAliasDescriptor &&
|
||||
(constructor.declarationDescriptor != null || this is CapturedType || this is NewCapturedType || this is DefinitelyNotNullType || constructor is IntegerLiteralTypeConstructor)
|
||||
(constructor.declarationDescriptor != null || this is CapturedType || this is NewCapturedType || this is DefinitelyNotNullType || constructor is IntegerLiteralTypeConstructor || isSingleClassifierTypeWithEnhancement())
|
||||
}
|
||||
|
||||
private fun SimpleTypeMarker.isSingleClassifierTypeWithEnhancement() =
|
||||
this is SimpleTypeWithEnhancement && origin.isSingleClassifierType()
|
||||
|
||||
override fun KotlinTypeMarker.contains(predicate: (KotlinTypeMarker) -> Boolean): Boolean {
|
||||
require(this is KotlinType, this::errorMessage)
|
||||
return containsInternal(this, predicate)
|
||||
|
||||
Reference in New Issue
Block a user