Added return type check for non-local return (despite it is prohibited yet)
This commit is contained in:
@@ -5,11 +5,12 @@ fun unitEmpty() : Unit {}
|
||||
fun unitEmptyReturn() : Unit {return}
|
||||
fun unitIntReturn() : Unit {return <!TYPE_MISMATCH!>1<!>}
|
||||
fun unitUnitReturn() : Unit {return ()}
|
||||
fun test1() : Any = {<!RETURN_NOT_ALLOWED!>return<!>}
|
||||
fun test1() : Any = {<!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return<!>}
|
||||
fun test2() : Any = @a {return@a 1}
|
||||
fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> }
|
||||
fun test4(): fun(): Unit = { <!RETURN_NOT_ALLOWED!>return@test4<!> }
|
||||
fun test4(): fun(): Unit = { <!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return@test4<!> }
|
||||
fun test5(): Any = @{ return@ }
|
||||
fun test5(): Any = {<!RETURN_NOT_ALLOWED!>return 1<!>}
|
||||
|
||||
fun bbb() {
|
||||
return <!TYPE_MISMATCH!>1<!>
|
||||
|
||||
@@ -23,7 +23,7 @@ fun t2() : String {
|
||||
if (true) {
|
||||
return@ 1
|
||||
}
|
||||
<!RETURN_NOT_ALLOWED!>return <!TYPE_MISMATCH!>"s"<!><!>
|
||||
<!RETURN_NOT_ALLOWED!>return "s"<!>
|
||||
}
|
||||
return "s"
|
||||
}
|
||||
@@ -32,10 +32,10 @@ fun t3() : String {
|
||||
invoker(
|
||||
@{
|
||||
if (true) {
|
||||
<!RETURN_NOT_ALLOWED!>return@t3 <!TYPE_MISMATCH!>"1"<!><!>
|
||||
<!RETURN_NOT_ALLOWED!>return@t3 "1"<!>
|
||||
}
|
||||
else {
|
||||
<!RETURN_NOT_ALLOWED!>return <!TYPE_MISMATCH!>"2"<!><!>
|
||||
<!RETURN_NOT_ALLOWED!>return <!ERROR_COMPILE_TIME_VALUE!>2<!><!>
|
||||
}
|
||||
return@ 0
|
||||
}
|
||||
@@ -47,7 +47,7 @@ fun t3() : String {
|
||||
)
|
||||
invoker(
|
||||
{
|
||||
<!RETURN_NOT_ALLOWED!>return <!TYPE_MISMATCH!>"0"<!><!>
|
||||
<!RETURN_NOT_ALLOWED!>return "0"<!>
|
||||
}
|
||||
)
|
||||
return "2"
|
||||
|
||||
Reference in New Issue
Block a user