Skip to content

Sometimes @tailrec does not compile #6479

@scabug

Description

@scabug

Works for 2.9.1, 2.9.2 and 2.10.0-M2. Does not work for 2.10.0-M7.

object TailrecAfterTryCatch {

  @annotation.tailrec
  final def good1() {
    1 match {
      case 2 => {
        try {
        //  return
        } catch {
          case e: ClassNotFoundException =>
        }
        good1()
      }
    }
  }

  @annotation.tailrec
  final def good2() {
    //1 match {
    //  case 2 => {
        try {
          return
        } catch {
          case e: ClassNotFoundException =>
        }
        good2()
    //  }
    //}
  }

  @annotation.tailrec
  final def good3() {
    val 1 = 2
    try {
      return
    } catch {
      case e: ClassNotFoundException =>
    }
    good3()
  }

  @annotation.tailrec
  final def bad() {
    1 match {
      case 2 => {
        try {
          return
        } catch {
          case e: ClassNotFoundException =>
        }
        bad()
      }
    }
  }

}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions