summaryrefslogblamecommitdiff
path: root/test/files/run/finally.scala
blob: 0da616cfdda1a034b06fcd5e91204ab28008a6c7 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                              
                         




                   
                                              






                                        









                                   




                        

    
 
// test that finally is not covered by any exception handlers.
object Test extends App {
  def bar {
    try {
      println("hi")
    }
    catch {
      case e => println("SHOULD NOT GET HERE")
    }
    finally {
      println("In Finally")
      throw new RuntimeException("ouch")
    }
  }

  def m1 {
    try {
      throw new Exception
    } catch {
      case e =>
        println(e);
        return
    } finally println("in finally")
  }

  try {
    bar
  } catch {
    case e => println(e)
  }

  m1
}