[CSSimplify] Thin to thin is also allowed

This commit is contained in:
Luciano Almeida
2020-06-05 06:11:01 -03:00
parent baccbde0d1
commit d6bf34e65c
2 changed files with 12 additions and 5 deletions

View File

@@ -1367,6 +1367,15 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1,
if (!(last && last->is<LocatorPathElt::FunctionArgument>()))
return false;
auto isThin = [](FunctionTypeRepresentation rep) {
return rep == FunctionTypeRepresentation::CFunctionPointer ||
rep == FunctionTypeRepresentation::Thin;
};
// Allowing "thin" (c, thin) to "thin" conventions
if (isThin(rep1) && isThin(rep2))
return false;
// Allowing all to "thick" (swift, block) conventions
// "thin" (c, thin) to "thick" or "thick" to "thick"
if (rep2 == FunctionTypeRepresentation::Swift ||