mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: Canonicalize capture types with the AST function's generic signature.
When lowering closures, we avoid capturing the enclosing generic context when possible. However, the generic context may still be necessary to canonicalize types mentioned inside the closure, such as when an associated type is referred to that is same-typed to a concrete type. Fixes rdar://problem/30254048.
This commit is contained in:
@@ -176,6 +176,16 @@ public:
|
||||
}
|
||||
llvm_unreachable("unexpected AnyFunctionRef representation");
|
||||
}
|
||||
|
||||
GenericSignature *getGenericSignature() const {
|
||||
if (auto afd = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
|
||||
return afd->getGenericSignature();
|
||||
}
|
||||
if (auto ce = TheFunction.dyn_cast<AbstractClosureExpr *>()) {
|
||||
return ce->getGenericSignatureOfContext();
|
||||
}
|
||||
llvm_unreachable("unexpected AnyFunctionRef representation");
|
||||
}
|
||||
};
|
||||
#if SWIFT_COMPILER_IS_MSVC
|
||||
#pragma warning(pop)
|
||||
|
||||
Reference in New Issue
Block a user