@@ -75,7 +75,7 @@ import ast.Trees._
7575 // isBool(ift.tpe) && !elsep.const.booleanValue =>
7676 // cond.select(defn.Boolean_&&).appliedTo(elsep)
7777 // the other case ins't handled intentionally. See previous case for explanation
78-
78+
7979 case If (t @ Select (recv, _), thenp, elsep) if t.symbol eq defn.Boolean_! =>
8080 If (recv, elsep, thenp)
8181
@@ -98,11 +98,6 @@ import ast.Trees._
9898 case (lhs, Literal (_)) if ! lhs.isInstanceOf [Literal ] && simplifyPhase.CommutativePrimitiveOperations .contains(sym) =>
9999 rhs.select(sym).appliedTo(lhs)
100100
101- case (l, _) if (sym == defn.Boolean_&& ) && isConst(l.tpe) =>
102- val const = asConst(l.tpe).value.booleanValue
103- if (const) Block (lhs :: Nil , rhs)
104- else l
105-
106101 case (l, x : Literal ) if sym == defn.Boolean_== && isBool(l.tpe) && isBool(x.tpe) =>
107102 if (x.const.booleanValue) l
108103 else l.select(defn.Boolean_! ).ensureApplied
@@ -119,11 +114,6 @@ import ast.Trees._
119114 if (! x.const.booleanValue) l
120115 else l.select(defn.Boolean_! ).ensureApplied
121116
122- case (l : Literal , _) if (sym == defn.Boolean_|| ) && isConst(l.tpe) =>
123- val const = asConst(l.tpe).value.booleanValue
124- if (l.const.booleanValue) l
125- else Block (lhs :: Nil , rhs)
126-
127117 // case (Literal(Constant(1)), _) if sym == defn.Int_* => rhs
128118 // case (Literal(Constant(0)), _) if sym == defn.Int_+ => rhs
129119 // case (Literal(Constant(1L)), _) if sym == defn.Long_* => rhs
@@ -143,7 +133,7 @@ import ast.Trees._
143133
144134 case (l : Literal , r : Literal ) =>
145135 (l.tpe.widenTermRefExpr, r.tpe.widenTermRefExpr) match {
146- case (ConstantType (_), ConstantType (_)) =>
136+ case (ConstantType (_), ConstantType (_)) =>
147137 val s = ConstFold .apply(t)
148138 if ((s ne null ) && s.tpe.isInstanceOf [ConstantType ]) Literal (s.tpe.asInstanceOf [ConstantType ].value)
149139 else t
@@ -169,8 +159,6 @@ import ast.Trees._
169159 case t => t
170160 }
171161
172-
173-
174162 def isSimilar (t1 : Tree , t2 : Tree )(implicit ctx : Context ): Boolean = t1 match {
175163 case t1 : Apply =>
176164 t2 match {
@@ -207,6 +195,4 @@ import ast.Trees._
207195 }
208196
209197 def isBool (tpe : Type )(implicit ctx : Context ): Boolean = tpe.derivesFrom(defn.BooleanClass )
210- def isConst (tpe : Type )(implicit ctx : Context ): Boolean = tpe.isInstanceOf [ConstantType ]
211- def asConst (tpe : Type )(implicit ctx : Context ): ConstantType = tpe.asInstanceOf [ConstantType ]
212198}
0 commit comments