mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Type checker] Don't re-insert node types when merging solutions.
Merging partial solutions can end up assigning the same type to a particular typed node (expression, parameter, etc.), which can lead to unbalanced set/clear when exploring the solution space (and later on, crashes). Don't re-insert such information. This is the same approach taken for type variable bindings, but it's all pretty unfortunate: partial solutions should only record information relative to their part of the constraint system, which would save time and memory during solving. Howver, that's too big a change for right now. Fixes rdar://problem/50853028.
This commit is contained in:
@@ -251,7 +251,8 @@ void ConstraintSystem::applySolution(const Solution &solution) {
|
||||
|
||||
// Add the node types back.
|
||||
for (auto &nodeType : solution.addedNodeTypes) {
|
||||
setType(nodeType.first, nodeType.second);
|
||||
if (!hasType(nodeType.first))
|
||||
setType(nodeType.first, nodeType.second);
|
||||
}
|
||||
|
||||
// Register the conformances checked along the way to arrive to solution.
|
||||
|
||||
Reference in New Issue
Block a user