提交 c158c64e 编写于 作者: V Victor Petukhov

Reformat TypeWithEnhancement.kt

上级 0d40022d
...@@ -28,18 +28,18 @@ interface TypeWithEnhancement { ...@@ -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( ...@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册