diff options
Diffstat (limited to 'tests/pos')
-rw-r--r-- | tests/pos/finalvals.scala | 8 | ||||
-rw-r--r-- | tests/pos/freezeBounds.scala | 6 | ||||
-rw-r--r-- | tests/pos/i566.scala | 2 | ||||
-rw-r--r-- | tests/pos/i831.scala | 4 | ||||
-rw-r--r-- | tests/pos/inf.scala | 28 | ||||
-rw-r--r-- | tests/pos/sets.scala | 11 | ||||
-rw-r--r-- | tests/pos/tycons.scala | 2 |
7 files changed, 59 insertions, 2 deletions
diff --git a/tests/pos/finalvals.scala b/tests/pos/finalvals.scala new file mode 100644 index 000000000..03a992053 --- /dev/null +++ b/tests/pos/finalvals.scala @@ -0,0 +1,8 @@ +object Test { + final val x = 2 + final val y = { println("x"); 2 } + val x1 = x + val y1 = y + object O { val x = 42 } + println(O.x) +} diff --git a/tests/pos/freezeBounds.scala b/tests/pos/freezeBounds.scala new file mode 100644 index 000000000..6cc644d99 --- /dev/null +++ b/tests/pos/freezeBounds.scala @@ -0,0 +1,6 @@ +object Test { + + def f[X]: (Set[X], Set[X]) = ??? + + val a = if (true) f else (Set[Int](), Set[String]()) +} diff --git a/tests/pos/i566.scala b/tests/pos/i566.scala index 34d25f8f2..a0e6f2fe7 100644 --- a/tests/pos/i566.scala +++ b/tests/pos/i566.scala @@ -1,4 +1,4 @@ -object Test { +class Test { type T = String type U reflect.classTag[T] diff --git a/tests/pos/i831.scala b/tests/pos/i831.scala new file mode 100644 index 000000000..629853b9c --- /dev/null +++ b/tests/pos/i831.scala @@ -0,0 +1,4 @@ +object Test { self => + def a = 5 + self.a +} diff --git a/tests/pos/inf.scala b/tests/pos/inf.scala new file mode 100644 index 000000000..71bb38f57 --- /dev/null +++ b/tests/pos/inf.scala @@ -0,0 +1,28 @@ +object Test { + + def f[T](x: T, y: T): T = x + def g[T](x: T)(y: T): T = x + + val x: Int = 1 + val y: Long = x + + val xs: Seq[Int] = Seq(1) + val ys: Traversable[Int] = xs + + val r1 = f(x, y) + val s1: AnyVal = r1 + val r2 = f(y, x) + val s2: AnyVal = r2 + val r3 = f(xs, ys) + val s3: Traversable[Int] = r3 + val r4 = f(ys, xs) + val s4: Traversable[Int] = r4 + val r5 = g(x)(y) + val s5: AnyVal = r5 + val r6 = g(y)(x) + val s6: AnyVal = r6 + val r7 = g(xs)(ys) + val s7: Traversable[Int]= r7 + val r8 = g(ys)(xs) + val s8: Traversable[Int] = r8 +} diff --git a/tests/pos/sets.scala b/tests/pos/sets.scala new file mode 100644 index 000000000..577d709f5 --- /dev/null +++ b/tests/pos/sets.scala @@ -0,0 +1,11 @@ +object Test { + + val subPatBinders = List[Symbol]() + + def extraStoredBinders: Set[Symbol] = ??? + + val storedBinders: Set[Symbol] = + (if (true) subPatBinders.toSet else Set.empty) ++ extraStoredBinders// -- ignoredSubPatBinders + + +} diff --git a/tests/pos/tycons.scala b/tests/pos/tycons.scala index ef16a7792..1ed4d2855 100644 --- a/tests/pos/tycons.scala +++ b/tests/pos/tycons.scala @@ -16,7 +16,7 @@ abstract class Functor[F <: TypeConstructor] { def map[A, B](f: F { type TypeArg <: A }): F { type TypeArg <: B } } -implicit object ListFunctor extends Functor[List] { +object ListFunctor extends Functor[List] { override def map[A, B](f: List { type TypeArg <: A }): List { type TypeArg <: B } = ??? } |