diff options
Diffstat (limited to 'test/files/neg/bug1275.scala')
-rw-r--r-- | test/files/neg/bug1275.scala | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/test/files/neg/bug1275.scala b/test/files/neg/bug1275.scala index 769156fff2..e9be13c763 100644 --- a/test/files/neg/bug1275.scala +++ b/test/files/neg/bug1275.scala @@ -1,12 +1,14 @@ -object Test { - trait Seq[+t] { - type MyType[+t] <: Seq[t] - def f: MyType[t] - } - - def span[a, s <: Seq[a] { type MyType <: s } ](xs: s): s - = xs f // xs: s <: Seq[a]{type MyType <: s } - // xs.f : xs.MyType[a] <: Seq[a] - // ill-formed type in bound for s: Seq[a] { type MyType <: s } - // refinements aren't checked -- should they? -}
\ No newline at end of file +// tested using Scala compiler version 2.6.0-RC1 -- (c) 2002-2010 LAMP/EPFL + +// prompted by "Covariant return types" mailing list question +object TestCovariance { + + // see Type constructor polymorphism in http://www.scala-lang.org/docu/changelog.html + trait Seq[+t] { + type MyType[+t] <: Seq[t] + + def f: MyType[t] + } + + def span[a, s <: Seq[a] { type MyType <: s } ](xs: s): s = xs f +} |