No need to produce error types when RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED is reported

This commit is contained in:
Andrey Breslav
2013-08-21 20:06:06 +04:00
parent 3f3ee378f3
commit a51ea10f55
8 changed files with 27 additions and 21 deletions
@@ -1,8 +1,9 @@
fun test2(a: Int) {
(run @f{
val x = run @f{
if (a > 0) <!RETURN_NOT_ALLOWED!>return<!>
<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>
}): Int
}
x: Int
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,5 +1,6 @@
fun test2() {
(run @f{<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>}): Int
val x = run @f{<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>}
x: Int
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,10 +1,12 @@
fun test() {
run(@f{<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>}): Int
val x = run(@f{<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>})
x: Int
}
fun test1() {
run(@{<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@ 1<!>}): Int
val x = run(@{<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@ 1<!>})
x: Int
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,11 +1,12 @@
fun test() {
(run @f{
val x = run @f{
fun local(a: Int): String {
if (a > 0) return "2"
return@local "3"
}
<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>
}): Int
}
x: Int
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,10 +1,11 @@
fun test() {
(run @f{
val x = run @f{
run @ff {
<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@ff "2"<!>
}
<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f 1<!>
}): Int
}
x: Int
}
fun run<T>(f: () -> T): T { return f() }
@@ -1,8 +1,9 @@
fun test(a: Int) {
(run @f{
val x = run @f{
if (a > 0) <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f<!>
else <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f Unit.VALUE<!>
}): Unit
}
x: Unit
}
fun run<T>(f: () -> T): T { return f() }
@@ -4,10 +4,11 @@ trait C: A
fun test(a: C, b: B) {
(run @f{
val x = run @f{
if (a != b) <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f a<!>
b
}): A
}
x: A
}
fun run<T>(f: () -> T): T { return f() }