summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/override.check5
-rwxr-xr-xtest/files/neg/override.scala15
-rw-r--r--test/files/neg/t3774.check7
-rw-r--r--test/files/neg/t3774.scala5
-rw-r--r--test/files/neg/t3776.check4
-rw-r--r--test/files/neg/t3776.scala10
-rw-r--r--test/files/pos/t2133.scala18
-rwxr-xr-xtest/files/pos/t3174.scala14
-rwxr-xr-xtest/files/pos/t3174b.scala12
-rwxr-xr-xtest/files/pos/t3568.scala46
-rw-r--r--test/files/pos/t3688.scala9
-rw-r--r--test/files/run/t3763.scala3
-rwxr-xr-xtest/files/run/weakconform.scala4
-rwxr-xr-xtest/pending/run/t3609.scala11
14 files changed, 163 insertions, 0 deletions
diff --git a/test/files/neg/override.check b/test/files/neg/override.check
new file mode 100644
index 0000000000..0336fb2b11
--- /dev/null
+++ b/test/files/neg/override.check
@@ -0,0 +1,5 @@
+override.scala:9: error: overriding type T in trait A with bounds >: Int <: Int;
+ type T in trait B with bounds >: String <: String has incompatible type
+ lazy val x : A with B = x
+ ^
+one error found
diff --git a/test/files/neg/override.scala b/test/files/neg/override.scala
new file mode 100755
index 0000000000..764b06603a
--- /dev/null
+++ b/test/files/neg/override.scala
@@ -0,0 +1,15 @@
+trait X {
+ trait A { type T >: Int <: Int }
+ val x : A
+ var n : x.T = 3
+}
+
+trait Y extends X {
+ trait B { type T >: String <: String }
+ lazy val x : A with B = x
+ n = "foo"
+}
+
+object Test extends Application {
+ new Y {}
+}
diff --git a/test/files/neg/t3774.check b/test/files/neg/t3774.check
new file mode 100644
index 0000000000..d73166bff9
--- /dev/null
+++ b/test/files/neg/t3774.check
@@ -0,0 +1,7 @@
+t3774.scala:4: error: overloaded method value ++ with alternatives:
+ [B1 >: List[Int]](xs: scala.collection.TraversableOnce[((Int, Int), B1)])scala.collection.immutable.Map[(Int, Int),B1] <and>
+ [B >: ((Int, Int), List[Int]),That](that: scala.collection.TraversableOnce[B])(implicit bf: scala.collection.generic.CanBuildFrom[scala.collection.immutable.Map[(Int, Int),List[Int]],B,That])That
+ cannot be applied to (scala.collection.immutable.IndexedSeq[((Int, Int), scala.collection.immutable.Range.Inclusive)])
+ Map[(Int,Int),List[Int]]() ++ (for(x <- 0 to 1 ; y <- 0 to 1) yield {(x,y)-> (0 to 1)})
+ ^
+one error found
diff --git a/test/files/neg/t3774.scala b/test/files/neg/t3774.scala
new file mode 100644
index 0000000000..2869925b01
--- /dev/null
+++ b/test/files/neg/t3774.scala
@@ -0,0 +1,5 @@
+// This used to hang the lub process. Now it rejects the file. This is still not correct,
+// but we can solve this only after a redesign of lub a la dot.
+object Hang {
+ Map[(Int,Int),List[Int]]() ++ (for(x <- 0 to 1 ; y <- 0 to 1) yield {(x,y)-> (0 to 1)})
+}
diff --git a/test/files/neg/t3776.check b/test/files/neg/t3776.check
new file mode 100644
index 0000000000..e8798df6f3
--- /dev/null
+++ b/test/files/neg/t3776.check
@@ -0,0 +1,4 @@
+t3776.scala:8: error: value someOperation is not a member of _$1
+ def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v
+ ^
+one error found
diff --git a/test/files/neg/t3776.scala b/test/files/neg/t3776.scala
new file mode 100644
index 0000000000..6e368165aa
--- /dev/null
+++ b/test/files/neg/t3776.scala
@@ -0,0 +1,10 @@
+import util.parsing.combinator.{PackratParsers, RegexParsers}
+
+object MyParser extends RegexParsers with PackratParsers {
+}
+
+object Test {
+ class ParsedAs(a: String) (implicit pattern: MyParser.Parser[_]) {
+ def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v
+ }
+}
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/pos/t3688.scala b/test/files/pos/t3688.scala
new file mode 100644
index 0000000000..0ac1cfe514
--- /dev/null
+++ b/test/files/pos/t3688.scala
@@ -0,0 +1,9 @@
+import collection.mutable
+import collection.JavaConversions._
+import java.{util => ju}
+
+object Test {
+
+ implicitly[mutable.Map[Int, String] => ju.Dictionary[Int, String]]
+
+}
diff --git a/test/files/run/t3763.scala b/test/files/run/t3763.scala
new file mode 100644
index 0000000000..c8462b7437
--- /dev/null
+++ b/test/files/run/t3763.scala
@@ -0,0 +1,3 @@
+object Test extends Application {
+ val x = Array(Array(1), List(1))
+}
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)
+}
diff --git a/test/pending/run/t3609.scala b/test/pending/run/t3609.scala
new file mode 100755
index 0000000000..262948137d
--- /dev/null
+++ b/test/pending/run/t3609.scala
@@ -0,0 +1,11 @@
+object Test extends Application {
+ class A
+ class B extends A
+ def foo(x: A, y: B) = print(1)
+ val foo = new {
+ //def apply(x: B, y: A) = print(3)
+ def apply = (x: B, z: B) => print(4)
+ }
+
+ foo(new B, new B)
+}