我有以下代码
def sendMoney[T <: MoneyType](fn: T => Future[T], input: T): Unit
就是这样称呼的
case x: Any => (sendMoney(_, _).tupled(x match {
case c: HoldsMoney => (createHold(_: HoldsMoney), c: HoldsMoney)
case r: ReserveMoney => (createReserve(_: ReserveMoney), r: ReserveMoney)
})
HoldsMoney
并ReserveMoney
具有MoneyType
.
Scala 编译器抛出以下错误。
missing parameter type for expanded function
请注意,如果
x match {
case c: HoldsMoney => sendMoney(createHold(_: HoldsMoney), c)
case r: ReserveMoney => sendMoney(createReserve(_: ReserveMoney), r)
}