[stdlib] Remove useless hashCode override in iterable ranges KT-48530
diff --git a/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.decompiled.text.kt b/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.decompiled.text.kt
index 521d5f8..dd27552 100644
--- a/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.decompiled.text.kt
+++ b/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.decompiled.text.kt
@@ -62,8 +62,6 @@
 
     public open operator fun equals(other: kotlin.Any?): kotlin.Boolean { /* compiled code */ }
 
-    public open fun hashCode(): kotlin.Int { /* compiled code */ }
-
     public open fun toString(): kotlin.String { /* compiled code */ }
 }
 
@@ -136,8 +134,6 @@
 
     public open operator fun equals(other: kotlin.Any?): kotlin.Boolean { /* compiled code */ }
 
-    public open fun hashCode(): kotlin.Int { /* compiled code */ }
-
     public open fun toString(): kotlin.String { /* compiled code */ }
 }
 
@@ -200,8 +196,6 @@
 
     public open operator fun equals(other: kotlin.Any?): kotlin.Boolean { /* compiled code */ }
 
-    public open fun hashCode(): kotlin.Int { /* compiled code */ }
-
     public open fun toString(): kotlin.String { /* compiled code */ }
 }
 
diff --git a/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.stubs.txt b/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.stubs.txt
index b64ee88..4aa2645 100644
--- a/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.stubs.txt
+++ b/analysis/stubs/testData/builtins/stubs/ranges.kotlin_builtins.stubs.txt
@@ -450,15 +450,6 @@
               REFERENCE_EXPRESSION[referencedName=kotlin]
             REFERENCE_EXPRESSION[referencedName=Boolean]
               isClassRef: true
-      FUNCTION[fqName=kotlin.ranges.CharRange.hashCode, hasBody=true, hasNoExpressionBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=hashCode]
-        MODIFIER_LIST[public open MustUseReturnValue]
-        VALUE_PARAMETER_LIST
-        TYPE_REFERENCE
-          USER_TYPE
-            USER_TYPE
-              REFERENCE_EXPRESSION[referencedName=kotlin]
-            REFERENCE_EXPRESSION[referencedName=Int]
-              isClassRef: true
       FUNCTION[fqName=kotlin.ranges.CharRange.toString, hasBody=true, hasNoExpressionBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=toString]
         MODIFIER_LIST[public open MustUseReturnValue]
         VALUE_PARAMETER_LIST
@@ -966,15 +957,6 @@
               REFERENCE_EXPRESSION[referencedName=kotlin]
             REFERENCE_EXPRESSION[referencedName=Boolean]
               isClassRef: true
-      FUNCTION[fqName=kotlin.ranges.IntRange.hashCode, hasBody=true, hasNoExpressionBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=hashCode]
-        MODIFIER_LIST[public open MustUseReturnValue]
-        VALUE_PARAMETER_LIST
-        TYPE_REFERENCE
-          USER_TYPE
-            USER_TYPE
-              REFERENCE_EXPRESSION[referencedName=kotlin]
-            REFERENCE_EXPRESSION[referencedName=Int]
-              isClassRef: true
       FUNCTION[fqName=kotlin.ranges.IntRange.toString, hasBody=true, hasNoExpressionBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=toString]
         MODIFIER_LIST[public open MustUseReturnValue]
         VALUE_PARAMETER_LIST
@@ -1430,15 +1412,6 @@
               REFERENCE_EXPRESSION[referencedName=kotlin]
             REFERENCE_EXPRESSION[referencedName=Boolean]
               isClassRef: true
-      FUNCTION[fqName=kotlin.ranges.LongRange.hashCode, hasBody=true, hasNoExpressionBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=hashCode]
-        MODIFIER_LIST[public open MustUseReturnValue]
-        VALUE_PARAMETER_LIST
-        TYPE_REFERENCE
-          USER_TYPE
-            USER_TYPE
-              REFERENCE_EXPRESSION[referencedName=kotlin]
-            REFERENCE_EXPRESSION[referencedName=Int]
-              isClassRef: true
       FUNCTION[fqName=kotlin.ranges.LongRange.toString, hasBody=true, hasNoExpressionBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=toString]
         MODIFIER_LIST[public open MustUseReturnValue]
         VALUE_PARAMETER_LIST
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK21.txt b/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK21.txt
index 58ea8ec..85a4d91f 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK21.txt
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK21.txt
@@ -2655,8 +2655,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Char|
@@ -2670,6 +2668,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/CharIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Char|
         public get(): R|kotlin/Char|
 
