Skip to content

Commit 57b768d

Browse files
committed
ClangImporter: Missed a few more places where they check for requirements
1 parent 39411d3 commit 57b768d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,16 @@ class DeclAndTypePrinter::Implementation
383383
printMembers(SD->getMembers());
384384
for (const auto *ed :
385385
owningPrinter.interopContext.getExtensionsForNominalType(SD)) {
386-
auto sign = ed->getGenericSignature();
387-
// FIXME: support requirements.
388-
if (!sign.getRequirements().empty())
389-
continue;
386+
SmallVector<Requirement, 2> reqs;
387+
SmallVector<InverseRequirement, 2> inverseReqs;
388+
if (auto sig = ed->getGenericSignature()) {
389+
sig->getRequirementsWithInverses(reqs, inverseReqs);
390+
assert(inverseReqs.empty() &&
391+
"Non-copyable generics not supported here!");
392+
// FIXME: support requirements.
393+
if (!reqs.empty())
394+
continue;
395+
}
390396
printMembers(ed->getMembers());
391397
}
392398
},

lib/PrintAsClang/PrintClangFunction.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,14 @@ ClangRepresentation DeclAndTypeClangFunctionPrinter::printFunctionSignature(
700700
}
701701
if (FD->isGeneric()) {
702702
auto Signature = FD->getGenericSignature().getCanonicalSignature();
703-
auto Requirements = Signature.getRequirements();
703+
704704
// FIXME: Support generic requirements.
705-
if (!Requirements.empty())
705+
SmallVector<Requirement, 2> reqs;
706+
SmallVector<InverseRequirement, 2> inverseReqs;
707+
Signature->getRequirementsWithInverses(reqs, inverseReqs);
708+
assert(inverseReqs.empty() && "Non-copyable generics not supported here!");
709+
710+
if (!reqs.empty())
706711
return ClangRepresentation::unsupported;
707712
// Print the template and requires clauses for this function.
708713
if (kind == FunctionSignatureKind::CxxInlineThunk)

0 commit comments

Comments
 (0)