Skip to content

Commit ef255d3

Browse files
authored
Merge pull request #8828 from dotty-staging/fix-prune
Don't lose info in bounds when pruning
2 parents 93ef012 + 031c69a commit ef255d3

File tree

8 files changed

+292
-365
lines changed

8 files changed

+292
-365
lines changed

compiler/src/dotty/tools/dotc/config/Config.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ object Config {
1515
*/
1616
final val checkConstraintsNonCyclic = false
1717

18-
/** Make sure none of the bounds of a parameter in an OrderingConstraint
19-
* contains this parameter at its toplevel (i.e. as an operand of a
20-
* combination of &'s and |'s.). The check is performed each time a new bound
21-
* is added to the constraint.
22-
*/
23-
final val checkConstraintsSeparated = false
24-
2518
/** Check that each constraint resulting from a subtype test
2619
* is satisfiable.
2720
*/

compiler/src/dotty/tools/dotc/core/Constraint.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ abstract class Constraint extends Showable {
151151
def & (other: Constraint, otherHasErrors: Boolean)(implicit ctx: Context): Constraint
152152

153153
/** Check that no constrained parameter contains itself as a bound */
154-
def checkNonCyclic()(implicit ctx: Context): Unit
154+
def checkNonCyclic()(implicit ctx: Context): this.type
155155

156156
/** Check that constraint only refers to TypeParamRefs bound by itself */
157157
def checkClosed()(implicit ctx: Context): Unit

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 117 additions & 203 deletions
Large diffs are not rendered by default.

compiler/src/dotty/tools/dotc/core/GadtConstraint.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ final class ProperGadtConstraint private(
155155
else if (isUpper) addLess(symTvar.origin, boundTvar.origin)
156156
else addLess(boundTvar.origin, symTvar.origin)
157157
case bound =>
158-
if (isUpper) addUpperBound(symTvar.origin, bound)
159-
else addLowerBound(symTvar.origin, bound)
158+
addBoundTransitively(symTvar.origin, bound, isUpper)
160159
}
161160
).reporting({
162161
val descr = if (isUpper) "upper" else "lower"
@@ -271,7 +270,7 @@ final class ProperGadtConstraint private(
271270

272271
// ---- Debug ------------------------------------------------------------
273272

274-
override def constr_println(msg: => String): Unit = gadtsConstr.println(msg)
273+
override def constr = gadtsConstr
275274

276275
override def toText(printer: Printer): Texts.Text = constraint.toText(printer)
277276

0 commit comments

Comments
 (0)