- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
the "head of empty list" error (ParallelMatching.scala:1137)
Thu, 2009-08-20, 18:25
I know quite a few parties are interested in this one as it seems to be
getting in everyone's face even though scalac builds itself. When you
try to build scalac with about anything but scalac ant you might see:
Exception in thread "main" java.util.NoSuchElementException: head of empty list
at scala.collection.immutable.Nil$.head(List.scala:443)
at scala.collection.immutable.Nil$.head(List.scala:440)
at scala.collection.generic.LinearSequenceTemplate$class.apply(LinearSequenceTemplate.scala:60)
at scala.collection.immutable.List.apply(List.scala:27)
at scala.tools.nsc.matching.ParallelMatching$MatchMatrix$Rep.applyRule(ParallelMatching.scala:1137)
at scala.tools.nsc.matching.ParallelMatching$MatchMatrix$Rep.toTree(ParallelMatching.scala:1083)
Here is what I have determined so far. The illustrative reproduction:
# crashes
scalac -d /tmp scala/collection/immutable/List.scala scala/concurrent/pilib.scala
# succeeds
scalac -d /tmp scala/concurrent/pilib.scala scala/collection/immutable/List.scala
The only material difference I can see when logging everything is that
whichever one runs first causes MatchError to be unpickled:
< [log parser] unpickle class MatchError and object MatchError
< [log parser] unpickled class MatchError:<?>, object MatchError:<?>
If pilib runs first, list is OK with that. If list runs first, pilib is
totally not okay with that.
The only other difference I found in the output is right at the crash
site:
< [log erasure] mkRule: MixTypes(Scrutinee(value temp19): .this.scala.collection.immutable.List[pilib.this.UGP]) {
---
> [log erasure] mkRule: MixTypes(Scrutinee(variable temp19): pilib.this.UGP) {
Obviously there's some big time confusion at that point, but I don't
know what to pin it on if it's not a result of the MatchError
unpickling.
If anyone has any good ideas here I'm all ears. My debugging skills are
pretty impaired right now as my 1.5 year old is literally crawling all
over me as I type this.