File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
compiler/fir/cones/src/org/jetbrains/kotlin/fir/types Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -143,14 +143,22 @@ open class ConeFlexibleType(
143
143
if (other !is ConeFlexibleType ) return false
144
144
145
145
if (lowerBound != other.lowerBound) return false
146
+
147
+ if (isTrivial && other.isTrivial) return true
148
+
146
149
if (upperBound != other.upperBound) return false
147
150
148
151
return true
149
152
}
150
153
151
154
final override fun hashCode (): Int {
152
155
var result = lowerBound.hashCode()
153
- result = 31 * result + upperBound.hashCode()
156
+ // We don't use `upperBound.hashCode()` because it might lead to performance loss for trivial types.
157
+ // While doing something like `31 * lowerBoundResult + Boolean.hashCode(true/* markedNullable */)`
158
+ // to replicate `upperBound.hashCode()` behavior seems too fragile.
159
+ // But we want the result was different from just lowerBound's one,
160
+ // so we add a beautiful though random prime number.
161
+ result = 31 * result + 2999
154
162
return result
155
163
}
156
164
}
You can’t perform that action at this time.
0 commit comments