field method takes a
=> Unit function as parameter. Hence,
_.age, which is equivalent
x => x.age, is typechecked as
Unit. The compiler warns
that you are using a pure expression
x.age) in statement position
Unit), which basically
means that the expression is useless, and might as
well be removed.
There is a very simple symptomatic solution to
your problem: replace
m: T => Unit
m: T => Any. Now your
x.age is not in statement
position anymore, and the compiler is happy.
But your code suggests that there is something
wrong a little bit deeper, since you obviously
don't use the result of
m for anyway?