diff options
author | Paul Phillips <paulp@improving.org> | 2010-06-15 21:14:14 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-06-15 21:14:14 +0000 |
commit | 0c6cbdac433a001f76b1f9afd00f4280d17d1832 (patch) | |
tree | 5832b44a587f89cb7d936ae8671333be8881ace0 /test | |
parent | de7fbb051b280f794cb8d706414191e4d5d08bf9 (diff) | |
download | scala-0c6cbdac433a001f76b1f9afd00f4280d17d1832.tar.gz scala-0c6cbdac433a001f76b1f9afd00f4280d17d1832.tar.bz2 scala-0c6cbdac433a001f76b1f9afd00f4280d17d1832.zip |
Disables NotNull checking unless -Ynotnull is g...
Disables NotNull checking unless -Ynotnull is given. Closes #3568,
review by odersky.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/bug3568.scala | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/files/pos/bug3568.scala b/test/files/pos/bug3568.scala new file mode 100644 index 0000000000..7cfb927138 --- /dev/null +++ b/test/files/pos/bug3568.scala @@ -0,0 +1,46 @@ +import scala.annotation._ +import scala.annotation.unchecked._ +import scala.collection._ + + +package object buffer { + val broken = new ArrayVec2() // commenting out this line causes the file to compile. + + val works = Class.forName("buffer.ArrayVec2").newInstance().asInstanceOf[ArrayVec2] +} + +package buffer { + object Main { + // ArrayVec2 can be compiled, instantiated and used. + def main(args: Array[String]) { println(works) } + } + + trait ElemType { type Element; type Component <: ElemType } + trait Float1 extends ElemType { type Element = Float; type Component = Float1} + class Vec2 extends ElemType { type Element = Vec2; type Component = Float1 } + + abstract class BaseSeq[T <: ElemType, E] + extends IndexedSeq[E] with IndexedSeqOptimized[E, IndexedSeq[E]] { + def length = 1 + def apply(i: Int) :E + } + + abstract class GenericSeq[T <: ElemType] extends BaseSeq[T, T#Element] + trait DataArray[T <: ElemType] extends BaseSeq[T, T#Element] + trait DataView[T <: ElemType] extends BaseSeq[T, T#Element] + abstract class BaseFloat1 extends BaseSeq[Float1, Float] + + class ArrayFloat1 extends BaseFloat1 with DataArray[Float1] { + def apply(i: Int) :Float = 0f + } + + class ViewFloat1 extends BaseFloat1 with DataView[Float1] { + def apply(i: Int) :Float = 0f + } + + class ArrayVec2(val backingSeq: ArrayFloat1) + extends GenericSeq[Vec2] with DataArray[Vec2] { + def this() = this(new ArrayFloat1) + def apply(i: Int) :Vec2 = null + } +}
\ No newline at end of file |