mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: When transforming to AnyHashable materialize the value in a temporary
emitAnyHashable expects an address value. rdar://40583597
This commit is contained in:
@@ -598,8 +598,10 @@ ManagedValue Transform::transform(ManagedValue v,
|
||||
KnownProtocolKind::Hashable);
|
||||
auto conformance = SGF.SGM.M.getSwiftModule()->lookupConformance(
|
||||
inputSubstType, protocol);
|
||||
auto result = SGF.emitAnyHashableErasure(Loc, v, inputSubstType,
|
||||
*conformance, ctxt);
|
||||
auto addr = v.getType().isAddress() ? v : v.materialize(SGF, Loc);
|
||||
auto result = SGF.emitAnyHashableErasure(Loc, addr,
|
||||
inputSubstType, *conformance,
|
||||
ctxt);
|
||||
if (result.isInContext())
|
||||
return ManagedValue::forInContext();
|
||||
return std::move(result).getAsSingleValue(SGF, Loc);
|
||||
|
||||
Reference in New Issue
Block a user