diff options
Diffstat (limited to 'test/files/pos')
24 files changed, 119 insertions, 24 deletions
diff --git a/test/files/pos/issue244.scala b/test/files/pos/issue244.scala new file mode 100644 index 0000000000..f9189c9313 --- /dev/null +++ b/test/files/pos/issue244.scala @@ -0,0 +1,2 @@ +trait T { lazy val overloaded: String = "a" } +class C extends T { def overloaded(a: String): String = "b" } diff --git a/test/files/pos/sd219.scala b/test/files/pos/sd219.scala new file mode 100644 index 0000000000..3c3f4962f0 --- /dev/null +++ b/test/files/pos/sd219.scala @@ -0,0 +1,11 @@ +class Global { class Name } + +trait CommonPrintUtils { + val global: Global + + lazy val precedence: global.Name => Int = ??? +} + +trait CompilerProvider { val global: Global = ??? } + +class AbstractPrinter extends CommonPrintUtils with CompilerProvider
\ No newline at end of file diff --git a/test/files/pos/sd248/Prop_1.scala b/test/files/pos/sd248/Prop_1.scala new file mode 100644 index 0000000000..d5decda547 --- /dev/null +++ b/test/files/pos/sd248/Prop_1.scala @@ -0,0 +1,2 @@ +package p +object Prop { class Whitelist } diff --git a/test/files/pos/sd248/Test_2.scala b/test/files/pos/sd248/Test_2.scala new file mode 100644 index 0000000000..602e6d37b5 --- /dev/null +++ b/test/files/pos/sd248/Test_2.scala @@ -0,0 +1,5 @@ +package p + +object PropTest { + def t = new Prop.Whitelist +} diff --git a/test/files/pos/sd248/package_1.scala b/test/files/pos/sd248/package_1.scala new file mode 100644 index 0000000000..a90354e66f --- /dev/null +++ b/test/files/pos/sd248/package_1.scala @@ -0,0 +1,3 @@ +package object p { + type Prop = String +} diff --git a/test/files/pos/shapeless-regression.scala b/test/files/pos/shapeless-regression.scala new file mode 100644 index 0000000000..f3a1ed1ba0 --- /dev/null +++ b/test/files/pos/shapeless-regression.scala @@ -0,0 +1,16 @@ +class W[T <: AnyRef](val t: T) { + val v: T {} = t +} + +object W { + def apply[T <: AnyRef](t: T) = new W[t.type](t) +} + +object RightAssoc { + def ra_:[T](t: T): Unit = () +} + +object Boom { + W("fooo").v ra_: RightAssoc +} + diff --git a/test/files/pos/t5148.scala b/test/files/pos/t5148.scala deleted file mode 100644 index fca64e57df..0000000000 --- a/test/files/pos/t5148.scala +++ /dev/null @@ -1,4 +0,0 @@ -package scala.tools.nsc -package interpreter - -class IMain extends Imports diff --git a/test/files/pos/t5165b.flags b/test/files/pos/t5165b.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t5165b.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t6734.scala b/test/files/pos/t6734.scala new file mode 100644 index 0000000000..88932cd2cc --- /dev/null +++ b/test/files/pos/t6734.scala @@ -0,0 +1,17 @@ + +// desugars to package p { object `package` } +// previously, synthetic p.C was incorrectly added to this tree +// This only matters because synthetics are not hygienic +package object p + +package p { + import scala.concurrent.Future + case class C private[p] (value: Future[Int]) // private to avoid rewriting C.apply to new C +} + +package client { + trait X { + import scala.concurrent.Future + def f = p.C(Future(42)(null)) // ensure synthetics were generated, i.e., p.C.apply + } +} diff --git a/test/files/pos/t6978.flags b/test/files/pos/t6978.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/pos/t6978.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/pos/t6978/J.java b/test/files/pos/t6978/J.java new file mode 100644 index 0000000000..1b9029ce53 --- /dev/null +++ b/test/files/pos/t6978/J.java @@ -0,0 +1,5 @@ + +public class J { + public int f() { return 42; } +} + diff --git a/test/files/pos/t6978/S.scala b/test/files/pos/t6978/S.scala new file mode 100644 index 0000000000..41897db5ac --- /dev/null +++ b/test/files/pos/t6978/S.scala @@ -0,0 +1,7 @@ + +trait X { def f: Int } + +object Test extends J with X with App { + println(f) +} + diff --git a/test/files/pos/t7014/ThreadSafety.java b/test/files/pos/t7014/ThreadSafety.java deleted file mode 100644 index ed508804e3..0000000000 --- a/test/files/pos/t7014/ThreadSafety.java +++ /dev/null @@ -1,9 +0,0 @@ -package t7014; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse) -public @interface ThreadSafety { - ThreadSafetyLevel level(); -}
\ No newline at end of file diff --git a/test/files/pos/t7014/ThreadSafetyLevel.java b/test/files/pos/t7014/ThreadSafetyLevel.java deleted file mode 100644 index 4df1dc787a..0000000000 --- a/test/files/pos/t7014/ThreadSafetyLevel.java +++ /dev/null @@ -1,8 +0,0 @@ -package t7014; // package needed due to other bug in scalac's java parser - -// since we parse eagerly, we have not yet parsed the classfile when parsing the annotation, -// and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference -// from the annotation's argument to the enum's member -// for now, let's just not crash -- should implement lazy completing at some point -@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) -public enum ThreadSafetyLevel { COMPLETELY_THREADSAFE } diff --git a/test/files/pos/t7014/t7014.scala b/test/files/pos/t7014/t7014.scala deleted file mode 100644 index 7c73f700be..0000000000 --- a/test/files/pos/t7014/t7014.scala +++ /dev/null @@ -1,3 +0,0 @@ -package t7014 - -import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed diff --git a/test/files/pos/t7551.flags b/test/files/pos/t7551.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t7551.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7551/A.java b/test/files/pos/t7551/A.java new file mode 100644 index 0000000000..72aeb40fa0 --- /dev/null +++ b/test/files/pos/t7551/A.java @@ -0,0 +1,9 @@ +package p; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface A { + Class<?> subInterface(); +} diff --git a/test/files/pos/t7551/T.scala b/test/files/pos/t7551/T.scala new file mode 100644 index 0000000000..017926e0e2 --- /dev/null +++ b/test/files/pos/t7551/T.scala @@ -0,0 +1,9 @@ +package p + +@A(subInterface = classOf[T.S]) +trait T { +} + +object T { + private[p] trait S extends T { } +} diff --git a/test/files/pos/t7551/Test.scala b/test/files/pos/t7551/Test.scala new file mode 100644 index 0000000000..c1f529c4b1 --- /dev/null +++ b/test/files/pos/t7551/Test.scala @@ -0,0 +1,5 @@ +package p + +object Foo { + def bar(t: T) { } +} diff --git a/test/files/pos/t9020.scala b/test/files/pos/t9020.scala index 16e31e2572..c77a63cb1a 100644 --- a/test/files/pos/t9020.scala +++ b/test/files/pos/t9020.scala @@ -8,3 +8,9 @@ test/files/pos/t9020.scala:2: warning: discarded non-Unit value ^ one warning found */ + +trait DiscardThis { + import collection.mutable.ListBuffer + val b = ListBuffer.empty[String] + def add(s: String): Unit = b += s +} diff --git a/test/files/pos/t9918/package.scala b/test/files/pos/t9918/package.scala new file mode 100644 index 0000000000..9bd8ac9a69 --- /dev/null +++ b/test/files/pos/t9918/package.scala @@ -0,0 +1 @@ +package object pkg extends T diff --git a/test/files/pos/t9918/t9918.scala b/test/files/pos/t9918/t9918.scala new file mode 100644 index 0000000000..ec9a146579 --- /dev/null +++ b/test/files/pos/t9918/t9918.scala @@ -0,0 +1,3 @@ +package pkg + +trait T { object O } diff --git a/test/files/pos/t9920.scala b/test/files/pos/t9920.scala new file mode 100644 index 0000000000..8612618cc4 --- /dev/null +++ b/test/files/pos/t9920.scala @@ -0,0 +1,6 @@ +object Test { + def o = { + def i: Int = { i; 0 } + i + } +} diff --git a/test/files/pos/t9943.scala b/test/files/pos/t9943.scala new file mode 100644 index 0000000000..0d4717ccbb --- /dev/null +++ b/test/files/pos/t9943.scala @@ -0,0 +1,9 @@ +class Foo[T] { + def toMap[K, V](implicit ev: Foo[T] <:< Foo[(K, V)]): Foo[Map[K, V]] = null + def toMap[K](keySelector: T => K): Foo[Map[K, T]] = null +} + +object Foo { + (??? : Foo[Int]) toMap (_ % 2) + (??? : Foo[(Int, String)]).toMap +} |