Minor. simplified creation of simple type with default scope.

This commit is contained in:
Stanislav Erokhin
2016-06-04 02:21:06 +03:00
parent 0bec639b07
commit de97bc2a05
8 changed files with 19 additions and 25 deletions
@@ -114,9 +114,8 @@ class JavaTypeResolver(
val constructor = computeTypeConstructor(javaType, attr) ?: return null
val arguments = computeArguments(javaType, attr, constructor)
val isNullable = isNullable(javaType, attr)
val memberScope = AbstractLazyType.computeMemberScope(constructor, arguments)
return KotlinTypeFactory.simpleType(annotations, constructor, arguments, isNullable, memberScope)
return KotlinTypeFactory.simpleType(annotations, constructor, arguments, isNullable)
}
private fun computeTypeConstructor(javaType: JavaClassifierType, attr: JavaTypeAttributes): TypeConstructor? {
@@ -121,8 +121,7 @@ internal object RawSubstitution : TypeSubstitution() {
TypeProjectionImpl(componentTypeProjection.projectionKind, eraseType(componentTypeProjection.type))
)
return KotlinTypeFactory.simpleType(
type.annotations, type.constructor, arguments, type.isMarkedNullable,
declaration.getMemberScope(arguments)
type.annotations, type.constructor, arguments, type.isMarkedNullable
) to false
}
@@ -129,16 +129,11 @@ private fun SimpleType.enhanceInflexible(qualifiers: (Int) -> JavaTypeQualifiers
enhancedNullabilityAnnotations
).filterNotNull().compositeAnnotationsOrSingle()
val newSubstitution = TypeConstructorSubstitution.create(typeConstructor, enhancedArguments)
val enhancedType = KotlinTypeFactory.simpleType(
newAnnotations,
typeConstructor,
enhancedArguments,
enhancedNullability,
if (enhancedClassifier is ClassDescriptor)
enhancedClassifier.getMemberScope(newSubstitution)
else enhancedClassifier.defaultType.memberScope
enhancedNullability
)
val result = if (effectiveQualifiers.isNotNullTypeParameter) NotNullTypeParameter(enhancedType) else enhancedType