diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/bug1275.check | 8 | ||||
-rw-r--r-- | test/files/neg/bug1275.scala | 26 | ||||
-rw-r--r-- | test/files/pos/t3374.scala | 6 |
3 files changed, 23 insertions, 17 deletions
diff --git a/test/files/neg/bug1275.check b/test/files/neg/bug1275.check index 9f806c0689..40c5d79d27 100644 --- a/test/files/neg/bug1275.check +++ b/test/files/neg/bug1275.check @@ -1,4 +1,6 @@ -bug1275.scala:13: error: The kind of type MyType does not conform to the expected kind of type MyType[+t] <: TestCovariance.Seq[t] in trait Seq. - def span[a, s <: Seq[a] { type MyType <: s } ](xs: s): s = xs f - ^ +bug1275.scala:8: error: type mismatch; + found : xs.MyType[a] + required: s + = xs f // xs: s <: Seq[a]{type MyType <: s } + ^ one error found diff --git a/test/files/neg/bug1275.scala b/test/files/neg/bug1275.scala index e9be13c763..769156fff2 100644 --- a/test/files/neg/bug1275.scala +++ b/test/files/neg/bug1275.scala @@ -1,14 +1,12 @@ -// 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 -} +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 diff --git a/test/files/pos/t3374.scala b/test/files/pos/t3374.scala new file mode 100644 index 0000000000..4c0293181d --- /dev/null +++ b/test/files/pos/t3374.scala @@ -0,0 +1,6 @@ +trait Parent { + type Test[A, H[B <: A]] +} +trait Sub extends Parent { + type Test[AS, HS[B <: AS]] = AS +}
\ No newline at end of file |