Fix exception when expected type is subtype of a function type

#KT-28984 Fixed
 #EA-132850 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-12-17 12:33:03 +03:00
parent 68c65a5014
commit 84222afe2f
7 changed files with 50 additions and 8 deletions
@@ -97,6 +97,11 @@ class ReflectionTypes(module: ModuleDescriptor, private val notFoundClasses: Not
fun isCallableType(type: KotlinType): Boolean =
type.isFunctionTypeOrSubtype || type.isSuspendFunctionTypeOrSubtype || isKCallableType(type)
fun isBaseTypeForNumberedReferenceTypes(type: KotlinType): Boolean =
ReflectionTypes.hasKPropertyTypeFqName(type) ||
ReflectionTypes.hasKMutablePropertyTypeFqName(type) ||
ReflectionTypes.hasKCallableTypeFqName(type)
@JvmStatic
fun isNumberedKPropertyOrKMutablePropertyType(type: KotlinType): Boolean =
isNumberedKPropertyType(type) || isNumberedKMutablePropertyType(type)