diff options
author | Martin Odersky <odersky@gmail.com> | 2007-02-20 18:33:06 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-02-20 18:33:06 +0000 |
commit | 199cec961a4405d49ed41752fbd97e8bed574074 (patch) | |
tree | d235084dcb085b1e3fb43a9087439205b67e1084 /src/compiler | |
parent | 45bcd02f6ba099277bedbf83ec2bda07435c7797 (diff) | |
download | scala-199cec961a4405d49ed41752fbd97e8bed574074.tar.gz scala-199cec961a4405d49ed41752fbd97e8bed574074.tar.bz2 scala-199cec961a4405d49ed41752fbd97e8bed574074.zip |
suppressed exhaustivity warnings; fixed bug957 ...
suppressed exhaustivity warnings; fixed bug957 (attributes)
Diffstat (limited to 'src/compiler')
5 files changed, 13 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala index 2f932a2e84..5294cb5fc6 100644 --- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala @@ -106,10 +106,12 @@ abstract class TreePrinters { def printAnnotations(tree: Tree): unit = { val attrs = tree.symbol.attributes - if (!attrs.isEmpty) print(attrs mkString ("[", ", ", "]")) + if (!attrs.isEmpty) + attrs foreach { attr => print("@"+attr+" ") } else { val attrs = tree.asInstanceOf[MemberDef].mods.attributes - if (!attrs.isEmpty) printRow(attrs, "[", ", ", "]") + if (!attrs.isEmpty) + attrs foreach { attr => print("@"+attr+" ") } } } diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 5118d12236..251d1a774f 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -331,7 +331,7 @@ abstract class TreeBuilder { /** Create tree for a lifted expression XX-LIFTING */ def makeLifted(gs: List[ValFrom], body: Tree): Tree = { - def combine(gs: List[ValFrom]): ValFrom = gs match { + def combine(gs: List[ValFrom]): ValFrom = (gs: @unsealed) match { case g :: Nil => g case ValFrom(pos1, pat1, rhs1) :: gs2 => val ValFrom(pos2, pat2, rhs2) = combine(gs2) diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 5c58352a36..66d1913608 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1312,8 +1312,10 @@ trait Symbols requires SymbolTable { case class AttrInfo(atp: Type, args: List[Constant], assocs: List[Pair[Name, Constant]]) { override def toString: String = atp + - (if (args.isEmpty) "" else args.mkString("(", ", ", ")")) + - (assocs map { case Pair(x, y) => x+" = "+y } mkString ("{", ", ", "}")) + (if (args.isEmpty) "" + else args.mkString("(", ", ", ")")) + + (if (assocs.isEmpty) "" + else (assocs map { case Pair(x, y) => x+" = "+y } mkString ("{", ", ", "}"))) } def cloneSymbols(syms: List[Symbol]): List[Symbol] = { diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index 64f2bf2625..9c096e4df7 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -288,7 +288,7 @@ abstract class AddInterfaces extends InfoTransform { mc.hasFlag(lateINTERFACE) && mc != ScalaObjectClass) yield mixinConstructorCall(implClass(mc)) } - tree match { + (tree: @unsealed) match { case Block(supercall :: stats, expr) => copy.Block(tree, supercall :: mixinConstructorCalls ::: stats, expr) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 199dbe9cdb..46f3573edb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -877,13 +877,13 @@ trait Typers requires Analyzer { if (getter hasFlag OVERLOADED) error(getter.pos, getter+" is defined twice") val getterDef: DefDef = { - getter.attributes = value.attributes + getter.attributes = value.initialize.attributes val result = DefDef(getter, vparamss => if (mods hasFlag DEFERRED) EmptyTree else typed(atPos(vdef.pos)(Select(This(value.owner), value)), EXPRmode, value.tpe)) result.tpt.asInstanceOf[TypeTree] setOriginal tpt /* setPos tpt.pos */ checkNoEscaping.privates(getter, result.tpt) - copy.DefDef(result, result.mods withAnnotations vdef.mods.attributes, result.name, + copy.DefDef(result, result.mods withAnnotations mods.attributes, result.name, result.tparams, result.vparamss, result.tpt, result.rhs) //todo: withAnnotations is probably unnecessary } @@ -897,7 +897,7 @@ trait Typers requires Analyzer { else typed(Assign(Select(This(value.owner), value), Ident(vparamss.head.head))))) - copy.DefDef(result, result.mods withAnnotations vdef.mods.attributes, result.name, + copy.DefDef(result, result.mods withAnnotations mods.attributes, result.name, result.tparams, result.vparamss, result.tpt, result.rhs) } val gs = if (mods hasFlag MUTABLE) List(getterDef, setterDef) |