mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[DI] TypeWrappers: Support conformance requirements on Wrapper/Storage parameters
This commit is contained in:
@@ -1315,15 +1315,24 @@ void LifetimeChecker::injectTypeWrapperStorageInitalization() {
|
||||
wrapperInitArgs.push_back(storageObj);
|
||||
wrapperInitArgs.push_back(typeWrapperType);
|
||||
|
||||
// <wrapper-var> = <TypeWrapper>.init(storage: tmpStorage)
|
||||
auto wrapperInitResult = b.createApply(
|
||||
loc, typeWrapperInitRef,
|
||||
SubstitutionMap::get(typeWrapperInit->getGenericSignature(),
|
||||
/*substitutions=*/
|
||||
{wrappedType->getMetatypeInstanceType(),
|
||||
storageType.getASTType()},
|
||||
/*conformances=*/{}),
|
||||
wrapperInitArgs);
|
||||
TypeSubstitutionMap wrapperInitSubs;
|
||||
{
|
||||
auto sig =
|
||||
typeWrapperInit->getGenericSignature().getCanonicalSignature();
|
||||
wrapperInitSubs[sig.getGenericParams()[0]] =
|
||||
wrappedType->getMetatypeInstanceType();
|
||||
wrapperInitSubs[sig.getGenericParams()[1]] = storageType.getASTType();
|
||||
}
|
||||
|
||||
// <wrapper-var> = <TypeWrapper>.init(for: <Type>, storage: tmpStorage)
|
||||
auto wrapperInitResult =
|
||||
b.createApply(loc, typeWrapperInitRef,
|
||||
SubstitutionMap::get(
|
||||
typeWrapperInit->getGenericSignature(),
|
||||
QueryTypeSubstitutionMap{wrapperInitSubs},
|
||||
LookUpConformanceInModule(
|
||||
ctor->getDeclContext()->getParentModule())),
|
||||
wrapperInitArgs);
|
||||
|
||||
// self.$storage is a property access so it has to has to be wrapped
|
||||
// in begin/end access instructions.
|
||||
|
||||
Reference in New Issue
Block a user