SILGen: Open existential lvalues on entry into an OpenExistentialExpr again.

4b25945 changed codegen for lvalue OpenExistentialExprs so that the existential was not opened until the OpaqueValue's lvalue was evaluated, but this is incorrect—we need to open the dynamic type of the existential immediately since it can be used arbitrarily within the subexpression. This caused a regression when evaluating default argument generators on protocol extension methods (rdar://problem/37031037), and would become a bigger problem when we generalize the ability to open existentials.
This commit is contained in:
Joe Groff
2018-02-06 15:15:38 -08:00
parent f75dd6c704
commit 742e7fc583
7 changed files with 72 additions and 53 deletions

View File

@@ -1412,10 +1412,10 @@ public:
llvm::SmallDenseMap<OpaqueValueExpr *, OpaqueValueState>
OpaqueValues;
/// A mapping from opaque value expressions to the open-existential
/// expression that determines them, used while lowering lvalues.
llvm::SmallDenseMap<OpaqueValueExpr *, OpenExistentialExpr *>
OpaqueValueExprs;
/// A mapping from opaque value lvalue expressions to the address of the
/// opened value in memory.
llvm::SmallDenseMap<OpaqueValueExpr *, std::pair<SILValue, CanType>>
OpaqueLValues;
/// RAII object that introduces a temporary binding for an opaque value.
///