Improve recursion-breaking when resolving type witnesses.

Specifically track when we're resolving type witnesses for a given
conformance, and refuse to recursively attempt to resolve those type
witnesses. The standard library patch in rdar://problem/21789238
triggers this, and isolating it in a small test case has proven
illusive.

Swift SVN r30160
This commit is contained in:
Doug Gregor
2015-07-13 20:06:57 +00:00
parent 0e35bad9dc
commit 161f309975
7 changed files with 134 additions and 84 deletions

View File

@@ -731,6 +731,11 @@ ArrayRef<Substitution> BoundGenericType::getSubstitutions(
++index;
}
// Before recording substitutions, make sure we didn't end up doing it
// recursively.
if (auto known = ctx.getSubstitutions(canon, gpContext))
return *known;
// Copy and record the substitutions.
auto permanentSubs = ctx.AllocateCopy(resultSubstitutions,
hasTypeVariables