@@ -591,15 +591,26 @@ void swift::simple_display(raw_ostream &out, GenericSignature sig) {
591
591
out << " NULL" ;
592
592
}
593
593
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
+
594
605
bool Requirement::isCanonical () const {
595
- if (getFirstType () && !getFirstType ()->isCanonical ())
606
+ if (!getFirstType ()->isCanonical ())
596
607
return false ;
597
608
598
609
switch (getKind ()) {
599
610
case RequirementKind::Conformance:
600
611
case RequirementKind::SameType:
601
612
case RequirementKind::Superclass:
602
- if (getSecondType () && !getSecondType ()->isCanonical ())
613
+ if (!getSecondType ()->isCanonical ())
603
614
return false ;
604
615
break ;
605
616
@@ -612,17 +623,13 @@ bool Requirement::isCanonical() const {
612
623
613
624
// / Get the canonical form of this requirement.
614
625
Requirement Requirement::getCanonical () const {
615
- Type firstType = getFirstType ();
616
- if (firstType)
617
- firstType = firstType->getCanonicalType ();
626
+ Type firstType = getFirstType ()->getCanonicalType ();
618
627
619
628
switch (getKind ()) {
620
629
case RequirementKind::Conformance:
621
630
case RequirementKind::SameType:
622
631
case RequirementKind::Superclass: {
623
- Type secondType = getSecondType ();
624
- if (secondType)
625
- secondType = secondType->getCanonicalType ();
632
+ Type secondType = getSecondType ()->getCanonicalType ();
626
633
return Requirement (getKind (), firstType, secondType);
627
634
}
628
635
0 commit comments