virtual pattern matcher order-dependence fun

106 views
Skip to first unread message

Paul Phillips

unread,
Nov 13, 2011, 7:05:07 PM11/13/11
to Adriaan Moors, scala-i...@googlegroups.com
[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 <none>)
>: _(in method getElems) with _; type _4(in <none>) >: _(in method
getElems) with _; type _6(in <none>) >:
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 <none>)
>: _(in method collisionToArray) with _; type _7(in <none>) >: _(in
method collisionToArray) with _; type _9(in <none>) >:
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

Adriaan Moors

unread,
Nov 14, 2011, 4:27:57 AM11/14/11
to Paul Phillips, scala-i...@googlegroups.com
Hi,

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?
Indeed. To bootstrap, you still need to patch the stdlib a bit (including these files below)

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...

cheers
adriaan
Reply all
Reply to author
Forward
0 new messages