summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-07-29 10:45:52 +0200
committerLukas Rytz <lukas.rytz@typesafe.com>2015-07-29 10:45:52 +0200
commita745f06e35e070061348e95725afb0def8ca45de (patch)
treef4f328c8c68455276b8a322c8c46efe07f72e61e /src/compiler
parent65fa73dff3e15f2d01b18c0528ac2dad6fe8e517 (diff)
parentec95e534a213a6ea760aa31c507d122ce449890a (diff)
downloadscala-a745f06e35e070061348e95725afb0def8ca45de.tar.gz
scala-a745f06e35e070061348e95725afb0def8ca45de.tar.bz2
scala-a745f06e35e070061348e95725afb0def8ca45de.zip
Merge pull request #4670 from retronym/ticket/9422
SI-9422 Fix incorrect constant propagation
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala b/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala
index 0e6ee76eb2..fb1799e092 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala
@@ -170,9 +170,11 @@ abstract class ConstantOptimization extends SubComponent {
// out all the possibilities
case Impossible(possible2) => (possible -- possible2).nonEmpty
})
- def mightNotEqual(other: Contents): Boolean = (this ne other) && (other match {
- // two Possibles might not be equal if either has possible members that the other doesn't
- case Possible(possible2) => (possible -- possible2).nonEmpty || (possible2 -- possible).nonEmpty
+ def mightNotEqual(other: Contents): Boolean = (other match {
+ case Possible(possible2) =>
+ // two Possibles must equal if each is known to be of the same, single value
+ val mustEqual = possible.size == 1 && possible == possible2
+ !mustEqual
case Impossible(_) => true
})
}