aboutsummaryrefslogtreecommitdiff
path: root/tests/run/t6632.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/t6632.scala')
-rw-r--r--tests/run/t6632.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/run/t6632.scala b/tests/run/t6632.scala
new file mode 100644
index 000000000..baf4e7309
--- /dev/null
+++ b/tests/run/t6632.scala
@@ -0,0 +1,22 @@
+object Test extends dotty.runtime.LegacyApp {
+ import collection.mutable.ListBuffer
+
+ def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
+
+ def iiobe[A](f: => A) =
+ try { f }
+ catch { case ex: IndexOutOfBoundsException => println(ex) }
+
+ val lb0 = newLB
+ iiobe( lb0.insert(-1, 'x) )
+
+ val lb1 = newLB
+ iiobe( lb1.insertAll(-2, Array('x, 'y, 'z)) )
+
+ val lb2 = newLB
+ iiobe( lb2.update(-3, 'u) )
+
+ val lb3 = newLB
+ iiobe( lb3.updated(-1, 'u) )
+ iiobe( lb3.updated(5, 'u) )
+}