you must have the -Xlint flag of the compiler when compiling the code. Looks like this warning was indeed added in 2.11.x. And this is a mistake in scalac ( https://issues.scala-lang.org/browse/SI-9211 ), as if you are removing a type alias (from the orElse argument), it works fine
$ scala -Xlint Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_80). Type in expressions to have them evaluated. Type :help for more information. scala> type Problem = PartialFunction[Any,Unit] defined type alias Problem scala> def moreProblems(problem1: Problem, problem2: Problem) = problem1 orElse problem2 <console>:8: warning: a type was inferred to be `Any`; this may indicate a programming error. def moreProblems(problem1: Problem, problem2: Problem) = problem1 orElse problem2 ^ moreProblems: (problem1: Problem, problem2: Problem)PartialFunction[Any,Unit] scala> def moreProblems(problem1: PartialFunction[Any, Unit], problem2: Problem) = problem1 orElse problem2 <console>:8: warning: a type was inferred to be `Any`; this may indicate a programming error. def moreProblems(problem1: PartialFunction[Any, Unit], problem2: Problem) = problem1 orElse problem2 ^ moreProblems: (problem1: PartialFunction[Any,Unit], problem2: Problem)PartialFunction[Any,Unit] scala> def moreProblems(problem1: Problem, problem2: PartialFunction[Any, Unit]) = problem1 orElse problem2 moreProblems: (problem1: Problem, problem2: PartialFunction[Any,Unit])PartialFunction[Any,Unit]
source share