IR text tests: New tests specifically for main functions mangling
^KT-57755
This commit is contained in:
committed by
Space Team
parent
af247c3344
commit
61282fcaeb
+12
@@ -540,6 +540,18 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionManglingInJvm.kt")
|
||||
public void testMainFunctionManglingInJvm() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionManglingInJvm.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+12
@@ -540,6 +540,18 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionManglingInJvm.kt")
|
||||
public void testMainFunctionManglingInJvm() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionManglingInJvm.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
FILE fqName:<root> fileName:/a.kt
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="main()"
|
||||
FUN name:main visibility:public modality:FINAL <T> (t:T of <root>.main) returnType:T of <root>.main
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.main
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="main(T): T"
|
||||
RETURN type=kotlin.Nothing from='public final fun main <T> (t: T of <root>.main): T of <root>.main declared in <root>'
|
||||
GET_VAR 't: T of <root>.main declared in <root>.main' type=T of <root>.main origin=null
|
||||
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:main visibility:public modality:FINAL <> ($this:<root>.C) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="C.main()"
|
||||
FUN name:main visibility:public modality:FINAL <T> ($this:<root>.C, t:T of <root>.C.main) returnType:T of <root>.C.main
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.C.main
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="C.main(T): T"
|
||||
RETURN type=kotlin.Nothing from='public final fun main <T> (t: T of <root>.C.main): T of <root>.C.main declared in <root>.C'
|
||||
GET_VAR 't: T of <root>.C.main declared in <root>.C.main' type=T of <root>.C.main origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS OBJECT name:O modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.O
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.O [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:O modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:main visibility:public modality:FINAL <> ($this:<root>.O) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.O
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="O.main()"
|
||||
FUN name:main visibility:public modality:FINAL <T> ($this:<root>.O, t:T of <root>.O.main) returnType:T of <root>.O.main
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.O
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.O.main
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="O.main(T): T"
|
||||
RETURN type=kotlin.Nothing from='public final fun main <T> (t: T of <root>.O.main): T of <root>.O.main declared in <root>.O'
|
||||
GET_VAR 't: T of <root>.O.main declared in <root>.O.main' type=T of <root>.O.main origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FILE fqName:foo fileName:/b.kt
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.main()"
|
||||
FUN name:main visibility:public modality:FINAL <T> (t:T of foo.main) returnType:T of foo.main
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:t index:0 type:T of foo.main
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.main(T): T"
|
||||
RETURN type=kotlin.Nothing from='public final fun main <T> (t: T of foo.main): T of foo.main declared in foo'
|
||||
GET_VAR 't: T of foo.main declared in foo.main' type=T of foo.main origin=null
|
||||
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.C
|
||||
CONSTRUCTOR visibility:public <> () returnType:foo.C [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:main visibility:public modality:FINAL <> ($this:foo.C) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.C
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.C.main()"
|
||||
FUN name:main visibility:public modality:FINAL <T> ($this:foo.C, t:T of foo.C.main) returnType:T of foo.C.main
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.C
|
||||
VALUE_PARAMETER name:t index:0 type:T of foo.C.main
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.C.main(T): T"
|
||||
RETURN type=kotlin.Nothing from='public final fun main <T> (t: T of foo.C.main): T of foo.C.main declared in foo.C'
|
||||
GET_VAR 't: T of foo.C.main declared in foo.C.main' type=T of foo.C.main origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS OBJECT name:O modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.O
|
||||
CONSTRUCTOR visibility:private <> () returnType:foo.O [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:O modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:main visibility:public modality:FINAL <> ($this:foo.O) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.O
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.O.main()"
|
||||
FUN name:main visibility:public modality:FINAL <T> ($this:foo.O, t:T of foo.O.main) returnType:T of foo.O.main
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:foo.O
|
||||
VALUE_PARAMETER name:t index:0 type:T of foo.O.main
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.O.main(T): T"
|
||||
RETURN type=kotlin.Nothing from='public final fun main <T> (t: T of foo.O.main): T of foo.O.main declared in foo.O'
|
||||
GET_VAR 't: T of foo.O.main declared in foo.O.main' type=T of foo.O.main origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,78 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
// MUTE_SIGNATURE_COMPARISON_K2: JVM_IR
|
||||
// ^^^ JVM K2 eagerly mangles all the functions with `main` name, which is not so in JVM K1. That's the difference that, however,
|
||||
// does not cause problems when switching between K1 and K2 compilers, since signatures are not serialized in JARs.
|
||||
|
||||
// FILE: a.kt
|
||||
fun main() {
|
||||
println("main()")
|
||||
}
|
||||
|
||||
// Looks like `main` but is not a main function.
|
||||
fun <T> main(t: T): T {
|
||||
println("main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
class C {
|
||||
fun main() {
|
||||
println("C.main()")
|
||||
}
|
||||
|
||||
// Looks like `main` but is not a main function.
|
||||
fun <T> main(t: T): T {
|
||||
println("C.main(T): T")
|
||||
return t
|
||||
}
|
||||
}
|
||||
|
||||
object O {
|
||||
fun main() {
|
||||
println("O.main()")
|
||||
}
|
||||
|
||||
// Looks like `main` but is not a main function.
|
||||
fun <T> main(t: T): T {
|
||||
println("O.main(T): T")
|
||||
return t
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
package foo
|
||||
|
||||
fun main() {
|
||||
println("foo.main()")
|
||||
}
|
||||
|
||||
// Looks like `main` but is not a main function.
|
||||
fun <T> main(t: T): T {
|
||||
println("foo.main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
class C {
|
||||
fun main() {
|
||||
println("foo.C.main()")
|
||||
}
|
||||
|
||||
// Looks like `main` but is not a main function.
|
||||
fun <T> main(t: T): T {
|
||||
println("foo.C.main(T): T")
|
||||
return t
|
||||
}
|
||||
}
|
||||
|
||||
object O {
|
||||
fun main() {
|
||||
println("foo.O.main()")
|
||||
}
|
||||
|
||||
// Looks like `main` but is not a main function.
|
||||
fun <T> main(t: T): T {
|
||||
println("foo.O.main(T): T")
|
||||
return t
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// FILE: a.kt
|
||||
|
||||
fun main() {
|
||||
println(message = "main()")
|
||||
}
|
||||
|
||||
fun <T : Any?> main(t: T): T {
|
||||
println(message = "main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
class C {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun main() {
|
||||
println(message = "C.main()")
|
||||
}
|
||||
|
||||
fun <T : Any?> main(t: T): T {
|
||||
println(message = "C.main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object O {
|
||||
private constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun main() {
|
||||
println(message = "O.main()")
|
||||
}
|
||||
|
||||
fun <T : Any?> main(t: T): T {
|
||||
println(message = "O.main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
package foo
|
||||
|
||||
fun main() {
|
||||
println(message = "foo.main()")
|
||||
}
|
||||
|
||||
fun <T : Any?> main(t: T): T {
|
||||
println(message = "foo.main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
class C {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun main() {
|
||||
println(message = "foo.C.main()")
|
||||
}
|
||||
|
||||
fun <T : Any?> main(t: T): T {
|
||||
println(message = "foo.C.main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object O {
|
||||
private constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun main() {
|
||||
println(message = "foo.O.main()")
|
||||
}
|
||||
|
||||
fun <T : Any?> main(t: T): T {
|
||||
println(message = "foo.O.main(T): T")
|
||||
return t
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
// FILE: a.kt
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: C
|
||||
// Public signature: /C|null[0]
|
||||
class C {
|
||||
// CHECK:
|
||||
// Mangled name: C#<init>(){}
|
||||
// Public signature: /C.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: C#main(){}
|
||||
// Public signature: /C.main|-4284757841571462650[0]
|
||||
// Public signature debug description: main(){}
|
||||
fun main(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: C#main(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: /C.main|2157137022584307775[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}0:0
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: C#main(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: /C.main|-6008025846492417520[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}
|
||||
fun <T : Any?> main(t: T): T
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: O
|
||||
// Public signature: /O|null[0]
|
||||
object O {
|
||||
// CHECK:
|
||||
// Mangled name: O#<init>(){}
|
||||
// Public signature: /O.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
private constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: O#main(){}
|
||||
// Public signature: /O.main|-4284757841571462650[0]
|
||||
// Public signature debug description: main(){}
|
||||
fun main(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: O#main(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: /O.main|2157137022584307775[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}0:0
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: O#main(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: /O.main|-6008025846492417520[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}
|
||||
fun <T : Any?> main(t: T): T
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #main(){}
|
||||
// Mangled name for the signature by IR: main(){}
|
||||
// Mangled name for the signature by Frontend: main(){}%a.kt
|
||||
// Public signature by IR: /main|-4284757841571462650[0]
|
||||
// Public signature by IR debug description: main(){}
|
||||
// Public signature by Frontend: /main|2314384220441172254[0]
|
||||
// Public signature by Frontend debug description: main(){}%a.kt
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #main(){}
|
||||
// Public signature: /main|-4284757841571462650[0]
|
||||
// Public signature debug description: main(){}
|
||||
fun main(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #main(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: /main|2157137022584307775[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}0:0
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: #main(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: /main|-6008025846492417520[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}
|
||||
fun <T : Any?> main(t: T): T
|
||||
|
||||
// FILE: b.kt
|
||||
package foo
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: foo.C
|
||||
// Public signature: foo/C|null[0]
|
||||
class C {
|
||||
// CHECK:
|
||||
// Mangled name: foo.C#<init>(){}
|
||||
// Public signature: foo/C.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: foo.C#main(){}
|
||||
// Public signature: foo/C.main|-4284757841571462650[0]
|
||||
// Public signature debug description: main(){}
|
||||
fun main(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: foo.C#main(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: foo/C.main|2157137022584307775[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}0:0
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: foo.C#main(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: foo/C.main|-6008025846492417520[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}
|
||||
fun <T : Any?> main(t: T): T
|
||||
|
||||
}
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: foo.O
|
||||
// Public signature: foo/O|null[0]
|
||||
object O {
|
||||
// CHECK:
|
||||
// Mangled name: foo.O#<init>(){}
|
||||
// Public signature: foo/O.<init>|-5645683436151566731[0]
|
||||
// Public signature debug description: <init>(){}
|
||||
private constructor() /* primary */
|
||||
|
||||
// CHECK:
|
||||
// Mangled name: foo.O#main(){}
|
||||
// Public signature: foo/O.main|-4284757841571462650[0]
|
||||
// Public signature debug description: main(){}
|
||||
fun main(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: foo.O#main(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: foo/O.main|2157137022584307775[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}0:0
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: foo.O#main(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: foo/O.main|-6008025846492417520[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}
|
||||
fun <T : Any?> main(t: T): T
|
||||
|
||||
}
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: foo#main(){}
|
||||
// Mangled name for the signature by IR: main(){}
|
||||
// Mangled name for the signature by Frontend: main(){}%b.kt
|
||||
// Public signature by IR: foo/main|-4284757841571462650[0]
|
||||
// Public signature by IR debug description: main(){}
|
||||
// Public signature by Frontend: foo/main|8375568780578146760[0]
|
||||
// Public signature by Frontend debug description: main(){}%b.kt
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: foo#main(){}
|
||||
// Public signature: foo/main|-4284757841571462650[0]
|
||||
// Public signature debug description: main(){}
|
||||
fun main(): Unit
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: foo#main(0:0){0§<kotlin.Any?>}0:0
|
||||
// Public signature: foo/main|2157137022584307775[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}0:0
|
||||
// CHECK JS_IR NATIVE:
|
||||
// Mangled name: foo#main(0:0){0§<kotlin.Any?>}
|
||||
// Public signature: foo/main|-6008025846492417520[0]
|
||||
// Public signature debug description: main(0:0){0§<kotlin.Any?>}
|
||||
fun <T : Any?> main(t: T): T
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
FILE fqName:<root> fileName:/a.kt
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="main() in a.kt"
|
||||
FILE fqName:<root> fileName:/b.kt
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="main() in b.kt"
|
||||
FILE fqName:foo fileName:/c.kt
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.main() in c.kt"
|
||||
FILE fqName:foo fileName:/d.kt
|
||||
FUN name:main visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
|
||||
message: CONST String type=kotlin.String value="foo.main() in d.kt"
|
||||
@@ -0,0 +1,29 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// ^^^ Only JVM allows `main` functions in the same package but in different files.
|
||||
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: a.kt
|
||||
fun main() {
|
||||
println("main() in a.kt")
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
fun main() {
|
||||
println("main() in b.kt")
|
||||
}
|
||||
|
||||
// FILE: c.kt
|
||||
package foo
|
||||
|
||||
fun main() {
|
||||
println("foo.main() in c.kt")
|
||||
}
|
||||
|
||||
// FILE: d.kt
|
||||
package foo
|
||||
|
||||
fun main() {
|
||||
println("foo.main() in d.kt")
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// FILE: a.kt
|
||||
|
||||
fun main() {
|
||||
println(message = "main() in a.kt")
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
fun main() {
|
||||
println(message = "main() in b.kt")
|
||||
}
|
||||
|
||||
// FILE: c.kt
|
||||
package foo
|
||||
|
||||
fun main() {
|
||||
println(message = "foo.main() in c.kt")
|
||||
}
|
||||
|
||||
// FILE: d.kt
|
||||
package foo
|
||||
|
||||
fun main() {
|
||||
println(message = "foo.main() in d.kt")
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// FILE: a.kt
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #main(){}
|
||||
// Mangled name for the signature by IR: main(){}
|
||||
// Mangled name for the signature by Frontend: main(){}%a.kt
|
||||
// Public signature by IR: /main|-4284757841571462650[0]
|
||||
// Public signature by IR debug description: main(){}
|
||||
// Public signature by Frontend: /main|2314384220441172254[0]
|
||||
// Public signature by Frontend debug description: main(){}%a.kt
|
||||
fun main(): Unit
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: #main(){}
|
||||
// Mangled name for the signature by IR: main(){}
|
||||
// Mangled name for the signature by Frontend: main(){}%b.kt
|
||||
// Public signature by IR: /main|-4284757841571462650[0]
|
||||
// Public signature by IR debug description: main(){}
|
||||
// Public signature by Frontend: /main|8375568780578146760[0]
|
||||
// Public signature by Frontend debug description: main(){}%b.kt
|
||||
fun main(): Unit
|
||||
|
||||
// FILE: c.kt
|
||||
package foo
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: foo#main(){}
|
||||
// Mangled name for the signature by IR: main(){}
|
||||
// Mangled name for the signature by Frontend: main(){}%c.kt
|
||||
// Public signature by IR: foo/main|-4284757841571462650[0]
|
||||
// Public signature by IR debug description: main(){}
|
||||
// Public signature by Frontend: foo/main|-6421719669605920145[0]
|
||||
// Public signature by Frontend debug description: main(){}%c.kt
|
||||
fun main(): Unit
|
||||
|
||||
// FILE: d.kt
|
||||
package foo
|
||||
|
||||
// CHECK JVM_IR:
|
||||
// Mangled name: foo#main(){}
|
||||
// Mangled name for the signature by IR: main(){}
|
||||
// Mangled name for the signature by Frontend: main(){}%d.kt
|
||||
// Public signature by IR: foo/main|-4284757841571462650[0]
|
||||
// Public signature by IR debug description: main(){}
|
||||
// Public signature by Frontend: foo/main|-405077377165952676[0]
|
||||
// Public signature by Frontend debug description: main(){}%d.kt
|
||||
fun main(): Unit
|
||||
+12
@@ -540,6 +540,18 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionManglingInJvm.kt")
|
||||
public void testMainFunctionManglingInJvm() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionManglingInJvm.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
+5
@@ -423,6 +423,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/packageLevelProperties.kt");
|
||||
|
||||
Generated
+6
@@ -480,6 +480,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
+6
@@ -480,6 +480,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
+6
@@ -480,6 +480,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
+6
@@ -480,6 +480,12 @@ public class ClassicNativeIrTextTestGenerated extends AbstractClassicNativeIrTex
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
+6
@@ -480,6 +480,12 @@ public class FirLightTreeNativeIrTextTestGenerated extends AbstractFirLightTreeN
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
+6
@@ -480,6 +480,12 @@ public class FirPsiNativeIrTextTestGenerated extends AbstractFirPsiNativeIrTextT
|
||||
runTest("compiler/testData/ir/irText/declarations/localVarInDoWhile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mainFunctionMangling.kt")
|
||||
public void testMainFunctionMangling() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/mainFunctionMangling.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packageLevelProperties.kt")
|
||||
public void testPackageLevelProperties() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user