[Common IR] Do not add internal methods to overrides

[JS IR] Use a module name in JsFunctionSignature for internal methods

^KT-60635 Fixed
This commit is contained in:
Alexander Korepanov
2023-08-09 16:35:59 +00:00
committed by Space Team
parent 788fa5d545
commit 7a31167e0b
51 changed files with 1171 additions and 12 deletions
@@ -385,6 +385,12 @@ public class JsFirInvalidationPerFileTestGenerated extends AbstractJsFirInvalida
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
}
@Test
@TestMetadata("openClassWithInternalField")
public void testOpenClassWithInternalField() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/openClassWithInternalField/");
}
@Test
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
@@ -385,6 +385,12 @@ public class JsFirInvalidationPerModuleTestGenerated extends AbstractJsFirInvali
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
}
@Test
@TestMetadata("openClassWithInternalField")
public void testOpenClassWithInternalField() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/openClassWithInternalField/");
}
@Test
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
@@ -385,6 +385,12 @@ public class JsIrES6InvalidationPerFileTestGenerated extends AbstractJsIrES6Inva
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
}
@Test
@TestMetadata("openClassWithInternalField")
public void testOpenClassWithInternalField() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/openClassWithInternalField/");
}
@Test
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
@@ -385,6 +385,12 @@ public class JsIrES6InvalidationPerModuleTestGenerated extends AbstractJsIrES6In
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
}
@Test
@TestMetadata("openClassWithInternalField")
public void testOpenClassWithInternalField() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/openClassWithInternalField/");
}
@Test
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
@@ -385,6 +385,12 @@ public class JsIrInvalidationPerFileTestGenerated extends AbstractJsIrInvalidati
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
}
@Test
@TestMetadata("openClassWithInternalField")
public void testOpenClassWithInternalField() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/openClassWithInternalField/");
}
@Test
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
@@ -385,6 +385,12 @@ public class JsIrInvalidationPerModuleTestGenerated extends AbstractJsIrInvalida
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
}
@Test
@TestMetadata("openClassWithInternalField")
public void testOpenClassWithInternalField() throws Exception {
runTest("js/js.translator/testData/incremental/invalidation/openClassWithInternalField/");
}
@Test
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
@@ -1505,6 +1505,30 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
}
@Test
@TestMetadata("internalMethodOverrideInFriendModule.kt")
public void testInternalMethodOverrideInFriendModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInFriendModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideInOtherModule.kt")
public void testInternalMethodOverrideInOtherModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInOtherModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideMultipleInheritance.kt")
public void testInternalMethodOverrideMultipleInheritance() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideMultipleInheritance.kt");
}
@Test
@TestMetadata("internalMethodOverridePublishedApi.kt")
public void testInternalMethodOverridePublishedApi() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverridePublishedApi.kt");
}
@Test
@TestMetadata("jsName.kt")
public void testJsName() throws Exception {
@@ -1505,6 +1505,30 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
}
@Test
@TestMetadata("internalMethodOverrideInFriendModule.kt")
public void testInternalMethodOverrideInFriendModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInFriendModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideInOtherModule.kt")
public void testInternalMethodOverrideInOtherModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInOtherModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideMultipleInheritance.kt")
public void testInternalMethodOverrideMultipleInheritance() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideMultipleInheritance.kt");
}
@Test
@TestMetadata("internalMethodOverridePublishedApi.kt")
public void testInternalMethodOverridePublishedApi() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverridePublishedApi.kt");
}
@Test
@TestMetadata("jsName.kt")
public void testJsName() throws Exception {
@@ -1505,6 +1505,30 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
}
@Test
@TestMetadata("internalMethodOverrideInFriendModule.kt")
public void testInternalMethodOverrideInFriendModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInFriendModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideInOtherModule.kt")
public void testInternalMethodOverrideInOtherModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInOtherModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideMultipleInheritance.kt")
public void testInternalMethodOverrideMultipleInheritance() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideMultipleInheritance.kt");
}
@Test
@TestMetadata("internalMethodOverridePublishedApi.kt")
public void testInternalMethodOverridePublishedApi() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverridePublishedApi.kt");
}
@Test
@TestMetadata("jsName.kt")
public void testJsName() throws Exception {
@@ -1505,6 +1505,30 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/bridges/innerClassTypeParameters.kt");
}
@Test
@TestMetadata("internalMethodOverrideInFriendModule.kt")
public void testInternalMethodOverrideInFriendModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInFriendModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideInOtherModule.kt")
public void testInternalMethodOverrideInOtherModule() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideInOtherModule.kt");
}
@Test
@TestMetadata("internalMethodOverrideMultipleInheritance.kt")
public void testInternalMethodOverrideMultipleInheritance() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverrideMultipleInheritance.kt");
}
@Test
@TestMetadata("internalMethodOverridePublishedApi.kt")
public void testInternalMethodOverridePublishedApi() throws Exception {
runTest("compiler/testData/codegen/box/bridges/internalMethodOverridePublishedApi.kt");
}
@Test
@TestMetadata("jsName.kt")
public void testJsName() throws Exception {
@@ -0,0 +1,4 @@
abstract class A {
internal var prop: Int = 0
internal fun func(): Int = 0
}
@@ -0,0 +1,4 @@
abstract class A {
internal var prop: Int = 1
internal fun func(): Int = 1
}
@@ -0,0 +1,2 @@
abstract class A {
}
@@ -0,0 +1,4 @@
abstract class A {
internal var prop: Int = 3
internal fun func(): Int = 3
}
@@ -0,0 +1,7 @@
fun testProp(a: A): Int {
return a.prop
}
fun testFunc(a: A): Int {
return a.func()
}
@@ -0,0 +1,7 @@
fun testProp(a: A): Int {
return 2
}
fun testFunc(a: A): Int {
return 2
}
@@ -0,0 +1,7 @@
fun testProp(a: A): Int {
return a.prop
}
fun testFunc(a: A): Int {
return a.func()
}
@@ -0,0 +1,19 @@
STEP 0:
modifications:
U : A.0.kt -> A.kt
U : l1.0.kt -> l1.kt
added file: A.kt, l1.kt
STEP 1:
modifications:
U : A.1.kt -> A.kt
modified ir: A.kt
STEP 2:
modifications:
U : A.2.kt -> A.kt
U : l1.2.kt -> l1.kt
modified ir: A.kt, l1.kt
STEP 3:
modifications:
U : A.3.kt -> A.kt
U : l1.3.kt -> l1.kt
modified ir: A.kt, l1.kt
@@ -0,0 +1,6 @@
class B: A() {
val prop: Int
get() = 10000
fun func(): Int = 20000
}
@@ -0,0 +1,12 @@
fun box(stepId: Int): String {
val prop = testProp(B())
if (prop != stepId) {
return "Fail prop: $prop != $stepId"
}
val func = testFunc(B())
if (func != stepId) {
return "Fail func: $func != $stepId"
}
return "OK"
}
@@ -0,0 +1,8 @@
STEP 0:
dependencies: lib1
modifications:
U : B.0.kt -> B.kt
U : m.0.kt -> m.kt
added file: m.kt, B.kt
STEP 1..3:
dependencies: lib1
@@ -0,0 +1,18 @@
MODULES: lib1, main
STEP 0:
libs: lib1, main
dirty js modules: lib1, main
dirty js files: lib1/l1, lib1/A, main/B, main/m, main/m.export, main
STEP 1:
libs: lib1, main
dirty js modules: lib1
dirty js files: lib1/A
STEP 2:
libs: lib1, main
dirty js modules: lib1
dirty js files: lib1/l1, lib1/A
STEP 3:
libs: lib1, main
dirty js modules: lib1
dirty js files: lib1/l1, lib1/A