挂在RegexParser的相位类型器上的Scalac [英] Scalac hanging on phase typer of RegexParser

查看:87
本文介绍了挂在RegexParser的相位类型器上的Scalac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个scala程序,其中除其他外还具有解析器组合器.这是通过扩展scala.util.parsing.combinator.RegexParsers来完成的.我使用Scala 2.10进行了开发,并且一切正常.

I have a scala program which among other things has a parser-combinator. This is done by extending scala.util.parsing.combinator.RegexParsers. I had developed it using Scala 2.10 and all was working fine.

昨天我将系统与IntelliJ 14.02一起升级到了Scala 2.11.4(无关紧要).

Yesterday I upgraded my system to Scala 2.11.4, together with IntelliJ 14.02 (not that it matters).

但是,每当我现在尝试编译该程序时,scalac就会在此阶段挂起:

However, whenever I try to compile this program now, scalac hangs during this phase:

scalac: phase typer on MyParser.scala

我对这段代码完全没有做任何更改,我不明白为什么它挂了或者应该从哪里开始. IntelliJ警告有关解析器表达式(如constants_def?structure_def*)的后缀运算符,其中?*跟随标记,由于

I changed absolutely nothing to this code, I can't understand why it is hanging or from where I should start. IntelliJ had a warning about postfix operators for parser expressions like constants_def? or structure_def*, where the ? and * follow the token, and I added this line, because of the SIP: Language Modularization Features:

import scala.language.postfixOps

它实际上没有任何作用,问题仍然存在.

It didn't really have any effect and the problem is still the same.

如何解决正在发生的事情?我不知道从哪里开始理解为什么相位类型器会无限期地挂起.

How can I troubleshoot what is going on? I can't figure out from where to start understanding why the phase typer is just hanging indefinitely.

推荐答案

一种解决方法是添加一个显式类型:

It looks like a workaround is to add an explicit type:

def da_gd : Parser[Expression with TimedCondition] =
  pref_timed_gd | da_gd_conjunction |
  (empty_temporal: Parser[Expression with TimedCondition])

堆栈转储表明它正在确定expr的类型,而-Ytyper-debug显示其附近.

A stack dump shows that it's figuring out the type of the expr, and -Ytyper-debug shows the vicinity.

既然午夜后什么都没发生,我就停在那里.

Since nothing good happens after midnight, I'll stop there.

这篇关于挂在RegexParser的相位类型器上的Scalac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