From 8a742b25743e795361b0e4f467a875210c36a232 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Thu, 21 Apr 2022 10:35:05 +0300 Subject: [PATCH] FIR: Refine operations over OriginalProjectionTypeAttribute It's necessary because during substitution it might be necessary to combine attributes from the original type (this) and substitution where OriginalProjectionTypeAttribute is actually expected to be null. Probably, it's worth considering some kind of assertion that `other` is always null or their projections are the same. --- .../checkers/FirUpperBoundViolatedHelpers.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirUpperBoundViolatedHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirUpperBoundViolatedHelpers.kt index ed3423d641c..39876d444c5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirUpperBoundViolatedHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirUpperBoundViolatedHelpers.kt @@ -129,17 +129,9 @@ private class FE10LikeConeSubstitutor( } private class OriginalProjectionTypeAttribute(val data: ConeTypeProjection) : ConeAttribute() { - override fun union(other: OriginalProjectionTypeAttribute?): OriginalProjectionTypeAttribute? { - return other - } - - override fun intersect(other: OriginalProjectionTypeAttribute?): OriginalProjectionTypeAttribute? { - return other - } - - override fun add(other: OriginalProjectionTypeAttribute?): OriginalProjectionTypeAttribute? { - return other - } + override fun union(other: OriginalProjectionTypeAttribute?): OriginalProjectionTypeAttribute = other ?: this + override fun intersect(other: OriginalProjectionTypeAttribute?): OriginalProjectionTypeAttribute = other ?: this + override fun add(other: OriginalProjectionTypeAttribute?): OriginalProjectionTypeAttribute = other ?: this override fun isSubtypeOf(other: OriginalProjectionTypeAttribute?): Boolean { return true