SIL: Stop using FunctionType::getOld() in type lowering

There are still a couple of hacks remaining because AbstractionPattern
and DestructureInputs do silly things. Refactoring those is the next step
here.
This commit is contained in:
Slava Pestov
2018-08-16 01:51:49 -07:00
parent dd3364a7d1
commit b210fa20e4
4 changed files with 157 additions and 148 deletions

View File

@@ -1027,9 +1027,18 @@ bool AbstractionPattern::hasSameBasicTypeStructure(CanType l, CanType r) {
auto lFunction = dyn_cast<AnyFunctionType>(l);
auto rFunction = dyn_cast<AnyFunctionType>(r);
if (lFunction && rFunction) {
return hasSameBasicTypeStructure(lFunction.getInput(),
rFunction.getInput())
&& hasSameBasicTypeStructure(lFunction.getResult(),
auto lParam = lFunction.getParams();
auto rParam = rFunction.getParams();
if (lParam.size() != rParam.size())
return false;
for (unsigned i : indices(lParam)) {
if (!hasSameBasicTypeStructure(lParam[i].getPlainType(),
rParam[i].getPlainType()))
return false;
}
return hasSameBasicTypeStructure(lFunction.getResult(),
rFunction.getResult());
} else if (lFunction || rFunction) {
return false;