Skip to content

Commit 3acbb6e

Browse files
committed
Skip macro-expanded code in the playground transform.
Playgrounds cannot display any macro expansions anyway and the @observable macro can generate instrumentations that don't typecheck and/or reference missing functions. rdar://112122752 (cherry picked from commit 388bd6e)
1 parent 07138e4 commit 3acbb6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/PlaygroundTransform.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,9 @@ void swift::performPlaygroundTransform(SourceFile &SF, PlaygroundOptionSet Opts)
949949

950950
PreWalkAction walkToDeclPre(Decl *D) override {
951951
if (auto *FD = dyn_cast<AbstractFunctionDecl>(D)) {
952-
if (!FD->isImplicit() && !FD->isBodySkipped()) {
952+
// Skip any functions that do not have user-written source code.
953+
if (!FD->isImplicit() && !FD->isBodySkipped() &&
954+
!FD->isInMacroExpansionInContext()) {
953955
if (BraceStmt *Body = FD->getBody()) {
954956
const ParameterList *PL = FD->getParameters();
955957
Instrumenter I(ctx, FD, RNG, Options, TmpNameIndex);

0 commit comments

Comments
 (0)