Skip to content

Commit 6c282cb

Browse files
committed
[TBDGen] Use default kind for AFPAST SILDeclRef.
When adding an AsyncFunctionPointer to the TBD, a LinkEntity of kind AsyncFunctionPointerAST is constructed containing the decl. That decl is then wrapped in a SILDeclRef which is then mangled. Previously, the kind of the SILDeclRef was erroneously forced to be Func. The result was a failure to mangle the TBD symbol for async constructors correctly. Here, that argument is omitted so that the kind can be determined appropriately by SILDeclRef's constructor. rdar://80485869
1 parent a8c2aaa commit 6c282cb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/IRGen/Linking.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,7 @@ std::string LinkEntity::mangleAsString() const {
462462

463463
case Kind::AsyncFunctionPointerAST: {
464464
std::string Result;
465-
Result =
466-
SILDeclRef(const_cast<ValueDecl *>(getDecl()), SILDeclRef::Kind::Func)
467-
.mangle();
465+
Result = SILDeclRef(const_cast<ValueDecl *>(getDecl())).mangle();
468466
Result.append("Tu");
469467
return Result;
470468
}

test/TBD/rdar80485869.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend %s -emit-module-path %t/module -emit-tbd -enable-testing
3+
4+
public actor Tom {
5+
init() async {
6+
}
7+
}

0 commit comments

Comments
 (0)