The method have a implicit parameter can not be reference as argument ? In my code ,i create a method that have a implicit parameter. Some time i just want to transfer it to other method . In this time Scala give me error. See below:
case class ComplicatedSalesTaxData(baseRate: Float,isTaxHoliday: Boolean)
def calcText(amount: Float,rate : (ComplicatedSalesTaxData) => Float ) : Float = amount * rate(ComplicatedSalesTaxData(0.06F,false))
def rate(implicit cstd:ComplicatedSalesTaxData) = {
if(cstd.isTaxHoliday)
cstd.baseRate
else
0.01F }
calcText(100F,rate) // will get error : could not find implicit value for parameter cstd: ComplicatedSalesTaxData
implicitinstance ofComplicatedSalesTaxData?