Reformat TypeWithEnhancement.kt

This commit is contained in:
Victor Petukhov
2021-02-04 12:11:03 +03:00
parent 0d40022d6d
commit c158c64ee0
@@ -28,18 +28,18 @@ interface TypeWithEnhancement {
} }
class SimpleTypeWithEnhancement( class SimpleTypeWithEnhancement(
override val delegate: SimpleType, override val delegate: SimpleType,
override val enhancement: KotlinType override val enhancement: KotlinType
) : DelegatingSimpleType(), ) : DelegatingSimpleType(),
TypeWithEnhancement { TypeWithEnhancement {
override val origin: UnwrappedType get() = delegate override val origin: UnwrappedType get() = delegate
override fun replaceAnnotations(newAnnotations: Annotations): SimpleType override fun replaceAnnotations(newAnnotations: Annotations): SimpleType =
= origin.replaceAnnotations(newAnnotations).wrapEnhancement(enhancement) as SimpleType origin.replaceAnnotations(newAnnotations).wrapEnhancement(enhancement) as SimpleType
override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType = origin.makeNullableAsSpecified(newNullability)
= origin.makeNullableAsSpecified(newNullability).wrapEnhancement(enhancement.unwrap().makeNullableAsSpecified(newNullability)) as SimpleType .wrapEnhancement(enhancement.unwrap().makeNullableAsSpecified(newNullability)) as SimpleType
@TypeRefinement @TypeRefinement
override fun replaceDelegate(delegate: SimpleType) = SimpleTypeWithEnhancement(delegate, enhancement) override fun replaceDelegate(delegate: SimpleType) = SimpleTypeWithEnhancement(delegate, enhancement)
@@ -47,23 +47,23 @@ class SimpleTypeWithEnhancement(
@TypeRefinement @TypeRefinement
@OptIn(TypeRefinement::class) @OptIn(TypeRefinement::class)
override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): SimpleTypeWithEnhancement = override fun refine(kotlinTypeRefiner: KotlinTypeRefiner): SimpleTypeWithEnhancement =
SimpleTypeWithEnhancement( SimpleTypeWithEnhancement(
kotlinTypeRefiner.refineType(delegate) as SimpleType, kotlinTypeRefiner.refineType(delegate) as SimpleType,
kotlinTypeRefiner.refineType(enhancement) kotlinTypeRefiner.refineType(enhancement)
) )
} }
class FlexibleTypeWithEnhancement( class FlexibleTypeWithEnhancement(
override val origin: FlexibleType, override val origin: FlexibleType,
override val enhancement: KotlinType override val enhancement: KotlinType
) : FlexibleType(origin.lowerBound, origin.upperBound), ) : FlexibleType(origin.lowerBound, origin.upperBound),
TypeWithEnhancement { TypeWithEnhancement {
override fun replaceAnnotations(newAnnotations: Annotations): UnwrappedType override fun replaceAnnotations(newAnnotations: Annotations): UnwrappedType =
= origin.replaceAnnotations(newAnnotations).wrapEnhancement(enhancement) origin.replaceAnnotations(newAnnotations).wrapEnhancement(enhancement)
override fun makeNullableAsSpecified(newNullability: Boolean): UnwrappedType override fun makeNullableAsSpecified(newNullability: Boolean): UnwrappedType =
= origin.makeNullableAsSpecified(newNullability).wrapEnhancement(enhancement.unwrap().makeNullableAsSpecified(newNullability)) origin.makeNullableAsSpecified(newNullability).wrapEnhancement(enhancement.unwrap().makeNullableAsSpecified(newNullability))
override fun render(renderer: DescriptorRenderer, options: DescriptorRendererOptions): String { override fun render(renderer: DescriptorRenderer, options: DescriptorRendererOptions): String {
if (options.enhancedTypes) { if (options.enhancedTypes) {