我有一个接受隐式参数的方法,并且在代码中已经定义了隐式值。但是,我还没有找到我的代码在哪里创建的。
有没有一种简单的方法可以找到在Scala中定义隐式值的位置?到目前为止,我只是扫描我的导入的源代码,但这是非常乏味的。我正在使用IntelliJ。
发布于 2019-02-11 08:50:18
Intellij插件最近增加了一些特性,用于显式显示:)
您可以按下ctl+alt+shift+++
来显示隐含。
或者参考Travis Brown here的回答。从他的回答中得到的小片段:
scala> import scala.reflect.runtime.universe.reify
import scala.reflect.runtime.universe.reify
scala> reify("a" * 3).tree
res6: reflect.runtime.universe.Tree = Predef.augmentString("a").$times(3)
https://stackoverflow.com/questions/54635012
复制相似问题