From ef96912573563e99afb7d62ae9b64e91097cf1a2 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Wed, 20 Sep 2023 15:27:57 +0200 Subject: [PATCH] [FIR] Apply withNullability to attributes with cone types #KT-56989 --- .../providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt index 7a3e7e6ecde..6a96e9c2435 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt @@ -259,7 +259,8 @@ fun T.withNullability( preserveEnhancedNullability: Boolean = false, ): T { val theAttributes = attributes.butIf(!preserveEnhancedNullability) { - it.remove(CompilerConeAttributes.EnhancedNullability) + val withoutEnhanced = it.remove(CompilerConeAttributes.EnhancedNullability) + withoutEnhanced.transformTypesWith { t -> t.withNullability(nullability, typeContext) } ?: withoutEnhanced } if (this.nullability == nullability && this.attributes == theAttributes) {