Skip to content

Commit 924f245

Browse files
authored
Merge pull request #85114 from hamishknight/garbage-collect
2 parents a25f72b + 8306112 commit 924f245

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,8 +2726,8 @@ void PrintAST::printAccessors(const AbstractStorageDecl *ASD) {
27262726
bool needsDisambiguationAttr = false;
27272727
if (auto *VD = dyn_cast<VarDecl>(ASD)) {
27282728
if (auto *PBD = VD->getParentPatternBinding()) {
2729-
AccessorDecl *firstAccessor = *accessorsToPrint.begin();
2730-
if (!firstAccessor->isObservingAccessor()) {
2729+
if (accessorsToPrint.empty() ||
2730+
!accessorsToPrint.front()->isObservingAccessor()) {
27312731
const auto i = PBD->getPatternEntryIndexForVarDecl(VD);
27322732
if (Options.PrintExprs) {
27332733
needsDisambiguationAttr |= bool(PBD->getInit(i));
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// {"kind":"typecheck","original":"29a2d7da","signature":"(anonymous namespace)::PrintAST::printAccessors(swift::AbstractStorageDecl const*)"}
2+
// RUN: not %target-swift-frontend -typecheck %s
3+
protocol a {
4+
enum b: a
5+
enum c: a
6+
let d: a

0 commit comments

Comments
 (0)