summaryrefslogtreecommitdiff
path: root/test/files/neg/forgot-interpolator.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-27 13:49:56 -0700
committerPaul Phillips <paulp@improving.org>2013-09-27 13:49:56 -0700
commit85160957cd072507bbcd164349211c9a4eb8372d (patch)
tree9b878644e842e4ca6ca65e7a632336347375fdc1 /test/files/neg/forgot-interpolator.scala
parent5a8cd09819f58adcb866722f48b00066d23e7a82 (diff)
downloadscala-85160957cd072507bbcd164349211c9a4eb8372d.tar.gz
scala-85160957cd072507bbcd164349211c9a4eb8372d.tar.bz2
scala-85160957cd072507bbcd164349211c9a4eb8372d.zip
Some refinement of -Xlint interpolation warning.
I had covered a few more cases working on this recently. The warnings in several more cases involving polymorphism, currying, and selects vs. idents receive more refined handling.
Diffstat (limited to 'test/files/neg/forgot-interpolator.scala')
-rw-r--r--test/files/neg/forgot-interpolator.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/files/neg/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala
index e007f15009..34a7c7aef4 100644
--- a/test/files/neg/forgot-interpolator.scala
+++ b/test/files/neg/forgot-interpolator.scala
@@ -57,3 +57,37 @@ package test {
@implicitNotFound("No Z in ${A}") // no warn
class Z[A]
}
+
+
+package inf1 {
+ import scala.annotation.implicitNotFound
+
+ @implicitNotFound(msg = "Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.") // no warn
+ trait CannotBuildFrom[-From, -Elem, +To]
+}
+
+package inf2 {
+ @scala.annotation.implicitNotFound(msg = "Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.") // no warn
+ trait CannotBuildFrom[-From, -Elem, +To]
+}
+
+package inf3 {
+ @scala.annotation.implicitNotFound("Cannot construct a collection of type ${To} with elements of type ${Elem} based on a collection of type ${From}.") // no warn
+ trait CannotBuildFrom[-From, -Elem, +To]
+}
+
+package curry {
+ class A {
+ def bunko()(x: Int): Int = 5
+ def groucho(): Int = 5
+ def dingo()()()()()(): Int = 5 // kind of nuts this can be evaluated with just 'dingo', but okay
+ def calico[T1, T2]()()(): Int = 5 // even nutsier
+ def palomino[T1, T2]()(y: Int = 5)(): Int = 5 // even nutsier
+
+ def f1 = "I was picked up by the $bunko squad" // no warn
+ def f2 = "I salute $groucho" // warn 7
+ def f3 = "I even salute $dingo" // warn 8
+ def f4 = "I also salute $calico" // warn 9
+ def f5 = "I draw the line at $palomino" // no warn
+ }
+}