summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2017-02-24 08:36:02 +0100
committerGitHub <noreply@github.com>2017-02-24 08:36:02 +0100
commite2aaf2c1cbd2ee98da2d1a7807dc25b036832a08 (patch)
treea48b69fe2f23afd1163c848f51e2057fd539b315 /src/compiler
parentf174bfb1b820a7546af3529c1c703a1c2b20ef6a (diff)
parente5c957e764c5869e97da7d0dd8fec1bc86283e22 (diff)
downloadscala-e2aaf2c1cbd2ee98da2d1a7807dc25b036832a08.tar.gz
scala-e2aaf2c1cbd2ee98da2d1a7807dc25b036832a08.tar.bz2
scala-e2aaf2c1cbd2ee98da2d1a7807dc25b036832a08.zip
Merge pull request #5723 from dragos/issue/regression-assert-ide
Fix regression introduced by 5751763
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index d948d151a6..dd44366692 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -122,11 +122,16 @@ abstract class SymbolLoaders {
* and give them `completer` as type.
*/
def enterClassAndModule(root: Symbol, name: String, getCompleter: (ClassSymbol, ModuleSymbol) => SymbolLoader) {
- val clazz = newClass(root, name)
- val module = newModule(root, name)
- val completer = getCompleter(clazz, module)
- enterClass(root, clazz, completer)
- enterModule(root, module, completer)
+ val clazz0 = newClass(root, name)
+ val module0 = newModule(root, name)
+ val completer = getCompleter(clazz0, module0)
+ // enterClass/Module may return an existing symbol instead of the ones we created above
+ // this may happen when there's both sources and binaries on the classpath, but the class
+ // name is different from the file name, so the classpath can't match the binary and source
+ // representation. `companionModule/Class` prefers the source version, so we should be careful
+ // to reuse the symbols returned below.
+ val clazz = enterClass(root, clazz0, completer)
+ val module = enterModule(root, module0, completer)
if (!clazz.isAnonymousClass) {
// Diagnostic for SI-7147
def msg: String = {