FIR Checker: check tailrec
Difference from FE1.0 * KT-4285: calls to virtual method with default argument should be reported as not tailrec. FE1.0 is missing such cases. * KT-48600: calls inside lambda should be reported as not tailrec. FE1.0 also misses such cases.
This commit is contained in:
committed by
TeamCityServer
parent
5df316a129
commit
8525b4932b
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun noTails()<!> {
|
||||
// nothing here
|
||||
|
||||
-1
@@ -7,7 +7,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
class B {
|
||||
inner class C {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Int {
|
||||
var z = if (x > 3) 3 else x
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Int {
|
||||
if (x == 1) {
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
// KT-16549
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
class TailInline {
|
||||
private inline fun act(action: () -> Unit) {
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// KT-14961
|
||||
// IGNORE_BACKEND: JVM, JS_IR, WASM
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
fun listOfFactor(number: Int): List<Int> {
|
||||
tailrec fun listOfFactor(number: Int, acc: List<Int>): List<Int> {
|
||||
|
||||
-1
@@ -7,7 +7,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo()<!> {
|
||||
bar {
|
||||
|
||||
Vendored
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo()<!> {
|
||||
fun bar() {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Int {
|
||||
return if (x == 1) {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
if (counter == 0) return 0
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
if (counter == 0) return 0
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
if (counter == 0) return 0
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
|
||||
if (counter == 0) return 0
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Int =
|
||||
if (x == 1) {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Int {
|
||||
if (x == 10) {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Int {
|
||||
if (x == 0) {
|
||||
|
||||
Vendored
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun test(go: Boolean) : Unit<!> {
|
||||
if (!go) return
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
class A {
|
||||
tailrec fun f1(c : Int) {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun test(x : Int) : Unit {
|
||||
if (x == 1) {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun withWhen(counter : Int) : Int =
|
||||
when (counter) {
|
||||
|
||||
-1
@@ -7,7 +7,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun withWhen(counter : Int, d : Any) : Int =
|
||||
when (counter) {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
||||
|
||||
tailrec fun withWhen2(counter : Int) : Int =
|
||||
when {
|
||||
|
||||
Reference in New Issue
Block a user