"invoke" from function types do not have any meaningful parameter names
This commit is contained in:
+8
-7
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.synthetic
|
||||
import com.intellij.util.SmartList
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.load.java.sam.SingleAbstractMethodUtils
|
||||
@@ -161,11 +160,13 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
|
||||
newOwner: DeclarationDescriptor,
|
||||
newModality: Modality,
|
||||
newVisibility: Visibility,
|
||||
newIsOperator: Boolean,
|
||||
newIsInfix: Boolean,
|
||||
newIsExternal: Boolean,
|
||||
newIsInline: Boolean,
|
||||
newIsTailrec: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExternal: Boolean,
|
||||
isInline: Boolean,
|
||||
isTailrec: Boolean,
|
||||
hasStableParameterNames: Boolean,
|
||||
hasSynthesizedParameterNames: Boolean,
|
||||
original: FunctionDescriptor?,
|
||||
copyOverrides: Boolean,
|
||||
kind: CallableMemberDescriptor.Kind,
|
||||
@@ -178,7 +179,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
|
||||
): FunctionDescriptor? {
|
||||
val descriptor = super.doSubstitute(
|
||||
originalSubstitutor, newOwner, newModality, newVisibility,
|
||||
newIsOperator, newIsInfix, newIsExternal, newIsInline, newIsTailrec, original,
|
||||
isOperator, isInfix, isExternal, isInline, isTailrec, hasStableParameterNames, hasSynthesizedParameterNames, original,
|
||||
copyOverrides, kind, newValueParameterDescriptors, newExtensionReceiverParameterType, newReturnType, name,
|
||||
preserveSource, signatureChange)
|
||||
as MyFunctionDescriptor? ?: return null
|
||||
|
||||
@@ -87,6 +87,8 @@ private fun createSynthesizedFunctionWithFirstParameterAsReceiver(descriptor: Fu
|
||||
result.isExternal = original.isExternal
|
||||
result.isInline = original.isInline
|
||||
result.isTailrec = original.isTailrec
|
||||
result.setHasStableParameterNames(false);
|
||||
result.setHasSynthesizedParameterNames(true);
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ class A(foo: Int.() -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
fun test(foo: Int.() -> Unit) {
|
||||
4.foo()
|
||||
fun test(foo: Int.(String) -> Unit) {
|
||||
4.foo("")
|
||||
4.foo(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>p1<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
4.foo(<!NAMED_ARGUMENTS_NOT_ALLOWED!>p2<!> = "")
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ foo: kotlin.Int.() -> kotlin.Unit): kotlin.Unit
|
||||
public fun test(/*0*/ foo: kotlin.Int.(kotlin.String) -> kotlin.Unit): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A(/*0*/ foo: kotlin.Int.() -> kotlin.Unit)
|
||||
|
||||
+2
-2
@@ -22,6 +22,6 @@ fun test2(f: (String) -> Unit) {
|
||||
|
||||
fun test3(f: String.(String) -> Unit) {
|
||||
"".f("")
|
||||
"".f(<!NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
"".f(<!NAMED_PARAMETER_NOT_FOUND!>zzz<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
"".f(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
"".f(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>zzz<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ fun test(a: A) {
|
||||
|
||||
Resolved call:
|
||||
|
||||
Resulting descriptor: operator fun invoke(p1: Int): Int defined in kotlin.Function1
|
||||
Resulting descriptor: operator fun invoke(Int): Int defined in kotlin.Function1
|
||||
|
||||
Explicit receiver kind = DISPATCH_RECEIVER
|
||||
Dispatch receiver = foo {Function1<Int, Int>}
|
||||
|
||||
Reference in New Issue
Block a user