summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala4
-rw-r--r--test/files/neg/t8291.check7
-rw-r--r--test/files/neg/t8291.scala7
3 files changed, 17 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index b85c8e6d42..74c28122a1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -1478,8 +1478,10 @@ trait Implicits {
})
private lazy val typeParamNames: List[String] = sym.typeParams.map(_.decodedName)
+ private def typeArgsAtSym(paramTp: Type) = paramTp.baseType(sym).typeArgs
+
+ def format(paramName: Name, paramTp: Type): String = format(typeArgsAtSym(paramTp) map (_.toString))
- def format(paramName: Name, paramTp: Type): String = format(paramTp.typeArgs map (_.toString))
def format(typeArgs: List[String]): String =
interpolate(msg, Map((typeParamNames zip typeArgs): _*)) // TODO: give access to the name and type of the implicit argument, etc?
diff --git a/test/files/neg/t8291.check b/test/files/neg/t8291.check
new file mode 100644
index 0000000000..c9972e5575
--- /dev/null
+++ b/test/files/neg/t8291.check
@@ -0,0 +1,7 @@
+t8291.scala:5: error: Could not find implicit for Int or String
+ implicitly[X[Int, String]]
+ ^
+t8291.scala:6: error: Could not find implicit for Int or String
+ implicitly[Z[String]]
+ ^
+two errors found
diff --git a/test/files/neg/t8291.scala b/test/files/neg/t8291.scala
new file mode 100644
index 0000000000..b344586a56
--- /dev/null
+++ b/test/files/neg/t8291.scala
@@ -0,0 +1,7 @@
+@scala.annotation.implicitNotFound("Could not find implicit for ${T} or ${U}") trait X[T, U]
+
+object Test {
+ type Z[U] = X[Int, U]
+ implicitly[X[Int, String]]
+ implicitly[Z[String]]
+}