[Test] Migrate AbstractAsmLikeInstructionListingTest to new test infrastructure

This commit is contained in:
Dmitriy Novozhilov
2021-10-05 16:40:15 +03:00
committed by TeamCityServer
parent bc7cc6b5a9
commit aab8870903
93 changed files with 1512 additions and 228 deletions
@@ -0,0 +1,25 @@
public final class DeepInlineKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
1 $i$f$block: I
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $this$foo, int count) {
Local variables:
16 $i$a$-block-DeepInlineKt$foo$1$1$1: I
14 $this$foo_u24lambda_u2d2_u24lambda_u2d1_u24lambda_u2d0: J
13 $i$f$block: I
11 $i$a$-block-DeepInlineKt$foo$1$1: I
12 z: Z
9 $this$foo_u24lambda_u2d2_u24lambda_u2d1: J
8 $i$f$block: I
6 $i$a$-block-DeepInlineKt$foo$1: I
7 y: Z
4 $this$foo_u24lambda_u2d2: J
3 $i$f$block: I
2 x: Z
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
@@ -22,4 +22,4 @@ public final class DeepInlineKt : java/lang/Object {
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -15,4 +15,4 @@ fun String.foo(count: Int) {
}
}
inline fun block(block: Long.() -> Unit) = 5L.block()
inline fun block(block: Long.() -> Unit) = 5L.block()
@@ -0,0 +1,25 @@
public final class DeepInlineWithLabelsKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
1 $i$f$block: I
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $this$foo, int count) {
Local variables:
16 $i$a$-block-DeepInlineWithLabelsKt$foo$1$1$1: I
14 $this$foo_u24lambda_u2d2_u24lambda_u2d1_u24lambda_u2d0: J
13 $i$f$block: I
11 $i$a$-block-DeepInlineWithLabelsKt$foo$1$1: I
12 z: Z
9 $this$foo_u24lambda_u2d2_u24lambda_u2d1: J
8 $i$f$block: I
6 $i$a$-block-DeepInlineWithLabelsKt$foo$1: I
7 y: Z
4 $this$foo_u24lambda_u2d2: J
3 $i$f$block: I
2 x: Z
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
@@ -22,4 +22,4 @@ public final class DeepInlineWithLabelsKt : java/lang/Object {
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -15,4 +15,4 @@ fun String.foo(count: Int) {
}
}
inline fun block(block: Long.() -> Unit) = 5L.block()
inline fun block(block: Long.() -> Unit) = 5L.block()
@@ -0,0 +1,117 @@
final class DeepNoinlineWithLabels_afterKt$foo$1$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final long $this_b1
final long $this_b2
final java.lang.String $this_foo
final boolean $x
final boolean $y
final boolean $z
void <init>(java.lang.String $receiver, long $this_b1, long p2, boolean $this_b2, boolean p4, boolean $x, int $y) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1$1$1;
1 $receiver: Ljava/lang/String;
2 $this_b1: J
4 $this_b2: J
6 $x: Z
7 $y: Z
8 $z: Z
9 $count: I
}
public final void invoke(long $this$b3) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1$1$1;
1 $this$b3: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinlineWithLabels_afterKt$foo$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final long $this_b1
final java.lang.String $this_foo
final boolean $x
final boolean $y
void <init>(java.lang.String $receiver, long $this_b1, boolean p2, boolean $x, int $y) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1$1;
1 $receiver: Ljava/lang/String;
2 $this_b1: J
4 $x: Z
5 $y: Z
6 $count: I
}
public final void invoke(long $this$b2) {
Local variables:
3 z: Z
0 this: LDeepNoinlineWithLabels_afterKt$foo$1$1;
1 $this$b2: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinlineWithLabels_afterKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
void <init>(java.lang.String $receiver, boolean $x, int $count) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $count: I
}
public final void invoke(long $this$b1) {
Local variables:
3 y: Z
0 this: LDeepNoinlineWithLabels_afterKt$foo$1;
1 $this$b1: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinlineWithLabels_afterKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class DeepNoinlineWithLabels_afterKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $this$foo, int count) {
Local variables:
2 x: Z
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
@@ -66,4 +66,4 @@ public final class DeepNoinlineWithLabels_afterKt : java/lang/Object {
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,5 +1,5 @@
// !LANGUAGE: +NewCapturedReceiverFieldNamingConvention
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -0,0 +1,117 @@
final class DeepNoinlineWithLabels_beforeKt$foo$1$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final long $this
final long $this$1
final java.lang.String $this_foo
final boolean $x
final boolean $y
final boolean $z
void <init>(java.lang.String $receiver, long $this, long p2, boolean $this$1, boolean p4, boolean $x, int $y) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1$1$1;
1 $receiver: Ljava/lang/String;
2 $this: J
4 $this$1: J
6 $x: Z
7 $y: Z
8 $z: Z
9 $count: I
}
public final void invoke(long <this>) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1$1$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinlineWithLabels_beforeKt$foo$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final long $this
final java.lang.String $this_foo
final boolean $x
final boolean $y
void <init>(java.lang.String $receiver, long $this, boolean p2, boolean $x, int $y) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1$1;
1 $receiver: Ljava/lang/String;
2 $this: J
4 $x: Z
5 $y: Z
6 $count: I
}
public final void invoke(long <this>) {
Local variables:
3 z: Z
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinlineWithLabels_beforeKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
void <init>(java.lang.String $receiver, boolean $x, int $count) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $count: I
}
public final void invoke(long <this>) {
Local variables:
3 y: Z
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinlineWithLabels_beforeKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class DeepNoinlineWithLabels_beforeKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $receiver, int count) {
Local variables:
2 x: Z
0 $receiver: Ljava/lang/String;
1 count: I
}
}
@@ -66,4 +66,4 @@ public final class DeepNoinlineWithLabels_beforeKt : java/lang/Object {
0 $receiver: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,5 +1,5 @@
// !LANGUAGE: -NewCapturedReceiverFieldNamingConvention
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -16,4 +16,4 @@ fun String.foo(count: Int) {
}
}
fun block(block: Long.() -> Unit) = 5L.block()
fun block(block: Long.() -> Unit) = 5L.block()
@@ -0,0 +1,108 @@
final class DeepNoinline_afterKt$foo$1$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
final boolean $y
final boolean $z
void <init>(java.lang.String $receiver, boolean $x, boolean $y, boolean $z, int $count) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1$1$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $y: Z
4 $z: Z
5 $count: I
}
public final void invoke(long $this$block) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1$1$1;
1 $this$block: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinline_afterKt$foo$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
final boolean $y
void <init>(java.lang.String $receiver, boolean $x, boolean $y, int $count) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $y: Z
4 $count: I
}
public final void invoke(long $this$block) {
Local variables:
3 z: Z
0 this: LDeepNoinline_afterKt$foo$1$1;
1 $this$block: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinline_afterKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
void <init>(java.lang.String $receiver, boolean $x, int $count) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $count: I
}
public final void invoke(long $this$block) {
Local variables:
3 y: Z
0 this: LDeepNoinline_afterKt$foo$1;
1 $this$block: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinline_afterKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class DeepNoinline_afterKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $this$foo, int count) {
Local variables:
2 x: Z
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
@@ -62,4 +62,4 @@ public final class DeepNoinline_afterKt : java/lang/Object {
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,5 +1,5 @@
// !LANGUAGE: +NewCapturedReceiverFieldNamingConvention
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -0,0 +1,108 @@
final class DeepNoinline_beforeKt$foo$1$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
final boolean $y
final boolean $z
void <init>(java.lang.String $receiver, boolean $x, boolean $y, boolean $z, int $count) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1$1$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $y: Z
4 $z: Z
5 $count: I
}
public final void invoke(long <this>) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1$1$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinline_beforeKt$foo$1$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
final boolean $y
void <init>(java.lang.String $receiver, boolean $x, boolean $y, int $count) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $y: Z
4 $count: I
}
public final void invoke(long <this>) {
Local variables:
3 z: Z
0 this: LDeepNoinline_beforeKt$foo$1$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1$1;
1 p1: Ljava/lang/Object;
}
}
final class DeepNoinline_beforeKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
void <init>(java.lang.String $receiver, boolean $x, int $count) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $count: I
}
public final void invoke(long <this>) {
Local variables:
3 y: Z
0 this: LDeepNoinline_beforeKt$foo$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LDeepNoinline_beforeKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class DeepNoinline_beforeKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $receiver, int count) {
Local variables:
2 x: Z
0 $receiver: Ljava/lang/String;
1 count: I
}
}
@@ -62,4 +62,4 @@ public final class DeepNoinline_beforeKt : java/lang/Object {
0 $receiver: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,5 +1,5 @@
// !LANGUAGE: -NewCapturedReceiverFieldNamingConvention
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -16,4 +16,4 @@ fun String.foo(count: Int) {
}
}
fun block(block: Long.() -> Unit) = 5L.block()
fun block(block: Long.() -> Unit) = 5L.block()
@@ -0,0 +1,40 @@
public final class Foo$Bar : java/lang/Object {
final Foo this$0
public void <init>(Foo this$0) {
Local variables:
0 this: LFoo$Bar;
1 this$0: LFoo;
}
public final void bar() {
Local variables:
4 $i$a$-block-Foo$Bar$bar$1$1: I
3 $i$f$block: I
2 $i$a$-block-Foo$Bar$bar$1: I
1 $i$f$block: I
0 this: LFoo$Bar;
}
}
public final class Foo : java/lang/Object {
public void <init>() {
Local variables:
0 this: LFoo;
}
public final void foo() {
Local variables:
2 $i$a$-block-Foo$foo$1: I
1 $i$f$block: I
0 this: LFoo;
}
}
public final class InlineClassCaptureKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function0 block) {
Local variables:
1 $i$f$block: I
0 block: Lkotlin/jvm/functions/Function0;
}
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
class Foo {
@@ -23,4 +23,4 @@ class Foo {
}
}
inline fun block(block: () -> Unit) = block()
inline fun block(block: () -> Unit) = block()
@@ -0,0 +1,17 @@
public final class InlineReceiversKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
1 $i$f$block: I
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $this$foo, int count) {
Local variables:
6 $i$a$-block-InlineReceiversKt$foo$1: I
4 $this$foo_u24lambda_u2d0: J
3 $i$f$block: I
2 x: Z
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
@@ -14,4 +14,4 @@ public final class InlineReceiversKt : java/lang/Object {
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -9,4 +9,4 @@ fun String.foo(count: Int) {
}
}
inline fun block(block: Long.() -> Unit) = 5L.block()
inline fun block(block: Long.() -> Unit) = 5L.block()
@@ -0,0 +1,16 @@
public final class LocalFunctionsKt : java/lang/Object {
public final static void foo()
private final static void foo$a()
private final static void foo$a2()
private final static void foo$a2-0(int a) {
Local variables:
0 a: I
}
private final static void foo$b_c()
private final static void foo$c_d()
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun foo() {
@@ -7,4 +7,4 @@ fun foo() {
fun a2(a: Int) {}
fun `b c`() {}
fun `c$d`() {}
}
}
@@ -0,0 +1,144 @@
final class Arr : java/lang/Object {
private final int a1
private final int a2
private final int a3
private final int a4
private final int a5
public void <init>(int a1, int a2, int a3, int a4, int a5) {
Local variables:
0 this: LArr;
1 a1: I
2 a2: I
3 a3: I
4 a4: I
5 a5: I
}
public void <init>(int p0, int p1, int p2, int p3, int p4, int p5, kotlin.jvm.internal.DefaultConstructorMarker p6)
public void <init>() {
Local variables:
0 this: LArr;
}
public final int component1() {
Local variables:
0 this: LArr;
}
public final int component2() {
Local variables:
0 this: LArr;
}
public final int component3() {
Local variables:
0 this: LArr;
}
public final int component4() {
Local variables:
0 this: LArr;
}
public final int component5() {
Local variables:
0 this: LArr;
}
public final Arr copy(int a1, int a2, int a3, int a4, int a5) {
Local variables:
0 this: LArr;
1 a1: I
2 a2: I
3 a3: I
4 a4: I
5 a5: I
}
public static Arr copy$default(Arr p0, int p1, int p2, int p3, int p4, int p5, int p6, java.lang.Object p7)
public boolean equals(java.lang.Object other) {
Local variables:
0 this: LArr;
1 other: Ljava/lang/Object;
}
public final int getA1() {
Local variables:
0 this: LArr;
}
public final int getA2() {
Local variables:
0 this: LArr;
}
public final int getA3() {
Local variables:
0 this: LArr;
}
public final int getA4() {
Local variables:
0 this: LArr;
}
public final int getA5() {
Local variables:
0 this: LArr;
}
public int hashCode() {
Local variables:
1 result: I
0 this: LArr;
}
public java.lang.String toString() {
Local variables:
0 this: LArr;
}
}
final class MangledNamesKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
public final static MangledNamesKt$foo$1 INSTANCE
static void <clinit>()
void <init>() {
Local variables:
0 this: LMangledNamesKt$foo$1;
}
public final void invoke(Arr $dstr$a_u20b$b_u24c$c_u2dd$b_u24_u24c_u2d_u2dd$a_u28_u29§_u26_u2a_u26_u5e_u40あ化) {
Local variables:
2 a b: I
3 b$c: I
4 c-d: I
5 b$$c--d: I
6 a()§&*&^@あ化: I
0 this: LMangledNamesKt$foo$1;
1 $dstr$a_u20b$b_u24c$c_u2dd$b_u24_u24c_u2d_u2dd$a_u28_u29§_u26_u2a_u26_u5e_u40あ化: LArr;
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LMangledNamesKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class MangledNamesKt : java/lang/Object {
public final static void foo()
private final static void t(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
}
@@ -120,4 +120,4 @@ public final class MangledNamesKt : java/lang/Object {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
}
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun foo() {
@@ -15,4 +15,4 @@ private data class Arr(
val a3: Int = 0,
val a4: Int = 0,
val a5: Int = 0
)
)
@@ -0,0 +1,41 @@
final class NonInlineReceivers_afterKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
void <init>(java.lang.String $receiver, boolean $x, int $count) {
Local variables:
0 this: LNonInlineReceivers_afterKt$foo$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $count: I
}
public final void invoke(long $this$block) {
Local variables:
0 this: LNonInlineReceivers_afterKt$foo$1;
1 $this$block: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LNonInlineReceivers_afterKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class NonInlineReceivers_afterKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $this$foo, int count) {
Local variables:
2 x: Z
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
@@ -28,4 +28,4 @@ public final class NonInlineReceivers_afterKt : java/lang/Object {
0 $this$foo: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,4 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -9,4 +9,4 @@ fun String.foo(count: Int) {
}
}
fun block(block: Long.() -> Unit) = 5L.block()
fun block(block: Long.() -> Unit) = 5L.block()
@@ -0,0 +1,41 @@
final class NonInlineReceivers_beforeKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function1 {
final int $count
final java.lang.String $this_foo
final boolean $x
void <init>(java.lang.String $receiver, boolean $x, int $count) {
Local variables:
0 this: LNonInlineReceivers_beforeKt$foo$1;
1 $receiver: Ljava/lang/String;
2 $x: Z
3 $count: I
}
public final void invoke(long <this>) {
Local variables:
0 this: LNonInlineReceivers_beforeKt$foo$1;
1 <this>: J
}
public java.lang.Object invoke(java.lang.Object p1) {
Local variables:
0 this: LNonInlineReceivers_beforeKt$foo$1;
1 p1: Ljava/lang/Object;
}
}
public final class NonInlineReceivers_beforeKt : java/lang/Object {
public final static void block(kotlin.jvm.functions.Function1 block) {
Local variables:
0 block: Lkotlin/jvm/functions/Function1;
}
public final static void foo(java.lang.String $receiver, int count) {
Local variables:
2 x: Z
0 $receiver: Ljava/lang/String;
1 count: I
}
}
@@ -28,4 +28,4 @@ public final class NonInlineReceivers_beforeKt : java/lang/Object {
0 $receiver: Ljava/lang/String;
1 count: I
}
}
}
@@ -1,5 +1,5 @@
// !LANGUAGE: -NewCapturedReceiverFieldNamingConvention
// IGNORE_BACKEND: JVM_IR
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
fun String.foo(count: Int) {
@@ -10,4 +10,4 @@ fun String.foo(count: Int) {
}
}
fun block(block: Long.() -> Unit) = 5L.block()
fun block(block: Long.() -> Unit) = 5L.block()
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JVM
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// JVM_TARGET: 1.8
package foo
@@ -73,4 +73,4 @@ public final class foo/Kotlin : java/lang/Object {
@Lfoo/Ann;([]) : METHOD_FORMAL_PARAMETER 0, null
@Lfoo/Ann2;([]) : METHOD_FORMAL_PARAMETER 0, 0;
@Lorg/jetbrains/annotations/NotNull;([]) // invisible, parameter 0
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -13,4 +13,4 @@ public final class foo/Kotlin : java/lang/Object {
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
public abstract java.lang.String name()
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -16,4 +16,4 @@ public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/A
public abstract interface foo/TypeParameterAnn : java/lang/Object, java/lang/annotation/Annotation {
public abstract java.lang.String name()
}
}
@@ -28,4 +28,4 @@ public class foo/Kotlin : java/lang/Enum {
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
}
}
@@ -26,4 +26,4 @@ public class foo/Kotlin : java/lang/Enum {
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
}
}
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// IR_DIFFERENCE
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,16 +0,0 @@
// IGNORE_BACKEND: JVM
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
package foo
@Target(AnnotationTarget.TYPE)
annotation class TypeAnn
enum class Kotlin (s: @TypeAnn String) {
A("123") {
fun foo() {}
};
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,7 +1,6 @@
// IGNORE_BACKEND: JVM
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// JVM_TARGET: 1.8
package foo
@@ -12,6 +12,20 @@ final class foo/Kotlin$foo4$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
}
Lkotlin/jvm/internal/Lambda;Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;
final class foo/Kotlin$foo5$lambda$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function0 {
final foo.Kotlin this$0
void <init>(foo.Kotlin p0)
public java.lang.Object invoke()
public final java.lang.String invoke()
@Lorg/jetbrains/annotations/NotNull;([]) // invisible
@Lfoo/TypeAnn;([name="2"]) : METHOD_RETURN, null
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
}
public final class foo/Kotlin : java/lang/Object {
public void <init>()
@@ -29,6 +43,8 @@ public final class foo/Kotlin : java/lang/Object {
@Lorg/jetbrains/annotations/NotNull;([]) // invisible
@Lfoo/TypeAnn;([name="2"]) : METHOD_RETURN, null
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
public final void foo5()
}
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// IR_DIFFERENCE
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -26,4 +26,8 @@ class Kotlin {
fun foo4() = { foo2() }()
fun foo5() {
val lambda = { foo2() }
lambda()
}
}
@@ -1,33 +0,0 @@
// IGNORE_BACKEND: JVM
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
package foo
@Target(AnnotationTarget.TYPE)
annotation class TypeAnn(val name: String)
@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.BINARY)
annotation class TypeAnnBinary
@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.SOURCE)
annotation class TypeAnnSource
class Kotlin {
fun foo2(): @TypeAnn("2") @TypeAnnBinary @TypeAnnSource String {
return "OK"
}
fun foo3() = foo2()
fun foo4() = { foo2() }()
fun foo5() {
val lambda = { foo2() }
lambda()
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -9,4 +9,4 @@ annotation class TypeAnn
class Kotlin {
inner class Inner(s: @TypeAnn String) {}
}
}
@@ -26,4 +26,4 @@ public final class foo/FooClass : java/lang/Object {
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
public abstract java.lang.String name()
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -48,4 +48,4 @@ public final class foo/FooClass : java/lang/Object {
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
public abstract java.lang.String name()
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -24,4 +24,4 @@ object Foo {
fun foo(s: @TypeAnn("1") String , x: @TypeAnn("2") Int): @TypeAnn("return") Any? {
return null
}
}
}
@@ -78,4 +78,4 @@ public final class foo/Outer : java/lang/Object {
<T:Lfoo/Bar<Lfoo/Outer$Inner<Lfoo/Outer;>;>;>Ljava/lang/Object;
public final class foo/WithBound : java/lang/Object {
public void <init>()
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -57,4 +57,4 @@ class Kotlin {
}
class WithBound<T: Bar<Outer.Inner<@Ann Outer>>>()
class WithBound<T: Bar<Outer.Inner<@Ann Outer>>>()
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,7 +1,6 @@
// IGNORE_BACKEND: JVM
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// JVM_TARGET: 1.8
package foo
@@ -32,4 +32,4 @@ public abstract interface foo/TypeAnnBinary : java/lang/Object, java/lang/annota
public abstract interface foo/TypeAnnSource : java/lang/Object, java/lang/annotation/Annotation {
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -15,4 +15,4 @@ public final class foo/Kotlin : java/lang/Object {
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
public abstract java.lang.String name()
}
}
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,4 +1,4 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
// EMIT_JVM_TYPE_ANNOTATIONS
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,6 +1,5 @@
// IGNORE_BACKEND: JVM
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// TARGET_BACKEND: JVM_IR
// JVM_TARGET: 1.8
package foo
@@ -3,228 +3,216 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen;
package org.jetbrains.kotlin.test.runners.codegen;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/asmLike")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class AsmLikeInstructionListingTestGenerated extends AbstractAsmLikeInstructionListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@Test
public void testAllFilesPresentInAsmLike() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/asmLike"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Nested
@TestMetadata("compiler/testData/codegen/asmLike/receiverMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ReceiverMangling extends AbstractAsmLikeInstructionListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public class ReceiverMangling {
@Test
public void testAllFilesPresentInReceiverMangling() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/asmLike/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("deepInline.kt")
public void testDeepInline() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepInline.kt");
}
@Test
@TestMetadata("deepInlineWithLabels.kt")
public void testDeepInlineWithLabels() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepInlineWithLabels.kt");
}
@Test
@TestMetadata("deepNoinlineWithLabels_after.kt")
public void testDeepNoinlineWithLabels_after() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinlineWithLabels_after.kt");
}
@Test
@TestMetadata("deepNoinlineWithLabels_before.kt")
public void testDeepNoinlineWithLabels_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinlineWithLabels_before.kt");
}
@Test
@TestMetadata("deepNoinline_after.kt")
public void testDeepNoinline_after() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinline_after.kt");
}
@Test
@TestMetadata("deepNoinline_before.kt")
public void testDeepNoinline_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinline_before.kt");
}
@Test
@TestMetadata("inlineClassCapture.kt")
public void testInlineClassCapture() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/inlineClassCapture.kt");
}
@Test
@TestMetadata("inlineReceivers.kt")
public void testInlineReceivers() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/inlineReceivers.kt");
}
@Test
@TestMetadata("localFunctions.kt")
public void testLocalFunctions() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/localFunctions.kt");
}
@Test
@TestMetadata("mangledNames.kt")
public void testMangledNames() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/mangledNames.kt");
}
@Test
@TestMetadata("nonInlineReceivers_after.kt")
public void testNonInlineReceivers_after() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/nonInlineReceivers_after.kt");
}
@Test
@TestMetadata("nonInlineReceivers_before.kt")
public void testNonInlineReceivers_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/nonInlineReceivers_before.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/asmLike/typeAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeAnnotations extends AbstractAsmLikeInstructionListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public class TypeAnnotations {
@Test
public void testAllFilesPresentInTypeAnnotations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/asmLike/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("classTypeParameter.kt")
public void testClassTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/classTypeParameter.kt");
}
@Test
@TestMetadata("complex.kt")
public void testComplex() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/complex.kt");
}
@Test
@TestMetadata("constructor.kt")
public void testConstructor() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/constructor.kt");
}
@Test
@TestMetadata("defaultArgs.kt")
public void testDefaultArgs() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/defaultArgs.kt");
}
@Test
@TestMetadata("dontEmit.kt")
public void testDontEmit() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/dontEmit.kt");
}
@Test
@TestMetadata("enumClassConstructor.kt")
public void testEnumClassConstructor() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/enumClassConstructor.kt");
}
@TestMetadata("enumClassConstructor_ir.kt")
public void testEnumClassConstructor_ir() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/enumClassConstructor_ir.kt");
}
@Test
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/extension.kt");
}
@TestMetadata("functionTypeParameter.kt")
public void testFunctionTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/functionTypeParameter.kt");
}
@Test
@TestMetadata("implicit.kt")
public void testImplicit() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/implicit.kt");
}
@TestMetadata("implicit_ir.kt")
public void testImplicit_ir() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/implicit_ir.kt");
}
@Test
@TestMetadata("innerClassConstructor.kt")
public void testInnerClassConstructor() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/innerClassConstructor.kt");
}
@Test
@TestMetadata("jvmOverload.kt")
public void testJvmOverload() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/jvmOverload.kt");
}
@Test
@TestMetadata("jvmStatic.kt")
public void testJvmStatic() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/jvmStatic.kt");
}
@Test
@TestMetadata("notYetSupported.kt")
public void testNotYetSupported() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/notYetSupported.kt");
}
@Test
@TestMetadata("property.kt")
public void testProperty() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/property.kt");
}
@TestMetadata("propertyTypeParameter.kt")
public void testPropertyTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/propertyTypeParameter.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/simple.kt");
}
@Test
@TestMetadata("simple2Params.kt")
public void testSimple2Params() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/simple2Params.kt");
}
@Test
@TestMetadata("staticNested.kt")
public void testStaticNested() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/staticNested.kt");
}
@Test
@TestMetadata("syntheticAccessors.kt")
public void testSyntheticAccessors() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/syntheticAccessors.kt");
}
@TestMetadata("typeParameter.kt")
public void testTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/typeParameter.kt");
}
@Test
@TestMetadata("typeParameter16.kt")
public void testTypeParameter16() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/typeParameter16.kt");
@@ -3,228 +3,240 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.ir;
package org.jetbrains.kotlin.test.runners.codegen;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/asmLike")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class IrAsmLikeInstructionListingTestGenerated extends AbstractIrAsmLikeInstructionListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
@Test
public void testAllFilesPresentInAsmLike() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/asmLike"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Nested
@TestMetadata("compiler/testData/codegen/asmLike/receiverMangling")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ReceiverMangling extends AbstractIrAsmLikeInstructionListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public class ReceiverMangling {
@Test
public void testAllFilesPresentInReceiverMangling() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/asmLike/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("deepInline.kt")
public void testDeepInline() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepInline.kt");
}
@Test
@TestMetadata("deepInlineWithLabels.kt")
public void testDeepInlineWithLabels() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepInlineWithLabels.kt");
}
@Test
@TestMetadata("deepNoinlineWithLabels_after.kt")
public void testDeepNoinlineWithLabels_after() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinlineWithLabels_after.kt");
}
@Test
@TestMetadata("deepNoinlineWithLabels_before.kt")
public void testDeepNoinlineWithLabels_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinlineWithLabels_before.kt");
}
@Test
@TestMetadata("deepNoinline_after.kt")
public void testDeepNoinline_after() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinline_after.kt");
}
@Test
@TestMetadata("deepNoinline_before.kt")
public void testDeepNoinline_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/deepNoinline_before.kt");
}
@Test
@TestMetadata("inlineClassCapture.kt")
public void testInlineClassCapture() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/inlineClassCapture.kt");
}
@Test
@TestMetadata("inlineReceivers.kt")
public void testInlineReceivers() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/inlineReceivers.kt");
}
@Test
@TestMetadata("localFunctions.kt")
public void testLocalFunctions() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/localFunctions.kt");
}
@Test
@TestMetadata("mangledNames.kt")
public void testMangledNames() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/mangledNames.kt");
}
@Test
@TestMetadata("nonInlineReceivers_after.kt")
public void testNonInlineReceivers_after() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/nonInlineReceivers_after.kt");
}
@Test
@TestMetadata("nonInlineReceivers_before.kt")
public void testNonInlineReceivers_before() throws Exception {
runTest("compiler/testData/codegen/asmLike/receiverMangling/nonInlineReceivers_before.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/asmLike/typeAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeAnnotations extends AbstractIrAsmLikeInstructionListingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public class TypeAnnotations {
@Test
public void testAllFilesPresentInTypeAnnotations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/asmLike/typeAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("classTypeParameter.kt")
public void testClassTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/classTypeParameter.kt");
}
@Test
@TestMetadata("complex.kt")
public void testComplex() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/complex.kt");
}
@Test
@TestMetadata("constructor.kt")
public void testConstructor() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/constructor.kt");
}
@Test
@TestMetadata("defaultArgs.kt")
public void testDefaultArgs() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/defaultArgs.kt");
}
@Test
@TestMetadata("dontEmit.kt")
public void testDontEmit() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/dontEmit.kt");
}
@Test
@TestMetadata("enumClassConstructor.kt")
public void testEnumClassConstructor() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/enumClassConstructor.kt");
}
@TestMetadata("enumClassConstructor_ir.kt")
public void testEnumClassConstructor_ir() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/enumClassConstructor_ir.kt");
}
@Test
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/extension.kt");
}
@Test
@TestMetadata("functionTypeParameter.kt")
public void testFunctionTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/functionTypeParameter.kt");
}
@Test
@TestMetadata("implicit.kt")
public void testImplicit() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/implicit.kt");
}
@TestMetadata("implicit_ir.kt")
public void testImplicit_ir() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/implicit_ir.kt");
}
@Test
@TestMetadata("innerClassConstructor.kt")
public void testInnerClassConstructor() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/innerClassConstructor.kt");
}
@Test
@TestMetadata("jvmOverload.kt")
public void testJvmOverload() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/jvmOverload.kt");
}
@Test
@TestMetadata("jvmStatic.kt")
public void testJvmStatic() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/jvmStatic.kt");
}
@Test
@TestMetadata("notYetSupported.kt")
public void testNotYetSupported() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/notYetSupported.kt");
}
@Test
@TestMetadata("property.kt")
public void testProperty() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/property.kt");
}
@Test
@TestMetadata("propertyTypeParameter.kt")
public void testPropertyTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/propertyTypeParameter.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/simple.kt");
}
@Test
@TestMetadata("simple2Params.kt")
public void testSimple2Params() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/simple2Params.kt");
}
@Test
@TestMetadata("staticNested.kt")
public void testStaticNested() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/staticNested.kt");
}
@Test
@TestMetadata("syntheticAccessors.kt")
public void testSyntheticAccessors() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/syntheticAccessors.kt");
}
@Test
@TestMetadata("typeParameter.kt")
public void testTypeParameter() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/typeParameter.kt");
}
@Test
@TestMetadata("typeParameter16.kt")
public void testTypeParameter16() throws Exception {
runTest("compiler/testData/codegen/asmLike/typeAnnotations/typeParameter16.kt");
@@ -0,0 +1,391 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.backend.handlers
import org.jetbrains.kotlin.codegen.DefaultParameterValueSubstitutor
import org.jetbrains.kotlin.codegen.getClassFiles
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.CHECK_ASM_LIKE_INSTRUCTIONS
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.CURIOUS_ABOUT
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.IR_DIFFERENCE
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.LOCAL_VARIABLE_TABLE
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.RENDER_ANNOTATIONS
import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
import org.jetbrains.kotlin.test.model.BinaryArtifacts
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.moduleStructure
import org.jetbrains.kotlin.test.utils.MultiModuleInfoDumper
import org.jetbrains.kotlin.test.utils.withExtension
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.*
import org.jetbrains.org.objectweb.asm.util.Printer
import org.jetbrains.org.objectweb.asm.util.Textifier
import org.jetbrains.org.objectweb.asm.util.TraceFieldVisitor
import org.jetbrains.org.objectweb.asm.util.TraceMethodVisitor
class AsmLikeInstructionListingHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) {
companion object {
const val DUMP_EXTENSION = "asm.txt"
const val IR_DUMP_EXTENSION = "asm.ir.txt"
const val LINE_SEPARATOR = "\n"
val IGNORED_CLASS_VISIBLE_ANNOTATIONS = setOf(
"Lkotlin/Metadata;",
"Lkotlin/annotation/Target;",
"Lkotlin/annotation/Retention;",
"Ljava/lang/annotation/Retention;",
"Ljava/lang/annotation/Target;"
)
}
override val directiveContainers: List<DirectivesContainer>
get() = listOf(AsmLikeInstructionListingDirectives)
private val baseDumper = MultiModuleInfoDumper()
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
if (CHECK_ASM_LIKE_INSTRUCTIONS !in module.directives) return
val builder = baseDumper.builderForModule(module)
val classes = info.classFileFactory
.getClassFiles()
.sortedBy { it.relativePath }
.map { file -> ClassNode().also { ClassReader(file.asByteArray()).accept(it, ClassReader.EXPAND_FRAMES) } }
val printBytecodeForTheseMethods = module.directives[CURIOUS_ABOUT]
val showLocalVariables = LOCAL_VARIABLE_TABLE in module.directives
val renderAnnotations = RENDER_ANNOTATIONS in module.directives
classes.forEachIndexed { index, classNode ->
builder.renderClassNode(classNode, printBytecodeForTheseMethods, showLocalVariables, renderAnnotations)
builder.appendLine()
if (index != classes.indices.last) {
builder.appendLine()
}
}
}
private fun StringBuilder.renderClassNode(
clazz: ClassNode,
showBytecodeForTheseMethods: List<String>,
showLocalVariables: Boolean,
renderAnnotations: Boolean
) {
val fields = (clazz.fields ?: emptyList()).sortedBy { it.name }
val methods = (clazz.methods ?: emptyList()).sortedBy { it.name }
val superTypes = (listOf(clazz.superName) + clazz.interfaces).filterNotNull()
if (renderAnnotations) {
clazz.signature?.let {
appendLine(it)
}
}
renderVisibilityModifiers(clazz.access)
renderModalityModifiers(clazz.access)
append(if ((clazz.access and Opcodes.ACC_INTERFACE) != 0) "interface " else "class ")
append(clazz.name)
if (superTypes.isNotEmpty()) {
append(" : " + superTypes.joinToString())
}
appendLine(" {")
if (renderAnnotations) {
val textifier = Textifier()
val visitor = TraceMethodVisitor(textifier)
clazz.visibleAnnotations?.forEach {
if (it.desc !in IGNORED_CLASS_VISIBLE_ANNOTATIONS) {
it.accept(visitor.visitAnnotation(it.desc, true))
}
}
clazz.invisibleAnnotations?.forEach {
it.accept(visitor.visitAnnotation(it.desc, false))
}
clazz.visibleTypeAnnotations?.forEach {
it.accept(visitor.visitTypeAnnotation(it.typeRef, it.typePath, it.desc, true))
}
clazz.invisibleTypeAnnotations?.forEach {
it.accept(visitor.visitTypeAnnotation(it.typeRef, it.typePath, it.desc, false))
}
textifier.getText().takeIf { it.isNotEmpty() }?.let {
appendLine(textifier.getText().joinToString("").trimEnd())
appendLine("")
}
}
fields.joinTo(this, LINE_SEPARATOR.repeat(2)) { renderField(it, renderAnnotations).withMargin() }
if (fields.isNotEmpty()) {
appendLine().appendLine()
}
methods.joinTo(this, LINE_SEPARATOR.repeat(2)) {
val showBytecode = showBytecodeForTheseMethods.contains(it.name)
renderMethod(it, showBytecode, showLocalVariables, renderAnnotations).withMargin()
}
appendLine().append("}")
}
private fun renderField(field: FieldNode, renderAnnotations: Boolean): String = buildString {
if (renderAnnotations) {
field.signature?.let {
append(it).append("\n")
}
}
renderVisibilityModifiers(field.access)
renderModalityModifiers(field.access)
append(Type.getType(field.desc).className).append(' ')
append(field.name)
if (renderAnnotations) {
val textifier = Textifier()
val visitor = TraceFieldVisitor(textifier)
field.visibleAnnotations?.forEach {
it.accept(visitor.visitAnnotation(it.desc, true))
}
field.invisibleAnnotations?.forEach {
it.accept(visitor.visitAnnotation(it.desc, false))
}
field.visibleTypeAnnotations?.forEach {
it.accept(visitor.visitTypeAnnotation(it.typeRef, it.typePath, it.desc, true))
}
field.invisibleTypeAnnotations?.forEach {
it.accept(visitor.visitTypeAnnotation(it.typeRef, it.typePath, it.desc, false))
}
textifier.getText().takeIf { it.isNotEmpty() }?.let {
append("\n${textifier.getText().joinToString("").trimEnd()}")
}
}
}
private fun renderMethod(
method: MethodNode,
showBytecode: Boolean,
showLocalVariables: Boolean,
renderAnnotations: Boolean
): String = buildString {
if (renderAnnotations) {
method.signature?.let {
append(it).append("\n")
}
}
renderVisibilityModifiers(method.access)
renderModalityModifiers(method.access)
val (returnType, parameterTypes) = with(Type.getMethodType(method.desc)) { returnType to argumentTypes }
append(returnType.className).append(' ')
append(method.name)
parameterTypes.mapIndexed { index, type ->
val name = getParameterName(index, method)
"${type.className} $name"
}.joinTo(this, prefix = "(", postfix = ")")
if (renderAnnotations) {
val textifier = Textifier()
val visitor = TraceMethodVisitor(textifier)
method.visibleAnnotations?.forEach {
it.accept(visitor.visitAnnotation(it.desc, true))
}
method.invisibleAnnotations?.forEach {
it.accept(visitor.visitAnnotation(it.desc, false))
}
method.visibleTypeAnnotations?.forEach {
it.accept(visitor.visitTypeAnnotation(it.typeRef, it.typePath, it.desc, true))
}
method.invisibleTypeAnnotations?.forEach {
it.accept(visitor.visitTypeAnnotation(it.typeRef, it.typePath, it.desc, false))
}
method.visibleParameterAnnotations?.forEachIndexed { index, parameterAnnotations: MutableList<AnnotationNode>? ->
parameterAnnotations?.forEach {
it.accept(
visitor.visitParameterAnnotation(
index,
it.desc,
true
)
)
}
}
method.invisibleParameterAnnotations?.forEachIndexed { index, parameterAnnotations: MutableList<AnnotationNode>? ->
parameterAnnotations?.forEach {
it.accept(
visitor.visitParameterAnnotation(
index,
it.desc,
false
)
)
}
}
textifier.getText().takeIf { it.isNotEmpty() }?.let {
append("\n${textifier.getText().joinToString("").trimEnd()}")
}
}
val actualShowBytecode = showBytecode && (method.access and Opcodes.ACC_ABSTRACT) == 0
val actualShowLocalVariables = showLocalVariables && method.localVariables?.takeIf { it.isNotEmpty() } != null
if (actualShowBytecode || actualShowLocalVariables) {
appendLine(" {")
if (actualShowLocalVariables) {
val localVariableTable = buildLocalVariableTable(method)
if (localVariableTable.isNotEmpty()) {
append(localVariableTable.withMargin())
}
}
if (actualShowBytecode) {
if (actualShowLocalVariables) {
appendLine().appendLine()
}
append(renderBytecodeInstructions(method.instructions).trimEnd().withMargin())
}
appendLine().append("}")
method.visibleTypeAnnotations
}
}
private fun getParameterName(index: Int, method: MethodNode): String {
val localVariableIndexOffset = when {
(method.access and Opcodes.ACC_STATIC) != 0 -> 0
method.isJvmOverloadsGenerated() -> 0
else -> 1
}
val actualIndex = index + localVariableIndexOffset
val localVariables = method.localVariables
return localVariables?.firstOrNull {
it.index == actualIndex
}?.name ?: "p$index"
}
private fun buildLocalVariableTable(method: MethodNode): String {
val localVariables = method.localVariables?.takeIf { it.isNotEmpty() } ?: return ""
return buildString {
append("Local variables:")
for (variable in localVariables) {
appendLine().append((variable.index.toString() + " " + variable.name + ": " + variable.desc).withMargin())
}
}
}
private fun renderBytecodeInstructions(instructions: InsnList) = buildString {
val labelMappings = LabelMappings()
var currentInsn = instructions.first
while (currentInsn != null) {
renderInstruction(currentInsn, labelMappings)
currentInsn = currentInsn.next
}
}
private fun StringBuilder.renderInstruction(node: AbstractInsnNode, labelMappings: LabelMappings) {
if (node is LabelNode) {
appendLine("LABEL (L" + labelMappings[node.label] + ")")
return
}
if (node is LineNumberNode) {
appendLine("LINENUMBER (" + node.line + ")")
return
}
if (node is FrameNode) return
append(" ").append(Printer.OPCODES[node.opcode] ?: error("Invalid opcode ${node.opcode}"))
when (node) {
is FieldInsnNode -> append(" (" + node.owner + ", " + node.name + ", " + node.desc + ")")
is JumpInsnNode -> append(" (L" + labelMappings[node.label.label] + ")")
is IntInsnNode -> append(" (" + node.operand + ")")
is MethodInsnNode -> append(" (" + node.owner + ", "+ node.name + ", " + node.desc + ")")
is VarInsnNode -> append(" (" + node.`var` + ")")
is LdcInsnNode -> append(" (" + node.cst + ")")
}
appendLine()
}
private fun String.withMargin(margin: String = " "): String {
return lineSequence().map { margin + it }.joinToString(LINE_SEPARATOR)
}
private fun StringBuilder.renderVisibilityModifiers(access: Int) {
if ((access and Opcodes.ACC_PUBLIC) != 0) append("public ")
if ((access and Opcodes.ACC_PRIVATE) != 0) append("private ")
if ((access and Opcodes.ACC_PROTECTED) != 0) append("protected ")
}
private fun StringBuilder.renderModalityModifiers(access: Int) {
if ((access and Opcodes.ACC_FINAL) != 0) append("final ")
if ((access and Opcodes.ACC_ABSTRACT) != 0) append("abstract ")
if ((access and Opcodes.ACC_STATIC) != 0) append("static ")
}
private class LabelMappings {
private var mappings = hashMapOf<Int, Int>()
private var currentIndex = 0
operator fun get(label: Label): Int {
val hashCode = System.identityHashCode(label)
return mappings.getOrPut(hashCode) { currentIndex++ }
}
}
private fun MethodNode.isJvmOverloadsGenerated(): Boolean {
fun AnnotationNode.isJvmOverloadsGenerated() =
this.desc == DefaultParameterValueSubstitutor.ANNOTATION_TYPE_DESCRIPTOR_FOR_JVM_OVERLOADS_GENERATED_METHODS
return (visibleAnnotations?.any { it.isJvmOverloadsGenerated() } ?: false)
|| (invisibleAnnotations?.any { it.isJvmOverloadsGenerated() } ?: false)
}
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
if (baseDumper.isEmpty()) return
val irDifference = IR_DIFFERENCE in testServices.moduleStructure.allDirectives
val extension = when (irDifference) {
false -> DUMP_EXTENSION
true -> when (testServices.moduleStructure.modules.first().targetBackend?.isIR) {
true -> IR_DUMP_EXTENSION
else -> DUMP_EXTENSION
}
}
val testDataFile = testServices.moduleStructure.originalTestDataFiles.first()
val file = testDataFile.withExtension(extension)
assertions.assertEqualsToFile(file, baseDumper.generateResultingDump())
if (irDifference) {
val noIrDump = testDataFile.withExtension(DUMP_EXTENSION)
val irDump = testDataFile.withExtension(IR_DUMP_EXTENSION)
if (noIrDump.exists() && irDump.exists()) {
assertions.assertFalse(noIrDump.readText().trim() == irDump.readText().trim()) {
"Dumps for IR backend and classic backend are identical. Please remove IR_DIFFERENCE directive and ${irDump.name} file"
}
}
}
}
}
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.directives
import org.jetbrains.kotlin.test.backend.handlers.AsmLikeInstructionListingHandler
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
object AsmLikeInstructionListingDirectives : SimpleDirectivesContainer() {
val CHECK_ASM_LIKE_INSTRUCTIONS by directive(
"Enables ${AsmLikeInstructionListingHandler::class}"
)
val IR_DIFFERENCE by directive(
"If present then saves dump for IR backend in asm.ir.txt file"
)
val CURIOUS_ABOUT by stringDirective(
"Specifies list of methods for which asm instructions should be printed"
)
val LOCAL_VARIABLE_TABLE by directive(
"Enables printing of local variable table"
)
val RENDER_ANNOTATIONS by directive(
"Enables rendering of annotations"
)
}
@@ -0,0 +1,98 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.runners.codegen
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor
import org.jetbrains.kotlin.test.backend.classic.ClassicBackendInput
import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade
import org.jetbrains.kotlin.test.backend.handlers.AsmLikeInstructionListingHandler
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.builders.configureClassicFrontendHandlersStep
import org.jetbrains.kotlin.test.builders.configureFirHandlersStep
import org.jetbrains.kotlin.test.builders.configureJvmArtifactsHandlersStep
import org.jetbrains.kotlin.test.directives.AsmLikeInstructionListingDirectives.CHECK_ASM_LIKE_INSTRUCTIONS
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler
import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDiagnosticsHandler
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest
abstract class AbstractAsmLikeInstructionListingTestBase<R : ResultingArtifact.FrontendOutput<R>, I : ResultingArtifact.BackendInput<I>>(
val targetFrontend: FrontendKind<R>,
targetBackend: TargetBackend
) : AbstractKotlinCompilerWithTargetBackendTest(targetBackend) {
abstract val frontendFacade: Constructor<FrontendFacade<R>>
abstract val frontendToBackendConverter: Constructor<Frontend2BackendConverter<R, I>>
abstract val backendFacade: Constructor<BackendFacade<I, BinaryArtifacts.Jvm>>
override fun TestConfigurationBuilder.configuration() {
defaultDirectives {
+CHECK_ASM_LIKE_INSTRUCTIONS
}
commonConfigurationForCodegenTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
configureClassicFrontendHandlersStep {
useHandlers(
::ClassicDiagnosticsHandler
)
}
configureFirHandlersStep {
useHandlers(
::FirDiagnosticsHandler
)
}
configureJvmArtifactsHandlersStep {
useHandlers(
::AsmLikeInstructionListingHandler
)
}
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor)
}
}
open class AbstractAsmLikeInstructionListingTest :
AbstractAsmLikeInstructionListingTestBase<ClassicFrontendOutputArtifact, ClassicBackendInput>(
FrontendKinds.ClassicFrontend,
TargetBackend.JVM
) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, ClassicBackendInput>>
get() = ::ClassicFrontend2ClassicBackendConverter
override val backendFacade: Constructor<BackendFacade<ClassicBackendInput, BinaryArtifacts.Jvm>>
get() = ::ClassicJvmBackendFacade
}
open class AbstractIrAsmLikeInstructionListingTest :
AbstractAsmLikeInstructionListingTestBase<ClassicFrontendOutputArtifact, IrBackendInput>(
FrontendKinds.ClassicFrontend,
TargetBackend.JVM_IR
) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, IrBackendInput>>
get() = ::ClassicFrontend2IrConverter
override val backendFacade: Constructor<BackendFacade<IrBackendInput, BinaryArtifacts.Jvm>>
get() = ::JvmIrBackendFacade
}
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.Label
@@ -20,6 +21,7 @@ import java.io.File
private val LINE_SEPARATOR = System.getProperty("line.separator")
@ObsoleteTestInfrastructure
abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
private companion object {
const val CURIOUS_ABOUT_DIRECTIVE = "// CURIOUS_ABOUT "
@@ -352,4 +354,4 @@ private fun MethodNode.isJvmOverloadsGenerated(): Boolean {
return (visibleAnnotations?.any { it.isJvmOverloadsGenerated() } ?: false)
|| (invisibleAnnotations?.any { it.isJvmOverloadsGenerated() } ?: false)
}
}
@@ -1,13 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.ir
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
import org.jetbrains.kotlin.test.TargetBackend
abstract class AbstractIrAsmLikeInstructionListingTest : AbstractAsmLikeInstructionListingTest() {
override val backend = TargetBackend.JVM_IR
}
@@ -106,10 +106,6 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
model("codegen/kapt", targetBackend = TargetBackend.JVM)
}
testClass<AbstractAsmLikeInstructionListingTest> {
model("codegen/asmLike", targetBackend = TargetBackend.JVM)
}
testClass<AbstractScriptCodegenTest> {
model("codegen/script", extension = "kts")
}
@@ -407,10 +403,6 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
model("debug/localVariables", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrAsmLikeInstructionListingTest> {
model("codegen/asmLike", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrScriptCodegenTest> {
model("codegen/script", extension = "kts", targetBackend = TargetBackend.JVM_IR)
}
@@ -138,6 +138,14 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
testClass<AbstractIrBytecodeListingTest> {
model("codegen/bytecodeListing")
}
testClass<AbstractAsmLikeInstructionListingTest> {
model("codegen/asmLike")
}
testClass<AbstractIrAsmLikeInstructionListingTest> {
model("codegen/asmLike")
}
}
// ---------------------------------------------- FIR tests ----------------------------------------------
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.android.parcel
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.android.synthetic.AndroidComponentRegistrar
import org.jetbrains.kotlin.android.synthetic.test.addAndroidExtensionsRuntimeLibrary
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
@@ -12,6 +13,7 @@ import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
import java.io.File
@OptIn(ObsoleteTestInfrastructure::class)
abstract class AbstractParcelBytecodeListingTest : AbstractAsmLikeInstructionListingTest() {
override fun setupEnvironment(environment: KotlinCoreEnvironment) {
AndroidComponentRegistrar.registerParcelExtensions(environment.project)
@@ -5,6 +5,7 @@
package org.jetbrains.kotlinx.serialization
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
@@ -12,6 +13,7 @@ import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
import java.io.File
@OptIn(ObsoleteTestInfrastructure::class)
abstract class AbstractSerializationIrBytecodeListingTest : AbstractAsmLikeInstructionListingTest() {
private val coreLibraryPath = getSerializationCoreLibraryJar()
@@ -5,11 +5,13 @@
package org.jetbrains.kotlinx.serialization
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
import org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
@OptIn(ObsoleteTestInfrastructure::class)
abstract class AbstractSerializationPluginBytecodeListingTest : AbstractAsmLikeInstructionListingTest() {
private val coreLibraryPath = getSerializationCoreLibraryJar()
@@ -5,12 +5,14 @@
package org.jetbrains.kotlin.parcelize.test
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
import org.jetbrains.kotlin.parcelize.ParcelizeComponentRegistrar
import org.jetbrains.kotlin.test.TargetBackend
import java.io.File
@OptIn(ObsoleteTestInfrastructure::class)
abstract class AbstractParcelizeBytecodeListingTest : AbstractAsmLikeInstructionListingTest() {
override fun setupEnvironment(environment: KotlinCoreEnvironment) {
ParcelizeComponentRegistrar.registerParcelizeComponents(environment.project)
@@ -25,4 +27,4 @@ abstract class AbstractParcelizeIrBytecodeListingTest : AbstractParcelizeBytecod
override fun getExpectedTextFileName(wholeFile: File): String {
return wholeFile.nameWithoutExtension + ".ir.txt"
}
}
}