@@ -776,80 +776,10 @@ void RewriteSystem::computeConflictDiagnostics(
776776 continue ;
777777
778778 Type subject = propertyMap.getTypeForTerm (subjectTerm, genericParams);
779-
780- // Record conflicting requirements on a type parameter, e.g.
781- // conflicting superclass requirements:
782- //
783- // class C1 {}
784- // class C2 {}
785- // protocol P { associatedtype A: C1 }
786- // func conflict<T: P>(_: T) where T.A: C2 {}
787- if (firstProperty->getKind () == secondProperty->getKind () &&
788- firstTerm.back ().getKind () != Symbol::Kind::Name) {
789- switch (firstProperty->getKind ()) {
790- case Symbol::Kind::ConcreteType:
791- errors.push_back (RequirementError::forConflictingRequirement (subject,
792- {RequirementKind::SameType, firstProperty->getConcreteType (),
793- secondProperty->getConcreteType ()},
794- signatureLoc));
795- continue ;
796-
797- case Symbol::Kind::Superclass:
798- // FIXME: shoving the conflicting superclass types into a superclass
799- // requiement is a little gross.
800- errors.push_back (RequirementError::forConflictingRequirement (subject,
801- {RequirementKind::Superclass, firstProperty->getConcreteType (),
802- secondProperty->getConcreteType ()},
803- signatureLoc));
804- continue ;
805-
806- // FIXME: Conflicting layout requirements?
807- default :
808- continue ;
809- }
810- }
811-
812- auto recordError = [&](Symbol subject, Symbol constraint) {
813- auto subjectType = subject.getConcreteType ();
814- switch (constraint.getKind ()) {
815- case Symbol::Kind::ConcreteType:
816- errors.push_back (RequirementError::forConflictingRequirement (
817- {RequirementKind::SameType, subjectType, constraint.getConcreteType ()},
818- signatureLoc));
819- return ;
820-
821- case Symbol::Kind::Superclass:
822- errors.push_back (RequirementError::forConflictingRequirement (
823- {RequirementKind::Superclass, subjectType, constraint.getConcreteType ()},
824- signatureLoc));
825- return ;
826-
827- case Symbol::Kind::Protocol:
828- errors.push_back (RequirementError::forConflictingRequirement (
829- {RequirementKind::Conformance, subjectType,
830- constraint.getProtocol ()->getDeclaredInterfaceType ()},
831- signatureLoc));
832- return ;
833-
834- case Symbol::Kind::Layout:
835- errors.push_back (RequirementError::forConflictingRequirement (
836- {RequirementKind::Layout, subjectType, constraint.getLayoutConstraint ()},
837- signatureLoc));
838- return ;
839-
840- case Symbol::Kind::ConcreteConformance:
841- case Symbol::Kind::AssociatedType:
842- case Symbol::Kind::GenericParam:
843- case Symbol::Kind::Name:
844- return ;
845- }
846- };
847-
848- if (firstProperty->getKind () == Symbol::Kind::ConcreteType) {
849- recordError (*firstProperty, *secondProperty);
850- } else if (secondProperty->getKind () == Symbol::Kind::ConcreteType) {
851- recordError (*secondProperty, *firstProperty);
852- }
779+ errors.push_back (RequirementError::forConflictingRequirement (
780+ *firstRule->getPropertyRequirement (subject),
781+ *secondRule->getPropertyRequirement (subject),
782+ signatureLoc));
853783 }
854784}
855785
0 commit comments