From 006e12a119e6fd5fc40584d4edb4c11f4ffdf7f9 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 23 May 2012 08:18:17 -0700 Subject: Relax -Xlint warning for implicit classes. Closes SI-5809. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 2 +- test/files/pos/t5809.flags | 1 + test/files/pos/t5809.scala | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/files/pos/t5809.flags create mode 100644 test/files/pos/t5809.scala diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 2f2278251b..b4f42a5033 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -636,7 +636,7 @@ trait Namers extends MethodSynthesis { classAndNamerOfModule(m) = (tree, null) } val owner = tree.symbol.owner - if (settings.lint.value && owner.isPackageObjectClass) { + if (settings.lint.value && owner.isPackageObjectClass && !mods.isImplicit) { context.unit.warning(tree.pos, "it is not recommended to define classes/objects inside of package objects.\n" + "If possible, define " + tree.symbol + " in " + owner.skipPackageObject + " instead." diff --git a/test/files/pos/t5809.flags b/test/files/pos/t5809.flags new file mode 100644 index 0000000000..e93641e931 --- /dev/null +++ b/test/files/pos/t5809.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings \ No newline at end of file diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala new file mode 100644 index 0000000000..8f6ce708d2 --- /dev/null +++ b/test/files/pos/t5809.scala @@ -0,0 +1,10 @@ +package scala.reflect + +package object api { + implicit class PimpedExpr[T](expr: Universe # Expr[T]) { + def runtimeEval: T = { + println("hello, dear") + expr.eval + } + } +} \ No newline at end of file -- cgit v1.2.3