summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-01-09 19:39:31 +0000
committerMartin Odersky <odersky@gmail.com>2007-01-09 19:39:31 +0000
commitf75cbd338f81a00ab9696fb0482fd561ce1a0826 (patch)
treee42d6f72e23be6c823d4408c07d5fa92791c8499 /src/compiler
parent6835f1377b16ef8d42850dade06ee840e0f2c35a (diff)
downloadscala-f75cbd338f81a00ab9696fb0482fd561ce1a0826.tar.gz
scala-f75cbd338f81a00ab9696fb0482fd561ce1a0826.tar.bz2
scala-f75cbd338f81a00ab9696fb0482fd561ce1a0826.zip
fixed bugs 880, 877, 876, 875, Added capitalize...
fixed bugs 880, 877, 876, 875, Added capitalize method to RichString
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/StdNames.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala23
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
4 files changed, 25 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 454eed1755..d8ca5d73a1 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1925,7 +1925,7 @@ trait Parsers requires SyntaxAnalyzer {
val parent = simpleType(false)
// System.err.println("classTempl: " + parent)
parents += parent
- if (in.token == LPAREN)
+ if (in.token == LPAREN && !mods.hasFlag(Flags.TRAIT))
do { argss += argumentExprs() } while (in.token == LPAREN)
else argss += List()
while (in.token == WITH) {
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index fee88151f2..be740910ef 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -173,6 +173,7 @@ trait StdNames requires SymbolTable {
val MINUS = encode("-")
val PLUS = encode("+")
+ val PLUSPLUS = encode("++")
val TILDE = encode("~")
val EQEQ = encode("==")
val BANG = encode("!")
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 05bd8b664d..9d3180f0f2 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -277,19 +277,30 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
val args1 =
formals.last match {
case TypeRef(pre, sym, List(elempt)) if (sym == RepeatedParamClass) =>
- def mkArrayValue(ts: List[Tree]) =
+ def mkArrayValue(ts: List[Tree]): Tree =
atPos(pos)(ArrayValue(TypeTree(elempt), ts) setType formals.last);
-
+ def mkConcat(left: Tree, right: Tree): Tree =
+ atPos(pos) {
+ localTyper.typed {
+ Apply(
+ TypeApply(
+ Select(left, nme.PLUSPLUS),
+ List(TypeTree(elempt))),
+ List(right))
+ } setType formals.last
+ }
if (args.isEmpty)
List(mkArrayValue(args))
else {
- val suffix: Tree = args.last match {
+ val {fixedArgs, varArgs} = args.splitAt(formals.length - 1)
+ val suffix = args.last match {
case Typed(arg, Ident(name)) if name == nme.WILDCARD_STAR.toTypeName =>
- arg setType seqType(arg.tpe)
+ if (varArgs.length > 1) mkConcat(ArrayValue(TypeTree(elempt), varArgs.init), arg)
+ else arg setType seqType(arg.tpe)
case _ =>
- mkArrayValue(args.drop(formals.length - 1))
+ mkArrayValue(varArgs)
}
- args.take(formals.length - 1) ::: List(suffix)
+ fixedArgs ::: List(suffix)
}
case _ => args
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index cc6c1dfb00..be33fb215d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -459,11 +459,10 @@ trait Typers requires Analyzer {
case Select(qual, _) => qual.tpe
case _ => NoPrefix
}
- if (tree.tpe.isInstanceOf[MethodType] && pre.isStable &&
- (pt.isStable || (mode & QUALmode) != 0 && !sym.isConstant || sym.isModule)) {
- assert(sym.tpe.paramTypes.isEmpty)
- tree.setType(MethodType(List(), singleType(pre, sym)))
- } else tree
+ if (tree.tpe.isInstanceOf[MethodType] && pre.isStable && sym.tpe.paramTypes.isEmpty &&
+ (pt.isStable || (mode & QUALmode) != 0 && !sym.isConstant || sym.isModule))
+ tree.setType(MethodType(List(), singleType(pre, sym)))
+ else tree
}
/** Perform the following adaptations of expression, pattern or type `tree' wrt to
@@ -1693,9 +1692,9 @@ trait Typers requires Analyzer {
else cx.depth - (cx.scope.nestingLevel - defEntry.owner.nestingLevel)
var impSym: Symbol = NoSymbol; // the imported symbol
var imports = context.imports; // impSym != NoSymbol => it is imported from imports.head
- while (impSym == NoSymbol && !imports.isEmpty && imports.head.depth > symDepth) {
+ while (!impSym.exists && !imports.isEmpty && imports.head.depth > symDepth) {
impSym = imports.head.importedSymbol(name)
- if (impSym == NoSymbol) imports = imports.tail
+ if (!impSym.exists) imports = imports.tail
}
// detect ambiguous definition/import,