Delete Hashable, pull up its members to Any
Extensions on nullable types remain in Library.kt #KT-1741 Obsolete #KT-2805 Obsolete #KT-1365 Fixed #KT-4517 In Progress
This commit is contained in:
@@ -181,7 +181,7 @@ public final class ByteRange : jet.Range<jet.Byte>, jet.Progression<jet.Byte> {
|
||||
}
|
||||
}
|
||||
|
||||
public final class Char : jet.Hashable, jet.Comparable<jet.Char> {
|
||||
public final class Char : jet.Comparable<jet.Char> {
|
||||
/*primary*/ private constructor Char()
|
||||
public final fun compareTo(/*0*/ other: jet.Byte): jet.Int
|
||||
public open override /*1*/ fun compareTo(/*0*/ other: jet.Char): jet.Int
|
||||
@@ -305,7 +305,7 @@ public trait CharSequence {
|
||||
public abstract fun get(/*0*/ index: jet.Int): jet.Char
|
||||
}
|
||||
|
||||
public trait Collection</*0*/ out E> : jet.Iterable<E>, jet.Hashable {
|
||||
public trait Collection</*0*/ out E> : jet.Iterable<E> {
|
||||
public abstract fun contains(/*0*/ o: jet.Any?): jet.Boolean
|
||||
public abstract fun containsAll(/*0*/ c: jet.Collection<jet.Any?>): jet.Boolean
|
||||
public abstract fun isEmpty(): jet.Boolean
|
||||
@@ -756,9 +756,6 @@ public trait Function9</*0*/ in P1, /*1*/ in P2, /*2*/ in P3, /*3*/ in P4, /*4*/
|
||||
public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9): R
|
||||
}
|
||||
|
||||
public trait Hashable {
|
||||
}
|
||||
|
||||
public final enum class InlineStrategy : jet.Enum<jet.InlineStrategy> {
|
||||
/*primary*/ private constructor InlineStrategy()
|
||||
public final override /*1*/ /*fake_override*/ fun name(): jet.String
|
||||
@@ -1383,7 +1380,7 @@ public trait Map</*0*/ K, /*1*/ out V> {
|
||||
public abstract fun size(): jet.Int
|
||||
public abstract fun values(): jet.Collection<V>
|
||||
|
||||
public trait Entry</*0*/ out K, /*1*/ out V> : jet.Hashable {
|
||||
public trait Entry</*0*/ out K, /*1*/ out V> {
|
||||
public abstract fun getKey(): K
|
||||
public abstract fun getValue(): V
|
||||
}
|
||||
@@ -1463,7 +1460,7 @@ public trait MutableMap</*0*/ K, /*1*/ V> : jet.Map<K, V> {
|
||||
public abstract override /*1*/ /*fake_override*/ fun size(): jet.Int
|
||||
public abstract override /*1*/ fun values(): jet.MutableCollection<V>
|
||||
|
||||
public trait MutableEntry</*0*/ K, /*1*/ V> : jet.Map.Entry<K, V>, jet.Hashable {
|
||||
public trait MutableEntry</*0*/ K, /*1*/ V> : jet.Map.Entry<K, V> {
|
||||
public abstract override /*1*/ /*fake_override*/ fun getKey(): K
|
||||
public abstract override /*1*/ /*fake_override*/ fun getValue(): V
|
||||
public abstract fun setValue(/*0*/ value: V): V
|
||||
@@ -1488,7 +1485,7 @@ public final class Nothing {
|
||||
/*primary*/ private constructor Nothing()
|
||||
}
|
||||
|
||||
public abstract class Number : jet.Hashable {
|
||||
public abstract class Number {
|
||||
/*primary*/ public constructor Number()
|
||||
public abstract fun toByte(): jet.Byte
|
||||
public abstract fun toChar(): jet.Char
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
public class MPair<out A> (
|
||||
public val first: A
|
||||
) {
|
||||
fun equals(o: Any?): Boolean {
|
||||
override fun equals(o: Any?): Boolean {
|
||||
val t = o as MPair<*>
|
||||
return first == t.first
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class T4(
|
||||
val c3: Boolean,
|
||||
val c4: String
|
||||
) {
|
||||
fun equals(o: Any?): Boolean {
|
||||
override fun equals(o: Any?): Boolean {
|
||||
if (o !is T4) return false;
|
||||
return c1 == o.c1 &&
|
||||
c2 == o.c2 &&
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C(val x: Int) {
|
||||
fun equals(rhs: Any?): Boolean {
|
||||
override fun equals(rhs: Any?): Boolean {
|
||||
if (rhs is C) {
|
||||
val rhsC = rhs as C
|
||||
return rhsC.x == x
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
fun foo(): Hashable = 1
|
||||
|
||||
fun box(): String {
|
||||
if (foo() == 1) return "OK"
|
||||
return "Fail"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
data class A(val x: Int) {
|
||||
fun equals(other: Any?): Boolean = false
|
||||
override fun equals(other: Any?): Boolean = false
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ data class D(val x: Int) {
|
||||
|
||||
data class E(val x: Int) {
|
||||
fun equals(x: E): Boolean = false
|
||||
fun equals(x: Any?): Boolean = false
|
||||
override fun equals(x: Any?): Boolean = false
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Dummy {
|
||||
fun equals(other: Any?) = true
|
||||
override fun equals(other: Any?) = true
|
||||
}
|
||||
|
||||
open data class A(val v: Any)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Dummy {
|
||||
fun equals(other: Any?) = true
|
||||
override fun equals(other: Any?) = true
|
||||
}
|
||||
|
||||
data class A(val v: Any?)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
data class A(val x: Int) {
|
||||
fun hashCode(): Int = -3
|
||||
override fun hashCode(): Int = -3
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fun box(): String {
|
||||
val a = true
|
||||
val x = if (a) {
|
||||
listOf(1)
|
||||
}
|
||||
else {
|
||||
1
|
||||
}
|
||||
// The result of the if() above is implicitly cast to jet.Hashable, which failed before we started to map Hashable to j.l.Object
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,13 +1,5 @@
|
||||
class A() {
|
||||
fun equals(<!UNUSED_PARAMETER!>a<!> : Any?) : Boolean = false
|
||||
}
|
||||
|
||||
class B() {
|
||||
fun equals(<!UNUSED_PARAMETER!>a<!> : Any?) : Boolean? = false
|
||||
}
|
||||
|
||||
class C() {
|
||||
fun equals(<!UNUSED_PARAMETER!>a<!> : Any?) : Int = 0
|
||||
override fun equals(other : Any?) : Boolean = false
|
||||
}
|
||||
|
||||
fun f(): Unit {
|
||||
@@ -22,8 +14,6 @@ fun f(): Unit {
|
||||
x != 1
|
||||
|
||||
<!EQUALITY_NOT_APPLICABLE!>A() == 1<!>
|
||||
B() <!RESULT_TYPE_MISMATCH!>==<!> 1
|
||||
C() <!RESULT_TYPE_MISMATCH!>==<!> 1
|
||||
|
||||
<!EQUALITY_NOT_APPLICABLE!>x === "1"<!>
|
||||
<!EQUALITY_NOT_APPLICABLE!>x !== "1"<!>
|
||||
|
||||
@@ -1 +1 @@
|
||||
fun f(a: MutableList<out Number>) = a is MutableList<out Hashable>
|
||||
fun f(a: MutableList<out Number>) = a is MutableList<out Any>
|
||||
|
||||
@@ -1 +1 @@
|
||||
fun f(a: List<Number>) = a is List<Hashable>
|
||||
fun f(a: List<Number>) = a is List<Any>
|
||||
|
||||
@@ -1 +1 @@
|
||||
fun f(a: List<Hashable>) = a is <!CANNOT_CHECK_FOR_ERASED!>List<Number><!>
|
||||
fun f(a: List<Any>) = a is <!CANNOT_CHECK_FOR_ERASED!>List<Number><!>
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Y extends X<A> {
|
||||
// FILE: test.kt
|
||||
|
||||
fun main() {
|
||||
Y().foo()<!UNSAFE_CALL!>.<!>hashCode()
|
||||
Y().foo()<!UNSAFE_CALL!>.<!>wait()
|
||||
Y().bar(null)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// No supertype at all
|
||||
class A1 {
|
||||
fun test() {
|
||||
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>.equals(null) // Call to an extension function
|
||||
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>.identityEquals(null) // Call to an extension function
|
||||
}
|
||||
}
|
||||
@@ -50,13 +50,35 @@ Trait.traitFunc:SimpleFunctionDescriptor
|
||||
Trait.traitProp:PropertyDescriptor
|
||||
Trait:ClassDescriptorWithResolutionScopes
|
||||
a:ValueParameterDescriptor
|
||||
fake <class-object-for-Class>.equals:SimpleFunctionDescriptor
|
||||
fake <class-object-for-Class>.hashCode:SimpleFunctionDescriptor
|
||||
fake <class-object-for-NestedClass>.equals:SimpleFunctionDescriptor
|
||||
fake <class-object-for-NestedClass>.hashCode:SimpleFunctionDescriptor
|
||||
fake <class-object-for-NestedObject>.equals:SimpleFunctionDescriptor
|
||||
fake <class-object-for-NestedObject>.hashCode:SimpleFunctionDescriptor
|
||||
fake <class-object-for-NestedObject>.nestedFunc:SimpleFunctionDescriptor
|
||||
fake <class-object-for-Object>.<get-objProp>:PropertyGetterDescriptor
|
||||
fake <class-object-for-Object>.equals:SimpleFunctionDescriptor
|
||||
fake <class-object-for-Object>.hashCode:SimpleFunctionDescriptor
|
||||
fake <class-object-for-Object>.objFunc:SimpleFunctionDescriptor
|
||||
fake <class-object-for-Object>.objProp:PropertyDescriptor
|
||||
fake Class.<get-traitProp>:PropertyGetterDescriptor
|
||||
fake Class.equals:SimpleFunctionDescriptor
|
||||
fake Class.hashCode:SimpleFunctionDescriptor
|
||||
fake Class.traitFunc:SimpleFunctionDescriptor
|
||||
fake Class.traitProp:PropertyDescriptor
|
||||
fake NestedClass.equals:SimpleFunctionDescriptor
|
||||
fake NestedClass.hashCode:SimpleFunctionDescriptor
|
||||
fake NestedObject.equals:SimpleFunctionDescriptor
|
||||
fake NestedObject.hashCode:SimpleFunctionDescriptor
|
||||
fake NestedTrait.equals:SimpleFunctionDescriptor
|
||||
fake NestedTrait.hashCode:SimpleFunctionDescriptor
|
||||
fake Object.equals:SimpleFunctionDescriptor
|
||||
fake Object.hashCode:SimpleFunctionDescriptor
|
||||
fake Outer.equals:SimpleFunctionDescriptor
|
||||
fake Outer.hashCode:SimpleFunctionDescriptor
|
||||
fake Trait.equals:SimpleFunctionDescriptor
|
||||
fake Trait.hashCode:SimpleFunctionDescriptor
|
||||
func.this:ReceiverParameterDescriptor
|
||||
innerTest.<get-prop>:PropertyGetterDescriptor
|
||||
innerTest.<get-propVar>:PropertyGetterDescriptor
|
||||
@@ -65,6 +87,17 @@ innerTest.func:SimpleFunctionDescriptor
|
||||
innerTest.prop:PropertyDescriptor
|
||||
innerTest.propVar:PropertyDescriptor
|
||||
innerTest:PackageViewDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
other:ValueParameterDescriptor
|
||||
prop.this:ReceiverParameterDescriptor
|
||||
prop.this:ReceiverParameterDescriptor
|
||||
test:PackageViewDescriptor
|
||||
Reference in New Issue
Block a user