@@ -1916,32 +1916,35 @@ bool GenericSignatureBuilder::addSameTypeRequirementToConcrete(
1916
1916
// Make sure the concrete type fulfills the requirements on the archetype.
1917
1917
// FIXME: Move later...
1918
1918
DenseMap<ProtocolDecl *, ProtocolConformanceRef> conformances;
1919
- if (!Concrete->is <ArchetypeType>()) {
1920
- CanType depTy = rep->getDependentType ({ }, /* allowUnresolved=*/ true )
1921
- ->getCanonicalType ();
1922
- for (auto &conforms : rep->getConformsTo ()) {
1923
- auto protocol = conforms.first ;
1924
- auto conformance =
1925
- getLookupConformanceFn ()(depTy, Concrete,
1926
- protocol->getDeclaredInterfaceType ()
1927
- ->castTo <ProtocolType>());
1928
- if (!conformance) {
1929
- Diags.diagnose (Source->getLoc (),
1930
- diag::requires_generic_param_same_type_does_not_conform,
1931
- Concrete, protocol->getName ());
1932
- return true ;
1933
- }
1919
+ CanType depTy = rep->getDependentType ({ }, /* allowUnresolved=*/ true )
1920
+ ->getCanonicalType ();
1921
+ for (auto &conforms : rep->getConformsTo ()) {
1922
+ auto protocol = conforms.first ;
1923
+ auto conformance =
1924
+ getLookupConformanceFn ()(depTy, Concrete,
1925
+ protocol->getDeclaredInterfaceType ()
1926
+ ->castTo <ProtocolType>());
1927
+ if (!conformance) {
1928
+ Diags.diagnose (Source->getLoc (),
1929
+ diag::requires_generic_param_same_type_does_not_conform,
1930
+ Concrete, protocol->getName ());
1931
+ return true ;
1932
+ }
1934
1933
1935
- conformances.insert ({protocol, *conformance});
1934
+ conformances.insert ({protocol, *conformance});
1936
1935
1937
- // Update the requirement source now that we know it's concrete.
1938
- // FIXME: Bad concrete source info.
1939
- auto concreteSource = Source->viaConcrete (*this ,
1940
- conformance->getConcrete ());
1941
- updateRequirementSource (conforms.second , concreteSource);
1942
- }
1936
+ // Abstract conformances are acceptable for existential types.
1937
+ assert (conformance->isConcrete () || Concrete->isExistentialType ());
1938
+
1939
+ // Update the requirement source now that we know it's concrete.
1940
+ // FIXME: Bad concrete source info.
1941
+ auto concreteSource = Source->viaConcrete (*this ,
1942
+ conformance->isConcrete ()
1943
+ ? conformance->getConcrete ()
1944
+ : nullptr );
1945
+ updateRequirementSource (conforms.second , concreteSource);
1943
1946
}
1944
-
1947
+
1945
1948
// Record the requirement.
1946
1949
rep->ConcreteType = Concrete;
1947
1950
0 commit comments