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:
@@ -0,0 +1,11 @@
|
||||
package forTests;
|
||||
|
||||
public class SamConversion {
|
||||
public interface Runnable {
|
||||
public abstract void run();
|
||||
}
|
||||
|
||||
public static void doAction(Runnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user