Replace some FIR syntax errors with more proper diagnostics

This commit is contained in:
Mikhail Glukhikh
2020-03-24 19:33:34 +03:00
parent 2f63c8a46a
commit b27152f903
53 changed files with 339 additions and 320 deletions
@@ -1,5 +1,5 @@
fun foo1() = while (b()) {}
fun foo1() = <!EXPRESSION_REQUIRED!>while (b()) {}<!>
fun foo2() = <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>for (i in 10) {}<!>
@@ -19,7 +19,7 @@ class Test3 {
}
fun test4() {
break@test4
<!BREAK_OR_CONTINUE_OUTSIDE_A_LOOP!>break@test4<!>
}
class Test5 {
@@ -43,11 +43,11 @@ class Test6 {
class Test7 {
fun Test7() {
Test8@ while (true) {
break@Test7
<!NOT_A_LOOP_LABEL!>break@Test7<!>
}
Test7@ while (true) {
break@Test8
<!NOT_A_LOOP_LABEL!>break@Test8<!>
}
}
}
@@ -15,7 +15,7 @@ fun main() {
}
//KT-351 Distinguish statement and expression positions
val w = while (true) {}
val w = <!EXPRESSION_REQUIRED!>while (true) {}<!>
fun foo() {
var z = 2
@@ -152,12 +152,12 @@ fun bar(a: Unit) {}
fun testStatementInExpressionContext() {
var z = 34
val a1: Unit = z = 334
val a1: Unit = <!EXPRESSION_REQUIRED!>z = 334<!>
val f = for (i in 1..10) {}
if (true) return z = 34
return while (true) {}
if (true) return <!EXPRESSION_REQUIRED!>z = 34<!>
return <!EXPRESSION_REQUIRED!>while (true) {}<!>
}
fun testStatementInExpressionContext2() {
val a2: Unit = while(true) {}
val a2: Unit = <!EXPRESSION_REQUIRED!>while(true) {}<!>
}