【问题标题】:Exception::raise(): Unimplemented Parser Node: EmptyElse异常::raise():未实现的解析器节点:EmptyElse
【发布时间】:2022-08-05 03:17:35
【问题描述】:

在 Rails 应用程序中运行 srb init 时,我得到以下信息:

Generating /tmp/d20220723-3779490-paqj5l/reflection.rbi with 6784 modules and 142 aliases

Printing your code\'s symbol table into /tmp/d20220723-3779490-paqj5l/from-source.json

/home/allan/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/sorbet-0.5.10206/lib/hidden-definition-finder.rb:123:in `write_constants\': Your source can\'t be read by Sorbet. (RuntimeError)

You can try `find . -type f | xargs -L 1 -t bundle exec srb tc --no-config --isolate-error-code 1000` and hopefully the last file it is processing before it dies is the culprit.

If not, maybe the errors in this file will help: /tmp/d20220723-3779490-paqj5l/from-source.json.err

当我检查该错误文件时,我发现:

异常::raise():未实现的解析器节点:EmptyElse

是否有解决此错误的方法?

  • 那么,哪个文件是罪魁祸首呢?那可能是个不错的起点

标签: sorbet


【解决方案1】:

每当您在 Sorbet 错误消息中看到 Exception::raise 时,这意味着 Sorbet 中存在错误。您可以在https://github.com/sorbet/sorbet/issues 报告 Sorbet 错误

我在这里为这个错误创建了一个修复:https://github.com/sorbet/sorbet/pull/6161

在您可以利用该修复程序之前,需要升级 Sorbet。如果你等不及了,你将不得不在你的代码库中寻找使用 Ruby 的新 case ... in 语法与空的 else 关键字进行模式匹配的文件,然后删除 else 关键字或更改它改为提及else nil

带来不便敬请谅解。


在将来, 请使用https://github.com/sorbet/sorbet/issues 报告所有问题——我今天只是偶然看到这个,但我通常不会监控 StackOverflow 的错误报告。


【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-11-19
    • 2013-10-06
    • 2011-04-12
    • 1970-01-01
    • 1970-01-01
    • 2019-04-06
    • 2018-10-04
    • 2012-10-19
    相关资源
    最近更新 更多