aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-01-20 22:25:09 +0100
committerMartin Odersky <odersky@gmail.com>2015-01-23 00:47:19 +0100
commitb45c69fb992acf1bbd9511408193d6d92ef7089a (patch)
treef861f6f7d09e773f9694b43bf54c136dd1a38bd6 /src/dotty/tools/dotc/core
parenteed18aab0d52bd2f7a1cb17433759b51890e40aa (diff)
downloaddotty-b45c69fb992acf1bbd9511408193d6d92ef7089a.tar.gz
dotty-b45c69fb992acf1bbd9511408193d6d92ef7089a.tar.bz2
dotty-b45c69fb992acf1bbd9511408193d6d92ef7089a.zip
Plugging a possible hole in unify
unify now does a full `replace` of one parameter with the other. The previous scheme of just updating the entry of a parameter risks breaking constraint invariants. In particular, other constraint bounds can still refer to the eliminated parameter. This might not be a problem, but then we should be systeamtically leaving these references in everywhere. In any case it seems better to harmonize what unify and replace are doing.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/TrackingConstraint.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TrackingConstraint.scala b/src/dotty/tools/dotc/core/TrackingConstraint.scala
index 5a77b88fc..37f4d5a6e 100644
--- a/src/dotty/tools/dotc/core/TrackingConstraint.scala
+++ b/src/dotty/tools/dotc/core/TrackingConstraint.scala
@@ -286,7 +286,7 @@ class TrackingConstraint(private val myMap: ParamInfo,
def unify(p1: PolyParam, p2: PolyParam)(implicit ctx: Context): This = {
val p1Bounds = (nonParamBounds(p1) & nonParamBounds(p2)).substParam(p2, p1)
- this.updateEntry(p1, p1Bounds).updateEntry(p2, p1)
+ updateEntry(p1, p1Bounds).replace(p2, p1)
}
// ---------- Removals ------------------------------------------------------------