how to find the implicit function or variables in scala

前端 未结 2 1974
一个人的身影
一个人的身影 2021-01-02 17:27

I can\'t find the implicit conversions or implicit argument values being used in Scala code. This makes reading open source projects very confusing.

The implic

2条回答
  •  梦谈多话
    2021-01-02 17:55

    One trick that has been covered on SO:

    scala> import reflect.runtime._,universe._
    import reflect.runtime._
    import universe._
    
    scala> reify { "abc".size }
    res1: reflect.runtime.universe.Expr[Int] = Expr[Int](Predef.augmentString("abc").size)
    

    Recent REPL:

    scala> 3 until 4 //print
       scala.Predef.intWrapper(3).until(4) // : scala.collection.immutable.Range
    

提交回复
热议问题