File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed
Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -916,6 +916,10 @@ namespace {
916916 if (!entry.isValid () || entry.getKind () != SILWitnessTable::Method ||
917917 entry.getMethodWitness ().Requirement != func)
918918 continue ;
919+ auto silFunc = entry.getMethodWitness ().Witness ;
920+ if (silFunc->isAsync ()) {
921+ return IGM.getAddrOfAsyncFunctionPointer (silFunc);
922+ }
919923 return IGM.getAddrOfSILFunction (entry.getMethodWitness ().Witness ,
920924 NotForDefinition);
921925 }
Original file line number Diff line number Diff line change 1+ public protocol Problem : class {
2+ }
3+
4+ public extension Problem {
5+ }
6+
7+ public func callGenericWitness< T: Problem > ( _ t: T ) async -> Int {
8+ return 0
9+ }
Original file line number Diff line number Diff line change 1+ public protocol Problem : class {
2+ func theProblem( ) async -> Int
3+ }
4+
5+ public extension Problem {
6+ func theProblem( ) async -> Int {
7+ return 1
8+ }
9+ }
10+
11+ public func callGenericWitness< T: Problem > ( _ t: T ) async -> Int {
12+ return await t. theProblem ( )
13+ }
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+
3+ // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_async)) -enable-library-evolution %S/Inputs/resilient_async.swift -emit-module -emit-module-path %t/resilient_async.swiftmodule -module-name resilient_async
4+ // RUN: %target-codesign %t/%target-library-name(resilient_async)
5+
6+ // RUN: %target-build-swift -parse-as-library %s -lresilient_async -I %t -L %t -o %t/main %target-rpath(%t)
7+ // RUN: %target-codesign %t/main
8+
9+ // Introduce a defaulted protocol method.
10+ // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_async)) -enable-library-evolution %S/Inputs/resilient_async2.swift -emit-module -emit-module-path %t/resilient_async.swiftmodule -module-name resilient_async
11+ // RUN: %target-codesign %t/%target-library-name(resilient_async)
12+
13+ // RUN: %target-run %t/main %t/%target-library-name(resilient_async)
14+
15+ // REQUIRES: executable_test
16+
17+
18+ import resilient_async
19+
20+ class Impl : Problem { }
21+
22+ @main struct Main {
23+ static func main( ) async {
24+ let i = Impl ( )
25+ // This used to crash.
26+ let r = await callGenericWitness ( i)
27+ assert ( r == 1 )
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments