-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type parameterization unstable based on file compilation order #4365
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4365?orig=1 |
@lrytz said: 1.scala package scala.collection
trait SeqViewLike[+A,
+Coll,
+This <: SeqView[A, Coll] with SeqViewLike[A, Coll, This]]
extends Seq[A] with GenSeqViewLike[A, Coll, This]
{
trait Transformed[+B] extends super[GenSeqViewLike].Transformed[B]
private[collection] abstract class AbstractTransformed[+B] extends Seq[B] with Transformed[B] {
def underlying: Coll = error("")
}
trait Reversed extends Transformed[A] with super[GenSeqViewLike].Reversed
protected def newReversed: Transformed[A] = new AbstractTransformed[A] with Reversed
} 2.scala package scala.collection
trait GenSeqViewLike[+A,
+Coll,
+This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]]
extends GenSeq[A] {
self =>
trait Transformed[+B] {
def length: Int = 0
def apply(idx: Int): B = error("")
}
trait Reversed extends Transformed[A] {
def iterator: Iterator[A] = createReversedIterator
private def createReversedIterator: Iterator[A] = {
self.foreach(_ => ())
null
}
}
} i get build/pack/bin/scalac -sourcepath src/library -d out -cp build/libs/classes/forkjoin:build/locker/classes/library sandbox/1.scala sandbox/2.scala
error: A in trait GenSeqViewLike cannot be instantiated from [+A, +Coll, +This <: scala.collection.GenSeqView[A,Coll] with scala.collection.GenSeqViewLike[A,Coll,This]]scala.collection.GenSeqViewLike[A,Coll,This]
[...]
lucmac:scala luc$ build/pack/bin/scalac -sourcepath src/library -d out -cp build/libs/classes/forkjoin:build/locker/classes/library sandbox/2.scala sandbox/1.scala
warning: there were 2 deprecation warnings; re-run with -deprecation for details
one warning found
lucmac:scala luc$ |
@lrytz said: lucmac:scala luc$ build/pack/bin/scalac -sourcepath src/library -d out -cp build/libs/classes/forkjoin:build/locker/classes/library src/library/scala/collection/SeqViewLike.scala src/library/scala/collection/GenSeqViewLike.scala
error: A in trait GenTraversableViewLike cannot be instantiated from [+A, +Coll, +This <: scala.collection.GenTraversableView[A,Coll] with scala.collection.GenTraversableViewLike[A,Coll,This]]scala.collection.GenTraversableViewLike[A,Coll,This]
[...] |
@paulp said (edited on Jul 14, 2012 8:59:31 AM UTC): // a_1.scala
trait SVL extends GSVL[Int, CBar] {
new Reversed { }
}
// a_2.scala
trait Bar0[+A]
trait Bar1[+This]
class CBar extends Bar0[Int] with Bar1[CBar] { }
trait GSVL[+A, +This <: Bar0[A] with Bar1[This]] {
// There has to be a method in Foo
trait Foo { def f = ??? }
// There has to be a private method with a closure in Reversed,
// and it has to be a trait.
trait Reversed extends Foo {
private def g = { List(1) map (_ + 1) ; ??? }
}
} |
@paulp said:
|
@lrytz said: |
@paulp said: But this one was a real standout in the difficulty department. |
@lrytz said: |
@ihji said (edited on Apr 22, 2013 8:21:33 AM UTC):
|
@paulp said: |
@paulp said: |
@adriaanm said: |
Extracted from #4305, where adriaan has some more info.
Assigning to myself, but don't infer that I know anything about how to fix it, I'm just diving in front of the bullet.
The text was updated successfully, but these errors were encountered: