@@ -725,34 +725,40 @@ SILCombiner::createApplyWithConcreteType(FullApplySite Apply,
725
725
726
726
// Form a new set of substitutions where Self is
727
727
// replaced by a concrete type.
728
- SubstitutionMap OrigCallSubs = Apply.getSubstitutionMap ();
728
+ auto OrigCallSubs =
729
+ Apply.getOrigCalleeType ()->getGenericSignature ()->getSubstitutionMap (
730
+ Apply.getSubstitutions ());
729
731
SubstitutionMap NewCallSubs = OrigCallSubs.subst (
730
732
[&](SubstitutableType *type) -> Type {
731
733
if (type == CEI.OpenedArchetype )
732
734
return CEI.ConcreteType ;
733
735
return type;
734
736
},
735
737
[&](CanType origTy, Type substTy,
736
- ProtocolDecl *proto) -> Optional<ProtocolConformanceRef> {
738
+ ProtocolType *proto) -> Optional<ProtocolConformanceRef> {
737
739
if (origTy->isEqual (CEI.OpenedArchetype )) {
738
740
assert (substTy->isEqual (CEI.ConcreteType ));
739
741
// Do a conformance lookup on this witness requirement using the
740
742
// existential's conformances. The witness requirement may be a base
741
743
// type of the existential's requirements.
742
- return CEI.lookupExistentialConformance (proto).getValue ();
744
+ return CEI.lookupExistentialConformance (proto-> getDecl () ).getValue ();
743
745
}
744
- return ProtocolConformanceRef (proto);
746
+ return ProtocolConformanceRef (proto-> getDecl () );
745
747
});
746
748
749
+ SmallVector<Substitution, 8 > Substitutions;
750
+ Apply.getOrigCalleeType ()->getGenericSignature ()->getSubstitutions (
751
+ NewCallSubs, Substitutions);
752
+
747
753
SILBuilderWithScope ApplyBuilder (Apply.getInstruction (), BuilderCtx);
748
754
FullApplySite NewApply;
749
755
if (auto *TAI = dyn_cast<TryApplyInst>(Apply))
750
756
NewApply = ApplyBuilder.createTryApply (
751
- Apply.getLoc (), Apply.getCallee (), NewCallSubs , NewArgs,
757
+ Apply.getLoc (), Apply.getCallee (), Substitutions , NewArgs,
752
758
TAI->getNormalBB (), TAI->getErrorBB ());
753
759
else
754
760
NewApply = ApplyBuilder.createApply (
755
- Apply.getLoc (), Apply.getCallee (), NewCallSubs , NewArgs,
761
+ Apply.getLoc (), Apply.getCallee (), Substitutions , NewArgs,
756
762
cast<ApplyInst>(Apply)->isNonThrowing ());
757
763
758
764
if (auto NewAI = dyn_cast<ApplyInst>(NewApply))
@@ -825,7 +831,7 @@ SILCombiner::propagateConcreteTypeOfInitExistential(FullApplySite Apply,
825
831
auto *NewWMI = WMIBuilder.createWitnessMethod (
826
832
WMI->getLoc (), CEI.ConcreteType , SelfConformance, WMI->getMember (),
827
833
WMI->getType ());
828
- NewWMI-> dump ();
834
+
829
835
// Replace only uses of the witness_method in the apply that was analyzed by
830
836
// ConcreteExistentialInfo.
831
837
MutableArrayRef<Operand> Operands =
0 commit comments