diff options
author | Burak Emir <emir@epfl.ch> | 2007-07-11 22:04:03 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-07-11 22:04:03 +0000 |
commit | bd02f6359731e8834012e49bab1a04a4ac095364 (patch) | |
tree | fd9c817be4188e434339df4aff1fd7e895742705 /src | |
parent | c5bacffe8dcdeda88ce1e93282ff3eeba21c656a (diff) | |
download | scala-bd02f6359731e8834012e49bab1a04a4ac095364.tar.gz scala-bd02f6359731e8834012e49bab1a04a4ac095364.tar.bz2 scala-bd02f6359731e8834012e49bab1a04a4ac095364.zip |
removed "DIFF"+fixed spurious warning+optimizin...
removed "DIFF"+fixed spurious warning+optimizing match on chars
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 14 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 3ce4acb0f3..71ebd4e4a0 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -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 } diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 5287e8cc16..3e1ce7519e 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -3114,8 +3114,8 @@ A type's symbol should never be inspected directly. /** The least upper bound wrt <:< 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 |