Sema: implement requiresClass using a request evaluator.

Add the request `ProtocolRequiresClassRequest` to lazily determine if a
`ProtocolDecl` requires conforming types to be a class.

Note that using the request evaluator to compute `requiresClass` introduces
cycle errors for protocol declarations, where this computation didn't
previously emit diagnostics. For now, we'll allow duplicate diagnostics in this
case, with the eventual goal of removing explicitly checking for cycles
via `checkCircularity` (instead letting the request evaluator handle cycle
diagnostics).
This commit is contained in:
Holly Borla
2019-07-17 14:56:51 -07:00
parent 8880aaef1f
commit 71fb2629ac
10 changed files with 115 additions and 57 deletions

View File

@@ -3323,7 +3323,8 @@ public:
None, /*TrailingWhere=*/nullptr);
declOrOffset = proto;
proto->setRequiresClass(isClassBounded);
ctx.evaluator.cacheOutput(ProtocolRequiresClassRequest{proto},
std::move(isClassBounded));
proto->setExistentialTypeSupported(existentialTypeSupported);
if (auto accessLevel = getActualAccessLevel(rawAccessLevel)) {