diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-01-28 16:13:12 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-01-28 16:13:12 +0000 |
commit | 1898ae130752be2c24b6a92bee417766a52b00f5 (patch) | |
tree | b6f2003c221e89a965f1460dba520ef38f9c40ad /src/compiler | |
parent | d265e01353435fb3078d1064d402cfb79cf84b1e (diff) | |
download | scala-1898ae130752be2c24b6a92bee417766a52b00f5.tar.gz scala-1898ae130752be2c24b6a92bee417766a52b00f5.tar.bz2 scala-1898ae130752be2c24b6a92bee417766a52b00f5.zip |
Fixed issues #1084 and #1611.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeGen.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala | 16 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 20 |
3 files changed, 23 insertions, 17 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index b0d99789b7..4350288fbc 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -77,9 +77,9 @@ abstract class TreeGen { mkAttributedThis(sym) } else if (sym.isType) { assert(termSym != NoSymbol) - mkAttributedIdent(termSym) setType tpe + mkAttributedIdent(termSym) setType tpe } else { - mkAttributedRef(pre, sym) + mkAttributedRef(pre, sym) } case ConstantType(value) => diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 74a63b4e0c..f3bda9fb9c 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -175,11 +175,11 @@ abstract class SymbolLoaders { def recordClass(file: AbstractFile, extension: String, classOK: global.classPath0.Context => Boolean) { if (!file.isDirectory && file.name.endsWith(extension)) { val name = file.name.substring(0, file.name.length - extension.length) - if (isValid(name) && !classes.isDefinedAt(name)) { + if (isValid(name) && !classes.isDefinedAt(name)) { val clazz = directory.find(name, false) if ((clazz ne null) && classOK(clazz)) classes(name) = clazz - } - } + } + } } for (dir <- directory.entries) if ((dir.location ne null) && (!inIDE || dir.location.isDirectory)) { @@ -217,11 +217,11 @@ abstract class SymbolLoaders { // if there's a $member object, enter its members as well. val membersModule = root.info.decl(nme.PACKAGEkw) if (membersModule.isModule) { - for (member <- membersModule.info.decls.elements) { - // todo: handle overlapping definitions in some way: mark as errors - // or treat as abstractions. - root.info.decls.enter(member) - } + for (member <- membersModule.info.decls.elements) { + // todo: handle overlapping definitions in some way: mark as errors + // or treat as abstractions. + root.info.decls.enter(member) + } } } } diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index c175888da7..cf2b194489 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -126,8 +126,9 @@ abstract class CleanUp extends Transform { * this limitation only arises when the called method is defined as a * refinement, where the refinement defines a parameter based on a * type variable. */ - case ad@ApplyDynamic(qual, params) => + case ad@ApplyDynamic(qual0, params) => assert(ad.symbol.isPublic) + var qual: Tree = qual0 /* ### CREATING THE METHOD CACHE ### */ @@ -620,12 +621,17 @@ abstract class CleanUp extends Transform { case MethodType(paramTypes, resType) => assert(params.length == paramTypes.length) atPos(ad.pos)(localTyper.typed { - fixResult(if (isValueClass(resType.typeSymbol)) boxedClass(resType.typeSymbol).tpe else resType) { - if (mayRequirePrimitiveReplacement) - callAsOperator(paramTypes, resType) - else - callAsMethod(paramTypes, resType) - } + val sym = currentOwner.newValue(ad.pos, newTermName(unit.fresh.newName("qual"))) setInfo qual0.tpe + qual = gen.mkAttributedRef(sym) + Block( + List(ValDef(sym, qual0)), + fixResult(if (isValueClass(resType.typeSymbol)) boxedClass(resType.typeSymbol).tpe else resType) { + if (mayRequirePrimitiveReplacement) + callAsOperator(paramTypes, resType) + else + callAsMethod(paramTypes, resType) + } + ) }) } |