diff options
author | Martin Odersky <odersky@gmail.com> | 2010-07-19 13:55:09 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-07-19 13:55:09 +0000 |
commit | a6bb10a310b2d10cfd2713b9d8ca5c21af73902d (patch) | |
tree | 7a9ac52d1ce9d9cd19b5200bd9ee3aacbf269cb2 /test/files | |
parent | 5c9400467b802dfb7102f2de507bb3c0c4193c22 (diff) | |
download | scala-a6bb10a310b2d10cfd2713b9d8ca5c21af73902d.tar.gz scala-a6bb10a310b2d10cfd2713b9d8ca5c21af73902d.tar.bz2 scala-a6bb10a310b2d10cfd2713b9d8ca5c21af73902d.zip |
new test files.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t2133.scala | 18 | ||||
-rwxr-xr-x | test/files/pos/t3174.scala | 14 | ||||
-rwxr-xr-x | test/files/pos/t3174b.scala | 12 | ||||
-rwxr-xr-x | test/files/pos/t3568.scala | 46 | ||||
-rwxr-xr-x | test/files/run/weakconform.scala | 4 |
5 files changed, 94 insertions, 0 deletions
diff --git a/test/files/pos/t2133.scala b/test/files/pos/t2133.scala new file mode 100644 index 0000000000..c74d0a4bbf --- /dev/null +++ b/test/files/pos/t2133.scala @@ -0,0 +1,18 @@ +trait Foo { + object bar { + private[this] def fn() = 5 + } +} + +trait Foo2 { + object bip { + def fn() = 10 + } +} + +class Bob extends AnyRef with Foo with Foo2 { + import bip._ + import bar._ + + def go() = fn() +} diff --git a/test/files/pos/t3174.scala b/test/files/pos/t3174.scala new file mode 100755 index 0000000000..c3d90a4946 --- /dev/null +++ b/test/files/pos/t3174.scala @@ -0,0 +1,14 @@ +object test { + def method() { + class Foo extends AnyRef { + object Color { + object Blue + } + + class Board { + val grid = Color.Blue + } + } + new Foo + } + } diff --git a/test/files/pos/t3174b.scala b/test/files/pos/t3174b.scala new file mode 100755 index 0000000000..4df1bfe837 --- /dev/null +++ b/test/files/pos/t3174b.scala @@ -0,0 +1,12 @@ +trait Foo[X] { def foo : Map[String,Foo[X]] } + +object Test { + def f[T]() : Foo[T] = { + class Anon extends Foo[T] { + var foo: Map[String, Foo[T]] = Map[String,Foo[T]]() + //def foo = Map[String,Foo[T]]() + //def foo_=(x: Map[String,Foo[T]]) {} + } + new Anon + } +} diff --git a/test/files/pos/t3568.scala b/test/files/pos/t3568.scala new file mode 100755 index 0000000000..c8e3fcc4be --- /dev/null +++ b/test/files/pos/t3568.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 + } +} diff --git a/test/files/run/weakconform.scala b/test/files/run/weakconform.scala new file mode 100755 index 0000000000..1ea81c9f64 --- /dev/null +++ b/test/files/run/weakconform.scala @@ -0,0 +1,4 @@ +object Test extends Application { + val x: Float = 10/3 + assert(x == 3.0) +} |