File tree Expand file tree Collapse file tree 2 files changed +33
-5
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -874,11 +874,16 @@ static Optional<RequirementMatch> findMissingGenericRequirementForSolutionFix(
874874 type = solution.simplifyType (type);
875875 missingType = solution.simplifyType (missingType);
876876
877- missingType = missingType->mapTypeOutOfContext ();
878- if (missingType->hasTypeParameter ())
879- if (auto env = conformance->getGenericEnvironment ())
880- if (auto assocType = env->mapTypeIntoContext (missingType))
881- missingType = assocType;
877+ if (auto *env = conformance->getGenericEnvironment ()) {
878+ // We use subst() with LookUpConformanceInModule here, because
879+ // associated type inference failures mean that we can end up
880+ // here with a DependentMemberType with an ArchetypeType base.
881+ missingType = missingType.subst (
882+ [&](SubstitutableType *type) -> Type {
883+ return env->mapTypeIntoContext (type->mapTypeOutOfContext ());
884+ },
885+ LookUpConformanceInModule (conformance->getDeclContext ()->getParentModule ()));
886+ }
882887
883888 auto missingRequirementMatch = [&](Type type) -> RequirementMatch {
884889 Requirement requirement (requirementKind, type, missingType);
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -emit-ir %s
2+
3+ public protocol PublicContent {
4+ associatedtype Model
5+ init ( _ model: Model )
6+ }
7+
8+ public protocol PublicConvertible {
9+ associatedtype Public
10+ func toPublic( ) -> Public
11+ }
12+
13+ extension PublicConvertible where Public: PublicContent , Public. Model == Self {
14+ public func toPublic( ) -> Public {
15+ Public ( self )
16+ }
17+ }
18+
19+ extension Array : PublicConvertible where Element: PublicConvertible {
20+ public func toPublic( ) -> [ Element . Public ] {
21+ map { $0. toPublic ( ) }
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments