Amend "Terminate preceding call with semicolon" quickfix

Quickfix wasn't aware of cases, when expression to be fixed
 is a part of parent call expression or dot-qualified expression.
 Incorrect position for extracting trailing lambdas led to broken
 formatting.

 #KT-34694 Fixed
This commit is contained in:
Pavel Kirpichenkov
2019-11-09 18:06:58 +03:00
parent 0f638db3e5
commit f1934fa49d
10 changed files with 196 additions and 29 deletions
@@ -0,0 +1,10 @@
// "Terminate preceding call with semicolon" "true"
fun doSomething() {}
fun Any.foo() {}
fun test() {
doSomething().foo()
// comment and formatting
{ doSomething()<caret> }()
}
@@ -0,0 +1,10 @@
// "Terminate preceding call with semicolon" "true"
fun doSomething() {}
fun Any.foo() {}
fun test() {
doSomething().foo();
// comment and formatting
{ doSomething() }()
}
@@ -0,0 +1,9 @@
// "Terminate preceding call with semicolon" "true"
fun foo() {}
fun test {
foo()
// comment and formatting
{ { { foo() }<caret> } }()()()
}
@@ -0,0 +1,9 @@
// "Terminate preceding call with semicolon" "true"
fun foo() {}
fun test {
foo();
// comment and formatting
{ { { foo() } } }()()()
}
@@ -0,0 +1,7 @@
// "Terminate preceding call with semicolon" "true"
fun foo() {
15.toString()
// comment and formatting
{<caret>}
}
@@ -0,0 +1,7 @@
// "Terminate preceding call with semicolon" "true"
fun foo() {
15.toString();
// comment and formatting
{}
}
@@ -0,0 +1,7 @@
// "Terminate preceding call with semicolon" "true"
fun foo() {
{ "first" }.invoke()
// comment and formatting
{<caret> "second" }.invoke()
}
@@ -0,0 +1,7 @@
// "Terminate preceding call with semicolon" "true"
fun foo() {
{ "first" }.invoke();
// comment and formatting
{ "second" }.invoke()
}