The following definition does not raise any warnings on scala 2.10.4:
class NoWarning[T] {
def f: PartialFunction[Any, T] = { case x: List[T] => x.head }
}
However, this does (as expected) on scala 2.10.4, but not on 2.11.1:
class WithWarning {
def f[T]: PartialFunction[Any, T] = { case x: List[T] => x.head }
}
- Why does the first definition not trigger a warning at all?
- Why does the second definition not trigger a warning on scala 2.11.1?
source
share