Analysis API: add test for getReturnExpressionTargetSymbol

Also fix FIR and FE1.0 implementations.
This commit is contained in:
Tianyu Geng
2021-11-16 19:59:43 -08:00
committed by Ilya Kirillov
parent 7aef45d5cf
commit d0d1c8c4b9
16 changed files with 269 additions and 27 deletions
@@ -0,0 +1,22 @@
fun test() {
run {
return@run/* <anonymous>@(2,9) */
}
run {
return@test/* test@(1,1) */
}
run a@{
return@a/* <anonymous>@(8,11) */
}
run {
with("") {
return@with/* <anonymous>@(12,18) */
return@run/* <anonymous>@(11,9) */
return@test/* test@(1,1) */
}
}
}
val i = a@{
return@a/* <anonymous>@(20,11) */
}
@@ -0,0 +1,36 @@
fun foo() {
return/* foo@(1,1) */
}
fun bar(): String {
return/* bar@(5,1) */""
}
fun baz(): Int {
if (true) {
return/* baz@(9,1) */1
} else {
return/* baz@(9,1) */2
}
}
fun quux(): Int {
while(true) {
return/* quux@(17,1) */1
}
return/* quux@(17,1) */2
}
fun test() {
run {
return/* test@(24,1) */
}
fun() {
return/* null@(28,5) */
}
run {
with("") {
return/* test@(24,1) */
}
}
}
@@ -1,8 +0,0 @@
fun /* EXPECTED_TARGET */x(): Int {
receiveLambda {
return<caret> 1
}
return 2
}
inline fun receiveLambda(x: () -> Unit){}
@@ -1,3 +0,0 @@
fun /* EXPECTED_TARGET */x(): Int {
return<caret> 1
}
@@ -1,3 +0,0 @@
fun /* EXPECTED_TARGET */x(): Int {
return<caret> 1
}
@@ -1,8 +0,0 @@
fun x(): Int {
receiveLambda { /* EXPECTED_TARGET */
return@receiveLambda<caret> 1
}
return 2
}
fun receiveLambda(x: () -> Int){}
@@ -0,0 +1,11 @@
fun test() {
return@blah/* null */
}
val i = {
return/* null */
}
val i = {
return@i/* null */
}