diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 13 | ||||
-rw-r--r-- | test/files/buildmanager/t4215/A.scala | 5 | ||||
-rw-r--r-- | test/files/buildmanager/t4215/t4215.check | 6 | ||||
-rw-r--r-- | test/files/buildmanager/t4215/t4215.test | 2 |
4 files changed, 24 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index c7e624d96e..54e5978e7b 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -3810,8 +3810,17 @@ A type's typeSymbol should never be inspected directly. } else if (sym.isModuleClass) { val adaptedSym = adaptToNewRun(pre, sym.sourceModule) // Handle nested objects properly - val result = if (adaptedSym.isLazy) adaptedSym.lazyAccessor else adaptedSym.moduleClass - assert(result != NoSymbol, sym+" "+adaptedSym+" "+adaptedSym.isLazy) + val result0 = if (adaptedSym.isLazy) adaptedSym.lazyAccessor else adaptedSym.moduleClass + val result = if (result0 == NoSymbol) + // The only possible way we got here is when + // object is defined inside the method and unfortunately + // we have no way of retrieving that information (and using it) + // at this point, so just use the old symbol. + // This also means that sym.sourceModule == adaptedSym since + // pre == NoPrefix. see #4215 + sym + else result0 + result } else if ((pre eq NoPrefix) || (pre eq NoType) || sym.isPackageClass) { sym diff --git a/test/files/buildmanager/t4215/A.scala b/test/files/buildmanager/t4215/A.scala new file mode 100644 index 0000000000..fbddd93afc --- /dev/null +++ b/test/files/buildmanager/t4215/A.scala @@ -0,0 +1,5 @@ +class A { + def B { + object C + } +} diff --git a/test/files/buildmanager/t4215/t4215.check b/test/files/buildmanager/t4215/t4215.check new file mode 100644 index 0000000000..d9ec9a743a --- /dev/null +++ b/test/files/buildmanager/t4215/t4215.check @@ -0,0 +1,6 @@ +builder > A.scala +compiling Set(A.scala) +Changes: Map() +builder > A.scala +compiling Set(A.scala) +Changes: Map(class A -> List(), object A$C$2 -> List()) diff --git a/test/files/buildmanager/t4215/t4215.test b/test/files/buildmanager/t4215/t4215.test new file mode 100644 index 0000000000..392e0d365f --- /dev/null +++ b/test/files/buildmanager/t4215/t4215.test @@ -0,0 +1,2 @@ +>>compile A.scala +>>compile A.scala |