2

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.

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

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

scalac: phase typer on MyParser.scala

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.

jbx
  • 21,365
  • 18
  • 90
  • 144
  • I would first suspect old build products in the IDE's workspace. Then I would try to reproduce with command-line scalac to eliminate the IDE. Then if I were curious, I'd use `-Ytyper-debug -verbose -Ydebug`. – som-snytt Dec 20 '14 at 23:38

1 Answers1

1

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])

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.

som-snytt
  • 39,429
  • 2
  • 47
  • 129
  • Thanks. So is it actually something that was broken in the 2.11 compiler? – jbx Dec 24 '14 at 10:28
  • Um, I dunno, I still haven't read the paper that Martin O. referenced on the bug report to the issue after this one. Well, it's clearly broken, but is it decidable? – som-snytt Dec 25 '14 at 07:24