mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Apply function_conversion peephole to CaptureListExprs.
Don't let a capture list suppress the reabstraction peephole when a closure literal appears in a context with a function conversion.
This commit is contained in:
@@ -82,6 +82,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "silgen-poly"
|
||||
#include "ExecutorBreadcrumb.h"
|
||||
#include "Initialization.h"
|
||||
#include "LValue.h"
|
||||
@@ -3055,6 +3056,24 @@ static ManagedValue createThunk(SILGenFunction &SGF,
|
||||
auto substSourceType = fn.getType().castTo<SILFunctionType>();
|
||||
auto substExpectedType = expectedTL.getLoweredType().castTo<SILFunctionType>();
|
||||
|
||||
LLVM_DEBUG(llvm::dbgs() << "=== Generating reabstraction thunk from:\n";
|
||||
substSourceType.dump(llvm::dbgs());
|
||||
llvm::dbgs() << "\n to:\n";
|
||||
substExpectedType.dump(llvm::dbgs());
|
||||
llvm::dbgs() << "\n for source location:\n";
|
||||
if (auto d = loc.getAsASTNode<Decl>()) {
|
||||
d->dump(llvm::dbgs());
|
||||
} else if (auto e = loc.getAsASTNode<Expr>()) {
|
||||
e->dump(llvm::dbgs());
|
||||
} else if (auto s = loc.getAsASTNode<Stmt>()) {
|
||||
s->dump(llvm::dbgs());
|
||||
} else if (auto p = loc.getAsASTNode<Pattern>()) {
|
||||
p->dump(llvm::dbgs());
|
||||
} else {
|
||||
loc.dump();
|
||||
}
|
||||
llvm::dbgs() << "\n");
|
||||
|
||||
// Apply substitutions in the source and destination types, since the thunk
|
||||
// doesn't change because of different function representations.
|
||||
CanSILFunctionType sourceType;
|
||||
|
||||
Reference in New Issue
Block a user