Permalink
Browse files

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 f5c336d
for more on this.)
  • Loading branch information...
1 parent 290220b commit 1e2328ea6a8b592b5a2abe3557dc633e96f688f2 @paulp paulp committed with adriaanm Oct 31, 2012
@@ -398,7 +398,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)
@@ -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
@@ -0,0 +1,5 @@
+object Test {
+ trait T extends Any
+ implicit case class Quux(value: Int) extends AnyVal with T
+ object Quux
+}

0 comments on commit 1e2328e

Please sign in to comment.