- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
virtual pattern matcher order-dependence fun
Mon, 2011-11-14, 01:05
[Throwing in scala-internals to be a good open source soldier.]
Is this a new development? I was able to bootstrap under -Yvirtpatmat
at some point in the past, but now (r26005) I'm hitting this. Or
maybe you dealt with that in some branch I've been using and it's not
in svn?
# ok
scalac3 -Yvirtpatmat -d /tmp/scala
src/library/scala/collection/immutable/TrieIterator.scala
src/library/scala/collection/immutable/Hash*
# not ok
scalac3 -Yvirtpatmat -d /tmp/scala
src/library/scala/collection/immutable/Hash*
src/library/scala/collection/immutable/TrieIterator.scala
src/library/scala/collection/immutable/TrieIterator.scala:39: error:
type mismatch;
found : MatchingStrategy.OptionMatchingStrategy.M[Nothing]
(which expands to) Option[Nothing]
required: Option[Array[?>: scala.collection.immutable.HashMap[_(in
method getElems),_] with scala.collection.immutable.HashSet[(some
other)_(in method getElems)] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with (some other)_(in method getElems) => Any with
scala.collection.generic.Subtractable[_ >: _(in method getElems) with
(some other)_(in method getElems),
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with (some other)_(in method getElems) => Any with
scala.collection.generic.Subtractable[_ >: _(in method getElems) with
(some other)_(in method getElems),
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]]]]
private[this] def getElems(x: Iterable[T]): Array[Iterable[T]] = (x match {
^
src/library/scala/collection/immutable/TrieIterator.scala:40: error:
type mismatch;
found : Option[Array[_ >: scala.collection.immutable.HashMap[_(in
method getElems),(some other)_(in method getElems)] with
scala.collection.immutable.HashSet[_] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with _ => Any with scala.collection.generic.Subtractable[_
>: _(in method getElems) with _,
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with _ => Any with scala.collection.generic.Subtractable[_
>: _(in method getElems) with _,
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]]]]
required: Option[Array[_ >: scala.collection.immutable.HashMap[_(in
method getElems),(some other)_(in method getElems)] with
scala.collection.immutable.HashSet[_] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with _ => Any with scala.collection.generic.Subtractable[_
>: _(in method getElems) with _,
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with _ => Any with scala.collection.generic.Subtractable[_
>: _(in method getElems) with _,
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]]]] forSome { type _5(in )
>: _(in method getElems) with _; type _4(in ) >: _(in method
getElems) with _; type _6(in ) >:
scala.collection.immutable.HashMap[_(in method getElems),(some
other)_(in method getElems)] with
scala.collection.immutable.HashSet[_] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with _ => Any with scala.collection.generic.Subtractable[_
>: _(in method getElems) with _,
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
getElems) with _ => Any with scala.collection.generic.Subtractable[_
>: _(in method getElems) with _,
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]] }
case x: HashTrieMap[_, _] => x.elems
^
src/library/scala/collection/immutable/TrieIterator.scala:44: error:
type mismatch;
found : MatchingStrategy.OptionMatchingStrategy.M[Nothing]
(which expands to) Option[Nothing]
required: Option[Array[?>: scala.collection.immutable.HashMap[_(in
method collisionToArray),_] with
scala.collection.immutable.HashSet[(some other)_(in method
collisionToArray)] <: scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with (some other)_(in method collisionToArray) =>
Any with scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with (some other)_(in method collisionToArray),
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with (some other)_(in method collisionToArray) =>
Any with scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with (some other)_(in method collisionToArray),
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]]]]
private[this] def collisionToArray(x: Iterable[T]):
Array[Iterable[T]] = (x match {
^
src/library/scala/collection/immutable/TrieIterator.scala:45: error:
type mismatch;
found : Option[Array[_ >: scala.collection.immutable.HashMap[_(in
method collisionToArray),(some other)_(in method collisionToArray)]
with scala.collection.immutable.HashSet[_] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with _ => Any with
scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with _, scala.collection.immutable.Iterable[Any]
with scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with _ => Any with
scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with _, scala.collection.immutable.Iterable[Any]
with scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]]]]
required: Option[Array[_ >: scala.collection.immutable.HashMap[_(in
method collisionToArray),(some other)_(in method collisionToArray)]
with scala.collection.immutable.HashSet[_] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with _ => Any with
scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with _, scala.collection.immutable.Iterable[Any]
with scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with _ => Any with
scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with _, scala.collection.immutable.Iterable[Any]
with scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]]]] forSome { type _8(in )
>: _(in method collisionToArray) with _; type _7(in ) >: _(in
method collisionToArray) with _; type _9(in ) >:
scala.collection.immutable.HashMap[_(in method collisionToArray),(some
other)_(in method collisionToArray)] with
scala.collection.immutable.HashSet[_] <:
scala.collection.immutable.Iterable[Any] with
scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with _ => Any with
scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with _, scala.collection.immutable.Iterable[Any]
with scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[Any,scala.collection.parallel.immutable.ParIterable[Any]
with Serializable with Equals] with Serializable with _(in method
collisionToArray) with _ => Any with
scala.collection.generic.Subtractable[_ >: _(in method
collisionToArray) with _, scala.collection.immutable.Iterable[Any]
with scala.collection.AbstractIterable[Any] with
scala.collection.CustomParallelizable[scala.collection.Parallel,scala.collection.Parallel]
with Serializable with Nothing => Any]] }
case x: HashMapCollision1[_, _] => x.kvs.map(x => HashMap(x)).toArray
^
four errors found
Indeed. To bootstrap, you still need to patch the stdlib a bit (including these files below)the branch (off of topic/virtpatmat) is https://github.com/adriaanm/scala-dev/tree/topic/virtpatmat-bootstrap
That said, the end goal must of course be unpatched bootstrapping, but yeah, for now I've punted on fun problems such as the one you ran into...
cheersadriaan