Skip to content

Commit 953489d

Browse files
committed
Serialization: Resolve macro conformances during serialization.
This ensures that conformances get serialized correctly when `-experimental-lazy-typecheck` is specified. Resolves rdar://119463830.
1 parent a4a6c69 commit 953489d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3206,6 +3206,9 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
32063206

32073207
unsigned numNames = introducedDeclNames.size();
32083208

3209+
(void)evaluateOrDefault(S.getASTContext().evaluator,
3210+
ResolveMacroConformances{theAttr, D}, {});
3211+
32093212
unsigned numConformances = 0;
32103213
for (auto conformance : theAttr->getConformances()) {
32113214
introducedDeclNames.push_back(

test/Macros/macro_expand_primary.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
// RUN: %target-swift-frontend -swift-version 5 -typecheck -I%t -verify -primary-file %s %S/Inputs/macro_expand_other.swift -verify-ignore-unknown -load-plugin-library %t/%target-library-name(MacroDefinition) -dump-macro-expansions > %t/expansions-dump.txt 2>&1
88
// RUN: %FileCheck -check-prefix=CHECK-DUMP %s < %t/expansions-dump.txt
99

10+
// Re-test with the macro library module emitted using -experimental-lazy-typecheck.
11+
// RUN: %target-swift-frontend -enable-experimental-feature ExtensionMacros -swift-version 5 -emit-module -o %t/lazy/macro_library.swiftmodule %S/Inputs/macro_library.swift -module-name macro_library -load-plugin-library %t/%target-library-name(MacroDefinition) -experimental-lazy-typecheck
12+
// RUN: %target-swift-frontend -swift-version 5 -typecheck -I%t/lazy -verify -primary-file %s %S/Inputs/macro_expand_other.swift -verify-ignore-unknown -load-plugin-library %t/%target-library-name(MacroDefinition) -dump-macro-expansions > %t/expansions-dump.txt 2>&1
13+
// RUN: %FileCheck -check-prefix=CHECK-DUMP %s < %t/expansions-dump.txt
14+
1015
import macro_library
1116

1217
struct Treat {}

0 commit comments

Comments
 (0)