异常::raise():未实现的分析程序节点:EmptyElse



在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错误消息中看到Exception::raise,都意味着Sorbet中存在错误。您可以在https://github.com/sorbet/sorbet/issues

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

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

很抱歉给您带来不便。


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


最新更新