From 712052bc9ae6a53502f2de35698f1329c8d86116 Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Mon, 5 Dec 2016 20:24:35 -0800 Subject: [PATCH] [QoI] Mark inactive constraints as retired after removing This makes sure that removed constraints are returned back to the system after current run, otherwise only constraint graph would get them back since it has its own scope. --- lib/Sema/ConstraintSystem.h | 3 +++ ...31-swift-constraints-constraintsystem-solvesimplified.swift | 2 +- .../28242-swift-constraints-constraintsystem-simplify.swift | 2 +- ...-constraints-constraintsystem-solverscope-solverscope.swift | 2 +- ...constraintsystem-addtypevariableconstraintstoworklist.swift | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) rename validation-test/{compiler_crashers => compiler_crashers_fixed}/28231-swift-constraints-constraintsystem-solvesimplified.swift (86%) rename validation-test/{compiler_crashers => compiler_crashers_fixed}/28242-swift-constraints-constraintsystem-simplify.swift (87%) rename validation-test/{compiler_crashers => compiler_crashers_fixed}/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift (86%) rename validation-test/{compiler_crashers => compiler_crashers_fixed}/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift (87%) diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index c33623047e97f..1ddb72f372b0d 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1444,6 +1444,9 @@ class ConstraintSystem { void removeInactiveConstraint(Constraint *constraint) { CG.removeConstraint(constraint); InactiveConstraints.erase(constraint); + + if (solverState) + solverState->retiredConstraints.push_back(constraint); } /// Retrieve the list of inactive constraints. diff --git a/validation-test/compiler_crashers/28231-swift-constraints-constraintsystem-solvesimplified.swift b/validation-test/compiler_crashers_fixed/28231-swift-constraints-constraintsystem-solvesimplified.swift similarity index 86% rename from validation-test/compiler_crashers/28231-swift-constraints-constraintsystem-solvesimplified.swift rename to validation-test/compiler_crashers_fixed/28231-swift-constraints-constraintsystem-solvesimplified.swift index 694e4cfa76354..ad26b1316fb77 100644 --- a/validation-test/compiler_crashers/28231-swift-constraints-constraintsystem-solvesimplified.swift +++ b/validation-test/compiler_crashers_fixed/28231-swift-constraints-constraintsystem-solvesimplified.swift @@ -5,5 +5,5 @@ // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// RUN: not --crash %target-swift-frontend %s -typecheck +// RUN: not %target-swift-frontend %s -typecheck {func a(a)class a{deinit{a(a{ diff --git a/validation-test/compiler_crashers/28242-swift-constraints-constraintsystem-simplify.swift b/validation-test/compiler_crashers_fixed/28242-swift-constraints-constraintsystem-simplify.swift similarity index 87% rename from validation-test/compiler_crashers/28242-swift-constraints-constraintsystem-simplify.swift rename to validation-test/compiler_crashers_fixed/28242-swift-constraints-constraintsystem-simplify.swift index cdc7c8c2d7ee3..6f26bc62603d0 100644 --- a/validation-test/compiler_crashers/28242-swift-constraints-constraintsystem-simplify.swift +++ b/validation-test/compiler_crashers_fixed/28242-swift-constraints-constraintsystem-simplify.swift @@ -5,5 +5,5 @@ // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// RUN: not --crash %target-swift-frontend %s -typecheck +// RUN: not %target-swift-frontend %s -typecheck {struct b{let a{struct D{let a=b([print{}}}}struct b diff --git a/validation-test/compiler_crashers/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift b/validation-test/compiler_crashers_fixed/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift similarity index 86% rename from validation-test/compiler_crashers/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift rename to validation-test/compiler_crashers_fixed/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift index 38038acbdd6ad..3236ef6496ce0 100644 --- a/validation-test/compiler_crashers/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift +++ b/validation-test/compiler_crashers_fixed/28247-swift-constraints-constraintsystem-solverscope-solverscope.swift @@ -5,5 +5,5 @@ // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// RUN: not --crash %target-swift-frontend %s -typecheck +// RUN: not %target-swift-frontend %s -typecheck {func a(a)class a{var _=a(a{{a{ diff --git a/validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift b/validation-test/compiler_crashers_fixed/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift similarity index 87% rename from validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift rename to validation-test/compiler_crashers_fixed/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift index d7a77278fb636..f9fc859bd1034 100644 --- a/validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift +++ b/validation-test/compiler_crashers_fixed/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift @@ -5,5 +5,5 @@ // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// RUN: not --crash %target-swift-frontend %s -typecheck +// RUN: not %target-swift-frontend %s -typecheck {class a{}func a(a)class c{func b{{{a(a{