Fix search of correspondent call expression by element (KT-11234)

getStrictParentOfType() looks for nearest parent of given type

In complex expressions like:

SamConversion.doAction({
  inlineCall {
    {
      // here <--
    }()
  }
})

doAction was found twice, while inlineCall was skipped.

See code:
// call(param, { <it> })
lambdaExpression?.typedParent<KtValueArgument>()?.typedParent<KtValueArgumentList>()?.typedParent<KtCallExpression>() ?:

// call { <it> }
lambdaExpression?.typedParent<KtLambdaArgument>()?.typedParent<KtCallExpression>()

 #KT-11234 Fixed
This commit is contained in:
Nikolay Krasko
2017-03-03 16:02:39 +03:00
parent b240ae791c
commit 2719016539
7 changed files with 88 additions and 1 deletions
@@ -0,0 +1,11 @@
package forTests;
public class SamConversion {
public interface Runnable {
public abstract void run();
}
public static void doAction(Runnable runnable) {
runnable.run();
}
}