File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1806,8 +1806,15 @@ Type Solution::simplifyTypeForCodeCompletion(Type Ty) const {
18061806 // variable representing the argument to retrieve protocol requirements from
18071807 // it. Look for a ArgumentConversion constraint that allows us to retrieve
18081808 // the argument type var.
1809- for (auto argConstraint :
1810- CS.getConstraintGraph ()[typeVar].getConstraints ()) {
1809+ auto &cg = CS.getConstraintGraph ();
1810+
1811+ // FIXME: The type variable is not going to be part of the constraint graph
1812+ // at this point unless it was created at the outermost decision level;
1813+ // otherwise it has already been rolled back! Work around this by creating
1814+ // an empty node if one doesn't exist.
1815+ cg.addTypeVariable (typeVar);
1816+
1817+ for (auto argConstraint : cg[typeVar].getConstraints ()) {
18111818 if (argConstraint->getKind () == ConstraintKind::ArgumentConversion &&
18121819 argConstraint->getFirstType ()->getRValueType ()->isEqual (typeVar)) {
18131820 if (auto argTV =
You can’t perform that action at this time.
0 commit comments