summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:31:23 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:31:23 -0800
commit9dbcbf14080197046825d16300b20b068cd7b1a0 (patch)
treeae134d7f0cfc50c0673713c2a2ba097eae6658fa
parent9739002305057e755957eb59d7e259e519b91537 (diff)
parent1212af48f474bc392b73d29f4719b5ff8d0a66fa (diff)
downloadscala-9dbcbf14080197046825d16300b20b068cd7b1a0.tar.gz
scala-9dbcbf14080197046825d16300b20b068cd7b1a0.tar.bz2
scala-9dbcbf14080197046825d16300b20b068cd7b1a0.zip
Merge pull request #1889 from retronym/ticket/5340
SI-5340 Change println to log
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--test/files/neg/t5340.check6
-rw-r--r--test/files/neg/t5340.scala29
3 files changed, 36 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 10003723fd..ec3a0a0ef7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -956,7 +956,7 @@ trait Implicits {
infoMap get sym match {
case Some(infos1) =>
if (infos1.nonEmpty && !(pre =:= infos1.head.pre.prefix)) {
- println("amb prefix: "+pre+"#"+sym+" "+infos1.head.pre.prefix+"#"+sym)
+ log(s"Ignoring implicit members of $pre#$sym as it is also visible via another prefix: ${infos1.head.pre.prefix}")
infoMap(sym) = List() // ambiguous prefix - ignore implicit members
}
case None =>
diff --git a/test/files/neg/t5340.check b/test/files/neg/t5340.check
new file mode 100644
index 0000000000..2de19293c4
--- /dev/null
+++ b/test/files/neg/t5340.check
@@ -0,0 +1,6 @@
+t5340.scala:17: error: type mismatch;
+ found : MyApp.r.E
+ required: MyApp.s.E
+ println(b: s.E)
+ ^
+one error found
diff --git a/test/files/neg/t5340.scala b/test/files/neg/t5340.scala
new file mode 100644
index 0000000000..b283f13338
--- /dev/null
+++ b/test/files/neg/t5340.scala
@@ -0,0 +1,29 @@
+class Poly {
+ class E
+ object E {
+ implicit def conv(value: Any): E = sys.error("")
+ }
+}
+
+object MyApp {
+ val r: Poly = sys.error("")
+ val s: Poly = sys.error("")
+ val b: r.E = sys.error("")
+
+ // okay
+ s.E.conv(b): s.E
+
+ // compilation fails with error below
+ println(b: s.E)
+
+ // amb prefix: MyApp.s.type#class E MyApp.r.type#class E
+ // amb prefix: MyApp.s.type#class E MyApp.r.type#class E
+ // ../test/pending/run/t5310.scala:17: error: type mismatch;
+ // found : MyApp.r.E
+ // required: MyApp.s.E
+ // println(b: s.E)
+ // ^
+
+ // The type error is as expected, but the `amb prefix` should be logged,
+ // rather than printed to standard out.
+}