Report RETURN_NOT_ALLOWED and RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY only on the return with label (KT-13340)

#KT-13340 Fixed
This commit is contained in:
Nikolay Krasko
2016-08-04 13:29:44 +03:00
parent 95ea191442
commit 300e0acd27
21 changed files with 70 additions and 32 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ fun blockNoReturnIfUnitInOneBranch(): Int {
fun nonBlockReturnIfEmptyIf(): Int = if (1 < 2) <error>{}</error> else <error>{}</error>
fun nonBlockNoReturnIfUnitInOneBranch(): Int = if (1 < 2) <error>{}</error> else 2
val a = <error>return 1</error>
val a = <error>return</error> 1
class A() {
}
@@ -1 +1 @@
<error descr="[RETURN_NOT_ALLOWED] 'return' is not allowed here">return a</error>
<error descr="[RETURN_NOT_ALLOWED] 'return' is not allowed here">return</error> a
+1 -1
View File
@@ -1 +1 @@
@file:<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: suppress">suppress</error>(<error descr="[RETURN_NOT_ALLOWED] 'return' is not allowed here"><error descr="[RETURN_NOT_ALLOWED] 'return' is not allowed here">return <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a">a</error></error></error></error>)
@file:<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: suppress">suppress</error>(<error descr="[RETURN_NOT_ALLOWED] 'return' is not allowed here"><error descr="[RETURN_NOT_ALLOWED] 'return' is not allowed here">return</error></error> <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: a">a</error></error>)