diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-31 14:08:29 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-31 14:11:56 -0700 |
commit | 187c61a0e49c8f880a0599d64955e47e167579dc (patch) | |
tree | c237da1d040e41ce9421a29b18c3fbc2c0e4a6fa | |
parent | 8eefac8c25c2b20e2e8d1e7de1882460e90ceeb5 (diff) | |
download | scala-187c61a0e49c8f880a0599d64955e47e167579dc.tar.gz scala-187c61a0e49c8f880a0599d64955e47e167579dc.tar.bz2 scala-187c61a0e49c8f880a0599d64955e47e167579dc.zip |
Fix for SI-6597, implicit case class crasher.
It seems to me like every call to scope.lookup in the
compiler is a latent bug. If a symbol is overloaded, you
get one at random. (See the FIXME comment in f5c336d5660
for more on this.)
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t6597.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6597.scala | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 2c4034db84..99b927af66 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -414,7 +414,7 @@ trait Namers extends MethodSynthesis { * a module definition or a class definition. */ def enterModuleSymbol(tree : ModuleDef): Symbol = { - var m: Symbol = context.scope.lookup(tree.name) + var m: Symbol = context.scope lookupAll tree.name find (_.isModule) getOrElse NoSymbol val moduleFlags = tree.mods.flags | MODULE if (m.isModule && !m.isPackage && inCurrentScope(m) && (currentRun.canRedefine(m) || m.isSynthetic)) { updatePosFlags(m, tree.pos, moduleFlags) diff --git a/test/files/neg/t6597.check b/test/files/neg/t6597.check new file mode 100644 index 0000000000..1d52519d1d --- /dev/null +++ b/test/files/neg/t6597.check @@ -0,0 +1,4 @@ +t6597.scala:3: error: illegal combination of modifiers: implicit and case for: class Quux + implicit case class Quux(value: Int) extends AnyVal with T + ^ +one error found diff --git a/test/files/neg/t6597.scala b/test/files/neg/t6597.scala new file mode 100644 index 0000000000..dde53bcc89 --- /dev/null +++ b/test/files/neg/t6597.scala @@ -0,0 +1,5 @@ +object Test { + trait T extends Any + implicit case class Quux(value: Int) extends AnyVal with T + object Quux +} |