@@ -607,33 +607,6 @@ AssociatedTypeInference::inferTypeWitnessesViaAssociatedType(
607
607
return result;
608
608
}
609
609
610
- // / Perform any necessary adjustments to the inferred associated type to
611
- // / make it suitable for later use.
612
- static Type adjustInferredAssociatedType (Type type) {
613
- // If we have an optional type, adjust its wrapped type.
614
- if (auto optionalObjectType = type->getOptionalObjectType ()) {
615
- auto newOptionalObjectType =
616
- adjustInferredAssociatedType (optionalObjectType);
617
- if (newOptionalObjectType.getPointer () == optionalObjectType.getPointer ())
618
- return type;
619
-
620
- return OptionalType::get (newOptionalObjectType);
621
- }
622
-
623
- // If we have a noescape function type, make it escaping.
624
- if (auto funcType = type->getAs <FunctionType>()) {
625
- if (funcType->isNoEscape ()) {
626
- return FunctionType::get (funcType->getParams (), funcType->getResult (),
627
- funcType->getExtInfo ().withNoEscape (false ));
628
- }
629
- }
630
-
631
- // We can only infer materializable types.
632
- if (!type->isMaterializable ()) return nullptr ;
633
-
634
- return type;
635
- }
636
-
637
610
// / Attempt to resolve a type witness via a specific value witness.
638
611
InferredAssociatedTypesByWitness
639
612
AssociatedTypeInference::inferTypeWitnessesViaValueWitness (ValueDecl *req,
@@ -689,14 +662,10 @@ AssociatedTypeInference::inferTypeWitnessesViaValueWitness(ValueDecl *req,
689
662
if (secondType->hasError ())
690
663
return true ;
691
664
692
- Type inferredType = adjustInferredAssociatedType (secondType);
693
- if (!inferredType)
694
- return true ;
695
-
696
665
auto proto = Conformance->getProtocol ();
697
666
if (auto assocType = getReferencedAssocTypeOfProtocol (firstDepMember,
698
667
proto)) {
699
- Inferred.Inferred .push_back ({assocType, inferredType });
668
+ Inferred.Inferred .push_back ({assocType, secondType });
700
669
}
701
670
702
671
// Always allow mismatches here.
0 commit comments