summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/macro-qmarkqmarkqmark.check0
-rw-r--r--test/files/pos/macro-qmarkqmarkqmark.scala7
-rw-r--r--test/files/pos/t1786.scala19
-rw-r--r--test/files/pos/t5459.scala48
-rw-r--r--test/files/pos/t5886.scala18
-rw-r--r--test/files/pos/t6091.flags1
-rw-r--r--test/files/pos/t6091.scala10
-rw-r--r--test/files/pos/t6771.flags1
-rw-r--r--test/files/pos/t6771.scala9
-rw-r--r--test/files/pos/t7426.scala3
-rw-r--r--test/files/pos/t7427.flags1
-rw-r--r--test/files/pos/t7427.scala4
-rw-r--r--test/files/pos/t7486.scala8
13 files changed, 129 insertions, 0 deletions
diff --git a/test/files/pos/macro-qmarkqmarkqmark.check b/test/files/pos/macro-qmarkqmarkqmark.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/macro-qmarkqmarkqmark.check
diff --git a/test/files/pos/macro-qmarkqmarkqmark.scala b/test/files/pos/macro-qmarkqmarkqmark.scala
new file mode 100644
index 0000000000..a91e4320b6
--- /dev/null
+++ b/test/files/pos/macro-qmarkqmarkqmark.scala
@@ -0,0 +1,7 @@
+import language.experimental.macros
+
+object Macros {
+ def foo1 = macro ???
+ def foo2(x: Int) = macro ???
+ def foo3[T] = macro ???
+} \ No newline at end of file
diff --git a/test/files/pos/t1786.scala b/test/files/pos/t1786.scala
new file mode 100644
index 0000000000..32d6c06f6e
--- /dev/null
+++ b/test/files/pos/t1786.scala
@@ -0,0 +1,19 @@
+class SomeClass(val intValue:Int)
+class MyClass[T <: SomeClass](val myValue:T)
+class Flooz[A >: Null <: SomeClass, T >: Null <: A](var value: T)
+
+class A {
+ def f1(i:MyClass[_]) = i.myValue.intValue
+ def f2(i:MyClass[_ <: SomeClass]) = i.myValue.intValue
+ // def f3[T](i: MyClass[T]) = i.myValue.intValue
+ def f4[T <: SomeClass](i: MyClass[T]) = i.myValue.intValue
+ // def f5[T >: Null](i: MyClass[T]) = i.myValue.intValue
+ // def f6[T >: Null <: String](i: MyClass[T]) = i.myValue.intValue + i.myValue.charAt(0)
+
+ // def g1[A, T](x: Flooz[A, T]) = { x.value = null ; x.value.intValue }
+ def g2(x: Flooz[_, _]) = { x.value = null ; x.value.intValue }
+
+ class MyClass2(x: MyClass[_]) { val p = x.myValue.intValue }
+ // class MyClass3[T <: String](x: MyClass[T]) { val p = x.myValue.intValue + x.myValue.length }
+ // class MyClass4[T >: Null](x: MyClass[T]) { val p = x.myValue.intValue }
+}
diff --git a/test/files/pos/t5459.scala b/test/files/pos/t5459.scala
new file mode 100644
index 0000000000..971e6f896d
--- /dev/null
+++ b/test/files/pos/t5459.scala
@@ -0,0 +1,48 @@
+trait A1
+trait A2
+trait A3
+trait L1 extends A1 with A2 with A3
+
+object Test {
+ trait T1[-A <: A1]
+ trait T2[-A >: L1]
+ trait T3[ A <: A1]
+ trait T4[ A >: L1]
+ trait T5[+A <: A1]
+ trait T6[+A >: L1]
+
+ def f1(x: T1[_]) = x
+ def f2(x: T2[_]) = x
+ def f3(x: T3[_]) = x
+ def f4(x: T4[_]) = x
+ def f5(x: T5[_]) = x
+ def f6(x: T6[_]) = x
+ // a.scala:22: error: type arguments [Any] do not conform to trait T5's type parameter bounds [+A <: A1]
+ // def f5(x: T5[_]) = x
+ // ^
+
+ def g1(x: T1[_ <: A1]) = x
+ def g2(x: T2[_ >: L1]) = x
+ def g3(x: T3[_ <: A1]) = x
+ def g4(x: T4[_ >: L1]) = x
+ def g5(x: T5[_ <: A1]) = x
+ def g6(x: T6[_ >: L1]) = x
+
+ def q1(x: T1[_ >: L1]) = x
+ def q2(x: T2[_ <: A1]) = x
+ def q3(x: T3[_ >: L1]) = x
+ def q4(x: T4[_ <: A1]) = x
+ def q5(x: T5[_ >: L1]) = x
+ def q6(x: T6[_ <: A1]) = x
+ // a.scala:41: error: type arguments [Any] do not conform to trait T5's type parameter bounds [+A <: A1]
+ // def q5(x: T5[_ >: L1]) = x
+ // ^
+ // two errors found
+
+ def h1(x: T1[_ >: L1 <: A1]) = x
+ def h2(x: T2[_ >: L1 <: A1]) = x
+ def h3(x: T3[_ >: L1 <: A1]) = x
+ def h4(x: T4[_ >: L1 <: A1]) = x
+ def h5(x: T5[_ >: L1 <: A1]) = x
+ def h6(x: T6[_ >: L1 <: A1]) = x
+}
diff --git a/test/files/pos/t5886.scala b/test/files/pos/t5886.scala
new file mode 100644
index 0000000000..066187322d
--- /dev/null
+++ b/test/files/pos/t5886.scala
@@ -0,0 +1,18 @@
+object A {
+ def f0[T](x: T): T = x
+ def f1[T](x: => T): T = x
+ def f2[T](x: () => T): T = x()
+
+ f0(this.getClass) // ok
+ f1(this.getClass)
+ f2(this.getClass) // ok
+
+ // a.scala:7: error: type mismatch;
+ // found : Class[_ <: A.type]
+ // required: Class[?0(in value x1)] where type ?0(in value x1) <: A.type
+ // Note: A.type >: ?0, but Java-defined class Class is invariant in type T.
+ // You may wish to investigate a wildcard type such as `_ >: ?0`. (SLS 3.2.10)
+ // val x1 = f1(this.getClass)
+ // ^
+ // one error found
+}
diff --git a/test/files/pos/t6091.flags b/test/files/pos/t6091.flags
new file mode 100644
index 0000000000..954eaba352
--- /dev/null
+++ b/test/files/pos/t6091.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -Xlint
diff --git a/test/files/pos/t6091.scala b/test/files/pos/t6091.scala
new file mode 100644
index 0000000000..72e663ec3b
--- /dev/null
+++ b/test/files/pos/t6091.scala
@@ -0,0 +1,10 @@
+object Foo { def eq(x:Int) = x }
+
+class X { def ==(other: String) = true }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ Foo eq 1
+ new X == null
+ }
+}
diff --git a/test/files/pos/t6771.flags b/test/files/pos/t6771.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t6771.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t6771.scala b/test/files/pos/t6771.scala
new file mode 100644
index 0000000000..0f0bd4e4a0
--- /dev/null
+++ b/test/files/pos/t6771.scala
@@ -0,0 +1,9 @@
+object Test {
+ type Id[X] = X
+ val a: Id[Option[Int]] = None
+
+ a match {
+ case Some(x) => println(x)
+ case None =>
+ }
+}
diff --git a/test/files/pos/t7426.scala b/test/files/pos/t7426.scala
new file mode 100644
index 0000000000..8e42ad1812
--- /dev/null
+++ b/test/files/pos/t7426.scala
@@ -0,0 +1,3 @@
+class foo(x: Any) extends annotation.StaticAnnotation
+
+@foo(new AnyRef { }) trait A
diff --git a/test/files/pos/t7427.flags b/test/files/pos/t7427.flags
new file mode 100644
index 0000000000..9c7d6400fc
--- /dev/null
+++ b/test/files/pos/t7427.flags
@@ -0,0 +1 @@
+-Ydebug
diff --git a/test/files/pos/t7427.scala b/test/files/pos/t7427.scala
new file mode 100644
index 0000000000..cca52950d1
--- /dev/null
+++ b/test/files/pos/t7427.scala
@@ -0,0 +1,4 @@
+// Compiles with no options
+// Compiles with -Ydebug -Ydisable-unreachable-prevention
+// Crashes with -Ydebug
+trait Bippy { 3 match { case 3 => } }
diff --git a/test/files/pos/t7486.scala b/test/files/pos/t7486.scala
new file mode 100644
index 0000000000..6dd7f4c4ac
--- /dev/null
+++ b/test/files/pos/t7486.scala
@@ -0,0 +1,8 @@
+object Test{
+ var locker = 0
+ // remove implicit, or change to `locker = locker + 1` to make it compile.
+ implicit val davyJones0 = {
+ locker += 0
+ 0
+ }
+}