Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/localFactorial.kt
T
Marco Pennekamp 2cdcdce6ed [LL FIR] KT-55327 Use body resolve return type calculator for locals
- LL FIR uses `ReturnTypeCalculatorWithJump` by default because it
  cannot guarantee that the implicit types of non-local functions
  referenced in a function `f` have been resolved during body resolve
  of `f`.
- However, if `ReturnTypeCalculatorWithJump` encountered a local
  function, it tried to resolve its return type even during body
  resolve of that same local function. The fix delegates to
  `ReturnTypeCalculatorForFullBodyResolve`, which should be used for
  local declarations.

^KT-55327 fixed
^KT-55324 fixed
2023-01-02 14:03:42 +01:00

12 lines
357 B
Kotlin
Vendored

// See KT-6271
fun foo() {
fun fact(n: Int) = {
if (n > 0) {
<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!><!DEBUG_INFO_MISSING_UNRESOLVED!>fact<!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>n<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>-<!> 1)<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>*<!> n
}
else {
1
}
}
}