diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/importedFromObject.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/importedFromObject.kt index 202809b635d..b7a741aceca 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/importedFromObject.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/importedFromObject.kt @@ -19,11 +19,11 @@ package org.jetbrains.kotlin.resolve import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.types.TypeSubstitutor -fun FunctionDescriptor.asImportedFromObject(original: FunctionImportedFromObject? = null) = - FunctionImportedFromObject(this, original) +fun FunctionDescriptor.asImportedFromObject(descriptor: FunctionImportedFromObject? = null) = + FunctionImportedFromObject(this, descriptor?.original) -fun PropertyDescriptor.asImportedFromObject(original: PropertyImportedFromObject? = null) = - PropertyImportedFromObject(this, original) +fun PropertyDescriptor.asImportedFromObject(descriptor: PropertyImportedFromObject? = null) = + PropertyImportedFromObject(this, descriptor?.original) abstract class ImportedFromObjectCallableDescriptor( val callableFromObject: TCallable, diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 664efb83189..e31dc7a3581 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -2138,6 +2138,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { 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") public void testManglingStability() throws Exception { runTest("js/js.translator/testData/box/expression/function/manglingStability.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index efa5d676d74..11fd58bcfdb 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -2148,6 +2148,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { 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") public void testManglingStability() throws Exception { runTest("js/js.translator/testData/box/expression/function/manglingStability.kt"); diff --git a/js/js.translator/testData/box/expression/function/manglingImportedFromObjectWithNI.kt b/js/js.translator/testData/box/expression/function/manglingImportedFromObjectWithNI.kt new file mode 100644 index 00000000000..ecdd8961a1e --- /dev/null +++ b/js/js.translator/testData/box/expression/function/manglingImportedFromObjectWithNI.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +NewInference +// EXPECTED_REACHABLE_NODES: 1329 +// Issue: KT-35904 + +import A.bar +import A.bar2 + +object A { + inline fun bar(x: T) = 42 + inline val T.bar2 get() = 42 +} + +fun T.foo1(): Int = bar(this) +fun T.foo2(): Int = this.bar2 + +fun box(): String { + 10.foo1() + 10.foo2() + + return "OK" +} \ No newline at end of file