Skip to content

Commit 6829f08

Browse files
authored
Merge pull request #67356 from DougGregor/macro-identifier-init-not-special
2 parents 2abfa25 + bf097b5 commit 6829f08

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

lib/AST/Decl.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10764,15 +10764,6 @@ void MacroDecl::getIntroducedNames(MacroRole role, ValueDecl *attachedTo,
1076410764
switch (expandedName.getKind()) {
1076510765
case MacroIntroducedDeclNameKind::Named: {
1076610766
names.push_back(DeclName(expandedName.getName()));
10767-
10768-
// Temporary hack: we previously allowed named(`init`) to mean the same
10769-
// thing as named(init), before the latter was supported. Smooth over the
10770-
// difference by treating the former as the latter, for a short time.
10771-
if (expandedName.getName().isSimpleName() &&
10772-
!expandedName.getName().getBaseName().isSpecial() &&
10773-
expandedName.getName().getBaseIdentifier().is("init"))
10774-
names.push_back(DeclName(DeclBaseName::createConstructor()));
10775-
1077610767
break;
1077710768
}
1077810769

test/Macros/macro_expand_synthesized_members.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// RUN: %empty-directory(%t)
44
// RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath
5-
// RUN: %target-typecheck-verify-swift -swift-version 5 -load-plugin-library %t/%target-library-name(MacroDefinition) -module-name MacroUser -DTEST_DIAGNOSTICS -swift-version 5
5+
// RUN: %target-typecheck-verify-swift -swift-version 5 -load-plugin-library %t/%target-library-name(MacroDefinition) -module-name MacroUser -DTEST_DIAGNOSTICS -swift-version 5 -verify-ignore-unknown
66
// RUN: %target-build-swift -g -swift-version 5 -load-plugin-library %t/%target-library-name(MacroDefinition) %s -o %t/main -module-name MacroUser -swift-version 5
77
// RUN: %target-codesign %t/main
88
// RUN: %target-run %t/main | %FileCheck %s
@@ -102,10 +102,12 @@ enum ElementType {
102102

103103
print(ElementType.paper.unknown())
104104

105+
#if TEST_DIAGNOSTICS
105106
@addMembersQuotedInit
106-
struct S2 {
107+
struct S2 { // expected-note{{in expansion of macro 'addMembersQuotedInit' here}}
107108
func useSynthesized() {
108109
S.method()
109110
print(type(of: getStorage()))
110111
}
111112
}
113+
#endif

test/Profiler/coverage_macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ macro accessViaStorage() = #externalMacro(module: "MacroDefinition", type: "Acce
1212

1313
@attached(
1414
member,
15-
names: named(`init`), named(Storage), named(storage), named(getStorage()), named(method)
15+
names: named(init), named(Storage), named(storage), named(getStorage()), named(method)
1616
)
1717
macro addMembers() = #externalMacro(module: "MacroDefinition", type: "AddMembers")
1818

0 commit comments

Comments
 (0)