From a47eaa2cb5edc7d10b3ad3cd676d75eca102540d Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 24 Jul 2015 15:09:16 +0300 Subject: [PATCH] Change part class naming scheme update tests depending on part class naming --- .../load/kotlin/PackagePartClassUtils.java | 22 +++++++------------ .../checkLocalVariablesTable/itInLambda.kt | 4 ++-- .../itInReturnedLambda.kt | 4 ++-- .../checkLocalVariablesTable/lambdaAsVar.kt | 4 ++-- .../checkLocalVariablesTable/localFun.kt | 4 ++-- .../testData/cli/jvm/classAndPartClash.kt | 14 ++++-------- .../testData/cli/jvm/classAndPartClash.out | 6 ++--- .../cli/jvm/sanitized-name.clash.args | 3 +++ .../testData/cli/jvm/sanitized-name.clash.kt | 5 +++++ .../testData/cli/jvm/sanitized-name.clash.out | 7 ++++++ .../boxInline/smap/anonymous/lambda.1.kt | 8 +++---- .../boxInline/smap/anonymous/lambda.2.kt | 2 +- .../smap/anonymous/lambdaOnCallSite.1.kt | 4 ++-- .../anonymous/lambdaOnInlineCallSite.1.kt | 8 +++---- .../boxInline/smap/anonymous/object.1.kt | 8 +++---- .../boxInline/smap/anonymous/object.2.kt | 2 +- .../smap/anonymous/objectOnCallSite.1.kt | 4 ++-- .../anonymous/objectOnInlineCallSite.1.kt | 8 +++---- .../codegen/boxInline/smap/assertion.1.kt | 4 ++-- .../codegen/boxInline/smap/assertion.2.kt | 4 ++-- .../codegen/boxInline/smap/oneFile.1.kt | 2 +- .../smap/resolve/inlineComponent.1.kt | 4 ++-- .../smap/resolve/inlineIterator.1.kt | 4 ++-- .../testData/codegen/boxInline/smap/smap.1.kt | 4 ++-- .../testData/codegen/boxInline/smap/smap.2.kt | 2 +- .../platformTypeAssertionStackTrace.kt | 4 ++-- .../reflection/enclosing/classInLambda.kt | 2 +- .../enclosing/functionExpressionInProperty.kt | 2 +- .../reflection/enclosing/lambdaInFunction.kt | 2 +- .../reflection/enclosing/lambdaInLambda.kt | 2 +- .../lambdaInLocalClassConstructor.kt | 4 ++-- .../enclosing/lambdaInLocalClassSuperCall.kt | 4 ++-- .../enclosing/lambdaInLocalFunction.kt | 2 +- .../lambdaInMemberFunctionInLocalClass.kt | 2 +- .../enclosing/lambdaInObjectExpression.kt | 4 ++-- .../lambdaInObjectLiteralSuperCall.kt | 2 +- .../reflection/enclosing/lambdaInPackage.kt | 2 +- .../enclosing/lambdaInPropertyGetter.kt | 2 +- .../enclosing/lambdaInPropertySetter.kt | 2 +- .../namedFunctionExpressionInProperty.kt | 2 +- .../reflection/enclosing/objectInLambda.kt | 2 +- .../bytecodeText/constClosureOptimization.kt | 6 ++--- .../codegen/bytecodeText/defaultDelegation.kt | 2 +- .../bytecodeText/inlineFromOtherModule.kt | 2 +- .../topLevelFunWithDefaultArgs.kt | 2 +- .../extensionFunction/a1.kt | 8 +++++++ .../functionDifferentPackage/a1.kt | 6 +++++ .../functionSamePackage/a1.kt | 8 +++++++ .../topLevelMemberInvocation/property/a1.kt | 6 +++++ .../propertyWithGetter/a1.kt | 9 ++++++++ .../serialization/local/anonymousObject.txt | 4 ++-- .../serialization/local/deepInnerChain.txt | 8 +++---- .../serialization/local/innerOfLocal.txt | 4 ++-- .../local/localClassInSignature.txt | 12 +++++----- .../local/simpleInTopLevelFunction.txt | 4 ++-- .../declarationSiteVariance/OutInField.kt | 4 ++-- .../cli/KotlincExecutableTestGenerated.java | 6 +++++ .../kotlin/codegen/OuterClassGenTest.java | 12 +++++----- .../idea/quickfix/QuickFixTestGenerated.java | 2 +- 59 files changed, 166 insertions(+), 120 deletions(-) create mode 100644 compiler/testData/cli/jvm/sanitized-name.clash.args create mode 100644 compiler/testData/cli/jvm/sanitized-name.clash.kt create mode 100644 compiler/testData/cli/jvm/sanitized-name.clash.out create mode 100644 compiler/testData/codegen/topLevelMemberInvocation/extensionFunction/a1.kt create mode 100644 compiler/testData/codegen/topLevelMemberInvocation/functionDifferentPackage/a1.kt create mode 100644 compiler/testData/codegen/topLevelMemberInvocation/functionSamePackage/a1.kt create mode 100644 compiler/testData/codegen/topLevelMemberInvocation/property/a1.kt create mode 100644 compiler/testData/codegen/topLevelMemberInvocation/propertyWithGetter/a1.kt diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/PackagePartClassUtils.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/PackagePartClassUtils.java index 4dd6a8baf57..5a8f1d7c1c8 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/PackagePartClassUtils.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/PackagePartClassUtils.java @@ -45,8 +45,12 @@ public class PackagePartClassUtils { } @NotNull - private static String replaceSpecialSymbols(@NotNull String str) { - return str.replace('.', '_'); + private static String getSanitizedIdentifier(@NotNull String str) { + str = str.replaceAll("[^\\p{L}\\p{Digit}]", "_"); + if (!Character.isJavaIdentifierStart(str.charAt(0))) { + str = "_" + str; + } + return str; } @NotNull @@ -65,20 +69,10 @@ public class PackagePartClassUtils { if ('a' <= c && c <= 'z') { fileName = Character.toUpperCase(fileName.charAt(0)) + fileName.substring(1); } + fileName += "Kt"; } - if (jetFile != null) { - for (PsiElement child : jetFile.getDeclarations()) { - if (child instanceof JetClassOrObject) { - if (fileName.equalsIgnoreCase(((JetClassOrObject) child).getName())) { - fileName += "_"; - break; - } - } - } - } - - return facadeFqName.parent().child(Name.identifier(replaceSpecialSymbols(fileName))); + return facadeFqName.parent().child(Name.identifier(getSanitizedIdentifier(fileName))); } @NotNull diff --git a/compiler/testData/checkLocalVariablesTable/itInLambda.kt b/compiler/testData/checkLocalVariablesTable/itInLambda.kt index 8b1fc8e5f97..9adbd252cb8 100644 --- a/compiler/testData/checkLocalVariablesTable/itInLambda.kt +++ b/compiler/testData/checkLocalVariablesTable/itInLambda.kt @@ -8,6 +8,6 @@ fun foo1() { } } -// METHOD : _DefaultPackage*$foo1$1.invoke(I)V -// VARIABLE : NAME=this TYPE=L_DefaultPackage*$foo1$1; INDEX=0 +// METHOD : ItInLambdaKt$foo1$1.invoke(I)V +// VARIABLE : NAME=this TYPE=LItInLambdaKt$foo1$1; INDEX=0 // VARIABLE : NAME=it TYPE=I INDEX=1 diff --git a/compiler/testData/checkLocalVariablesTable/itInReturnedLambda.kt b/compiler/testData/checkLocalVariablesTable/itInReturnedLambda.kt index b7227c03b78..23478ff5561 100644 --- a/compiler/testData/checkLocalVariablesTable/itInReturnedLambda.kt +++ b/compiler/testData/checkLocalVariablesTable/itInReturnedLambda.kt @@ -6,6 +6,6 @@ fun foo() { } } -// METHOD : _DefaultPackage*$foo$1$1.invoke(I)V -// VARIABLE : NAME=this TYPE=L_DefaultPackage*$foo$1$1; INDEX=0 +// METHOD : ItInReturnedLambdaKt$foo$1$1.invoke(I)V +// VARIABLE : NAME=this TYPE=LItInReturnedLambdaKt$foo$1$1; INDEX=0 // VARIABLE : NAME=it TYPE=I INDEX=1 diff --git a/compiler/testData/checkLocalVariablesTable/lambdaAsVar.kt b/compiler/testData/checkLocalVariablesTable/lambdaAsVar.kt index 59a9d71cd3a..e562031bbd9 100644 --- a/compiler/testData/checkLocalVariablesTable/lambdaAsVar.kt +++ b/compiler/testData/checkLocalVariablesTable/lambdaAsVar.kt @@ -4,5 +4,5 @@ fun foo() { } } -// METHOD : _DefaultPackage*$foo$a$1.invoke()V -// VARIABLE : NAME=this TYPE=L_DefaultPackage*$foo$a$1; INDEX=0 +// METHOD : LambdaAsVarKt$foo$a$1.invoke()V +// VARIABLE : NAME=this TYPE=LLambdaAsVarKt$foo$a$1; INDEX=0 diff --git a/compiler/testData/checkLocalVariablesTable/localFun.kt b/compiler/testData/checkLocalVariablesTable/localFun.kt index 5285fd66db3..8e97ed0f3b8 100644 --- a/compiler/testData/checkLocalVariablesTable/localFun.kt +++ b/compiler/testData/checkLocalVariablesTable/localFun.kt @@ -3,5 +3,5 @@ fun foo() { } } -// METHOD : _DefaultPackage*$foo$1.invoke()V -// VARIABLE : NAME=this TYPE=L_DefaultPackage*$foo$1; INDEX=0 +// METHOD : LocalFunKt$foo$1.invoke()V +// VARIABLE : NAME=this TYPE=LLocalFunKt$foo$1; INDEX=0 diff --git a/compiler/testData/cli/jvm/classAndPartClash.kt b/compiler/testData/cli/jvm/classAndPartClash.kt index 32cd97a93a4..764beb3baec 100644 --- a/compiler/testData/cli/jvm/classAndPartClash.kt +++ b/compiler/testData/cli/jvm/classAndPartClash.kt @@ -1,13 +1,7 @@ package test -class ClassAndPartClash { +class ClassAndPartClash +class ClassAndPartClash_ +class ClassAndPartClashKt -} - -class ClassAndPartClash_ { - -} - -fun z () { - -} \ No newline at end of file +fun z () {} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/classAndPartClash.out b/compiler/testData/cli/jvm/classAndPartClash.out index db2aabb9f0a..d1cfe7b2bad 100644 --- a/compiler/testData/cli/jvm/classAndPartClash.out +++ b/compiler/testData/cli/jvm/classAndPartClash.out @@ -1,7 +1,7 @@ -compiler/testData/cli/jvm/classAndPartClash.kt:1:1: error: duplicate JVM class name 'test/ClassAndPartClash_' generated from: package-fragment test, ClassAndPartClash_ +compiler/testData/cli/jvm/classAndPartClash.kt:1:1: error: duplicate JVM class name 'test/ClassAndPartClashKt' generated from: package-fragment test, ClassAndPartClashKt package test ^ -compiler/testData/cli/jvm/classAndPartClash.kt:7:1: error: duplicate JVM class name 'test/ClassAndPartClash_' generated from: package-fragment test, ClassAndPartClash_ -class ClassAndPartClash_ { +compiler/testData/cli/jvm/classAndPartClash.kt:5:1: error: duplicate JVM class name 'test/ClassAndPartClashKt' generated from: package-fragment test, ClassAndPartClashKt +class ClassAndPartClashKt ^ COMPILATION_ERROR \ No newline at end of file diff --git a/compiler/testData/cli/jvm/sanitized-name.clash.args b/compiler/testData/cli/jvm/sanitized-name.clash.args new file mode 100644 index 00000000000..72acfc1ff50 --- /dev/null +++ b/compiler/testData/cli/jvm/sanitized-name.clash.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/sanitized-name.clash.kt +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/sanitized-name.clash.kt b/compiler/testData/cli/jvm/sanitized-name.clash.kt new file mode 100644 index 00000000000..31ae873894a --- /dev/null +++ b/compiler/testData/cli/jvm/sanitized-name.clash.kt @@ -0,0 +1,5 @@ +class SanitizedNameClash +class Sanitized_Name_Clash +class Sanitized_name_clashKt + +fun foo() {} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/sanitized-name.clash.out b/compiler/testData/cli/jvm/sanitized-name.clash.out new file mode 100644 index 00000000000..e8eb1cb54f1 --- /dev/null +++ b/compiler/testData/cli/jvm/sanitized-name.clash.out @@ -0,0 +1,7 @@ +compiler/testData/cli/jvm/sanitized-name.clash.kt:1:1: error: duplicate JVM class name 'Sanitized_name_clashKt' generated from: package-fragment , Sanitized_name_clashKt +class SanitizedNameClash +^ +compiler/testData/cli/jvm/sanitized-name.clash.kt:3:1: error: duplicate JVM class name 'Sanitized_name_clashKt' generated from: package-fragment , Sanitized_name_clashKt +class Sanitized_name_clashKt +^ +COMPILATION_ERROR \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.1.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.1.kt index 197d9496179..2335da7e3c1 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.1.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.1.kt @@ -23,9 +23,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 lambda.1.kt -//_DefaultPackage +//Lambda_1Kt //+ 2 lambda.2.kt -//builders/BuildersPackage +//builders/Lambda_2Kt //*L //1#1,46:1 //4#2:47 @@ -37,9 +37,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 lambda.2.kt -//builders/BuildersPackage$lambda_2$HASH$call$1 +//builders/Lambda_2Kt$call$1 //+ 2 lambda.1.kt -//_DefaultPackage$lambda_1$HASH +//Lambda_1Kt //*L //1#1,18:1 //8#2:19 diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.2.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.2.kt index bee5fecd64a..4a7baf96fc9 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.2.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.2.kt @@ -12,7 +12,7 @@ inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) //*S Kotlin //*F //+ 1 lambda.2.kt -//builders/BuildersPackage$lambda_2$HASH$call$1 +//builders/Lambda_2Kt$call$1 //*L //1#1,18:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.1.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.1.kt index cba19ffbbdd..6c34163908d 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.1.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnCallSite.1.kt @@ -25,9 +25,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 lambdaOnCallSite.1.kt -//_DefaultPackage +//LambdaOnCallSite_1Kt //+ 2 lambdaOnCallSite.2.kt -//builders/BuildersPackage +//builders/LambdaOnCallSite_2Kt //*L //1#1,34:1 //4#2:35 diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.1.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.1.kt index b076459b8ee..5f071ca5c29 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.1.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambdaOnInlineCallSite.1.kt @@ -25,9 +25,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 lambdaOnInlineCallSite.1.kt -//_DefaultPackage +//LambdaOnInlineCallSite_1Kt //+ 2 lambdaOnInlineCallSite.2.kt -//builders/BuildersPackage +//builders/LambdaOnInlineCallSite_2Kt //*L //1#1,56:1 //4#2:57 @@ -39,7 +39,7 @@ fun box(): String { //*S Kotlin //*F //+ 1 lambdaOnInlineCallSite.1.kt -//_DefaultPackage$lambdaOnInlineCallSite_1$HASH$test$1$1 +//LambdaOnInlineCallSite_1Kt$test$1$1 //*L //1#1,56:1 //*E @@ -50,7 +50,7 @@ fun box(): String { //*S Kotlin //*F //+ 1 lambdaOnInlineCallSite.1.kt -//_DefaultPackage$lambdaOnInlineCallSite_1$HASH$test$1$1 +//LambdaOnInlineCallSite_1Kt$test$1$1 //*L //1#1,56:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/object.1.kt b/compiler/testData/codegen/boxInline/smap/anonymous/object.1.kt index 79f00fbc0f0..237c6501a45 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/object.1.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/object.1.kt @@ -22,9 +22,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 object.1.kt -//_DefaultPackage +//Object_1Kt //+ 2 object.2.kt -//builders/BuildersPackage +//builders/Object_2Kt //*L //1#1,45:1 //4#2,5:46 @@ -36,9 +36,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 object.2.kt -//builders/BuildersPackage$object_2$HASH$call$1 +//builders/Object_2Kt$call$1 //+ 2 object.1.kt -//_DefaultPackage$object_1$HASH +//Object_1Kt //*L //1#1,21:1 //8#2:22 diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/object.2.kt b/compiler/testData/codegen/boxInline/smap/anonymous/object.2.kt index 544fd5379a4..81c21f398be 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/object.2.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/object.2.kt @@ -15,7 +15,7 @@ inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) //*S Kotlin //*F //+ 1 object.2.kt -//builders/BuildersPackage$object_2$HASH$call$1 +//builders/Object_2Kt$call$1 //*L //1#1,21:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/objectOnCallSite.1.kt b/compiler/testData/codegen/boxInline/smap/anonymous/objectOnCallSite.1.kt index 80f427db242..ae8a8c5a0ce 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/objectOnCallSite.1.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/objectOnCallSite.1.kt @@ -27,9 +27,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 objectOnCallSite.1.kt -//_DefaultPackage +//ObjectOnCallSite_1Kt //+ 2 objectOnCallSite.2.kt -//builders/BuildersPackage +//builders/ObjectOnCallSite_2Kt //*L //1#1,36:1 //4#2:37 diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.1.kt b/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.1.kt index 717b53334ab..74f237b8edc 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.1.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSite.1.kt @@ -27,9 +27,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 objectOnInlineCallSite.1.kt -//_DefaultPackage +//ObjectOnInlineCallSite_1Kt //+ 2 objectOnInlineCallSite.2.kt -//builders/BuildersPackage +//builders/ObjectOnInlineCallSite_2Kt //*L //1#1,58:1 //4#2:59 @@ -41,7 +41,7 @@ fun box(): String { //*S Kotlin //*F //+ 1 objectOnInlineCallSite.1.kt -//_DefaultPackage$objectOnInlineCallSite_1$HASH$test$1$1 +//ObjectOnInlineCallSite_1Kt$test$1$1 //*L //1#1,58:1 //*E @@ -52,7 +52,7 @@ fun box(): String { //*S Kotlin //*F //+ 1 objectOnInlineCallSite.1.kt -//_DefaultPackage$objectOnInlineCallSite_1$HASH$test$1$1 +//ObjectOnInlineCallSite_1Kt$test$1$1 //*L //1#1,58:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/assertion.1.kt b/compiler/testData/codegen/boxInline/smap/assertion.1.kt index f4f7e4edc24..ff857ffd07a 100644 --- a/compiler/testData/codegen/boxInline/smap/assertion.1.kt +++ b/compiler/testData/codegen/boxInline/smap/assertion.1.kt @@ -15,9 +15,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 assertion.1.kt -//_DefaultPackage +//Assertion_1Kt //+ 2 assertion.2.kt -//test/TestPackage +//test/Assertion_2Kt //*L //1#1,25:1 //15#2,7:26 diff --git a/compiler/testData/codegen/boxInline/smap/assertion.2.kt b/compiler/testData/codegen/boxInline/smap/assertion.2.kt index 97509d2b005..ee44d6ec9d1 100644 --- a/compiler/testData/codegen/boxInline/smap/assertion.2.kt +++ b/compiler/testData/codegen/boxInline/smap/assertion.2.kt @@ -20,7 +20,7 @@ public inline fun massert(value: Boolean, message: Any = "Assertion failed") { } } -//TODO SHOUDL BE ABSENT +//TODO SHOULD BE ABSENT //SMAP //assertion.2.kt @@ -28,7 +28,7 @@ public inline fun massert(value: Boolean, message: Any = "Assertion failed") { //*S Kotlin //*F //+ 1 assertion.2.kt -//test/TestPackage +//test/Assertion_2Kt //*L //1#1,34:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/oneFile.1.kt b/compiler/testData/codegen/boxInline/smap/oneFile.1.kt index db876ac9e65..13d2f3226f9 100644 --- a/compiler/testData/codegen/boxInline/smap/oneFile.1.kt +++ b/compiler/testData/codegen/boxInline/smap/oneFile.1.kt @@ -16,7 +16,7 @@ inline fun test(p: () -> String): String { //*S Kotlin //*F //+ 1 oneFile.1.kt -//_DefaultPackage +//OneFile_1Kt //*L //1#1,22:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/smap/resolve/inlineComponent.1.kt b/compiler/testData/codegen/boxInline/smap/resolve/inlineComponent.1.kt index 0a719ebdc08..dca754ba80d 100644 --- a/compiler/testData/codegen/boxInline/smap/resolve/inlineComponent.1.kt +++ b/compiler/testData/codegen/boxInline/smap/resolve/inlineComponent.1.kt @@ -12,9 +12,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 inlineComponent.1.kt -//_DefaultPackage +//InlineComponent_1Kt //+ 2 inlineComponent.2.kt -//zzz/ZzzPackage +//zzz/InlineComponent_2Kt //*L //1#1,21:1 //5#2,3:22 diff --git a/compiler/testData/codegen/boxInline/smap/resolve/inlineIterator.1.kt b/compiler/testData/codegen/boxInline/smap/resolve/inlineIterator.1.kt index 16cef0cbd3e..b28508d7966 100644 --- a/compiler/testData/codegen/boxInline/smap/resolve/inlineIterator.1.kt +++ b/compiler/testData/codegen/boxInline/smap/resolve/inlineIterator.1.kt @@ -15,9 +15,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 inlineIterator.1.kt -//_DefaultPackage +//InlineIterator_1Kt //+ 2 inlineIterator.2.kt -//zzz/ZzzPackage +//zzz/InlineIterator_2Kt //*L //1#1,24:1 //5#2:25 diff --git a/compiler/testData/codegen/boxInline/smap/smap.1.kt b/compiler/testData/codegen/boxInline/smap/smap.1.kt index 015f17d15b2..32d6ebf838c 100644 --- a/compiler/testData/codegen/boxInline/smap/smap.1.kt +++ b/compiler/testData/codegen/boxInline/smap/smap.1.kt @@ -26,9 +26,9 @@ fun box(): String { //*S Kotlin //*F //+ 1 smap.1.kt -//_DefaultPackage +//Smap_1Kt //+ 2 smap.2.kt -//builders/BuildersPackage +//builders/Smap_2Kt //*L //1#1,38:1 //16#2:39 diff --git a/compiler/testData/codegen/boxInline/smap/smap.2.kt b/compiler/testData/codegen/boxInline/smap/smap.2.kt index b973d593786..891aef3d0b2 100644 --- a/compiler/testData/codegen/boxInline/smap/smap.2.kt +++ b/compiler/testData/codegen/boxInline/smap/smap.2.kt @@ -22,7 +22,7 @@ inline fun html(init: () -> Unit) { //*S Kotlin //*F //+ 1 smap.2.kt -//builders/BuildersPackage +//builders/Smap_2Kt //*L //1#1,28:1 //*E \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/fullJdk/platformTypeAssertionStackTrace.kt b/compiler/testData/codegen/boxWithStdlib/fullJdk/platformTypeAssertionStackTrace.kt index e2d11d5240c..4ed4214a891 100644 --- a/compiler/testData/codegen/boxWithStdlib/fullJdk/platformTypeAssertionStackTrace.kt +++ b/compiler/testData/codegen/boxWithStdlib/fullJdk/platformTypeAssertionStackTrace.kt @@ -12,8 +12,8 @@ fun box(): String { return "Fail: very small stack trace, should at least have current function and JUnit reflective calls: ${Arrays.toString(st)}" } val top = st[0] - if (!(top.getClassName().startsWith("_DefaultPackage") && top.getMethodName() == "box")) { - return "Fail: top stack trace element should be box() from default package, but was $top" + if (!(top.getClassName() == "PlatformTypeAssertionStackTraceKt" && top.getMethodName() == "box")) { + return "Fail: top stack trace element should be PlatformTypeAssertionStackTraceKt.box() from default package, but was $top" } return "OK" } diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/classInLambda.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/classInLambda.kt index 8e91a0ecb02..d4603687624 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/classInLambda.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/classInLambda.kt @@ -9,7 +9,7 @@ fun box(): String { if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" val enclosingClass = classInLambda.javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.endsWith("\$box\$classInLambda\$1")) return "enclosing class: $enclosingClass" + if (enclosingClass != "ClassInLambdaKt\$box\$classInLambda\$1") return "enclosing class: $enclosingClass" val declaringClass = classInLambda.javaClass.getDeclaringClass() if (declaringClass != null) return "class has a declaring class" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/functionExpressionInProperty.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/functionExpressionInProperty.kt index 24c71def982..01ac36f66dc 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/functionExpressionInProperty.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/functionExpressionInProperty.kt @@ -7,7 +7,7 @@ fun box(): String { if (enclosingMethod != null) return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("functionExpressionInProperty")) return "enclosing class: $enclosingClass" + if (enclosingClass != "FunctionExpressionInPropertyKt") return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInFunction.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInFunction.kt index ed88fd10d2f..c45d234b78c 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInFunction.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInFunction.kt @@ -6,7 +6,7 @@ fun box(): String { if (enclosingMethod?.getName() != "box") return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("lambdaInFunction")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInFunctionKt") return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLambda.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLambda.kt index 5e05e0aa25b..57b47dfdfdc 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLambda.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLambda.kt @@ -8,7 +8,7 @@ fun box(): String { if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.contains("\$box\$l\$1")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInLambdaKt\$box\$l\$1") return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassConstructor.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassConstructor.kt index 067c35f3822..962f25c29ad 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassConstructor.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassConstructor.kt @@ -12,10 +12,10 @@ fun box(): String { val javaClass = l.a.javaClass val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() - if (!enclosingMethod.startsWith("_DefaultPackage\$") || !enclosingMethod.endsWith("\$box\$L")) return "ctor: $enclosingMethod" + if (enclosingMethod != "LambdaInLocalClassConstructorKt\$box\$L") return "ctor: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.endsWith("\$box\$L")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInLocalClassConstructorKt\$box\$L") return "enclosing class: $enclosingClass" if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassSuperCall.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassSuperCall.kt index 55c2373f93e..b3089c8d0c6 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassSuperCall.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalClassSuperCall.kt @@ -7,10 +7,10 @@ fun box(): String { val javaClass = l.a.javaClass val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() - if (!enclosingMethod.startsWith("_DefaultPackage\$") || !enclosingMethod.endsWith("\$box\$L")) return "ctor: $enclosingMethod" + if (enclosingMethod != "LambdaInLocalClassSuperCallKt\$box\$L") return "ctor: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.endsWith("\$box\$L")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInLocalClassSuperCallKt\$box\$L") return "enclosing class: $enclosingClass" if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalFunction.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalFunction.kt index f486c657f6a..fab5d888d35 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalFunction.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInLocalFunction.kt @@ -8,7 +8,7 @@ fun box(): String { if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.contains("\$box$1")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInLocalFunctionKt\$box$1") return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt index d0169f485d7..7fd0bc06989 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInMemberFunctionInLocalClass.kt @@ -10,7 +10,7 @@ fun box(): String { if (enclosingMethod?.getName() != "foo") return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.contains("\$box\$C")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInMemberFunctionInLocalClassKt\$box\$C") return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectExpression.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectExpression.kt index 0e04ffaa04b..9cf1821e1d3 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectExpression.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectExpression.kt @@ -13,10 +13,10 @@ fun box(): String { val javaClass = l.a.javaClass val enclosingMethod = javaClass.getEnclosingConstructor()!!.getName() - if (!enclosingMethod.startsWith("_DefaultPackage\$") || !enclosingMethod.endsWith("\$box\$l\$1")) return "ctor: $enclosingMethod" + if (enclosingMethod != "LambdaInObjectExpressionKt\$box\$l\$1") return "ctor: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.endsWith("\$box\$l\$1")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInObjectExpressionKt\$box\$l\$1") return "enclosing class: $enclosingClass" if (enclosingMethod != enclosingClass) return "$enclosingClass != $enclosingMethod" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt index b3a032c9572..aa603c03429 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInObjectLiteralSuperCall.kt @@ -11,7 +11,7 @@ fun box(): String { if (enclosingMethod != "box") return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || enclosingClass != l.javaClass.getEnclosingClass()!!.getName()) + if (enclosingClass != "LambdaInObjectLiteralSuperCallKt" || enclosingClass != l.javaClass.getEnclosingClass()!!.getName()) return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPackage.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPackage.kt index 39d50c47b7b..ef9f1cb35bd 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPackage.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPackage.kt @@ -2,7 +2,7 @@ val l: Any = {} fun box(): String { val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("lambdaInPackage")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInPackageKt") return "enclosing class: $enclosingClass" val enclosingConstructor = l.javaClass.getEnclosingConstructor() if (enclosingConstructor != null) return "enclosing constructor found: $enclosingConstructor" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertyGetter.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertyGetter.kt index 8b9f8a3ad79..7d7885cf438 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertyGetter.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertyGetter.kt @@ -7,7 +7,7 @@ fun box(): String { if (enclosingMethod?.getName() != "getL") return "method: $enclosingMethod" val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("lambdaInPropertyGetter")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInPropertyGetterKt") return "enclosing class: $enclosingClass" val declaringClass = l.javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertySetter.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertySetter.kt index f35710058d5..302b74b5494 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertySetter.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/lambdaInPropertySetter.kt @@ -13,7 +13,7 @@ fun box(): String { if (enclosingMethod?.getName() != "setL") return "method: $enclosingMethod" val enclosingClass = l.javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("lambdaInPropertySetter")) return "enclosing class: $enclosingClass" + if (enclosingClass != "LambdaInPropertySetterKt") return "enclosing class: $enclosingClass" val declaringClass = l.javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/namedFunctionExpressionInProperty.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/namedFunctionExpressionInProperty.kt index 5e7c69be8cd..4f814390888 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/namedFunctionExpressionInProperty.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/namedFunctionExpressionInProperty.kt @@ -7,7 +7,7 @@ fun box(): String { if (enclosingMethod != null) return "method: $enclosingMethod" val enclosingClass = javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage") || !enclosingClass.contains("namedFunctionExpressionInProperty")) return "enclosing class: $enclosingClass" + if (enclosingClass != "NamedFunctionExpressionInPropertyKt") return "enclosing class: $enclosingClass" val declaringClass = javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass" diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/objectInLambda.kt b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/objectInLambda.kt index e0a33aca64d..5671b426673 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/objectInLambda.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/enclosing/objectInLambda.kt @@ -8,7 +8,7 @@ fun box(): String { if (enclosingMethod?.getName() != "invoke") return "method: $enclosingMethod" val enclosingClass = objectInLambda.javaClass.getEnclosingClass()!!.getName() - if (!enclosingClass.startsWith("_DefaultPackage\$") || !enclosingClass.endsWith("\$box\$objectInLambda\$1")) return "enclosing class: $enclosingClass" + if (enclosingClass != "ObjectInLambdaKt\$box\$objectInLambda\$1") return "enclosing class: $enclosingClass" val declaringClass = objectInLambda.javaClass.getDeclaringClass() if (declaringClass != null) return "anonymous object has a declaring class" diff --git a/compiler/testData/codegen/bytecodeText/constClosureOptimization.kt b/compiler/testData/codegen/bytecodeText/constClosureOptimization.kt index 2d886c33745..dfb525ce937 100644 --- a/compiler/testData/codegen/bytecodeText/constClosureOptimization.kt +++ b/compiler/testData/codegen/bytecodeText/constClosureOptimization.kt @@ -17,6 +17,6 @@ fun test() { (::local)() } -// 3 GETSTATIC _DefaultPackage\$.+\$test\$1\.INSTANCE\$ -// 1 GETSTATIC _DefaultPackage\$.+\$test\$2\.INSTANCE\$ -// 1 GETSTATIC _DefaultPackage\$.+\$test\$3\.INSTANCE\$ +// 3 GETSTATIC ConstClosureOptimizationKt\$test\$1\.INSTANCE\$ +// 1 GETSTATIC ConstClosureOptimizationKt\$test\$2\.INSTANCE\$ +// 1 GETSTATIC ConstClosureOptimizationKt\$test\$3\.INSTANCE\$ diff --git a/compiler/testData/codegen/bytecodeText/defaultDelegation.kt b/compiler/testData/codegen/bytecodeText/defaultDelegation.kt index 33cd85aeef1..948cd308b07 100644 --- a/compiler/testData/codegen/bytecodeText/defaultDelegation.kt +++ b/compiler/testData/codegen/bytecodeText/defaultDelegation.kt @@ -5,4 +5,4 @@ fun simpleFoo(s: Int = 111) { } // 1 BIPUSH 111 -// 1 INVOKESTATIC foo/FooPackage.+\.simpleFoo\$default \(II\)V +// 1 INVOKESTATIC foo/DefaultDelegationKt.simpleFoo\$default \(II\)V diff --git a/compiler/testData/codegen/bytecodeText/inlineFromOtherModule.kt b/compiler/testData/codegen/bytecodeText/inlineFromOtherModule.kt index 90aecc0039e..df5a7c62cea 100644 --- a/compiler/testData/codegen/bytecodeText/inlineFromOtherModule.kt +++ b/compiler/testData/codegen/bytecodeText/inlineFromOtherModule.kt @@ -4,4 +4,4 @@ fun foo() { // assert function will be inlined, and we assure that there are no calls via package part, but is call via package facade in inlined code // 0 INVOKESTATIC kotlin\/KotlinPackage.+\.getASSERTIONS_ENABLED \(\)Z -// 1 INVOKESTATIC kotlin\/KotlinPackage\.getASSERTIONS_ENABLED \(\)Z +// 1 INVOKESTATIC kotlin\/AssertionsJVMKt\.getASSERTIONS_ENABLED \(\)Z diff --git a/compiler/testData/codegen/bytecodeText/topLevelFunWithDefaultArgs.kt b/compiler/testData/codegen/bytecodeText/topLevelFunWithDefaultArgs.kt index c0542edf79c..7685b95aa68 100644 --- a/compiler/testData/codegen/bytecodeText/topLevelFunWithDefaultArgs.kt +++ b/compiler/testData/codegen/bytecodeText/topLevelFunWithDefaultArgs.kt @@ -1,4 +1,4 @@ fun foo(a: Int = 1) {} // 0 _DefaultPackage.foo -// 3 INVOKESTATIC _DefaultPackage.+ +// 3 INVOKESTATIC TopLevelFunWithDefaultArgsKt\.foo diff --git a/compiler/testData/codegen/topLevelMemberInvocation/extensionFunction/a1.kt b/compiler/testData/codegen/topLevelMemberInvocation/extensionFunction/a1.kt new file mode 100644 index 00000000000..9b04ece1273 --- /dev/null +++ b/compiler/testData/codegen/topLevelMemberInvocation/extensionFunction/a1.kt @@ -0,0 +1,8 @@ +fun Int.test1() {} + +fun test2() { + 1.test1() +} + +// 2 INVOKESTATIC A1Kt.test1 \(I\)V +// 1 INVOKESTATIC A1Kt.test2 \(\)V diff --git a/compiler/testData/codegen/topLevelMemberInvocation/functionDifferentPackage/a1.kt b/compiler/testData/codegen/topLevelMemberInvocation/functionDifferentPackage/a1.kt new file mode 100644 index 00000000000..f721d9f01a7 --- /dev/null +++ b/compiler/testData/codegen/topLevelMemberInvocation/functionDifferentPackage/a1.kt @@ -0,0 +1,6 @@ +package a + +fun test1() {} + +// 2 INVOKESTATIC a/A1Kt.test1 \(\)V +// 1 INVOKESTATIC b/A2Kt.test2 \(\)V diff --git a/compiler/testData/codegen/topLevelMemberInvocation/functionSamePackage/a1.kt b/compiler/testData/codegen/topLevelMemberInvocation/functionSamePackage/a1.kt new file mode 100644 index 00000000000..b9577ae1873 --- /dev/null +++ b/compiler/testData/codegen/topLevelMemberInvocation/functionSamePackage/a1.kt @@ -0,0 +1,8 @@ +fun test1() {} + +fun test2() { + test1() +} + +// 2 INVOKESTATIC A1Kt.test1 \(\)V +// 1 INVOKESTATIC A1Kt.test2 \(\)V diff --git a/compiler/testData/codegen/topLevelMemberInvocation/property/a1.kt b/compiler/testData/codegen/topLevelMemberInvocation/property/a1.kt new file mode 100644 index 00000000000..880c69ddbe0 --- /dev/null +++ b/compiler/testData/codegen/topLevelMemberInvocation/property/a1.kt @@ -0,0 +1,6 @@ +package a + +val prop = 1 + +// 2 INVOKESTATIC a/A1Kt.getProp \(\)I +// 1 GETSTATIC a/A1Kt.prop \: I diff --git a/compiler/testData/codegen/topLevelMemberInvocation/propertyWithGetter/a1.kt b/compiler/testData/codegen/topLevelMemberInvocation/propertyWithGetter/a1.kt new file mode 100644 index 00000000000..f4cc427acf0 --- /dev/null +++ b/compiler/testData/codegen/topLevelMemberInvocation/propertyWithGetter/a1.kt @@ -0,0 +1,9 @@ +package a + +val prop: Int = 0 + get() { + return $prop + 1 + } + +// 2 INVOKESTATIC a/A1Kt.getProp \(\)I +// 1 GETSTATIC a/A1Kt.prop \: I diff --git a/compiler/testData/serialization/local/anonymousObject.txt b/compiler/testData/serialization/local/anonymousObject.txt index 8a05a35200c..57a3b9a86d7 100644 --- a/compiler/testData/serialization/local/anonymousObject.txt +++ b/compiler/testData/serialization/local/anonymousObject.txt @@ -1,4 +1,4 @@ -local final class `_DefaultPackage$anonymousObject$*$main$1` : java.lang.Runnable +local final class `AnonymousObjectKt$main$1` : java.lang.Runnable -public constructor `_DefaultPackage$anonymousObject$*$main$1`() +public constructor `AnonymousObjectKt$main$1`() public open override /*1*/ fun run(): kotlin.Unit diff --git a/compiler/testData/serialization/local/deepInnerChain.txt b/compiler/testData/serialization/local/deepInnerChain.txt index 2c3ba294350..a22537d5229 100644 --- a/compiler/testData/serialization/local/deepInnerChain.txt +++ b/compiler/testData/serialization/local/deepInnerChain.txt @@ -1,7 +1,7 @@ local final inner class Deepest public constructor Deepest() -internal final fun deep(): `_DefaultPackage$deepInnerChain$*$main$Local$Inner$prop$1$foo$1$DeepLocal` -internal final fun deepest(): `_DefaultPackage$deepInnerChain$*$main$Local$Inner$prop$1$foo$1$DeepLocal`.Deepest? -internal final fun inner(): `_DefaultPackage$deepInnerChain$*$main$Local`.Inner -internal final fun local(): `_DefaultPackage$deepInnerChain$*$main$Local` +internal final fun deep(): `DeepInnerChainKt$main$Local$Inner$prop$1$foo$1$DeepLocal` +internal final fun deepest(): `DeepInnerChainKt$main$Local$Inner$prop$1$foo$1$DeepLocal`.Deepest? +internal final fun inner(): `DeepInnerChainKt$main$Local`.Inner +internal final fun local(): `DeepInnerChainKt$main$Local` diff --git a/compiler/testData/serialization/local/innerOfLocal.txt b/compiler/testData/serialization/local/innerOfLocal.txt index 55de5348986..53a75936172 100644 --- a/compiler/testData/serialization/local/innerOfLocal.txt +++ b/compiler/testData/serialization/local/innerOfLocal.txt @@ -1,5 +1,5 @@ local final inner class Inner public constructor Inner() -internal final fun inner(/*0*/ i: `_DefaultPackage$innerOfLocal$*$main$Local`.Inner): kotlin.Unit -internal final fun local(/*0*/ l: `_DefaultPackage$innerOfLocal$*$main$Local`): kotlin.Unit +internal final fun inner(/*0*/ i: `InnerOfLocalKt$main$Local`.Inner): kotlin.Unit +internal final fun local(/*0*/ l: `InnerOfLocalKt$main$Local`): kotlin.Unit diff --git a/compiler/testData/serialization/local/localClassInSignature.txt b/compiler/testData/serialization/local/localClassInSignature.txt index fbfc1a90a3b..6d59e84375d 100644 --- a/compiler/testData/serialization/local/localClassInSignature.txt +++ b/compiler/testData/serialization/local/localClassInSignature.txt @@ -1,7 +1,7 @@ -local open class `_DefaultPackage$localClassInSignature$*$main$Local` +local open class `LocalClassInSignatureKt$main$Local` -public constructor `_DefaultPackage$localClassInSignature$*$main$Local`() -internal final val returnType: `_DefaultPackage$localClassInSignature$*$main$Local` -internal final fun generic(/*0*/ t: T): U -internal final fun param(/*0*/ l: `_DefaultPackage$localClassInSignature$*$main$Local`): kotlin.Unit -internal final fun `_DefaultPackage$localClassInSignature$*$main$Local`.receiver(): `_DefaultPackage$localClassInSignature$*$main$Local` +public constructor `LocalClassInSignatureKt$main$Local`() +internal final val returnType: `LocalClassInSignatureKt$main$Local` +internal final fun generic(/*0*/ t: T): U +internal final fun param(/*0*/ l: `LocalClassInSignatureKt$main$Local`): kotlin.Unit +internal final fun `LocalClassInSignatureKt$main$Local`.receiver(): `LocalClassInSignatureKt$main$Local` diff --git a/compiler/testData/serialization/local/simpleInTopLevelFunction.txt b/compiler/testData/serialization/local/simpleInTopLevelFunction.txt index 4d093909b6b..3d1788ad51c 100644 --- a/compiler/testData/serialization/local/simpleInTopLevelFunction.txt +++ b/compiler/testData/serialization/local/simpleInTopLevelFunction.txt @@ -1,3 +1,3 @@ -local final class `_DefaultPackage$simpleInTopLevelFunction$*$main$Local` +local final class `SimpleInTopLevelFunctionKt$main$Local` -public constructor `_DefaultPackage$simpleInTopLevelFunction$*$main$Local`() +public constructor `SimpleInTopLevelFunctionKt$main$Local`() diff --git a/compiler/testData/writeSignature/declarationSiteVariance/OutInField.kt b/compiler/testData/writeSignature/declarationSiteVariance/OutInField.kt index 5b7af727822..86aac6cc5e7 100644 --- a/compiler/testData/writeSignature/declarationSiteVariance/OutInField.kt +++ b/compiler/testData/writeSignature/declarationSiteVariance/OutInField.kt @@ -1,10 +1,10 @@ public val list: List = throw Exception() public val mutList: MutableList = throw Exception() -// field: _DefaultPackage::list +// field: OutInFieldKt::list // jvm signature: Ljava/util/List; // generic signature: Ljava/util/List<+Ljava/lang/String;>; -// field: _DefaultPackage::mutList +// field: OutInFieldKt::mutList // jvm signature: Ljava/util/List; // generic signature: Ljava/util/List; \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java index 39cd53b27b0..c583e1fc978 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java @@ -145,6 +145,12 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes doJvmTest(fileName); } + @TestMetadata("sanitized-name.clash.args") + public void testSanitized_name_clash() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/sanitized-name.clash.args"); + doJvmTest(fileName); + } + @TestMetadata("signatureClash.args") public void testSignatureClash() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/signatureClash.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/OuterClassGenTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/OuterClassGenTest.java index 7e38ba3670e..63aa1cf08ad 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/OuterClassGenTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/OuterClassGenTest.java @@ -76,18 +76,18 @@ public class OuterClassGenTest extends CodegenTestCase { } public void testObjectLiteralInPackageClass() throws Exception { - OuterClassInfo expectedInfo = new OuterClassInfo("foo/FooPackage$outerClassInfo$", null, null); - doCustomTest("foo/FooPackage\\$.+\\$packageObjectLiteral\\$1", expectedInfo, "outerClassInfo"); + OuterClassInfo expectedInfo = new OuterClassInfo("foo/OuterClassInfo", null, null); + doCustomTest("foo/OuterClassInfoKt\\$packageObjectLiteral\\$1", expectedInfo, "outerClassInfo"); } public void testLocalClassInTopLevelFunction() throws Exception { - OuterClassInfo expectedInfo = new OuterClassInfo("foo/FooPackage$outerClassInfo$", "packageMethod", "(Lfoo/Foo;)V"); - doCustomTest("foo/FooPackage\\$.+\\$packageMethod\\$PackageLocalClass", expectedInfo, "outerClassInfo"); + OuterClassInfo expectedInfo = new OuterClassInfo("foo/OuterClassInfo", "packageMethod", "(Lfoo/Foo;)V"); + doCustomTest("foo/OuterClassInfoKt\\$packageMethod\\$PackageLocalClass", expectedInfo, "outerClassInfo"); } public void testLocalObjectInTopLevelFunction() throws Exception { - OuterClassInfo expectedInfo = new OuterClassInfo("foo/FooPackage$outerClassInfo$", "packageMethod", "(Lfoo/Foo;)V"); - doCustomTest("foo/FooPackage\\$.+\\$packageMethod\\$PackageLocalObject", expectedInfo, "outerClassInfo"); + OuterClassInfo expectedInfo = new OuterClassInfo("foo/OuterClassInfo", "packageMethod", "(Lfoo/Foo;)V"); + doCustomTest("foo/OuterClassInfoKt\\$packageMethod\\$PackageLocalObject", expectedInfo, "outerClassInfo"); } public void testLocalObjectInInlineFunction() throws Exception { diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 88a5ba274c1..45e614a0588 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -4557,7 +4557,7 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { @RunWith(JUnit3RunnerWithInners.class) public static class OptimizeImports extends AbstractQuickFixTest { public void testAllFilesPresentInOptimizeImports() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/optimizeImports"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/optimizeImports"), Pattern.compile("^([a-zA-Z0-9]+)\\.kt$"), true); } @TestMetadata("fileRuntime.kt")