FIR checker: report tailrec problems on the keyword
FE1.0 reports it on the declaration signature. This is not ideal so we move it to the `tailrec` keyword in FIR.
This commit is contained in:
committed by
teamcityserver
parent
922ae607f6
commit
5252effb10
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun noTails()<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun noTails() {
|
||||
// nothing here
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class B {
|
||||
}
|
||||
}
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun h2(x : Any)<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun h2(x : Any) {
|
||||
this@B.h2("no recursion") // keep vigilance
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo()<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun foo() {
|
||||
bar {
|
||||
<!NON_TAIL_RECURSIVE_CALL!>foo<!>()
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo()<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun foo() {
|
||||
fun bar() {
|
||||
<!NON_TAIL_RECURSIVE_CALL!>foo<!>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun test(counter : Int) : Int {
|
||||
if (counter == 0) return 0
|
||||
|
||||
try {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun test(counter : Int) : Int {
|
||||
if (counter == 0) return 0
|
||||
|
||||
try {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun test(counter : Int) : Int {
|
||||
if (counter == 0) return 0
|
||||
|
||||
try {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun test(counter : Int) : Int {
|
||||
if (counter == 0) return 0
|
||||
|
||||
try {
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(go: Boolean) : Unit<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun test(go: Boolean) : Unit {
|
||||
if (!go) return
|
||||
try {
|
||||
<!TAIL_RECURSION_IN_TRY_IS_NOT_SUPPORTED!>test<!>(false)
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ class A {
|
||||
}
|
||||
}
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun f3(a : A)<!> {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec<!> fun f3(a : A) {
|
||||
a.<!NON_TAIL_RECURSIVE_CALL!>f3<!>(a) // non-tail recursion, could be potentially resolved by condition if (a == this) f3() else a.f3()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user