Don't create substituted copy of invoke descriptor with unchanged names
#KT-34919 Fixed
This commit is contained in:
+6
@@ -31560,6 +31560,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionTypeInTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeWithParameterNameVisibility.kt")
|
||||
public void testFunctionalTypeWithParameterNameVisibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionalTypeWithParameterNameVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericTypeAliasConstructor.kt")
|
||||
public void testGenericTypeAliasConstructor() throws Exception {
|
||||
|
||||
+6
@@ -31560,6 +31560,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionTypeInTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeWithParameterNameVisibility.kt")
|
||||
public void testFunctionalTypeWithParameterNameVisibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionalTypeWithParameterNameVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericTypeAliasConstructor.kt")
|
||||
public void testGenericTypeAliasConstructor() throws Exception {
|
||||
|
||||
+6
@@ -31560,6 +31560,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionTypeInTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeWithParameterNameVisibility.kt")
|
||||
public void testFunctionalTypeWithParameterNameVisibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionalTypeWithParameterNameVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericTypeAliasConstructor.kt")
|
||||
public void testGenericTypeAliasConstructor() throws Exception {
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
typealias TA<X, Y> = (x: X) -> Y
|
||||
abstract class Base<X, Y> : TA<X, Y>
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Impl<!> : Base<Any, Any>()
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
typealias TA<X, Y> = (x: X) -> Y
|
||||
abstract class Base<X, Y> : TA<X, Y>
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class Impl<!> : Base<Any, Any>()
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public abstract class Base</*0*/ X, /*1*/ Y> : TA<X, Y> /* = (x: X) -> Y */ {
|
||||
public constructor Base</*0*/ X, /*1*/ Y>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ x: X): Y
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Impl : Base<kotlin.Any, kotlin.Any> {
|
||||
public constructor Impl()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ x: kotlin.Any): kotlin.Any
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
public typealias TA</*0*/ X, /*1*/ Y> = (x: X) -> Y
|
||||
|
||||
Generated
+6
@@ -31650,6 +31650,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionTypeInTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionalTypeWithParameterNameVisibility.kt")
|
||||
public void testFunctionalTypeWithParameterNameVisibility() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/typealias/functionalTypeWithParameterNameVisibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericTypeAliasConstructor.kt")
|
||||
public void testGenericTypeAliasConstructor() throws Exception {
|
||||
|
||||
+3
@@ -85,6 +85,9 @@ class FunctionInvokeDescriptor private constructor(
|
||||
private fun replaceParameterNames(parameterNames: List<Name?>): FunctionDescriptor {
|
||||
val indexShift = valueParameters.size - parameterNames.size
|
||||
assert(indexShift == 0 || indexShift == 1) // indexShift == 1 for extension function type
|
||||
if (indexShift == 0 && parameterNames.zip(valueParameters).all { (name, parameter) -> name == parameter.name }) {
|
||||
return this
|
||||
}
|
||||
|
||||
val newValueParameters = valueParameters.map {
|
||||
var newName = it.name
|
||||
|
||||
Reference in New Issue
Block a user