【问题标题】:How turn off/on typer phase in scala repl and sbt console如何在 scala repl 和 sbt 控制台中关闭/打开 typer 阶段
【发布时间】:2014-04-16 17:45:28
【问题描述】:

是否可以在不退出当前会话的情况下切换阶段?我试过进入 :power 模式,但它仍然不打印类型。

【问题讨论】:

    标签: scala console read-eval-print-loop


    【解决方案1】:

    在 SBT 中只需添加以下设置:

    set scalacOptions in (Compile, console) := "-Xprint:typer"
    

    在 REPL 中你可以使用:settings -Xprint:typer

    【讨论】:

    • REPL 在哪个版本的 Scala 中提供了:settings 命令?在 2.10.3 中,我得到“设置:没有这样的命令。键入 :help 寻求帮助。”当我使用您的示例时:settings -Xprint:typer。我也尝试了“电源模式”,结果相同。
    • @RandallSchulz 我有一个 2.11-RC1 版本,所以它只能从 2.11 开始使用
    • 2.11.X 没问题..但是在 sbt 0.13 中,你应该使用set scalacOption in (Compile, console) := Seq("-Xprint:typer")
    • @fairjm 你错过了一个's'。完整命令:set scalacOptions in (Compile, console) := Seq("-Xprint:typer")
    • 或者使用+=而不使用Seq
    猜你喜欢
    • 2019-04-26
    • 1970-01-01
    • 2015-12-14
    • 2014-08-20
    • 1970-01-01
    • 2018-02-20
    • 2012-09-24
    • 2016-09-07
    • 1970-01-01
    相关资源
    最近更新 更多