Skip to content

Commit 8b65fb1

Browse files
committed
Substitution can fail in some invalid cases.
Arguably, this code should not be run in invalid cases, but that seems difficult to enforce given the numnber of paths through the type-checker. It's better to simply be more conservative here.
1 parent 0d77281 commit 8b65fb1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Sema/CSApply.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ Type Solution::computeSubstitutions(
179179
currentReplacement = req.getFirstType().subst(currentModule,
180180
typeSubstitutions,
181181
None);
182+
if (!currentReplacement)
183+
currentReplacement = tc.Context.TheErrorType;
184+
182185
break;
183186
}
184187
}

0 commit comments

Comments
 (0)