Avoid creating SimpleType instances for default type
This commit is contained in:
@@ -34,13 +34,27 @@ object KotlinTypeFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun simpleType(
|
||||
annotations: Annotations,
|
||||
constructor: TypeConstructor,
|
||||
arguments: List<TypeProjection>,
|
||||
nullable: Boolean
|
||||
): SimpleType {
|
||||
if (annotations.isEmpty() && arguments.isEmpty() && !nullable && constructor.declarationDescriptor != null) {
|
||||
return constructor.declarationDescriptor!!.defaultType
|
||||
}
|
||||
|
||||
return SimpleTypeImpl(annotations, constructor, arguments, nullable, computeMemberScope(constructor, arguments))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun simpleType(
|
||||
annotations: Annotations,
|
||||
constructor: TypeConstructor,
|
||||
arguments: List<TypeProjection>,
|
||||
nullable: Boolean,
|
||||
memberScope: MemberScope = computeMemberScope(constructor, arguments)
|
||||
memberScope: MemberScope
|
||||
): SimpleType = SimpleTypeImpl(annotations, constructor, arguments, nullable, memberScope)
|
||||
|
||||
@JvmStatic
|
||||
|
||||
Reference in New Issue
Block a user