aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/disabled/run/t5293.scala (renamed from tests/run/t5293.scala)0
-rw-r--r--tests/disabled/scalac-dependent/WeakHashSetTest.scala (renamed from tests/run/WeakHashSetTest.scala)0
-rw-r--r--tests/disabled/scalac-dependent/shortClass.scala (renamed from tests/run/shortClass.scala)0
-rw-r--r--tests/disabled/scalac-dependent/showraw_nosymbol.scala (renamed from tests/run/showraw_nosymbol.scala)0
-rw-r--r--tests/disabled/scalac-dependent/sm-interpolator.scala (renamed from tests/run/sm-interpolator.scala)0
-rw-r--r--tests/disabled/scalac-dependent/structural.scala (renamed from tests/run/structural.scala)0
-rw-r--r--tests/disabled/scalac-dependent/t6732.scala (renamed from tests/run/t6732.scala)0
-rw-r--r--tests/partest-test/deadlock.scala44
-rw-r--r--tests/partest-test/infinite.scala9
-rw-r--r--tests/partest-test/infiniteAlloc.scala9
-rw-r--r--tests/partest-test/infiniteTail.scala7
-rw-r--r--tests/pos/i2152.scala7
-rw-r--r--tests/run/1938-2.scala37
-rw-r--r--tests/run/t429.scala1
-rw-r--r--tests/run/t9915/C_1.java20
-rw-r--r--tests/run/t9915/Test_2.scala12
16 files changed, 146 insertions, 0 deletions
diff --git a/tests/run/t5293.scala b/tests/disabled/run/t5293.scala
index 8a99989c5..8a99989c5 100644
--- a/tests/run/t5293.scala
+++ b/tests/disabled/run/t5293.scala
diff --git a/tests/run/WeakHashSetTest.scala b/tests/disabled/scalac-dependent/WeakHashSetTest.scala
index 8bcb95091..8bcb95091 100644
--- a/tests/run/WeakHashSetTest.scala
+++ b/tests/disabled/scalac-dependent/WeakHashSetTest.scala
diff --git a/tests/run/shortClass.scala b/tests/disabled/scalac-dependent/shortClass.scala
index c5c2043f4..c5c2043f4 100644
--- a/tests/run/shortClass.scala
+++ b/tests/disabled/scalac-dependent/shortClass.scala
diff --git a/tests/run/showraw_nosymbol.scala b/tests/disabled/scalac-dependent/showraw_nosymbol.scala
index 191647583..191647583 100644
--- a/tests/run/showraw_nosymbol.scala
+++ b/tests/disabled/scalac-dependent/showraw_nosymbol.scala
diff --git a/tests/run/sm-interpolator.scala b/tests/disabled/scalac-dependent/sm-interpolator.scala
index e4bec7afb..e4bec7afb 100644
--- a/tests/run/sm-interpolator.scala
+++ b/tests/disabled/scalac-dependent/sm-interpolator.scala
diff --git a/tests/run/structural.scala b/tests/disabled/scalac-dependent/structural.scala
index 0f18f4579..0f18f4579 100644
--- a/tests/run/structural.scala
+++ b/tests/disabled/scalac-dependent/structural.scala
diff --git a/tests/run/t6732.scala b/tests/disabled/scalac-dependent/t6732.scala
index ff0f0494d..ff0f0494d 100644
--- a/tests/run/t6732.scala
+++ b/tests/disabled/scalac-dependent/t6732.scala
diff --git a/tests/partest-test/deadlock.scala b/tests/partest-test/deadlock.scala
new file mode 100644
index 000000000..df561aff3
--- /dev/null
+++ b/tests/partest-test/deadlock.scala
@@ -0,0 +1,44 @@
+object Test {
+ class Lock
+ val lock1 = new Lock
+ val lock2 = new Lock
+
+ private[this] var took2: Boolean = false
+ def lock2Taken(): Unit = synchronized {
+ took2 = true
+ notify()
+ }
+ def tookLock2: Boolean = synchronized(took2)
+
+ val thread1 = new Thread {
+ override def run(): Unit = synchronized {
+ lock1.synchronized {
+ while (!tookLock2) wait()
+ lock2.synchronized {
+ println("thread1 in lock2!")
+ }
+ }
+ println("thread1, done!")
+ }
+ }
+
+ val thread2 = new Thread {
+ override def run(): Unit = synchronized {
+ lock2.synchronized {
+ lock2Taken()
+ lock1.synchronized {
+ println("thread2 in lock1!")
+ }
+ }
+ println("thread2, done!")
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ thread1.start() // takes lock1 then sleeps 1s - tries to take lock2
+ thread2.start() // takes lock2 then sleeps 1s - tries to take lock1
+
+ thread1.join() // wait for threads to complete, can't because deadlock!
+ thread2.join()
+ }
+}
diff --git a/tests/partest-test/infinite.scala b/tests/partest-test/infinite.scala
new file mode 100644
index 000000000..961382fea
--- /dev/null
+++ b/tests/partest-test/infinite.scala
@@ -0,0 +1,9 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ var sum = 0
+ while(true) {
+ sum += 1
+ }
+ println(sum)
+ }
+}
diff --git a/tests/partest-test/infiniteAlloc.scala b/tests/partest-test/infiniteAlloc.scala
new file mode 100644
index 000000000..89fa5d6ef
--- /dev/null
+++ b/tests/partest-test/infiniteAlloc.scala
@@ -0,0 +1,9 @@
+import scala.collection.mutable
+object Test {
+ val map = mutable.Map.empty[String, String]
+
+ def main(args: Array[String]): Unit = while (true) {
+ val time = System.currentTimeMillis.toString
+ map += (time -> time)
+ }
+}
diff --git a/tests/partest-test/infiniteTail.scala b/tests/partest-test/infiniteTail.scala
new file mode 100644
index 000000000..b3132cc19
--- /dev/null
+++ b/tests/partest-test/infiniteTail.scala
@@ -0,0 +1,7 @@
+object Test {
+ def foo: Int = bar
+ def bar: Int = foo
+
+ def main(args: Array[String]): Unit =
+ println(foo)
+}
diff --git a/tests/pos/i2152.scala b/tests/pos/i2152.scala
new file mode 100644
index 000000000..2171a487e
--- /dev/null
+++ b/tests/pos/i2152.scala
@@ -0,0 +1,7 @@
+class Contra[-D](task: AnyRef)
+object Test {
+ def narrow(task: AnyRef): Contra[task.type] = new Contra(task)
+ def ident[Before](elems: Contra[Before]): Contra[Before] = elems
+ val foo = null
+ ident(narrow(foo))
+}
diff --git a/tests/run/1938-2.scala b/tests/run/1938-2.scala
new file mode 100644
index 000000000..32e4c4518
--- /dev/null
+++ b/tests/run/1938-2.scala
@@ -0,0 +1,37 @@
+object ProdNonEmpty {
+ def _1: Int = 0
+ def _2: String = "???" // Slight variation with scalac: this test passes
+ // with ??? here. I think dotty behavior is fine
+ // according to the spec given that methods involved
+ // in pattern matching should be pure.
+ def isEmpty = false
+ def unapply(s: String): this.type = this
+ def get = this
+}
+
+object ProdEmpty {
+ def _1: Int = ???
+ def _2: String = ???
+ def isEmpty = true
+ def unapply(s: String): this.type = this
+ def get = this
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ "" match {
+ case ProdNonEmpty(0, _) => ()
+ case _ => ???
+ }
+
+ "" match {
+ case ProdNonEmpty(1, _) => ???
+ case _ => ()
+ }
+
+ "" match {
+ case ProdEmpty(_, _) => ???
+ case _ => ()
+ }
+ }
+}
diff --git a/tests/run/t429.scala b/tests/run/t429.scala
index eeed4b080..411d199ee 100644
--- a/tests/run/t429.scala
+++ b/tests/run/t429.scala
@@ -11,5 +11,6 @@ object Test {
}
def main (args: Array[String]): Unit = {
Console.print((new B).y);
+ println()
}
}
diff --git a/tests/run/t9915/C_1.java b/tests/run/t9915/C_1.java
new file mode 100644
index 000000000..4269cf74e
--- /dev/null
+++ b/tests/run/t9915/C_1.java
@@ -0,0 +1,20 @@
+/*
+ * javac: -encoding UTF-8
+ */
+public class C_1 {
+ public static final String NULLED = "X\000ABC";
+ public static final String SUPPED = "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖";
+
+ public String nulled() {
+ return C_1.NULLED;
+ }
+ public String supped() {
+ return C_1.SUPPED;
+ }
+ public int nulledSize() {
+ return C_1.NULLED.length();
+ }
+ public int suppedSize() {
+ return C_1.SUPPED.length();
+ }
+}
diff --git a/tests/run/t9915/Test_2.scala b/tests/run/t9915/Test_2.scala
new file mode 100644
index 000000000..afed667cc
--- /dev/null
+++ b/tests/run/t9915/Test_2.scala
@@ -0,0 +1,12 @@
+
+object Test extends App {
+ val c = new C_1
+ assert(c.nulled == "X\u0000ABC") // "X\000ABC"
+ assert(c.supped == "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖")
+
+ assert(C_1.NULLED == "X\u0000ABC") // "X\000ABC"
+ assert(C_1.SUPPED == "𐒈𐒝𐒑𐒛𐒐𐒘𐒕𐒖")
+
+ assert(C_1.NULLED.size == "XYABC".size)
+ assert(C_1.SUPPED.codePointCount(0, C_1.SUPPED.length) == 8)
+}