Fixes and refactors

This commit is contained in:
Irene Dea
2021-10-21 13:22:51 -07:00
committed by Dmitriy Novozhilov
parent 2e2e70fede
commit 19bfc43bee
70 changed files with 263 additions and 327 deletions
@@ -56,18 +56,18 @@ fun KClassifier.createType(
// TODO: throw exception if argument does not satisfy bounds
val typeAnnotations =
if (annotations.isEmpty()) Annotations.EMPTY
else Annotations.EMPTY // TODO: support type annotations
val typeAttributes =
if (annotations.isEmpty()) TypeAttributes.Empty
else TypeAttributes.Empty // TODO: support type annotations
return KTypeImpl(createKotlinType(typeAnnotations, typeConstructor, arguments, nullable))
return KTypeImpl(createKotlinType(typeAttributes, typeConstructor, arguments, nullable))
}
private fun createKotlinType(
typeAnnotations: Annotations, typeConstructor: TypeConstructor, arguments: List<KTypeProjection>, nullable: Boolean
attributes: TypeAttributes, typeConstructor: TypeConstructor, arguments: List<KTypeProjection>, nullable: Boolean
): SimpleType {
val parameters = typeConstructor.parameters
return KotlinTypeFactory.simpleType(typeAnnotations, typeConstructor, arguments.mapIndexed { index, typeProjection ->
return KotlinTypeFactory.simpleType(attributes, typeConstructor, arguments.mapIndexed { index, typeProjection ->
val type = (typeProjection.type as KTypeImpl?)?.type
when (typeProjection.variance) {
KVariance.INVARIANT -> TypeProjectionImpl(Variance.INVARIANT, type!!)