@@ -2801,8 +2801,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Int|
@@ -2816,6 +2814,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/IntIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Int|
         public get(): R|kotlin/Int|
 
@@ -2928,8 +2928,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Long|
@@ -2943,6 +2941,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/LongIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Long|
         public get(): R|kotlin/Long|
 
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK8.txt b/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK8.txt
index 26cbd97..abdcec2b 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK8.txt
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_fullJDK8.txt
@@ -2621,8 +2621,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Char|
@@ -2636,6 +2634,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/CharIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Char|
         public get(): R|kotlin/Char|
 
@@ -2767,8 +2767,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Int|
@@ -2782,6 +2780,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/IntIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Int|
         public get(): R|kotlin/Int|
 
@@ -2894,8 +2894,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Long|
@@ -2909,6 +2907,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/LongIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Long|
         public get(): R|kotlin/Long|
 
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_modifiedMockJDK.txt b/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_modifiedMockJDK.txt
index 3590fcf..f8726d1 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_modifiedMockJDK.txt
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/testData/builtIns/fallbackBuiltIns_modifiedMockJDK.txt
@@ -2501,8 +2501,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Char|
@@ -2516,6 +2514,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/CharIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Char|
         public get(): R|kotlin/Char|
 
@@ -2637,8 +2637,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Int|
@@ -2652,6 +2650,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/IntIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Int|
         public get(): R|kotlin/Int|
 
@@ -2754,8 +2754,6 @@
 
     public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
 
-    public open fun hashCode(): R|kotlin/Int|
-
     public open fun toString(): R|kotlin/String|
 
     public open val start: R|kotlin/Long|
@@ -2769,6 +2767,8 @@
 
     public open operator fun iterator(): R|kotlin/collections/LongIterator|
 
+    public open override fun hashCode(): R|kotlin/Int|
+
     public final val first: R|kotlin/Long|
         public get(): R|kotlin/Long|
 
diff --git a/compiler/testData/reflection/builtin-classes.txt b/compiler/testData/reflection/builtin-classes.txt
index 156d0b5..e66927f 100644
--- a/compiler/testData/reflection/builtin-classes.txt
+++ b/compiler/testData/reflection/builtin-classes.txt
@@ -1118,7 +1118,6 @@
   declaredMembers:
     public open operator fun kotlin.ranges.CharRange.contains(kotlin.Char): kotlin.Boolean
     public open operator fun kotlin.ranges.CharRange.equals(kotlin.Any?): kotlin.Boolean
-    public open fun kotlin.ranges.CharRange.hashCode(): kotlin.Int
     public open fun kotlin.ranges.CharRange.isEmpty(): kotlin.Boolean
     public open fun kotlin.ranges.CharRange.toString(): kotlin.String
     public open val kotlin.ranges.CharRange.endExclusive: kotlin.Char
@@ -1220,7 +1219,6 @@
   declaredMembers:
     public open operator fun kotlin.ranges.IntRange.contains(kotlin.Int): kotlin.Boolean
     public open operator fun kotlin.ranges.IntRange.equals(kotlin.Any?): kotlin.Boolean
-    public open fun kotlin.ranges.IntRange.hashCode(): kotlin.Int
     public open fun kotlin.ranges.IntRange.isEmpty(): kotlin.Boolean
     public open fun kotlin.ranges.IntRange.toString(): kotlin.String
     public open val kotlin.ranges.IntRange.endExclusive: kotlin.Int
@@ -1308,7 +1306,6 @@
   declaredMembers:
     public open operator fun kotlin.ranges.LongRange.contains(kotlin.Long): kotlin.Boolean
     public open operator fun kotlin.ranges.LongRange.equals(kotlin.Any?): kotlin.Boolean
-    public open fun kotlin.ranges.LongRange.hashCode(): kotlin.Int
     public open fun kotlin.ranges.LongRange.isEmpty(): kotlin.Boolean
     public open fun kotlin.ranges.LongRange.toString(): kotlin.String
     public open val kotlin.ranges.LongRange.endExclusive: kotlin.Long
diff --git a/generators/builtins/ranges.kt b/generators/builtins/ranges.kt
index 5b106b5..43b29d3 100644
--- a/generators/builtins/ranges.kt
+++ b/generators/builtins/ranges.kt
@@ -62,8 +62,6 @@
      */
     override fun equals(other: Any?): Boolean = super.equals(other)
 
