File tree 2 files changed +16
-3
lines changed
src/compiler/scala/tools/nsc/backend/opt 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -170,9 +170,11 @@ abstract class ConstantOptimization extends SubComponent {
170
170
// out all the possibilities
171
171
case Impossible (possible2) => (possible -- possible2).nonEmpty
172
172
})
173
- def mightNotEqual (other : Contents ): Boolean = (this ne other) && (other match {
174
- // two Possibles might not be equal if either has possible members that the other doesn't
175
- case Possible (possible2) => (possible -- possible2).nonEmpty || (possible2 -- possible).nonEmpty
173
+ def mightNotEqual (other : Contents ): Boolean = (other match {
174
+ case Possible (possible2) =>
175
+ // two Possibles must equal if each is known to be of the same, single value
176
+ val mustEqual = possible.size == 1 && possible == possible2
177
+ ! mustEqual
176
178
case Impossible (_) => true
177
179
})
178
180
}
Original file line number Diff line number Diff line change
1
+ class Test (val x : Long ) {
2
+ def sameDirection (y : Long ): Boolean =
3
+ (y == 0 || x == 0 || ((y > 0 ) == (x > 0 )))
4
+ }
5
+
6
+ object Test {
7
+ def main (args : Array [String ]) {
8
+ val b = new Test (1L )
9
+ assert(! b.sameDirection(- 1L ))
10
+ }
11
+ }
You can’t perform that action at this time.
0 commit comments