Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,12 @@ static bool needsForeignMetadataCompletionFunction(IRGenModule &IGM,

template <class Flags>
static Flags getMethodDescriptorFlags(ValueDecl *fn) {
if (isa<ConstructorDecl>(fn))
return Flags(Flags::Kind::Init); // 'init' is considered static
if (isa<ConstructorDecl>(fn)) {
auto flags = Flags(Flags::Kind::Init); // 'init' is considered static
if (auto *afd = dyn_cast<AbstractFunctionDecl>(fn))
flags = flags.withIsAsync(afd->hasAsync());
return flags;
}

auto kind = [&] {
auto accessor = dyn_cast<AccessorDecl>(fn);
Expand Down
14 changes: 14 additions & 0 deletions test/IRGen/async/protocol_req_descriptor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %target-swift-frontend -emit-ir -disable-availability-checking %s | %FileCheck -check-prefix CHECK -check-prefix CHECK-%target-cpu -check-prefix CHECK-%target-import-type %s
// REQUIRES: concurrency

// Make sure that the protocol requirement descriptor includes the async flag.
// CHECK: @"$s23protocol_req_descriptor12RepoProtocolMp" = {{.*}}%swift.protocol_requirement { i32 34, i32 0 }, %swift.protocol_requirement { i32 49, i32 0 } }>
protocol RepoProtocol {
init() async
func run() async
}

actor Impl: RepoProtocol {
init() async {}
func run() async {}
}