-    override fun hashCode(): Int = super.hashCode()
-
     override fun toString(): String = $toString
 
     public companion object {
diff --git a/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt b/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt
index 5efb5b2..fb97059 100644
--- a/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt
+++ b/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt
@@ -44,8 +44,6 @@
      */
     override fun equals(other: Any?): Boolean = super.equals(other)
 
-    override fun hashCode(): Int = super.hashCode()
-
     override fun toString(): String = "$first..$last"
 
     public companion object {
@@ -89,8 +87,6 @@
      */
     override fun equals(other: Any?): Boolean = super.equals(other)
 
-    override fun hashCode(): Int = super.hashCode()
-
     override fun toString(): String = "$first..$last"
 
     public companion object {
@@ -134,8 +130,6 @@
      */
     override fun equals(other: Any?): Boolean = super.equals(other)
 
-    override fun hashCode(): Int = super.hashCode()
-
     override fun toString(): String = "$first..$last"
 
     public companion object {
diff --git a/libraries/tools/binary-compatibility-validator/klib-public-api/kotlin-stdlib.api b/libraries/tools/binary-compatibility-validator/klib-public-api/kotlin-stdlib.api
index 329d6f3..aca3b1e 100644
--- a/libraries/tools/binary-compatibility-validator/klib-public-api/kotlin-stdlib.api
+++ b/libraries/tools/binary-compatibility-validator/klib-public-api/kotlin-stdlib.api
@@ -1800,7 +1800,6 @@
 
     final fun contains(kotlin/Char): kotlin/Boolean // kotlin.ranges/CharRange.contains|contains(kotlin.Char){}[0]
     final fun equals(kotlin/Any?): kotlin/Boolean // kotlin.ranges/CharRange.equals|equals(kotlin.Any?){}[0]
-    final fun hashCode(): kotlin/Int // kotlin.ranges/CharRange.hashCode|hashCode(){}[0]
     final fun isEmpty(): kotlin/Boolean // kotlin.ranges/CharRange.isEmpty|isEmpty(){}[0]
     final fun toString(): kotlin/String // kotlin.ranges/CharRange.toString|toString(){}[0]
 
@@ -1822,7 +1821,6 @@
 
     final fun contains(kotlin/Int): kotlin/Boolean // kotlin.ranges/IntRange.contains|contains(kotlin.Int){}[0]
     final fun equals(kotlin/Any?): kotlin/Boolean // kotlin.ranges/IntRange.equals|equals(kotlin.Any?){}[0]
-    final fun hashCode(): kotlin/Int // kotlin.ranges/IntRange.hashCode|hashCode(){}[0]
     final fun isEmpty(): kotlin/Boolean // kotlin.ranges/IntRange.isEmpty|isEmpty(){}[0]
     final fun toString(): kotlin/String // kotlin.ranges/IntRange.toString|toString(){}[0]
 
@@ -1844,7 +1842,6 @@
 
     final fun contains(kotlin/Long): kotlin/Boolean // kotlin.ranges/LongRange.contains|contains(kotlin.Long){}[0]
     final fun equals(kotlin/Any?): kotlin/Boolean // kotlin.ranges/LongRange.equals|equals(kotlin.Any?){}[0]
-    final fun hashCode(): kotlin/Int // kotlin.ranges/LongRange.hashCode|hashCode(){}[0]
     final fun isEmpty(): kotlin/Boolean // kotlin.ranges/LongRange.isEmpty|isEmpty(){}[0]
     final fun toString(): kotlin/String // kotlin.ranges/LongRange.toString|toString(){}[0]
 
diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt
index cad4019..f0955bc 100644
--- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt
+++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt
@@ -4911,7 +4911,6 @@
 	public synthetic fun getEndInclusive ()Ljava/lang/Comparable;
 	public fun getStart ()Ljava/lang/Character;
 	public synthetic fun getStart ()Ljava/lang/Comparable;
-	public fun hashCode ()I
 	public fun isEmpty ()Z
 	public fun toString ()Ljava/lang/String;
 }
@@ -4972,7 +4971,6 @@
 	public fun getEndInclusive ()Ljava/lang/Integer;
 	public synthetic fun getStart ()Ljava/lang/Comparable;
 	public fun getStart ()Ljava/lang/Integer;
-	public fun hashCode ()I
 	public fun isEmpty ()Z
 	public fun toString ()Ljava/lang/String;
 }
@@ -5010,7 +5008,6 @@
 	public fun getEndInclusive ()Ljava/lang/Long;
 	public synthetic fun getStart ()Ljava/lang/Comparable;
 	public fun getStart ()Ljava/lang/Long;
-	public fun hashCode ()I
 	public fun isEmpty ()Z
 	public fun toString ()Ljava/lang/String;
 }