Migrate bytecode text tests to multi-file framework

Get rid of BytecodeTextMultifileTestGenerated
This commit is contained in:
Alexander Udalov
2016-02-25 14:34:18 +03:00
parent fbc2fe74ad
commit 647e188a08
20 changed files with 214 additions and 208 deletions
@@ -0,0 +1,82 @@
// FILE: JClass.java
import org.jetbrains.annotations.NotNull;
public class JClass {
public final static int PrimitiveInt = 9000;
public final static int BigPrimitiveInt = 59000;
public final static long PrimitiveLong = 100000;
public final static short PrimitiveShort = 901;
public final static boolean PrimitiveBool = false;
public final static float PrimitiveFloat = 36.6;
public final static double PrimitiveDouble = 42.4242;
public final static byte PrimitiveByte = -8;
public final static char PrimitiveChar = 'K';
public final static String Str = ":J";
@Nullable
public final static String StrNullable = "nullable";
@NotNull
public final static Integer BoxedInt = 9500;
public static int NonFinal = 9700;
public final int NonStatic = 9800;
}
// FILE: test.kt
object KoKobject {
@JvmField
val JvmStatic: Int = 1
@JvmField
val JvmStaticString: String? = "123"
}
fun test() {
Integer.MIN_VALUE
java.lang.Long.MAX_VALUE
JClass.PrimitiveInt
JClass.BigPrimitiveInt
JClass.PrimitiveByte
JClass.PrimitiveChar
JClass.PrimitiveLong
JClass.PrimitiveShort
JClass.PrimitiveBool
JClass.PrimitiveFloat
JClass.PrimitiveDouble
JClass.Str
JClass.StrNullable
JClass.BoxedInt
JClass.NonFinal
JClass().NonStatic
KoKobject.JvmStatic
KoKobject.JvmStaticString
}
// 1 LDC -2147483648
// 1 LDC 9223372036854775807
// 1 SIPUSH 9000
// 1 LDC 59000
// 1 BIPUSH -8
// 1 LDC K
// 1 LDC 100000
// 1 SIPUSH 901
// 1 LDC false
// 1 LDC 36.6
// 1 LDC 42.4242
// 1 LDC ":J"
// 1 LDC "nullable"
// 1 GETSTATIC JClass.BoxedInt : Ljava/lang/Integer;
// 1 GETSTATIC JClass.NonFinal : I
// 1 GETFIELD JClass.NonStatic : I
// 1 GETSTATIC KoKobject.JvmStatic : I
// 1 GETSTATIC KoKobject.JvmStaticString : Ljava/lang/String
// 3 POP2
// 18 POP
+44
View File
@@ -0,0 +1,44 @@
// FILE: Child.java
class Child extends Parent {
public static int b = 3;
public static int c = 4;
public static void bar() {}
public static void baz() {}
}
// FILE: Parent.java
class Parent {
public static int a = 1;
public static int b = 2;
public static void foo() {}
public static void baz() {}
}
// FILE: test.kt
fun test() {
Parent.a
Parent.b
Parent.foo()
Parent.baz()
Child.a
Child.b
Child.c
Child.foo()
Child.bar()
Child.baz()
}
// 1 GETSTATIC Parent.a : I
// 1 GETSTATIC Parent.b : I
// 1 INVOKESTATIC Parent.foo()
// 1 INVOKESTATIC Parent.baz()
// 1 GETSTATIC Child.a : I
// 1 GETSTATIC Child.b : I
// 1 GETSTATIC Child.c : I
// 1 INVOKESTATIC Child.foo()
// 1 INVOKESTATIC Child.bar()
// 1 INVOKESTATIC Child.baz()
@@ -0,0 +1,33 @@
// FILE: otherFile.kt
@file:[JvmName("Util") JvmMultifileClass]
package test
internal fun internalInOtherFile() {}
public fun publicInOtherFile() {}
// FILE: thisFile.kt
@file:[JvmName("Util") JvmMultifileClass]
package test
fun foo() {
privateInThisFile()
internalInThisFile()
publicInThisFile()
internalInOtherFile()
publicInOtherFile()
}
private fun privateInThisFile() {}
internal fun internalInThisFile() {}
public fun publicInThisFile() {}
// @test/Util__ThisFileKt.class:
// 1 INVOKESTATIC test/Util__ThisFileKt.privateInThisFile
// 1 INVOKESTATIC test/Util.internalInThisFile
// 1 INVOKESTATIC test/Util.publicInThisFile
// 1 INVOKESTATIC test/Util.internalInOtherFile
// 1 INVOKESTATIC test/Util.publicInOtherFile
@@ -0,0 +1,27 @@
// FILE: otherFile.kt
@file:[JvmName("Util") JvmMultifileClass]
package test
public fun publicInOtherFile() {}
// FILE: thisFile.kt
@file:[JvmName("Util") JvmMultifileClass]
package test
inline fun foo(body: () -> Unit) {
publicInThisFile()
publicInOtherFile()
body()
}
public fun publicInThisFile() {}
fun bar() {
foo {}
}
// @test/Util__ThisFileKt.class:
// 2 INVOKESTATIC test/Util.publicInThisFile
// 2 INVOKESTATIC test/Util.publicInOtherFile
@@ -0,0 +1,73 @@
// FILE: JClass.java
import org.jetbrains.annotations.NotNull;
public class JClass {
public final static int PrimitiveInt = 9000;
public final static int BigPrimitiveInt = 59000;
public final static long PrimitiveLong = 100000;
public final static short PrimitiveShort = 901;
public final static boolean PrimitiveBool = false;
public final static float PrimitiveFloat = 36.6;
public final static double PrimitiveDouble = 42.4242;
public final static byte PrimitiveByte = -8;
public final static char PrimitiveChar = 'K';
public final static String Str = ":J";
@Nullable
public final static String StrNullable = "nullable";
@NotNull
public final static Integer BoxedInt = 9500;
public static int NonFinal = 9700;
public final int NonStatic = 9800;
}
// FILE: test.kt
enum class EClass {
VALUE
}
object KoKobject {
@JvmField
val JvmStatic: Int = 1
@JvmField
val JvmStaticString: String? = "123"
}
fun test() {
"res1: " +
Integer.MIN_VALUE + " " +
java.lang.Long.MAX_VALUE + " " +
JClass.PrimitiveInt + " " +
JClass.BigPrimitiveInt + " " +
JClass.PrimitiveByte + " " +
JClass.PrimitiveChar + " " +
JClass.PrimitiveLong + " " +
JClass.PrimitiveShort + " " +
JClass.PrimitiveBool + " " +
JClass.PrimitiveFloat + " " +
JClass.PrimitiveDouble + " " +
JClass.Str + " " +
JClass.StrNullable
"res2: " + JClass.BoxedInt
"res3: " + JClass.NonFinal
"res4: " + JClass().NonStatic
"res5: " + KoKobject.JvmStatic
"res6: " + KoKobject.JvmStaticString
"res7: " + EClass.VALUE
"res8: " + EClass::class
}
// 1 LDC "res1: -2147483648 9223372036854775807 9000 59000 -8 K 100000 901 false 36.6 42.4242 :J nullable"
// 1 LDC "res2: "
// 1 LDC "res3: "
// 1 LDC "res4: "
// 1 LDC "res5: "
// 1 LDC "res6: "
// 1 LDC "res7: "
// 1 LDC "res8: "