From 70aa16f71aa3f5ff8158c4f95d35e25333a3e749 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Wed, 8 Aug 2018 14:36:20 +0300 Subject: [PATCH] Fix `hashCode` & `equals` for `IntegerValueTypeConstant` --- .../kotlin/resolve/constants/CompileTimeConstant.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt index 01681b74872..7b8271acc91 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt @@ -42,7 +42,7 @@ interface CompileTimeConstant { val isUnsignedNumberLiteral: Boolean get() = parameters.isUnsignedNumberLiteral - class Parameters( + data class Parameters( val canBeUsedInAnnotation: Boolean, val isPure: Boolean, // `isUnsignedNumberLiteral` means that this constant represents simple number literal with `u` suffix (123u, 0xFEu) @@ -172,7 +172,8 @@ class IntegerValueTypeConstant( override fun toString() = typeConstructor.toString() - override fun equals(other: Any?) = other is IntegerValueTypeConstant && value == other.value + override fun equals(other: Any?) = other is IntegerValueTypeConstant && value == other.value && parameters == other.parameters + + override fun hashCode() = 31 * value.hashCode() + parameters.hashCode() - override fun hashCode() = value.hashCode() }