From 4e8414de05bc4c3e7591df861bc3dea25738074e Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 13 Dec 2005 19:24:04 +0000 Subject: *** empty log message *** --- sources/scala/dbc/datatype/ApproximateNumeric.scala | 2 +- sources/scala/dbc/statement/Select.scala | 8 ++++---- sources/scala/tools/nsc/ant/NSC.scala | 4 ++-- sources/scala/tools/nsc/ast/TreePrinters.scala | 2 +- sources/scala/tools/nsc/ast/parser/Parsers.scala | 5 ++++- sources/scala/tools/nsc/transform/Constructors.scala | 2 +- sources/scala/tools/nsc/typechecker/Namers.scala | 12 +++++++----- sources/scala/tools/nsc/typechecker/Typers.scala | 18 ++++++++++-------- .../scala/xml/parsing/ValidatingMarkupHandler.scala | 2 +- sources/scala/xml/path/Expression.scala | 4 ++-- 10 files changed, 33 insertions(+), 26 deletions(-) (limited to 'sources') diff --git a/sources/scala/dbc/datatype/ApproximateNumeric.scala b/sources/scala/dbc/datatype/ApproximateNumeric.scala index 5dd35842ec..d75da1eb50 100644 --- a/sources/scala/dbc/datatype/ApproximateNumeric.scala +++ b/sources/scala/dbc/datatype/ApproximateNumeric.scala @@ -45,7 +45,7 @@ abstract class ApproximateNumeric[Type] ( case Tuple2(2,128) => "DOUBLE PRECISION" case Tuple2(2,p) => throw exception.UnsupportedFeature("SQL-99 does not support an approximate numeric type with a binary defined precision other than 16, 32 and 64 bits"); - case Tuple2(10,p) => "FLOAT (" + p.toString + ")" + case Tuple2(10,p) => "FLOAT (" + p.toString() + ")" case Tuple2(pr,_) => throw exception.UnsupportedFeature("SQL-99 does not support the precision of an approximate numeric type to be defined in a radix other than 2 or 10"); } diff --git a/sources/scala/dbc/statement/Select.scala b/sources/scala/dbc/statement/Select.scala index cadf82a02d..47c449d0e1 100644 --- a/sources/scala/dbc/statement/Select.scala +++ b/sources/scala/dbc/statement/Select.scala @@ -56,13 +56,13 @@ abstract class Select extends Relation { }) + (selectList match { case Nil => " *" - case _ => " " + selectList.tail.foldLeft(selectList.head.sqlString) - ((name:String, dc:DerivedColumn) => name + ", " + dc.sqlString) + case _ => (" " + selectList.tail.foldLeft(selectList.head.sqlString) + ((name:String, dc:DerivedColumn) => name + ", " + dc.sqlString)) }) + (fromClause match { case Nil => error("Empty from clause is not allowed") - case _ => " FROM " + fromClause.tail.foldLeft(fromClause.head.sqlInnerString) - ((name:String, rel:Relation) => name + ", " + rel.sqlInnerString) + case _ => (" FROM " + fromClause.tail.foldLeft(fromClause.head.sqlInnerString) + ((name:String, rel:Relation) => name + ", " + rel.sqlInnerString)) }) + (whereClause match { case None => "" diff --git a/sources/scala/tools/nsc/ant/NSC.scala b/sources/scala/tools/nsc/ant/NSC.scala index e1b88160a5..0c12d81af6 100644 --- a/sources/scala/tools/nsc/ant/NSC.scala +++ b/sources/scala/tools/nsc/ant/NSC.scala @@ -491,7 +491,7 @@ package scala.tools.nsc.ant { * @return The file corresponding to the provided name. */ private def nameToFile(pathName: String, origin: File)(name: String): File = { - nameToFile(testReadableFile(pathName), origin)(name); + nameToFile((f: File) => testReadableFile(pathName)(f), origin)(name); } /** @@ -501,7 +501,7 @@ package scala.tools.nsc.ant { * @return The file corresponding to the provided name. */ private def nameToFile(pathName: String)(name: String): File = { - nameToFile(testReadableFile(pathName))(name); + nameToFile((f: File) => testReadableFile(pathName)(f))(name); } /** diff --git a/sources/scala/tools/nsc/ast/TreePrinters.scala b/sources/scala/tools/nsc/ast/TreePrinters.scala index df5683618f..2c6d8b2930 100644 --- a/sources/scala/tools/nsc/ast/TreePrinters.scala +++ b/sources/scala/tools/nsc/ast/TreePrinters.scala @@ -265,7 +265,7 @@ abstract class TreePrinters { tree match { case ClassDef(_, _, _, _, impl) => ClassDef(tree.symbol, impl) case ModuleDef(_, _, impl) => ModuleDef(tree.symbol, impl) - case ValDef(_, _, _, rhs) => ValDef(tree.symbol, rhs) +// case ValDef(_, _, _, rhs) => ValDef(tree.symbol, rhs) case DefDef(_, _, _, vparamss, _, rhs) => DefDef(tree.symbol, vparamss, rhs) case AbsTypeDef(_, _, _, _) => AbsTypeDef(tree.symbol) case AliasTypeDef(_, _, _, rhs) => AliasTypeDef(tree.symbol, rhs) diff --git a/sources/scala/tools/nsc/ast/parser/Parsers.scala b/sources/scala/tools/nsc/ast/parser/Parsers.scala index e5308d35d4..f1f8e26760 100755 --- a/sources/scala/tools/nsc/ast/parser/Parsers.scala +++ b/sources/scala/tools/nsc/ast/parser/Parsers.scala @@ -1530,7 +1530,10 @@ import Tokens._; val vparamss = paramClauses(name, implicitViews.toList, (mods & Flags.CASE) != 0); val thistpe = requiresTypeOpt(); val template = classTemplate(mods, name, vparamss); - ClassDef(mods, name, tparams, thistpe, template) + val mods1 = if ((mods & TRAIT) != 0 && + (template.body forall treeInfo.isInterfaceMember)) mods | Flags.INTERFACE + else mods; + ClassDef(mods1, name, tparams, thistpe, template) } /** ObjectDef ::= Id ClassTemplate diff --git a/sources/scala/tools/nsc/transform/Constructors.scala b/sources/scala/tools/nsc/transform/Constructors.scala index 3d8e36939d..ea31249d30 100755 --- a/sources/scala/tools/nsc/transform/Constructors.scala +++ b/sources/scala/tools/nsc/transform/Constructors.scala @@ -103,7 +103,7 @@ abstract class Constructors extends Transform { } case ValDef(mods, name, tpt, rhs) => if (stat.symbol.tpe.isInstanceOf[ConstantType]) - assert(stat.symbol.getter != NoSymbol, stat) + assert(stat.symbol.getter(stat.symbol.owner) != NoSymbol, stat) else { if (rhs != EmptyTree) { val rhs1 = intoConstructor(stat.symbol, rhs); diff --git a/sources/scala/tools/nsc/typechecker/Namers.scala b/sources/scala/tools/nsc/typechecker/Namers.scala index 39b2f3b20c..20e65934e4 100755 --- a/sources/scala/tools/nsc/typechecker/Namers.scala +++ b/sources/scala/tools/nsc/typechecker/Namers.scala @@ -84,11 +84,14 @@ trait Namers: Analyzer { } private def enterPackageSymbol(pos: int, name: Name): Symbol = { - val p: Symbol = context.scope.lookup(name); - if (p.isPackage && context.scope == p.owner.info.decls) { + val cscope = if (context.owner == EmptyPackageClass) RootClass.info.decls + else context.scope; + val p: Symbol = cscope.lookup(name); + if (p.isPackage && cscope == p.owner.info.decls) { p } else { - val pkg = context.owner.newPackage(pos, name); + val cowner = if (context.owner == EmptyPackageClass) RootClass else context.owner; + val pkg = cowner.newPackage(pos, name); pkg.moduleClass.setInfo(new PackageClassInfoType(new Scope(), pkg.moduleClass)); pkg.setInfo(pkg.moduleClass.tpe); enterInScope(pkg) @@ -189,8 +192,7 @@ trait Namers: Analyzer { tree.pos, mods & AccessFlags | METHOD | CASE, name.toTermName) .setInfo(innerNamer.caseFactoryCompleter(tree)) } - val mods1: int = if (impl.body forall treeInfo.isInterfaceMember) mods | INTERFACE else mods; - tree.symbol = enterClassSymbol(tree.pos, mods1, name); + tree.symbol = enterClassSymbol(tree.pos, mods, name); finishWith(tparams); case ModuleDef(mods, name, _) => tree.symbol = enterModuleSymbol(tree.pos, mods | MODULE | FINAL, name); diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala index a7e363ecb1..1d58570f4f 100755 --- a/sources/scala/tools/nsc/typechecker/Typers.scala +++ b/sources/scala/tools/nsc/typechecker/Typers.scala @@ -97,8 +97,6 @@ import collection.mutable.HashMap; val SUPERCONSTRmode = 0x100; // Set for the `super' in a superclass constructor call // super. - val STATmode = 0x200; // Set if we are type-checking a statement. - private val stickyModes: int = EXPRmode | PATTERNmode | TYPEmode; /** Report a type error. @@ -326,8 +324,9 @@ import collection.mutable.HashMap; typed(applyImplicitArgs(tree1), mode, pt) case mt: MethodType if ((mode & (EXPRmode | FUNmode)) == EXPRmode && isCompatible(tree.tpe, pt)) => // (4.2) - if (tree.symbol.isConstructor || (mode & STATmode) != 0) { - errorTree(tree, "missing arguments for " + tree.symbol) + if (tree.symbol.isConstructor || pt == WildcardType || + !(pt <:< functionType(mt.paramTypes map (t => WildcardType), WildcardType))) { + errorTree(tree, "missing arguments for " + tree.symbol) //debug } else { if (settings.debug.value) log("eta-expanding " + tree + ":" + tree.tpe + " to " + pt);//debug typed(etaExpand(tree), mode, pt) @@ -627,7 +626,7 @@ import collection.mutable.HashMap; Pair(call, List()) } val Pair(superConstr, superArgs) = decompose(rhs); - assert(superConstr.symbol != null, superConstr);//debug + assert(superConstr.symbol != null);//debug if (superConstr.symbol.isPrimaryConstructor) { val superClazz = superConstr.symbol.owner; if (!superClazz.hasFlag(JAVA)) { @@ -825,8 +824,7 @@ import collection.mutable.HashMap; EmptyTree case _ => (if (exprOwner != context.owner && (!stat.isDef || stat.isInstanceOf[LabelDef])) - newTyper(context.make(stat, exprOwner)) else this) - .typed(stat, EXPRmode | STATmode, WildcardType) + newTyper(context.make(stat, exprOwner)) else this).typed(stat) } } @@ -1149,7 +1147,8 @@ import collection.mutable.HashMap; /* newTyper(context.makeNewScope(tree, context.owner)).typedFunction(fun, mode, pt) */ - tree.symbol = context.owner.newValue(tree.pos, nme.ANON_FUN_NAME) setFlag SYNTHETIC; + tree.symbol = context.owner.newValue(tree.pos, nme.ANON_FUN_NAME) + .setFlag(SYNTHETIC).setInfo(NoType); newTyper(context.makeNewScope(tree, tree.symbol)).typedFunction(fun, mode, pt) case Assign(lhs, rhs) => @@ -1244,6 +1243,9 @@ import collection.mutable.HashMap; // do args first in order to maintain conext.undetparams on the function side. typedTypeApply(typed(fun, funmode | TAPPmode, WildcardType), args1) + case Apply(Block(stats, expr), args) => + typed1(Block(stats, Apply(expr, args)), mode, pt) + case Apply(fun, args) => val stableApplication = fun.symbol != null && fun.symbol.isMethod && fun.symbol.isStable; if (stableApplication && (mode & PATTERNmode) != 0) { diff --git a/sources/scala/xml/parsing/ValidatingMarkupHandler.scala b/sources/scala/xml/parsing/ValidatingMarkupHandler.scala index 4ae195511c..717ed52d79 100644 --- a/sources/scala/xml/parsing/ValidatingMarkupHandler.scala +++ b/sources/scala/xml/parsing/ValidatingMarkupHandler.scala @@ -39,7 +39,7 @@ abstract class ValidatingMarkupHandler extends MarkupHandler with Logged { log("advanceDFA(trans): "+trans); trans.get(ContentModel.ElemName(label)) match { case Some(qNew) => qCurrent = qNew - case _ => reportValidationError(pos, "DTD says, wrong element, expected one of "+trans.keys.toString); + case _ => reportValidationError(pos, "DTD says, wrong element, expected one of "+trans.keys.toString()); } } // advance in current automaton diff --git a/sources/scala/xml/path/Expression.scala b/sources/scala/xml/path/Expression.scala index 9f7d427b10..cf6c6d552f 100644 --- a/sources/scala/xml/path/Expression.scala +++ b/sources/scala/xml/path/Expression.scala @@ -4,8 +4,8 @@ object Expression { final def testFromString(x: String): Test = { x.charAt(0) match { - case '*' if( x.length == 1 ) => WildcardTest; - case _ => NameTest(x); + case '*' if( x.length() == 1 ) => WildcardTest; + case _ => NameTest(x); } } -- cgit v1.2.3