diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt index d72bdcb3f6e..ebdb48bf256 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt @@ -31,9 +31,7 @@ class DynamicTypesAllowed: DynamicTypesSettings() { get() = true } -interface Dynamicity : TypeCapability - -fun KotlinType.isDynamic(): Boolean = this.getCapability(Dynamicity::class.java) != null +fun KotlinType.isDynamic(): Boolean = this.getCapability(Flexibility::class.java)?.factory == DynamicTypeFactory fun createDynamicType(builtIns: KotlinBuiltIns) = DynamicTypeFactory.create(builtIns.nothingType, builtIns.nullableAnyType) @@ -51,14 +49,7 @@ object DynamicTypeFactory : FlexibleTypeFactory { } private class Impl(lowerBound: KotlinType, upperBound: KotlinType) : - DelegatingFlexibleType(lowerBound, upperBound, DynamicTypeFactory), Dynamicity { - - override fun getCapability(capabilityClass: Class): T? { - @Suppress("UNCHECKED_CAST") - if (capabilityClass == Dynamicity::class.java) return this as T - - return super.getCapability(capabilityClass) - } + DelegatingFlexibleType(lowerBound, upperBound, DynamicTypeFactory) { override val delegateType: KotlinType get() = upperBound