Consider the following two fragments of code:
scala> def f1(x:Any) = x match { case i:String => i; case _ => null }
f1: (x: Any)String
scala> def f2(x:Any) = x match { case i:Int => i; case _ => null }
f2: (x: Any)Any
Why is f2's return type Any, while f1's is String ? I was expecting either both to return Any or f2 to return Int.