Fix parameter indexing when a non-removed error param is followed by blocks.

Tested as part of the next commit.

Swift SVN r28977
This commit is contained in:
Jordan Rose
2015-05-24 01:48:19 +00:00
parent bc1500d50c
commit 6115efa9dd

View File

@@ -227,12 +227,15 @@ AbstractionPattern::getTupleElementType(unsigned index) const {
auto paramIndex = index;
if (errorInfo.hasErrorParameter()) {
auto errorParamIndex = errorInfo.getErrorParameterIndex();
if (paramIndex == errorParamIndex &&
errorInfo.isErrorParameterReplacedWithVoid()) {
assert(isVoidLike(swiftEltType));
return AbstractionPattern(swiftEltType);
} else if (paramIndex >= errorParamIndex) {
paramIndex++;
if (errorInfo.isErrorParameterReplacedWithVoid()) {
if (paramIndex == errorParamIndex) {
assert(isVoidLike(swiftEltType));
return AbstractionPattern(swiftEltType);
}
} else {
if (paramIndex >= errorParamIndex) {
paramIndex++;
}
}
}