Skip to content

Commit 24ac4f5

Browse files
committed
Sema: DeclChecker::visitStructDecl() does everything in the 'first pass'
The diagnostic change is harmless. The diagnostic that is no longer being emitted was intended for multi-file conformance checking only, and we still emit a diagnostic for the overall conformance failure with missing witnesses.
1 parent 6382572 commit 24ac4f5

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4392,29 +4392,31 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
43924392
}
43934393

43944394
void visitStructDecl(StructDecl *SD) {
4395+
if (!IsFirstPass) {
4396+
for (Decl *Member : SD->getMembers())
4397+
visit(Member);
4398+
4399+
return;
4400+
}
4401+
43954402
TC.checkDeclAttributesEarly(SD);
43964403
TC.computeAccessLevel(SD);
43974404

4398-
if (IsFirstPass) {
4399-
checkUnsupportedNestedType(SD);
4400-
4401-
TC.validateDecl(SD);
4402-
TC.DeclsToFinalize.remove(SD);
4403-
TC.addImplicitConstructors(SD);
4404-
}
4405+
checkUnsupportedNestedType(SD);
44054406

4406-
if (!IsFirstPass) {
4407-
checkAccessControl(TC, SD);
4407+
TC.validateDecl(SD);
4408+
TC.DeclsToFinalize.remove(SD);
44084409

4409-
if (!SD->isInvalid())
4410-
TC.checkConformancesInContext(SD, SD);
4411-
}
4410+
TC.addImplicitConstructors(SD);
44124411

4413-
// Visit each of the members.
44144412
for (Decl *Member : SD->getMembers())
44154413
visit(Member);
44164414

44174415
TC.checkDeclAttributes(SD);
4416+
checkAccessControl(TC, SD);
4417+
4418+
if (!SD->isInvalid())
4419+
TC.checkConformancesInContext(SD, SD);
44184420
}
44194421

44204422
/// Check whether the given properties can be @NSManaged in this class.

test/decl/protocol/req/associated_type_inference.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct XSubP0b : SubscriptP0 {
149149

150150
struct XSubP0c : SubscriptP0 {
151151
// expected-error@-1 {{type 'XSubP0c' does not conform to protocol 'SubscriptP0'}}
152-
subscript (i: Index) -> Element { get { } } // expected-error{{reference to invalid associated type 'Element' of type 'XSubP0c'}}
152+
subscript (i: Index) -> Element { get { } }
153153
}
154154

155155
struct XSubP0d : SubscriptP0 {

0 commit comments

Comments
 (0)