Minor. Add tests and comment about copying generic parameters to
constructor, but not function reference to the constructor. #KT-32162
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// LANGUAGE: -JvmInlineValueClasses, +GenericInlineClassParameter
|
||||
|
||||
inline class ICIntArray<T: Int>(val value: Array<T>)
|
||||
|
||||
fun box(): String = if (ICIntArray(arrayOf(1)).value[0] == 1) "OK" else "FAIL"
|
||||
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public final class ArrayKt {
|
||||
// source: 'array.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class ICIntArray {
|
||||
// source: 'array.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field value: java.lang.Integer[]
|
||||
private synthetic method <init>(p0: java.lang.Integer[]): void
|
||||
public synthetic final static method box-impl(p0: java.lang.Integer[]): ICIntArray
|
||||
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.Integer[]): java.lang.Integer[]
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: java.lang.Integer[], p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: java.lang.Integer[], p1: java.lang.Integer[]): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.Integer[]
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: java.lang.Integer[]): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: java.lang.Integer[]): java.lang.String
|
||||
public synthetic final method unbox-impl(): java.lang.Integer[]
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// LANGUAGE: -JvmInlineValueClasses, +GenericInlineClassParameter
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
inline class ICStr(val value: String)
|
||||
inline class ICIStr<T : ICStr>(val value: T)
|
||||
inline class ICIStrArray<T : ICStr>(val value: Array<T>)
|
||||
|
||||
fun box(): String {
|
||||
val res = ICIStrArray(arrayOf(ICStr("OK"))).value[0].value
|
||||
if (res != "OK") return res
|
||||
return ICIStr(ICStr("OK")).value.value
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
@kotlin.Metadata
|
||||
public final class ArrayICKt {
|
||||
// source: 'arrayIC.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class ICIStr {
|
||||
// source: 'arrayIC.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||
private synthetic method <init>(p0: java.lang.String): void
|
||||
public synthetic final static method box-impl(p0: java.lang.String): ICIStr
|
||||
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getValue-GZl9MeU(): java.lang.String
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: java.lang.String): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: java.lang.String): java.lang.String
|
||||
public synthetic final method unbox-impl(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class ICIStrArray {
|
||||
// source: 'arrayIC.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field value: ICStr[]
|
||||
private synthetic method <init>(p0: ICStr[]): void
|
||||
public synthetic final static method box-impl(p0: ICStr[]): ICIStrArray
|
||||
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: ICStr[]): ICStr[]
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: ICStr[], p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: ICStr[], p1: ICStr[]): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): ICStr[]
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: ICStr[]): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: ICStr[]): java.lang.String
|
||||
public synthetic final method unbox-impl(): ICStr[]
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class ICStr {
|
||||
// source: 'arrayIC.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||
private synthetic method <init>(p0: java.lang.String): void
|
||||
public synthetic final static method box-impl(p0: java.lang.String): ICStr
|
||||
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: java.lang.String, p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: java.lang.String, p1: java.lang.String): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: java.lang.String): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: java.lang.String): java.lang.String
|
||||
public synthetic final method unbox-impl(): java.lang.String
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// LANGUAGE: -JvmInlineValueClasses, +GenericInlineClassParameter
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
inline class ICInt<T: Int>(val value: T)
|
||||
|
||||
inline class ICIcInt<T: ICInt<Int>>(val value: T)
|
||||
|
||||
fun box(): String {
|
||||
var res = ICInt(1).value
|
||||
if (res != 1) return "FAIL 1: $res"
|
||||
res = ICIcInt(ICInt(1)).value.value
|
||||
if (res != 1) return "FAIL 2: $res"
|
||||
return "OK"
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class ICIcInt {
|
||||
// source: 'primitive.kt'
|
||||
private final field value: int
|
||||
private synthetic method <init>(p0: int): void
|
||||
public synthetic final static method box-impl(p0: int): ICIcInt
|
||||
public static method constructor-impl(p0: int): int
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: int, p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public final method getValue-F6dIzHg(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: int): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: int): java.lang.String
|
||||
public synthetic final method unbox-impl(): int
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class ICInt {
|
||||
// source: 'primitive.kt'
|
||||
private final field value: int
|
||||
private synthetic method <init>(p0: int): void
|
||||
public synthetic final static method box-impl(p0: int): ICInt
|
||||
public static method constructor-impl(p0: int): int
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: int, p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public final method getValue(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: int): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: int): java.lang.String
|
||||
public synthetic final method unbox-impl(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class PrimitiveKt {
|
||||
// source: 'primitive.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// LANGUAGE: -JvmInlineValueClasses, +GenericInlineClassParameter
|
||||
// IGNORE_BACKED: JVM
|
||||
|
||||
inline class ICAny<T>(val value: T)
|
||||
|
||||
fun box(): String {
|
||||
var res = ICAny("OK").value
|
||||
if (res != "OK") return "FAIL 1: $res"
|
||||
res = ICAny(ICAny("OK")).value.value
|
||||
if (res != "OK") return "FAIL 2: $res"
|
||||
res = ICAny(ICAny(ICAny("OK"))).value.value.value
|
||||
if (res != "OK") return "FAIL 3: $res"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user