Skip to content

Commit 02081d7

Browse files
committed
Make sure we evaluate the a global actor annotation on an extension.
Without doing this, we crash during serialization. Fixes rdar://90170284.
1 parent c4e6e6d commit 02081d7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3281,8 +3281,18 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) {
32813281
// retrieval request perform checking for us.
32823282
if (nominal->isGlobalActor()) {
32833283
(void)D->getGlobalActorAttr();
3284-
if (auto value = dyn_cast<ValueDecl>(D))
3284+
if (auto value = dyn_cast<ValueDecl>(D)) {
32853285
(void)getActorIsolation(value);
3286+
} else {
3287+
// Make sure we evaluate the global actor type.
3288+
auto dc = D->getInnermostDeclContext();
3289+
(void)evaluateOrDefault(
3290+
Ctx.evaluator,
3291+
CustomAttrTypeRequest{
3292+
attr, dc, CustomAttrTypeKind::GlobalActor},
3293+
Type());
3294+
}
3295+
32863296
return;
32873297
}
32883298

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
public actor Bar {}
2+
3+
public class SomewhatOnMainActor { }
4+
5+
@MainActor
6+
extension SomewhatOnMainActor { }

0 commit comments

Comments
 (0)