diff options
author | Paul Phillips <paulp@improving.org> | 2013-04-18 11:58:30 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-04-18 11:59:18 -0700 |
commit | 8556ca04c466cd7f7412465f02c52b764104f736 (patch) | |
tree | 0f847a4c1119fcca236183793a8615bd945341f0 | |
parent | 4525e9223a2fb7c1ec3014073566b559e5839805 (diff) | |
download | scala-8556ca04c466cd7f7412465f02c52b764104f736.tar.gz scala-8556ca04c466cd7f7412465f02c52b764104f736.tar.bz2 scala-8556ca04c466cd7f7412465f02c52b764104f736.zip |
Quiet down overloaded implicit warning.
Apparently implicit classes product both a method symbol and
a module symbol, both of which are marked implicit, which left
this warning code believing there was an overloaded implicit
method.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 9 | ||||
-rw-r--r-- | test/files/pos/xlint1.flags | 1 | ||||
-rw-r--r-- | test/files/pos/xlint1.scala | 13 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index b9fdd7280e..9a9ca6a654 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -135,7 +135,8 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans } if (settings.lint.value) { clazz.info.decls filter (x => x.isImplicit && x.typeParams.nonEmpty) foreach { sym => - val alts = clazz.info.decl(sym.name).alternatives + // implicit classes leave both a module symbol and a method symbol as residue + val alts = clazz.info.decl(sym.name).alternatives filterNot (_.isModule) if (alts.size > 1) alts foreach (x => unit.warning(x.pos, "parameterized overloaded implicit methods are not visible as view bounds")) } @@ -1373,12 +1374,12 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans */ private def checkMigration(sym: Symbol, pos: Position) = { if (sym.hasMigrationAnnotation) { - val changed = try + val changed = try settings.Xmigration.value < ScalaVersion(sym.migrationVersion.get) catch { - case e : NumberFormatException => + case e : NumberFormatException => unit.warning(pos, s"${sym.fullLocationString} has an unparsable version number: ${e.getMessage()}") - // if we can't parse the format on the migration annotation just conservatively assume it changed + // if we can't parse the format on the migration annotation just conservatively assume it changed true } if (changed) diff --git a/test/files/pos/xlint1.flags b/test/files/pos/xlint1.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/pos/xlint1.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/pos/xlint1.scala b/test/files/pos/xlint1.scala new file mode 100644 index 0000000000..27936d8b14 --- /dev/null +++ b/test/files/pos/xlint1.scala @@ -0,0 +1,13 @@ +package object foo { + implicit class Bar[T](val x: T) extends AnyVal { + def bippy = 1 + } +} + +package foo { + object Baz { + def main(args: Array[String]): Unit = { + "abc".bippy + } + } +} |