diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-08 08:43:32 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-08 08:43:32 -0700 |
commit | 7d3b2de7b52fec492bc63296d5adf076f68faf0a (patch) | |
tree | 420a9422126ac8891c7a796417899493192520b0 /test/files/neg | |
parent | ca9831e4f42abf24cc5c14a972fe40a08c4fc569 (diff) | |
parent | 95b36489829c12eb323e6252a28bbf54b27b9977 (diff) | |
download | scala-7d3b2de7b52fec492bc63296d5adf076f68faf0a.tar.gz scala-7d3b2de7b52fec492bc63296d5adf076f68faf0a.tar.bz2 scala-7d3b2de7b52fec492bc63296d5adf076f68faf0a.zip |
Merge pull request #1087 from hubertp/2.10.x-issue/5687
Fixes SI-5687.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t5687.check | 8 | ||||
-rw-r--r-- | test/files/neg/t5687.scala | 55 |
2 files changed, 63 insertions, 0 deletions
diff --git a/test/files/neg/t5687.check b/test/files/neg/t5687.check new file mode 100644 index 0000000000..5096077ee5 --- /dev/null +++ b/test/files/neg/t5687.check @@ -0,0 +1,8 @@ +t5687.scala:4: error: type arguments [T] do not conform to class Template's type parameter bounds [T <: AnyRef] + type Repr[T]<:Template[T] + ^ +t5687.scala:20: error: overriding type Repr in class Template with bounds[T] <: Template[T]; + type Repr has incompatible type + type Repr = CurveTemplate[T] + ^ +two errors found diff --git a/test/files/neg/t5687.scala b/test/files/neg/t5687.scala new file mode 100644 index 0000000000..90a9ae265c --- /dev/null +++ b/test/files/neg/t5687.scala @@ -0,0 +1,55 @@ +abstract class Template[T <: AnyRef](private val t: T) { + +// type Repr[A<:AnyRef]<:Template[T] + type Repr[T]<:Template[T] + + def access1(timeout: Int): Repr[T] = this.asInstanceOf[Repr[T]] + def access2: Repr[T] = this.asInstanceOf[Repr[T]] + val access3: Repr[T] = this.asInstanceOf[Repr[T]] + def access4(v: Repr[T]): Repr[T] = this.asInstanceOf[Repr[T]] + def access5(x: X): Repr[T] = this.asInstanceOf[Repr[T]] + def access5(x: Y): Repr[T] = this.asInstanceOf[Repr[T]] + + def withReadModifiers(readModifiers:Int): Repr[T] = this.asInstanceOf[Repr[T]] +} + +class Curve + +class CurveTemplate [T <: Curve](t: T) extends Template(t) { +// type Repr[A<: AnyRef] = CurveTemplate[T] + type Repr = CurveTemplate[T] +} + +class Base +class X extends Base +class Y extends Base + + +object Example { + def test1() { + new CurveTemplate(new Curve).access1(10) + + new CurveTemplate(new Curve).access2 + + new CurveTemplate(new Curve).access3 + + new CurveTemplate(new Curve).access4(null) + + new CurveTemplate(new Curve).access5(new X) + + () + + } + + def test2() { + new CurveTemplate(new Curve).access1(10).withReadModifiers(1) + + new CurveTemplate(new Curve).access2.withReadModifiers(1) + + new CurveTemplate(new Curve).access3.withReadModifiers(1) + + new CurveTemplate(new Curve).access4(null).withReadModifiers(1) + + new CurveTemplate(new Curve).access5(new X).withReadModifiers(1) + } +} |