[NI] Use original descriptor for functions imported from object during JS mangling
^KT-35904 Fixed
This commit is contained in:
@@ -19,11 +19,11 @@ package org.jetbrains.kotlin.resolve
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
|
|
||||||
fun FunctionDescriptor.asImportedFromObject(original: FunctionImportedFromObject? = null) =
|
fun FunctionDescriptor.asImportedFromObject(descriptor: FunctionImportedFromObject? = null) =
|
||||||
FunctionImportedFromObject(this, original)
|
FunctionImportedFromObject(this, descriptor?.original)
|
||||||
|
|
||||||
fun PropertyDescriptor.asImportedFromObject(original: PropertyImportedFromObject? = null) =
|
fun PropertyDescriptor.asImportedFromObject(descriptor: PropertyImportedFromObject? = null) =
|
||||||
PropertyImportedFromObject(this, original)
|
PropertyImportedFromObject(this, descriptor?.original)
|
||||||
|
|
||||||
abstract class ImportedFromObjectCallableDescriptor<out TCallable : CallableMemberDescriptor>(
|
abstract class ImportedFromObjectCallableDescriptor<out TCallable : CallableMemberDescriptor>(
|
||||||
val callableFromObject: TCallable,
|
val callableFromObject: TCallable,
|
||||||
|
|||||||
+5
@@ -2138,6 +2138,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
|||||||
runTest("js/js.translator/testData/box/expression/function/manglingClashWithFunctionsWithoutParameters.kt");
|
runTest("js/js.translator/testData/box/expression/function/manglingClashWithFunctionsWithoutParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("manglingImportedFromObjectWithNI.kt")
|
||||||
|
public void testManglingImportedFromObjectWithNI() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/expression/function/manglingImportedFromObjectWithNI.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("manglingStability.kt")
|
@TestMetadata("manglingStability.kt")
|
||||||
public void testManglingStability() throws Exception {
|
public void testManglingStability() throws Exception {
|
||||||
runTest("js/js.translator/testData/box/expression/function/manglingStability.kt");
|
runTest("js/js.translator/testData/box/expression/function/manglingStability.kt");
|
||||||
|
|||||||
+5
@@ -2148,6 +2148,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
runTest("js/js.translator/testData/box/expression/function/manglingClashWithFunctionsWithoutParameters.kt");
|
runTest("js/js.translator/testData/box/expression/function/manglingClashWithFunctionsWithoutParameters.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("manglingImportedFromObjectWithNI.kt")
|
||||||
|
public void testManglingImportedFromObjectWithNI() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/expression/function/manglingImportedFromObjectWithNI.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("manglingStability.kt")
|
@TestMetadata("manglingStability.kt")
|
||||||
public void testManglingStability() throws Exception {
|
public void testManglingStability() throws Exception {
|
||||||
runTest("js/js.translator/testData/box/expression/function/manglingStability.kt");
|
runTest("js/js.translator/testData/box/expression/function/manglingStability.kt");
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
// !LANGUAGE: +NewInference
|
||||||
|
// EXPECTED_REACHABLE_NODES: 1329
|
||||||
|
// Issue: KT-35904
|
||||||
|
|
||||||
|
import A.bar
|
||||||
|
import A.bar2
|
||||||
|
|
||||||
|
object A {
|
||||||
|
inline fun <T> bar(x: T) = 42
|
||||||
|
inline val <T> T.bar2 get() = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> T.foo1(): Int = bar(this)
|
||||||
|
fun <T> T.foo2(): Int = this.bar2
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
10.foo1()
|
||||||
|
10.foo2()
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user