From 315c097d3a72077512fa06d7c26e8ad09a8b3f66 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 16 May 2014 14:25:39 +0200 Subject: Triage of tests t27xx-t29xx. --- tests/pos/t2708.scala | 1 + tests/pos/t2726/SQLBuilder_1.scala | 7 +++++++ tests/pos/t2726/t2726_2.scala | 3 +++ tests/pos/t2741/2741_1.scala | 9 +++++++++ tests/pos/t2741/2741_2.scala | 5 +++++ tests/pos/t2794.scala | 9 +++++++++ tests/pos/t2797.scala | 9 +++++++++ tests/pos/t2799.flags | 1 + tests/pos/t2799.scala | 1 + tests/pos/t2809.scala | 20 ++++++++++++++++++++ tests/pos/t2810.scala | 8 ++++++++ tests/pos/t284-pos.scala | 5 +++++ tests/pos/t287.scala | 12 ++++++++++++ tests/pos/t289.scala | 5 +++++ tests/pos/t2910.scala | 33 +++++++++++++++++++++++++++++++++ tests/pos/t2939.scala | 13 +++++++++++++ tests/pos/t295.scala | 2 ++ tests/pos/t296.scala | 3 +++ tests/pos/t2973.scala | 1 + tests/pos/tuplePatDef.scala | 4 ++++ 20 files changed, 151 insertions(+) create mode 100644 tests/pos/t2708.scala create mode 100644 tests/pos/t2726/SQLBuilder_1.scala create mode 100644 tests/pos/t2726/t2726_2.scala create mode 100644 tests/pos/t2741/2741_1.scala create mode 100644 tests/pos/t2741/2741_2.scala create mode 100644 tests/pos/t2794.scala create mode 100644 tests/pos/t2797.scala create mode 100644 tests/pos/t2799.flags create mode 100644 tests/pos/t2799.scala create mode 100644 tests/pos/t2809.scala create mode 100644 tests/pos/t2810.scala create mode 100644 tests/pos/t284-pos.scala create mode 100644 tests/pos/t287.scala create mode 100644 tests/pos/t289.scala create mode 100644 tests/pos/t2910.scala create mode 100644 tests/pos/t2939.scala create mode 100644 tests/pos/t295.scala create mode 100644 tests/pos/t296.scala create mode 100644 tests/pos/t2973.scala create mode 100644 tests/pos/tuplePatDef.scala (limited to 'tests/pos') diff --git a/tests/pos/t2708.scala b/tests/pos/t2708.scala new file mode 100644 index 000000000..19485bf4c --- /dev/null +++ b/tests/pos/t2708.scala @@ -0,0 +1 @@ +class Foo(@volatile var v: Int) diff --git a/tests/pos/t2726/SQLBuilder_1.scala b/tests/pos/t2726/SQLBuilder_1.scala new file mode 100644 index 000000000..8d07a8826 --- /dev/null +++ b/tests/pos/t2726/SQLBuilder_1.scala @@ -0,0 +1,7 @@ +class SQLBuilder extends SQLBuilder.Segment + +object SQLBuilder { + trait Segment +} + + diff --git a/tests/pos/t2726/t2726_2.scala b/tests/pos/t2726/t2726_2.scala new file mode 100644 index 000000000..e738143ae --- /dev/null +++ b/tests/pos/t2726/t2726_2.scala @@ -0,0 +1,3 @@ +object SQuery2Test { + new SQLBuilder +} diff --git a/tests/pos/t2741/2741_1.scala b/tests/pos/t2741/2741_1.scala new file mode 100644 index 000000000..d9d04f7ab --- /dev/null +++ b/tests/pos/t2741/2741_1.scala @@ -0,0 +1,9 @@ +trait Partial { + type Apply[XYZ] = List[XYZ] +} +trait MA[M[_]] +trait MAs { + val a: MA[Partial#Apply] = null // after compilation, the type is pickled as `MA[ [B] List[B] ]` +} + +object Scalaz extends MAs diff --git a/tests/pos/t2741/2741_2.scala b/tests/pos/t2741/2741_2.scala new file mode 100644 index 000000000..a9fd9d7d0 --- /dev/null +++ b/tests/pos/t2741/2741_2.scala @@ -0,0 +1,5 @@ +// object Test compiles jointly, but not separately. +object Test { + import Scalaz._ + Scalaz.a +} diff --git a/tests/pos/t2794.scala b/tests/pos/t2794.scala new file mode 100644 index 000000000..a17edf8cb --- /dev/null +++ b/tests/pos/t2794.scala @@ -0,0 +1,9 @@ +class Key[T] + +class Entry[T](val k: Key[T], val v: T) + +object Entry { + + def makeDefault[T >: Null <: AnyRef] = new Entry[T](new Key[T], null: T) + +} diff --git a/tests/pos/t2797.scala b/tests/pos/t2797.scala new file mode 100644 index 000000000..cf579d8de --- /dev/null +++ b/tests/pos/t2797.scala @@ -0,0 +1,9 @@ +class MyVector[A] { + def map[B](f: A => B): MyVector[B] = sys.error("") +} + +object Test { + def unzip[B, C](_this: MyVector[(B, C)]): (MyVector[B], MyVector[C]) = { + (_this.map{ bc => bc._1 }, _this.map{ bc => bc._2 }) + } +} diff --git a/tests/pos/t2799.flags b/tests/pos/t2799.flags new file mode 100644 index 000000000..d1b831ea8 --- /dev/null +++ b/tests/pos/t2799.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings \ No newline at end of file diff --git a/tests/pos/t2799.scala b/tests/pos/t2799.scala new file mode 100644 index 000000000..7710cce26 --- /dev/null +++ b/tests/pos/t2799.scala @@ -0,0 +1 @@ +@deprecated("hi mom", "") case class Bob () diff --git a/tests/pos/t2809.scala b/tests/pos/t2809.scala new file mode 100644 index 000000000..1f68b0b07 --- /dev/null +++ b/tests/pos/t2809.scala @@ -0,0 +1,20 @@ +package p1 { + abstract class T1 { + protected def bug(p: Int = 1): Int // without 'protected' compiles fine + } +} +package p2 { // all being in the same package compiles fine + import p1._ + abstract class T2 extends T1 { + class A { + bug() + } + } + + abstract class T3 extends T2 { + class A { + bug() + } + } +} + diff --git a/tests/pos/t2810.scala b/tests/pos/t2810.scala new file mode 100644 index 000000000..c85eca164 --- /dev/null +++ b/tests/pos/t2810.scala @@ -0,0 +1,8 @@ + + + + +object Test { + val closeable1: { def close(): Unit } = new scala.io.Source { val iter: Iterator[Char] = "".iterator } + val closeable2: { def close(): Unit } = new java.io.Closeable { def close() = {} } +} diff --git a/tests/pos/t284-pos.scala b/tests/pos/t284-pos.scala new file mode 100644 index 000000000..40277e2db --- /dev/null +++ b/tests/pos/t284-pos.scala @@ -0,0 +1,5 @@ +trait B[T] { + def f1(a: T): Unit { } + def f2(a: T): Unit + def f3(a: T): Unit = { } +} diff --git a/tests/pos/t287.scala b/tests/pos/t287.scala new file mode 100644 index 000000000..8e5e8831c --- /dev/null +++ b/tests/pos/t287.scala @@ -0,0 +1,12 @@ +object testBuf { + class mystream extends java.io.BufferedOutputStream(new java.io.FileOutputStream("/dev/null")) { + def w( x:String ):Unit = { + val foo = new Array[Byte](2); + + // write( byte[] ) is defined in FilterOutputStream, the superclass of BufferedOutputStream + super.write( foo ); // error + + super.write( foo, 0, foo.length ); // this works however + } + } +} diff --git a/tests/pos/t289.scala b/tests/pos/t289.scala new file mode 100644 index 000000000..96c0244df --- /dev/null +++ b/tests/pos/t289.scala @@ -0,0 +1,5 @@ +class A { + object B; +} + +object C extends A; diff --git a/tests/pos/t2910.scala b/tests/pos/t2910.scala new file mode 100644 index 000000000..f9f2c87a9 --- /dev/null +++ b/tests/pos/t2910.scala @@ -0,0 +1,33 @@ +object Test { + def test1: Unit = { + C + object C + } + + def test2: Unit = { + println(s.length) + lazy val s = "abc" + } + + def test3: Unit = { + lazy val lazyBar = bar + object bar { + val foo = 12 + } + lazy val lazyBar2 = bar + } + + def test4: Unit = { + lazy val x = { + x + lazy val x = 12 + 0 + } + } + + def test5: Unit = { + lazy val f: Int = g + Console.println("foo") + lazy val g: Int = f + } +} diff --git a/tests/pos/t2939.scala b/tests/pos/t2939.scala new file mode 100644 index 000000000..57dd52024 --- /dev/null +++ b/tests/pos/t2939.scala @@ -0,0 +1,13 @@ +import collection._ + +object Proxies { + class C1 extends MapProxy[Int,Int] { def self = Map[Int,Int]() } + class C2 extends mutable.MapProxy[Int,Int] { def self = mutable.Map[Int,Int]() } + class C3 extends immutable.MapProxy[Int,Int] { def self = immutable.Map[Int,Int]() } + + class C4 extends SetProxy[Int] { def self = Set[Int]() } + class C5 extends mutable.SetProxy[Int] { def self = mutable.Set[Int]() } + class C6 extends immutable.SetProxy[Int] { def self = immutable.Set[Int]() } + + class C7 extends SeqProxy[Int] { def self = Seq[Int]() } +} diff --git a/tests/pos/t295.scala b/tests/pos/t295.scala new file mode 100644 index 000000000..22c7beff4 --- /dev/null +++ b/tests/pos/t295.scala @@ -0,0 +1,2 @@ +object Test extends java.rmi.server.UnicastRemoteObject { +} diff --git a/tests/pos/t296.scala b/tests/pos/t296.scala new file mode 100644 index 000000000..0c267a307 --- /dev/null +++ b/tests/pos/t296.scala @@ -0,0 +1,3 @@ +object Bug { + def foo (l: => String) : String = 12 match { case _ => l} +} diff --git a/tests/pos/t2973.scala b/tests/pos/t2973.scala new file mode 100644 index 000000000..f5dde856d --- /dev/null +++ b/tests/pos/t2973.scala @@ -0,0 +1 @@ +package foo {}; package bar {}; package baz {} diff --git a/tests/pos/tuplePatDef.scala b/tests/pos/tuplePatDef.scala new file mode 100644 index 000000000..22f8f8e7d --- /dev/null +++ b/tests/pos/tuplePatDef.scala @@ -0,0 +1,4 @@ + +object Test { + val (x,y): (String, Int) = null +} -- cgit v1.2.3