@@ -188,6 +188,11 @@ Solution ConstraintSystem::finalize() {
188
188
solution.keyPathComponentTypes .insert (keyPathComponentType);
189
189
}
190
190
191
+ // Remember key paths.
192
+ for (const auto &keyPaths : KeyPaths) {
193
+ solution.KeyPaths .insert (keyPaths);
194
+ }
195
+
191
196
// Remember contextual types.
192
197
for (auto &entry : contextualTypes) {
193
198
solution.contextualTypes .push_back ({entry.first , entry.second .first });
@@ -304,6 +309,11 @@ void ConstraintSystem::applySolution(const Solution &solution) {
304
309
nodeType.getSecond ());
305
310
}
306
311
312
+ // Add key paths.
313
+ for (const auto &keypath : solution.KeyPaths ) {
314
+ KeyPaths.insert (keypath);
315
+ }
316
+
307
317
// Add the contextual types.
308
318
for (const auto &contextualType : solution.contextualTypes ) {
309
319
if (!getContextualTypeInfo (contextualType.first )) {
@@ -616,6 +626,7 @@ ConstraintSystem::SolverScope::SolverScope(ConstraintSystem &cs)
616
626
numDefaultedConstraints = cs.DefaultedConstraints .size ();
617
627
numAddedNodeTypes = cs.addedNodeTypes .size ();
618
628
numAddedKeyPathComponentTypes = cs.addedKeyPathComponentTypes .size ();
629
+ numKeyPaths = cs.KeyPaths .size ();
619
630
numDisabledConstraints = cs.solverState ->getNumDisabledConstraints ();
620
631
numFavoredConstraints = cs.solverState ->getNumFavoredConstraints ();
621
632
numResultBuilderTransformed = cs.resultBuilderTransformed .size ();
@@ -724,6 +735,9 @@ ConstraintSystem::SolverScope::~SolverScope() {
724
735
}
725
736
truncate (cs.addedKeyPathComponentTypes , numAddedKeyPathComponentTypes);
726
737
738
+ // / Remove any key path expressions.
739
+ truncate (cs.KeyPaths , numKeyPaths);
740
+
727
741
// / Remove any builder transformed closures.
728
742
truncate (cs.resultBuilderTransformed , numResultBuilderTransformed);
729
743
0 commit comments