|
After a great struggle, I realized that the major reason that
code like this still doesn't compile:
List(Stream(), List())
is that we were poisoning the computed lub in mergePrefixAndArgs by
throwing in Any when the max recursion depth was reached. I modified
it to return NoType instead, which allowed me to teach lublist to
recognize what has happened and fall back to a weaker type, one
which does not contain recursive bounds. This enables the lubbing
process to complete. The most elusive lub, defeated. Notice also
that the refinement members are correctly parameterized on Nothing,
rather than on Any as has often been the case.
scala> List(Stream(), List())
res0: List[scala.collection.immutable.LinearSeq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[Nothing] with scala.collection.AbstractSeq[Nothing]{def reverse: scala.collection.immutable.LinearSeq[Nothing] with scala.collection.AbstractSeq[Nothing]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[Nothing] with scala.collection.AbstractSeq[Nothing]; def takeRight(n: ...
|