removed "DIFF"+fixed spurious warning+optimizing match on chars

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@12277 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
emir 2007-07-11 22:04:03 +00:00
parent 2dbef79f29
commit dcdd2a4deb
2 changed files with 12 additions and 6 deletions

View File

@ -25,7 +25,8 @@ trait ParallelMatching {
def MixtureRule(scrutinee:Symbol, column:List[Tree], rest:Rep): RuleApplication = {
def isSimpleIntSwitch: Boolean = {
(isSameType(scrutinee.tpe.widen, definitions.IntClass.tpe)) && {
(isSameType(scrutinee.tpe.widen, definitions.IntClass.tpe)||
isSameType(scrutinee.tpe.widen, definitions.CharClass.tpe)) && {
var xs = column
while(!xs.isEmpty) { // forall
val h = xs.head
@ -708,7 +709,9 @@ trait ParallelMatching {
makeIf(Equals(Ident(ml.scrutinee),lit), body, ndefault)
} else {
val defCase = CaseDef(mk_(definitions.IntClass.tpe), EmptyTree, ndefault)
val selector = Ident(ml.scrutinee)
var selector:Tree = Ident(ml.scrutinee)
if(isSameType(ml.scrutinee.tpe.widen, definitions.CharClass.tpe))
selector = gen.mkAsInstanceOf(selector, definitions.IntClass.tpe)
Match(selector, cases ::: defCase :: Nil)
}
@ -921,9 +924,12 @@ object Rep {
val symtpe = if(sym.hasFlag(symtab.Flags.MODULE)) {
singleType(sym.tpe.prefix, sym.linkedModuleOfClass) // e.g. None, Nil
} else sym.tpe
p.tpe.symbol == sym || symtpe <:< p.tpe
//Console.print("covers: sym="+sym+" symtpe="+symtpe+" p="+p+", p.tpe="+p.tpe+" ?")
(p.tpe.symbol == sym) || (symtpe <:< p.tpe) ||
/* outer, see scala.util.parsing.combinator.lexical.Scanner */
(p.tpe.prefix.memberType(sym) <:< p.tpe)
}
//Console.println("covers: sym="+sym+" p="+p+", p.tpe="+p.tpe+" ?"+res)
//Console.println(res)
res
}

View File

@ -3114,8 +3114,8 @@ A type's symbol should never be inspected directly.
/** The least upper bound wrt &lt;:&lt; of a list of types */
def lub(ts: List[Type], depth: Int): Type = {
def lub0(ts0: List[Type]): Type = {
if (elimSub(ts0 map (_.deconst)) != elimSub(ts0))
println("DIFF for lub of "+ts+", with deconst = "+elimSub(ts0 map (_.deconst))+", without = "+elimSub(ts0))
//if (elimSub(ts0 map (_.deconst)) != elimSub(ts0))
// println("DIFF for lub of "+ts+", with deconst = "+elimSub(ts0 map (_.deconst))+", without = "+elimSub(ts0))
elimSub(ts0/* map (_.deconst) */) match {
case List() => AllClass.tpe