Fix argument mapping for lambda arguments and default arguments
Maybe for other elements ValueArgument itself used as SourceElement
This commit is contained in:
+4
-2
@@ -167,15 +167,17 @@ internal class FirWrapperResolvedCall(val firSimpleWrapperCall: FirSimpleWrapper
|
|||||||
val firArguments = firCall.withFir { it.argumentMapping } ?: context.implementationPostponed()
|
val firArguments = firCall.withFir { it.argumentMapping } ?: context.implementationPostponed()
|
||||||
val argumentExpression = valueArgument.getArgumentExpression() ?: context.implementationPostponed()
|
val argumentExpression = valueArgument.getArgumentExpression() ?: context.implementationPostponed()
|
||||||
|
|
||||||
|
fun FirExpression.isMyArgument() = realPsi === valueArgument || realPsi === argumentExpression
|
||||||
|
|
||||||
var targetFirParameter: FirValueParameter? = null
|
var targetFirParameter: FirValueParameter? = null
|
||||||
outer@ for ((firExpression, firValueParameter) in firArguments.entries) {
|
outer@ for ((firExpression, firValueParameter) in firArguments.entries) {
|
||||||
if (firExpression is FirVarargArgumentsExpression) {
|
if (firExpression is FirVarargArgumentsExpression) {
|
||||||
for (subExpression in firExpression.arguments)
|
for (subExpression in firExpression.arguments)
|
||||||
if (subExpression.realPsi === argumentExpression) {
|
if (subExpression.isMyArgument()) {
|
||||||
targetFirParameter = firValueParameter
|
targetFirParameter = firValueParameter
|
||||||
break@outer
|
break@outer
|
||||||
}
|
}
|
||||||
} else if (firExpression.realPsi === argumentExpression) {
|
} else if (firExpression.isMyArgument()) {
|
||||||
targetFirParameter = firValueParameter
|
targetFirParameter = firValueParameter
|
||||||
break@outer
|
break@outer
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(fn: () -> Boolean) : Boolean = true
|
operator fun contains(fn: () -> Boolean) : Boolean = true
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(fn: () -> Boolean) : Boolean = true
|
operator fun contains(fn: () -> Boolean) : Boolean = true
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(fn: () -> Boolean) : Boolean = true
|
operator fun contains(fn: () -> Boolean) : Boolean = true
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(fn: () -> Boolean) : Boolean = true
|
operator fun contains(fn: () -> Boolean) : Boolean = true
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(fn: () -> Boolean) : Boolean = true
|
operator fun contains(fn: () -> Boolean) : Boolean = true
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(fn: () -> Boolean) : Boolean = true
|
operator fun contains(fn: () -> Boolean) : Boolean = true
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun <T> doSomething(a: T) {}
|
fun <T> doSomething(a: T) {}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun <T> doSomething(a: T) {}
|
fun <T> doSomething(a: T) {}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
-2
@@ -1,7 +1,5 @@
|
|||||||
// IS_APPLICABLE: false
|
// IS_APPLICABLE: false
|
||||||
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
|
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
|
||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
|
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
// IS_APPLICABLE: false
|
// IS_APPLICABLE: false
|
||||||
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
|
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
|
||||||
// IGNORE_FE10_BINDING_BY_FIR
|
|
||||||
fun test() {
|
fun test() {
|
||||||
class Test{
|
class Test{
|
||||||
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
|
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
|
||||||
|
|||||||
Reference in New Issue
Block a user