Skip to content

Commit 17305da

Browse files
authored
Merge pull request #68400 from slavapestov/fix-rdar114823719-5.9
SILGen: Use the right abstraction pattern when loading 'async let' result [5.9]
2 parents 7ed864f + bd60148 commit 17305da

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7015,11 +7015,10 @@ ManagedValue SILGenFunction::emitReadAsyncLetBinding(SILLocation loc,
70157015
assert(visitor.varAddr && "didn't find var in pattern?");
70167016

70177017
// Load and reabstract the value if needed.
7018-
auto genericSig = F.getLoweredFunctionType()->getInvocationGenericSignature();
7019-
auto substVarTy = var->getType()->getReducedType(genericSig);
7020-
auto substAbstraction = AbstractionPattern(genericSig, substVarTy);
7021-
return emitLoad(loc, visitor.varAddr, substAbstraction, substVarTy,
7022-
getTypeLowering(substAbstraction, substVarTy),
7018+
auto substVarTy = var->getType()->getCanonicalType();
7019+
return emitLoad(loc, visitor.varAddr,
7020+
AbstractionPattern::getOpaque(), substVarTy,
7021+
getTypeLowering(substVarTy),
70237022
SGFContext(), IsNotTake);
70247023
}
70257024

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %target-swift-frontend -emit-silgen %s -disable-availability-checking
2+
// REQUIRES: concurrency
3+
4+
public func callee() async -> (() -> ()) {
5+
fatalError()
6+
}
7+
8+
public func caller() async {
9+
async let future = callee()
10+
let result = await future
11+
result()
12+
}

0 commit comments

Comments
 (0)