diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-10-05 10:26:02 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-10-05 10:28:13 +1000 |
commit | a87db212098a5e69176652c93284f425bb7e1b09 (patch) | |
tree | 1fd1cbf43b17f085c3760a04ac6ecb5d221fcafd /test/files | |
parent | 7b2c3cb8bb0f5f96f3182f551eb82cb1c59d460c (diff) | |
download | scala-a87db212098a5e69176652c93284f425bb7e1b09.tar.gz scala-a87db212098a5e69176652c93284f425bb7e1b09.tar.bz2 scala-a87db212098a5e69176652c93284f425bb7e1b09.zip |
SI-8291 Fix implicitNotFound message with type aliases
This pattern of code is typically a bug:
if (f(tp.typeSymbol)) {
g(tp.typeArgs)
}
Intead, one needs to take the base type of `tp` wrt `tp.typeSymbol`.
This commit does exactly that when formatting the `@implicitNotFound`
custom error message.
Patch found on the back of an envelope in the handwriting of @adriaanm
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t8291.check | 7 | ||||
-rw-r--r-- | test/files/neg/t8291.scala | 7 |
2 files changed, 14 insertions, 0 deletions
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]] +} |