Revert "[CSSolver] Use correct locator when matching function result types re…"

This commit is contained in:
Pavel Yaskevich
2018-03-07 23:19:30 -08:00
committed by GitHub
parent c4c5b7130e
commit d8b355dbae
7 changed files with 14 additions and 174 deletions

View File

@@ -1573,9 +1573,6 @@ class ResultPlanner {
///
/// Valid: reabstraction info, InnerResult, OuterResult.
ReabstractDirectToDirect,
/// Ignore the next direct inner result, since the outer is 'Void'.
IgnoreDirectResult,
};
Operation(Kind kind) : TheKind(kind) {}
@@ -1720,24 +1717,6 @@ private:
SILResultInfo outerResult,
SILValue optOuterResultAddr);
void planIgnoredResult(AbstractionPattern innerOrigType,
CanType innerSubstType, PlanData &planData) {
if (innerOrigType.isTuple()) {
auto innerSubstTuple = cast<TupleType>(innerSubstType);
for (unsigned i = 0, n = innerSubstTuple->getNumElements(); i != n; ++i)
planIgnoredResult(innerOrigType.getTupleElementType(i),
innerSubstTuple.getElementType(i), planData);
return;
}
auto innerResult = claimNextInnerResult(planData);
if (innerResult.isFormalIndirect() &&
SGF.silConv.isSILIndirect(innerResult))
(void)addInnerIndirectResultTemporary(planData, innerResult);
else
addIgnoreDirectResult();
}
/// Claim the next inner result from the plan data.
SILResultInfo claimNextInnerResult(PlanData &data) {
return claimNext(data.InnerResults);
@@ -1887,10 +1866,6 @@ private:
op.OuterOrigType = outerOrigType;
op.OuterSubstType = outerSubstType;
}
void addIgnoreDirectResult() {
(void)addOperation(Operation::IgnoreDirectResult);
}
};
} // end anonymous namespace
@@ -1901,13 +1876,6 @@ void ResultPlanner::plan(AbstractionPattern innerOrigType,
AbstractionPattern outerOrigType,
CanType outerSubstType,
PlanData &planData) {
// Conversion from `() -> T` to `() -> Void` is allowed when
// the argument is a closure.
if (!innerSubstType->isVoid() && outerSubstType->isVoid()) {
planIgnoredResult(innerOrigType, innerSubstType, planData);
return;
}
// The substituted types must match up in tuple-ness and arity.
assert(
isa<TupleType>(innerSubstType) == isa<TupleType>(outerSubstType) ||
@@ -2616,10 +2584,6 @@ void ResultPlanner::execute(ArrayRef<SILValue> innerDirectResults,
case Operation::InjectOptionalIndirect:
SGF.B.createInjectEnumAddr(Loc, op.OuterResultAddr, op.SomeDecl);
continue;
case Operation::IgnoreDirectResult:
(void)claimNext(innerDirectResults);
continue;
}
llvm_unreachable("bad operation kind");
}