mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Change the order in which we attempt disjunctions
to be stable. We currently will stop visiting the elements of a disjunction under certain circumstances once we have found a solution. The result we get is inherently dependent on the order in which we determine to visit the disjunctions themselves (in addition to the elements of the disjunction). This change makes the order in which we visit disjunctions stable. Future commits will create a stable ordering for the elements of disjunctions. Once we also have that stable ordering in place we can in theory short circuit more often as part of changing the way in which we decide what the "best" solution is to a system. This results in an expression in validation-test/stdlib/AnyHashable.swift.gyb no longer being able to typecheck in a reasonable amount of time, so I had to tweak that expression.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -798,6 +798,7 @@ Constraint *Constraint::createDisjunction(ConstraintSystem &cs,
|
||||
auto disjunction = new (mem) Constraint(ConstraintKind::Disjunction,
|
||||
cs.allocateCopy(constraints), locator, typeVars);
|
||||
disjunction->RememberChoice = (bool) rememberChoice;
|
||||
cs.noteNewDisjunction(disjunction);
|
||||
return disjunction;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user