Reserve box/unbox/equals/hashCode methods inside inline classes

#KT-26573 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-08-31 17:23:23 +03:00
parent 7f8863bfd0
commit 002a66fec1
10 changed files with 130 additions and 2 deletions
@@ -0,0 +1,39 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
inline class IC1(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>() {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>() {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(x: Any) {}
override fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>equals<!>(other: Any?): Boolean = true
override fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>hashCode<!>(): Int = 0
}
inline class IC2(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>equals<!>(my: Any, other: Any): Boolean = true
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>hashCode<!>(a: Any): Int = 0
}
inline class IC3(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(x: Any): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>unbox<!>(x: Any): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>equals<!>(): Boolean = true
}
interface WithBox {
fun box(): String
}
inline class IC4(val s: String) : WithBox {
override fun <!RESERVED_MEMBER_INSIDE_INLINE_CLASS!>box<!>(): String = ""
}
@@ -0,0 +1,54 @@
package
public final inline class IC1 {
public constructor IC1(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Unit
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Unit
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
public final inline class IC2 {
public constructor IC2(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Any
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
public final inline class IC3 {
public constructor IC3(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Any
public final fun equals(): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any
}
public final inline class IC4 : WithBox {
public constructor IC4(/*0*/ s: kotlin.String)
public final val s: kotlin.String
public open override /*1*/ fun box(): kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public interface WithBox {
public abstract fun box(): kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}