File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -3997,6 +3997,10 @@ namespace {
3997
3997
auto results = namelookup::lookupMacros (CurDC, DeclNameRef (moduleName),
3998
3998
DeclNameRef (macroName), roles);
3999
3999
for (const auto &result : results) {
4000
+ // Ignore invalid results. This matches the OverloadedDeclRefExpr
4001
+ // logic.
4002
+ if (result->isInvalid ())
4003
+ continue ;
4000
4004
OverloadChoice choice = OverloadChoice (Type (), result, functionRefKind);
4001
4005
choices.push_back (choice);
4002
4006
}
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift
2
+
3
+ // https://github.com/swiftlang/swift/issues/77393
4
+ // Make sure we don't crash.
5
+
6
+ @freestanding ( expression)
7
+ macro someMacro( ) = #externalMacro( module: " " , type: " " )
8
+ // expected-warning@-1 {{external macro implementation type '.' could not be found for macro 'someMacro()'; plugin for module '' not found}}
9
+ // expected-note@-2 {{'someMacro()' previously declared here}}
10
+ // expected-note@-3 {{'someMacro()' declared here}}
11
+
12
+ @freestanding ( expression)
13
+ macro someMacro( ) = #externalMacro( module: " " , type: " " )
14
+ // expected-error@-1 {{invalid redeclaration of 'someMacro()'}}
15
+ // expected-warning@-2 {{external macro implementation type '.' could not be found for macro 'someMacro()'; plugin for module '' not found}}
16
+
17
+ #someMacro( )
18
+ // expected-error@-1 {{external macro implementation type '.' could not be found for macro 'someMacro()'; plugin for module '' not found}}
19
+
20
+ macro invalidMacro( )
21
+ // expected-error@-1 {{macro 'invalidMacro()' requires a definition}}
22
+ // expected-error@-2 {{macro 'invalidMacro()' must declare its applicable roles via '@freestanding' or @attached'}}
23
+
24
+ #invalidMacro( ) // expected-error {{no macro named 'invalidMacro'}}
You can’t perform that action at this time.
0 commit comments