summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t8072.check4
-rw-r--r--test/files/neg/t8072.scala6
-rw-r--r--test/files/pos/t5165b/TestAnnotation_1.java11
-rw-r--r--test/files/pos/t5165b/TestObject_3.scala3
-rw-r--r--test/files/pos/t5165b/TestTrait_2.scala3
-rw-r--r--test/files/pos/t8301.scala19
-rw-r--r--test/files/pos/t8301b.scala36
-rw-r--r--test/files/run/t5134.scala8
-rw-r--r--test/files/run/t5565.scala12
9 files changed, 102 insertions, 0 deletions
diff --git a/test/files/neg/t8072.check b/test/files/neg/t8072.check
new file mode 100644
index 0000000000..9267010135
--- /dev/null
+++ b/test/files/neg/t8072.check
@@ -0,0 +1,4 @@
+t8072.scala:4: error: value ifParSeq is not a member of List[Int]
+ val y = x.ifParSeq[Int](throw new Exception).otherwise(0) // Shouldn't compile
+ ^
+one error found
diff --git a/test/files/neg/t8072.scala b/test/files/neg/t8072.scala
new file mode 100644
index 0000000000..2c8213e34a
--- /dev/null
+++ b/test/files/neg/t8072.scala
@@ -0,0 +1,6 @@
+class NoIfParSeq {
+ import collection.parallel._
+ val x = List(1,2)
+ val y = x.ifParSeq[Int](throw new Exception).otherwise(0) // Shouldn't compile
+ val z = x.toParArray
+} \ No newline at end of file
diff --git a/test/files/pos/t5165b/TestAnnotation_1.java b/test/files/pos/t5165b/TestAnnotation_1.java
new file mode 100644
index 0000000000..02eb3f9d4c
--- /dev/null
+++ b/test/files/pos/t5165b/TestAnnotation_1.java
@@ -0,0 +1,11 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TestAnnotation_1 {
+ public enum TestEnumOne { A, B }
+ public enum TestEnumTwo { C, D }
+
+ public TestEnumOne one();
+ public TestEnumTwo two();
+ public String strVal();
+}
diff --git a/test/files/pos/t5165b/TestObject_3.scala b/test/files/pos/t5165b/TestObject_3.scala
new file mode 100644
index 0000000000..eaf244e9d0
--- /dev/null
+++ b/test/files/pos/t5165b/TestObject_3.scala
@@ -0,0 +1,3 @@
+
+object TestObject extends TestTrait
+
diff --git a/test/files/pos/t5165b/TestTrait_2.scala b/test/files/pos/t5165b/TestTrait_2.scala
new file mode 100644
index 0000000000..ab4facebcd
--- /dev/null
+++ b/test/files/pos/t5165b/TestTrait_2.scala
@@ -0,0 +1,3 @@
+
+@TestAnnotation_1(one=TestAnnotation_1.TestEnumOne.A, two=TestAnnotation_1.TestEnumTwo.C, strVal="something")
+trait TestTrait
diff --git a/test/files/pos/t8301.scala b/test/files/pos/t8301.scala
new file mode 100644
index 0000000000..2d10864c57
--- /dev/null
+++ b/test/files/pos/t8301.scala
@@ -0,0 +1,19 @@
+trait Universe {
+ type Symbol >: Null <: AnyRef with SymbolApi
+ trait SymbolApi
+
+ type TypeSymbol >: Null <: TypeSymbolApi with Symbol
+ trait TypeSymbolApi
+
+ implicit class CompatibleSymbol(sym: Symbol) {
+ def asFreeType: TypeSymbol = ???
+ }
+}
+
+object Test extends App {
+ val u: Universe = ???
+ import u._
+
+ val sym: Symbol = ???
+ sym.asFreeType
+}
diff --git a/test/files/pos/t8301b.scala b/test/files/pos/t8301b.scala
new file mode 100644
index 0000000000..5641547c18
--- /dev/null
+++ b/test/files/pos/t8301b.scala
@@ -0,0 +1,36 @@
+// cf. pos/t8300-patmat.scala
+trait Universe {
+ type Name >: Null <: AnyRef with NameApi
+ trait NameApi
+
+ type TermName >: Null <: TermNameApi with Name
+ trait TermNameApi extends NameApi
+}
+
+object Test extends App {
+ val u: Universe = ???
+ import u._
+
+ val ScalaName: TermName = ???
+ locally {
+
+ ??? match {
+ case Test.ScalaName => ???
+ }
+ import Test.ScalaName._
+
+ ??? match {
+ case ScalaName => ???
+ }
+ import ScalaName._
+
+ // both the pattern and import led to
+ // stable identifier required, but SN found. Note that value SN
+ // is not stable because its type, Test.u.TermName, is volatile.
+ val SN = ScalaName
+ ??? match {
+ case SN => ???
+ }
+ import SN._
+ }
+}
diff --git a/test/files/run/t5134.scala b/test/files/run/t5134.scala
new file mode 100644
index 0000000000..384442fda2
--- /dev/null
+++ b/test/files/run/t5134.scala
@@ -0,0 +1,8 @@
+import language._
+
+object Test extends App {
+ def b = new AnyRef {
+ def a= ()
+ }
+ b.a match { case _ => () }
+}
diff --git a/test/files/run/t5565.scala b/test/files/run/t5565.scala
new file mode 100644
index 0000000000..9ced87ca21
--- /dev/null
+++ b/test/files/run/t5565.scala
@@ -0,0 +1,12 @@
+import scala.language.reflectiveCalls
+import scala.language.implicitConversions
+
+object Test extends App {
+ implicit def doubleWithApproxEquals(d: Double) = new {
+ def ~==(v: Double, margin: Double = 0.001): Boolean =
+ math.abs(d - v) < margin
+ }
+
+ assert(math.abs(-4.0) ~== (4.0, 0.001))
+ assert(math.abs(-4.0) ~== 4.0)
+}