summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-01-27 19:01:25 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-01-29 11:09:17 +1000
commit79a52e6807d2797dee12bab1730765441a0e222d (patch)
tree7dadef54293eee75a2cf93572a0365bd1bea0dc9 /src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
parentbbd890bf907c00f17df39eb4bc656b30d4317b9a (diff)
downloadscala-79a52e6807d2797dee12bab1730765441a0e222d.tar.gz
scala-79a52e6807d2797dee12bab1730765441a0e222d.tar.bz2
scala-79a52e6807d2797dee12bab1730765441a0e222d.zip
SI-9630 Fix spurious warning related to same-named case accessors
Hash consing of trees within pattern match analysis was broken, and considered `x1.foo#1` to be the same tree as `x1.foo#2`, even though the two `foo`-s referred to different symbols. The hash consing was based on `Tree#correspondsStructure`, but the predicate in that function cannot veto correspondance, it can only supplement the default structural comparison. I've instead created a custom tree comparison method for use in the pattern matcher that handles the tree shapes that we use.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/patmat/Logic.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Logic.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
index 1a4df9973e..8b2e09495f 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
@@ -691,7 +691,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis {
// if X is mutable.
freshExistentialSubtype(t.tpe)
}
- else trees find (a => a.correspondsStructure(t)(sameValue)) match {
+ else trees find (a => equivalentTree(a, t)) match {
case Some(orig) =>
debug.patmat("unique tp for tree: " + ((orig, orig.tpe)))
orig.tpe