summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/duration-tck.scala11
-rw-r--r--test/files/neg/unchecked-knowable.check7
-rw-r--r--test/files/neg/unchecked-knowable.scala4
-rw-r--r--test/files/pos/t6537.flags1
-rw-r--r--test/files/pos/t6537.scala16
-rw-r--r--test/files/pos/t6552.scala8
6 files changed, 40 insertions, 7 deletions
diff --git a/test/files/jvm/duration-tck.scala b/test/files/jvm/duration-tck.scala
index df1052fed3..d0f13816a6 100644
--- a/test/files/jvm/duration-tck.scala
+++ b/test/files/jvm/duration-tck.scala
@@ -170,11 +170,14 @@ object Test extends App {
// test Deadline
val dead = 2.seconds.fromNow
val dead2 = 2 seconds fromNow
- assert(dead.timeLeft > 1.second)
- assert(dead2.timeLeft > 1.second)
+
+ { val l = dead.timeLeft; assert(l > 1.second, s"$l <= 1.second") }
+ { val l = dead2.timeLeft; assert(l > 1.second, s"$l <= 1.second") }
+
Thread.sleep(1.second.toMillis)
- assert(dead.timeLeft < 1.second)
- assert(dead2.timeLeft < 1.second)
+
+ { val l = dead.timeLeft; assert(l <= 1.second, s"$l > 1.second") }
+ { val l = dead2.timeLeft; assert(l <= 1.second, s"$l > 1.second") }
// test integer mul/div
diff --git a/test/files/neg/unchecked-knowable.check b/test/files/neg/unchecked-knowable.check
index 3a6ef994b5..d279427327 100644
--- a/test/files/neg/unchecked-knowable.check
+++ b/test/files/neg/unchecked-knowable.check
@@ -1,4 +1,7 @@
-unchecked-knowable.scala:17: error: fruitless type test: a value of type Bippy cannot also be a A1
+unchecked-knowable.scala:18: error: fruitless type test: a value of type Bippy cannot also be a A1
/* warn */ (new Bippy).isInstanceOf[A1]
^
-one error found
+unchecked-knowable.scala:19: error: fruitless type test: a value of type Bippy cannot also be a B1
+ /* warn */ (new Bippy).isInstanceOf[B1]
+ ^
+two errors found
diff --git a/test/files/neg/unchecked-knowable.scala b/test/files/neg/unchecked-knowable.scala
index 667b47f504..21624c4fb4 100644
--- a/test/files/neg/unchecked-knowable.scala
+++ b/test/files/neg/unchecked-knowable.scala
@@ -7,6 +7,7 @@ final class A4 extends A2
/** Unknowable */
sealed abstract class B1
sealed abstract class B2 extends B1
+sealed trait B2B extends B1
final class B3 extends B1
trait B4 extends B2
@@ -15,6 +16,7 @@ trait Dingus
class A {
/* warn */ (new Bippy).isInstanceOf[A1]
- /* nowarn */ (new Bippy).isInstanceOf[B1]
+ /* warn */ (new Bippy).isInstanceOf[B1]
+ /* nowarn */ (null: Dingus).isInstanceOf[B1]
/* nowarn */ ((new Bippy): Any).isInstanceOf[A1]
}
diff --git a/test/files/pos/t6537.flags b/test/files/pos/t6537.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/pos/t6537.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/pos/t6537.scala b/test/files/pos/t6537.scala
new file mode 100644
index 0000000000..d0ca3ba435
--- /dev/null
+++ b/test/files/pos/t6537.scala
@@ -0,0 +1,16 @@
+package tester
+
+object PatMatWarning {
+
+ sealed trait X
+ sealed trait Y
+
+ def f(x: X) = x match {
+ case _: Y => false
+ case _ => true
+ }
+
+ class X1 extends X
+ class Y1 extends Y
+ class Z1 extends X with Y
+}
diff --git a/test/files/pos/t6552.scala b/test/files/pos/t6552.scala
new file mode 100644
index 0000000000..98e686a1ae
--- /dev/null
+++ b/test/files/pos/t6552.scala
@@ -0,0 +1,8 @@
+object Repros {
+ class Bar {}
+ class Baz(val myFoo: Foo) { }
+ trait Foo {
+ this: Bar =>
+ val thing = new Baz(this)
+ }
+}