Showing inferred types of Scala expressions

前端 未结 3 892
梦谈多话
梦谈多话 2021-02-14 20:13

How can I see the types inferred by the Scala compiler for expressions etc.? I have some code with complicated type inference and implicit conversions, and it\'s hard to see wha

3条回答
  •  攒了一身酷
    2021-02-14 20:38

    Hoist the expression to a non-local def or val, without an explicit type - then it will appear in the Outline view in Eclipse, with an inferred type assigned.

    However, this isn't an ideal solution because it requires some work, and it can't be used when recursion is involved.

提交回复
热议问题