Skip to content

Commit 712052b

Browse files
committed
[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.
1 parent e0bec70 commit 712052b

5 files changed

+7
-4
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,9 @@ class ConstraintSystem {
14441444
void removeInactiveConstraint(Constraint *constraint) {
14451445
CG.removeConstraint(constraint);
14461446
InactiveConstraints.erase(constraint);
1447+
1448+
if (solverState)
1449+
solverState->retiredConstraints.push_back(constraint);
14471450
}
14481451

14491452
/// Retrieve the list of inactive constraints.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -typecheck
8+
// RUN: not %target-swift-frontend %s -typecheck
99
{func a(a)class a{deinit{a(a{

validation-test/compiler_crashers/28242-swift-constraints-constraintsystem-simplify.swift renamed to validation-test/compiler_crashers_fixed/28242-swift-constraints-constraintsystem-simplify.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -typecheck
8+
// RUN: not %target-swift-frontend %s -typecheck
99
{struct b{let a{struct D{let a=b([print{}}}}struct b
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -typecheck
8+
// RUN: not %target-swift-frontend %s -typecheck
99
{func a(a)class a{var _=a(a{{a{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -typecheck
8+
// RUN: not %target-swift-frontend %s -typecheck
99
{class a{}func a(a)class c{func b{{{a(a{

0 commit comments

Comments
 (0)