Optimize LazyScopeAdapter internals

This commit is contained in:
Ilya Chernikov
2020-06-02 23:05:02 +02:00
parent c2ede13d5a
commit c720fa5793
5 changed files with 24 additions and 14 deletions
@@ -440,9 +440,9 @@ class TypeResolver(
private fun getScopeForTypeParameter(c: TypeResolutionContext, typeParameterDescriptor: TypeParameterDescriptor): MemberScope {
return when {
c.checkBounds -> TypeIntersector.getUpperBoundsAsType(typeParameterDescriptor).memberScope
else -> LazyScopeAdapter(LockBasedStorageManager.NO_LOCKS.createLazyValue {
else -> LazyScopeAdapter {
TypeIntersector.getUpperBoundsAsType(typeParameterDescriptor).memberScope
})
}
}
}
@@ -281,12 +281,12 @@ open class WrappedTypeParameterDescriptor(
private val _defaultType: SimpleType by lazy {
KotlinTypeFactory.simpleTypeWithNonTrivialMemberScope(
Annotations.EMPTY, typeConstructor, emptyList(), false,
LazyScopeAdapter(LockBasedStorageManager.NO_LOCKS.createLazyValue {
LazyScopeAdapter {
TypeIntersectionScope.create(
"Scope for type parameter " + name.asString(),
upperBounds
)
})
}
)
}