@@ -75,7 +75,7 @@ import ast.Trees._
75
75
// isBool(ift.tpe) && !elsep.const.booleanValue =>
76
76
// cond.select(defn.Boolean_&&).appliedTo(elsep)
77
77
// the other case ins't handled intentionally. See previous case for explanation
78
-
78
+
79
79
case If (t @ Select (recv, _), thenp, elsep) if t.symbol eq defn.Boolean_! =>
80
80
If (recv, elsep, thenp)
81
81
@@ -98,11 +98,6 @@ import ast.Trees._
98
98
case (lhs, Literal (_)) if ! lhs.isInstanceOf [Literal ] && simplifyPhase.CommutativePrimitiveOperations .contains(sym) =>
99
99
rhs.select(sym).appliedTo(lhs)
100
100
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
-
106
101
case (l, x : Literal ) if sym == defn.Boolean_== && isBool(l.tpe) && isBool(x.tpe) =>
107
102
if (x.const.booleanValue) l
108
103
else l.select(defn.Boolean_! ).ensureApplied
@@ -119,11 +114,6 @@ import ast.Trees._
119
114
if (! x.const.booleanValue) l
120
115
else l.select(defn.Boolean_! ).ensureApplied
121
116
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
-
127
117
// case (Literal(Constant(1)), _) if sym == defn.Int_* => rhs
128
118
// case (Literal(Constant(0)), _) if sym == defn.Int_+ => rhs
129
119
// case (Literal(Constant(1L)), _) if sym == defn.Long_* => rhs
@@ -143,7 +133,7 @@ import ast.Trees._
143
133
144
134
case (l : Literal , r : Literal ) =>
145
135
(l.tpe.widenTermRefExpr, r.tpe.widenTermRefExpr) match {
146
- case (ConstantType (_), ConstantType (_)) =>
136
+ case (ConstantType (_), ConstantType (_)) =>
147
137
val s = ConstFold .apply(t)
148
138
if ((s ne null ) && s.tpe.isInstanceOf [ConstantType ]) Literal (s.tpe.asInstanceOf [ConstantType ].value)
149
139
else t
@@ -169,8 +159,6 @@ import ast.Trees._
169
159
case t => t
170
160
}
171
161
172
-
173
-
174
162
def isSimilar (t1 : Tree , t2 : Tree )(implicit ctx : Context ): Boolean = t1 match {
175
163
case t1 : Apply =>
176
164
t2 match {
@@ -207,6 +195,4 @@ import ast.Trees._
207
195
}
208
196
209
197
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 ]
212
198
}
0 commit comments