diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-12-08 09:16:30 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-12-09 15:47:23 +0100 |
commit | edc9edb79bcc9cb4581037ae0e8fb8907739bef6 (patch) | |
tree | b8f41b134bd52bd9aeef0bbc18de9f4bc49b6f27 /test/files/pos | |
parent | 75cc6cf256df9e152eaec771121ce0db9f7039f8 (diff) | |
download | scala-edc9edb79bcc9cb4581037ae0e8fb8907739bef6.tar.gz scala-edc9edb79bcc9cb4581037ae0e8fb8907739bef6.tar.bz2 scala-edc9edb79bcc9cb4581037ae0e8fb8907739bef6.zip |
SI-8046 Fix baseTypeSeq in presence of type aliases
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t8046.scala | 20 | ||||
-rw-r--r-- | test/files/pos/t8046b.scala | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/files/pos/t8046.scala b/test/files/pos/t8046.scala new file mode 100644 index 0000000000..304d70b6b8 --- /dev/null +++ b/test/files/pos/t8046.scala @@ -0,0 +1,20 @@ +trait One { + type Op[A] + type Alias[A] = Op[A] +} + +trait Two extends One { + trait Op[A] extends (A => A) + + // This compiles + class View1 extends Op[Int] { def apply(xs: Int) = xs } + + // ??? base class View2 not found in basetypes of class View2 + // ./a.scala:9: error: class View2 needs to be abstract, since \ + // method apply in trait Function1 of type (v1: T1)R is not defined + // (Note that T1 does not match Int) + // class View2 extends Alias[Int] { def apply(xs: Int) = xs } + // ^ + // one error found + class View2 extends Alias[Int] { def apply(xs: Int) = xs } +} diff --git a/test/files/pos/t8046b.scala b/test/files/pos/t8046b.scala new file mode 100644 index 0000000000..45b99fd7e0 --- /dev/null +++ b/test/files/pos/t8046b.scala @@ -0,0 +1,16 @@ +trait One { + type Op[A] + type Alias = Op[Int] +} + +trait Two extends One { + trait Op[A] extends M[A] + //(a: Alias) => a.value.toChar // okay + // (=> A).asSeenFrom(a.type, trait M): => Int + class View2 extends Alias { value.toChar } // toChar is not a member of type parameter A + // (=> A).asSeenFrom(View2.this.type, trait M): => A + + // override type Alias = Op[Int] // works with this +} + +trait M[A] { def value: A = sys.error("") } |