How does the type inferencer work on reduceLeft?
问题 Further to my other question about reduceLeft , the signature of reduceLeft on Seq is def reduceLeft [B >: A] (f: (B, A) ⇒ B): B and we can call it with expressions such as List(1,2,3,4) reduceLeft (_ + _) In this example A is Int , so reduceLeft expects a Function2[B >: Int, Int, B] . Regardless of how reduceLeft works (which is irrelevant), how does the type inferencer know that B has a + method, when it could be of type Any ? 回答1: I think the section 6.26.4 Local Type Inference of the spec