aboutsummaryrefslogtreecommitdiff
path: root/tests/neg
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-02-08 22:21:05 +1100
committerGitHub <noreply@github.com>2017-02-08 22:21:05 +1100
commit18d5913821064fffa0c74524ba1a8ead9a7def31 (patch)
tree502b93ffc33390ec0f433dfa5b71b7e9c384edd2 /tests/neg
parent99679cffc0a5d20e7e7f3c090eb310a6134eeee7 (diff)
parentabbee9e28ef3f0150c9afa48f485ecc49e0e3787 (diff)
downloaddotty-18d5913821064fffa0c74524ba1a8ead9a7def31.tar.gz
dotty-18d5913821064fffa0c74524ba1a8ead9a7def31.tar.bz2
dotty-18d5913821064fffa0c74524ba1a8ead9a7def31.zip
Merge pull request #1921 from dotty-staging/fix-#1907
Fix #1907: Improve error message
Diffstat (limited to 'tests/neg')
-rw-r--r--tests/neg/i1802.scala4
-rw-r--r--tests/neg/i1907.scala7
-rw-r--r--tests/neg/undet-classtag.scala27
3 files changed, 36 insertions, 2 deletions
diff --git a/tests/neg/i1802.scala b/tests/neg/i1802.scala
index 56da672a8..93e790f18 100644
--- a/tests/neg/i1802.scala
+++ b/tests/neg/i1802.scala
@@ -14,8 +14,8 @@ object Exception {
def apply(x: Throwable): T = f(downcast(x).get)
}
- def mkThrowableCatcher[T](isDef: Throwable => Boolean, f: Throwable => T) = mkCatcher(isDef, f)
+ def mkThrowableCatcher[T](isDef: Throwable => Boolean, f: Throwable => T) = mkCatcher(isDef, f) // error: undetermined ClassTag
- implicit def throwableSubtypeToCatcher[Ex <: Throwable: ClassTag, T](pf: PartialFunction[Ex, T]) = // error: cyclic reference
+ implicit def throwableSubtypeToCatcher[Ex <: Throwable: ClassTag, T](pf: PartialFunction[Ex, T]) =
mkCatcher(pf.isDefinedAt _, pf.apply _)
}
diff --git a/tests/neg/i1907.scala b/tests/neg/i1907.scala
new file mode 100644
index 000000000..6bc3bb56f
--- /dev/null
+++ b/tests/neg/i1907.scala
@@ -0,0 +1,7 @@
+import java.io.File
+
+object Test {
+ Some(new File("."))
+ .map(_.listFiles).getOrElse(Array.empty) // error: undetermined ClassTag
+ .map(_.listFiles)
+}
diff --git a/tests/neg/undet-classtag.scala b/tests/neg/undet-classtag.scala
new file mode 100644
index 000000000..dfe0eb2db
--- /dev/null
+++ b/tests/neg/undet-classtag.scala
@@ -0,0 +1,27 @@
+import scala.reflect.ClassTag
+
+object Test {
+ def f[T: reflect.ClassTag](x: T) = ???
+
+ f(???) // error: undetermined ClassTag
+}
+
+// SI 9754
+object Program {
+ def test[T: ClassTag](x: T) = {
+ val arr = new Array[T](1)
+ println(arr.getClass)
+ println(x.getClass)
+ arr(0) = x
+ }
+
+ def main(args: Array[String]): Unit = {
+ test(new Array[Nothing](0)) // error: undetermined ClassTag
+ }
+}
+
+// SI 5353
+object t5353 {
+ if (false) Array("qwe") else Array() // error: undetermined ClassTag
+}
+