From 2eece06d5cd71976e469ec911489e42c5e236456 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 7 Oct 2016 18:51:38 +0300 Subject: [PATCH] Minor. Add `hashCode` override after existing `equals` --- .../codegen/optimization/boxing/NullabilityInterpreter.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/NullabilityInterpreter.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/NullabilityInterpreter.kt index e3a1d80cc07..bcb7a296e35 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/NullabilityInterpreter.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/boxing/NullabilityInterpreter.kt @@ -30,7 +30,7 @@ class NullabilityInterpreter(insns: InsnList) : BoxingInterpreter(insns) { override fun isExactValue(value: BasicValue) = super.isExactValue(value) || value is NotNullBasicValue - override fun createNewBoxing(insn: AbstractInsnNode, type: Type, progressionIterator: ProgressionIteratorBasicValue?) = + override fun createNewBoxing(insn: AbstractInsnNode, type: Type, progressionIterator: ProgressionIteratorBasicValue?) = NotNullBasicValue(BasicValue(type)) } @@ -42,4 +42,7 @@ private fun makeNotNullIfNeeded(insn: AbstractInsnNode, value: BasicValue?): Bas class NotNullBasicValue(wrappedValue: BasicValue?) : BasicValueWrapper(wrappedValue) { override fun equals(other: Any?): Boolean = other is NotNullBasicValue + // We do not differ not-nullable values, so we should always return the same hashCode + // Actually it doesn't really matter because analyzer is not supposed to store values in hashtables + override fun hashCode() = 0 }