Skip to content

Commit 043d76a

Browse files
committed
Sema: Don't type check enum element default args in non-primary files
Move the checking from validateDecl() to typeCheckDecl() since there's no need to do it unless we're going to be emitting the enum declaration.
1 parent 8292cbe commit 043d76a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2941,6 +2941,9 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
29412941
TC.validateDecl(EED);
29422942
TC.checkDeclAttributes(EED);
29432943

2944+
if (auto *PL = EED->getParameterList())
2945+
TC.checkDefaultArguments(PL, EED);
2946+
29442947
checkAccessControl(TC, EED);
29452948
}
29462949

@@ -4098,7 +4101,6 @@ void TypeChecker::validateDecl(ValueDecl *D) {
40984101
EED->getParentEnum(),
40994102
ED->getGenericSignature()),
41004103
TypeResolverContext::EnumElementDecl);
4101-
checkDefaultArguments(PL, EED);
41024104
}
41034105

41044106
// If we have a raw value, make sure there's a raw type as well.

0 commit comments

Comments
 (0)