Skip to content

Commit a7b3468

Browse files
authored
Merge pull request swiftlang#36789 from hborla/ast-scope-implicit-attribute-crash
[ASTScope] Always skip implicit attributes.
2 parents 7b5b474 + 97ecb94 commit a7b3468

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/AST/ASTScopeCreation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,11 @@ void ScopeCreator::addChildrenForKnownAttributes(ValueDecl *decl,
506506
SmallVector<DeclAttribute *, 2> relevantAttrs;
507507

508508
for (auto *attr : decl->getAttrs()) {
509-
if (isa<DifferentiableAttr>(attr)) {
510-
if (!attr->isImplicit())
511-
relevantAttrs.push_back(attr);
512-
}
509+
if (attr->isImplicit())
510+
continue;
511+
512+
if (isa<DifferentiableAttr>(attr))
513+
relevantAttrs.push_back(attr);
513514

514515
if (isa<SpecializeAttr>(attr))
515516
relevantAttrs.push_back(attr);

test/Concurrency/global_actor_inference.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,17 @@ struct WrapperOnActor<Wrapped> {
282282
}
283283
}
284284

285+
@MainActor
286+
@propertyWrapper
287+
public struct WrapperOnMainActor<Wrapped> {
288+
// Make sure inference of @MainActor on wrappedValue doesn't crash.
289+
public var wrappedValue: Wrapped
290+
291+
public init(wrappedValue: Wrapped) {
292+
self.wrappedValue = wrappedValue
293+
}
294+
}
295+
285296
@propertyWrapper
286297
actor WrapperActor<Wrapped> {
287298
@actorIndependent(unsafe) var storage: Wrapped

0 commit comments

Comments
 (0)