def decode(l: List[(Int, Symbol)]) : List[Symbol] = {
def foo(r : Int, s: Symbol):List[Symbol] = r match {
case 0 => Nil
case x: Int => s::foo(r-1,s)
}
l match {
case Nil => Nil
case h::tail => foo(h._1 , h._2 ) :+ decode(tail)
}
}
Here I get a compilation error "scala: type mismatch; found:List[Object] required: List[Symbol] case h::tail => foo(h._1 : Int, h._2 : Symbol) :+ decode(tail) "