@@ -591,15 +591,26 @@ void swift::simple_display(raw_ostream &out, GenericSignature sig) {
591591 out << " NULL" ;
592592}
593593
594+ bool Requirement::hasError () const {
595+ if (getFirstType ()->hasError ())
596+ return true ;
597+
598+ if (getKind () != RequirementKind::Layout &&
599+ getSecondType ()->hasError ())
600+ return true ;
601+
602+ return false ;
603+ }
604+
594605bool Requirement::isCanonical () const {
595- if (getFirstType () && !getFirstType ()->isCanonical ())
606+ if (!getFirstType ()->isCanonical ())
596607 return false ;
597608
598609 switch (getKind ()) {
599610 case RequirementKind::Conformance:
600611 case RequirementKind::SameType:
601612 case RequirementKind::Superclass:
602- if (getSecondType () && !getSecondType ()->isCanonical ())
613+ if (!getSecondType ()->isCanonical ())
603614 return false ;
604615 break ;
605616
@@ -612,17 +623,13 @@ bool Requirement::isCanonical() const {
612623
613624// / Get the canonical form of this requirement.
614625Requirement Requirement::getCanonical () const {
615- Type firstType = getFirstType ();
616- if (firstType)
617- firstType = firstType->getCanonicalType ();
626+ Type firstType = getFirstType ()->getCanonicalType ();
618627
619628 switch (getKind ()) {
620629 case RequirementKind::Conformance:
621630 case RequirementKind::SameType:
622631 case RequirementKind::Superclass: {
623- Type secondType = getSecondType ();
624- if (secondType)
625- secondType = secondType->getCanonicalType ();
632+ Type secondType = getSecondType ()->getCanonicalType ();
626633 return Requirement (getKind (), firstType, secondType);
627634 }
628635
0 commit comments