Skip to content

Commit f3d8feb

Browse files
committed
[ASTGEn] Handle _ identifier as the empty identifier
1 parent ef9edbd commit f3d8feb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/AST/CASTBridging.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ void SwiftDiagnostic_finish(BridgedDiagnostic diagPtr) {
119119
BridgedIdentifier
120120
SwiftASTContext_getIdentifier(void *ctx, const unsigned char *_Nullable str,
121121
long len) {
122+
if (len == 1 && str[0] == '_')
123+
return BridgedIdentifier();
124+
122125
// If this was a back-ticked identifier, drop the back-ticks.
123126
if (len >= 2 && str[0] == '`' && str[len-1] == '`') {
124127
++str;

test/ASTGen/types.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ func test12(_ producer: @escaping @autoclosure () -> Int) {
3131
func test12a(i: Int) {
3232
test12(i)
3333
}
34+
35+
func test13(body: (_ value: Int) -> Void, i: Int) {
36+
body(i)
37+
}

0 commit comments

Comments
 (0)