jua*_*aid 0 scala intellij-idea
我有一个方法可以接受隐式参数,并且在代码中某个位置已定义了隐式值。但是,我无法找到我的代码在哪里创建了它。
有没有一种简单的方法可以找到在Scala中定义了隐式值的位置?到目前为止,我只是在扫描导入的源代码,但这非常繁琐。我正在使用IntelliJ。
Intellij scala插件最近添加了可显式显示隐式特性的功能:)
您可以按ctl+alt+shift+++显示隐式。
或在这里引用Travis Brown的答案。他的回答的小片段:
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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
104 次 |
| 最近记录: |