@@ -1030,12 +1030,12 @@ class RequirementRepr {
10301030 SourceLoc SeparatorLoc;
10311031 RequirementReprKind Kind : 2 ;
10321032 bool Invalid : 1 ;
1033- TypeLoc FirstType;
1033+ TypeRepr * FirstType;
10341034
10351035 // / The second element represents the right-hand side of the constraint.
10361036 // / It can be e.g. a type or a layout constraint.
10371037 union {
1038- TypeLoc SecondType;
1038+ TypeRepr * SecondType;
10391039 LayoutConstraintLoc SecondLayout;
10401040 };
10411041
@@ -1044,16 +1044,16 @@ class RequirementRepr {
10441044 StringRef AsWrittenString;
10451045
10461046 RequirementRepr (SourceLoc SeparatorLoc, RequirementReprKind Kind,
1047- TypeLoc FirstType, TypeLoc SecondType)
1047+ TypeRepr * FirstType, TypeRepr * SecondType)
10481048 : SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false ),
10491049 FirstType (FirstType), SecondType(SecondType) { }
10501050
10511051 RequirementRepr (SourceLoc SeparatorLoc, RequirementReprKind Kind,
1052- TypeLoc FirstType, LayoutConstraintLoc SecondLayout)
1052+ TypeRepr * FirstType, LayoutConstraintLoc SecondLayout)
10531053 : SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false ),
10541054 FirstType(FirstType), SecondLayout(SecondLayout) { }
10551055
1056- void printImpl (ASTPrinter &OS, bool AsWritten ) const ;
1056+ void printImpl (ASTPrinter &OS) const ;
10571057
10581058public:
10591059 // / Construct a new type-constraint requirement.
@@ -1064,9 +1064,9 @@ class RequirementRepr {
10641064 // / this requirement was implied.
10651065 // / \param Constraint The protocol or protocol composition to which the
10661066 // / subject must conform, or superclass from which the subject must inherit.
1067- static RequirementRepr getTypeConstraint (TypeLoc Subject,
1067+ static RequirementRepr getTypeConstraint (TypeRepr * Subject,
10681068 SourceLoc ColonLoc,
1069- TypeLoc Constraint) {
1069+ TypeRepr * Constraint) {
10701070 return { ColonLoc, RequirementReprKind::TypeConstraint, Subject, Constraint };
10711071 }
10721072
@@ -1076,9 +1076,9 @@ class RequirementRepr {
10761076 // / \param EqualLoc The location of the '==' in the same-type constraint, or
10771077 // / an invalid location if this requirement was implied.
10781078 // / \param SecondType The second type.
1079- static RequirementRepr getSameType (TypeLoc FirstType,
1079+ static RequirementRepr getSameType (TypeRepr * FirstType,
10801080 SourceLoc EqualLoc,
1081- TypeLoc SecondType) {
1081+ TypeRepr * SecondType) {
10821082 return { EqualLoc, RequirementReprKind::SameType, FirstType, SecondType };
10831083 }
10841084
@@ -1090,7 +1090,7 @@ class RequirementRepr {
10901090 // / this requirement was implied.
10911091 // / \param Layout The layout requirement to which the
10921092 // / subject must conform.
1093- static RequirementRepr getLayoutConstraint (TypeLoc Subject,
1093+ static RequirementRepr getLayoutConstraint (TypeRepr * Subject,
10941094 SourceLoc ColonLoc,
10951095 LayoutConstraintLoc Layout) {
10961096 return {ColonLoc, RequirementReprKind::LayoutConstraint, Subject,
@@ -1108,48 +1108,15 @@ class RequirementRepr {
11081108
11091109 // / For a type-bound requirement, return the subject of the
11101110 // / conformance relationship.
1111- Type getSubject () const {
1112- assert (getKind () == RequirementReprKind::TypeConstraint ||
1113- getKind () == RequirementReprKind::LayoutConstraint);
1114- return FirstType.getType ();
1115- }
1116-
11171111 TypeRepr *getSubjectRepr () const {
1118- assert (getKind () == RequirementReprKind::TypeConstraint ||
1119- getKind () == RequirementReprKind::LayoutConstraint);
1120- return FirstType.getTypeRepr ();
1121- }
1122-
1123- TypeLoc &getSubjectLoc () {
1124- assert (getKind () == RequirementReprKind::TypeConstraint ||
1125- getKind () == RequirementReprKind::LayoutConstraint);
1126- return FirstType;
1127- }
1128-
1129- const TypeLoc &getSubjectLoc () const {
11301112 assert (getKind () == RequirementReprKind::TypeConstraint ||
11311113 getKind () == RequirementReprKind::LayoutConstraint);
11321114 return FirstType;
11331115 }
11341116
11351117 // / For a type-bound requirement, return the protocol or to which
11361118 // / the subject conforms or superclass it inherits.
1137- Type getConstraint () const {
1138- assert (getKind () == RequirementReprKind::TypeConstraint);
1139- return SecondType.getType ();
1140- }
1141-
11421119 TypeRepr *getConstraintRepr () const {
1143- assert (getKind () == RequirementReprKind::TypeConstraint);
1144- return SecondType.getTypeRepr ();
1145- }
1146-
1147- TypeLoc &getConstraintLoc () {
1148- assert (getKind () == RequirementReprKind::TypeConstraint);
1149- return SecondType;
1150- }
1151-
1152- const TypeLoc &getConstraintLoc () const {
11531120 assert (getKind () == RequirementReprKind::TypeConstraint);
11541121 return SecondType;
11551122 }
@@ -1170,43 +1137,13 @@ class RequirementRepr {
11701137 }
11711138
11721139 // / Retrieve the first type of a same-type requirement.
1173- Type getFirstType () const {
1174- assert (getKind () == RequirementReprKind::SameType);
1175- return FirstType.getType ();
1176- }
1177-
11781140 TypeRepr *getFirstTypeRepr () const {
1179- assert (getKind () == RequirementReprKind::SameType);
1180- return FirstType.getTypeRepr ();
1181- }
1182-
1183- TypeLoc &getFirstTypeLoc () {
1184- assert (getKind () == RequirementReprKind::SameType);
1185- return FirstType;
1186- }
1187-
1188- const TypeLoc &getFirstTypeLoc () const {
11891141 assert (getKind () == RequirementReprKind::SameType);
11901142 return FirstType;
11911143 }
11921144
11931145 // / Retrieve the second type of a same-type requirement.
1194- Type getSecondType () const {
1195- assert (getKind () == RequirementReprKind::SameType);
1196- return SecondType.getType ();
1197- }
1198-
11991146 TypeRepr *getSecondTypeRepr () const {
1200- assert (getKind () == RequirementReprKind::SameType);
1201- return SecondType.getTypeRepr ();
1202- }
1203-
1204- TypeLoc &getSecondTypeLoc () {
1205- assert (getKind () == RequirementReprKind::SameType);
1206- return SecondType;
1207- }
1208-
1209- const TypeLoc &getSecondTypeLoc () const {
12101147 assert (getKind () == RequirementReprKind::SameType);
12111148 return SecondType;
12121149 }
@@ -1217,19 +1154,13 @@ class RequirementRepr {
12171154 return SeparatorLoc;
12181155 }
12191156
1220- SourceRange getSourceRange () const {
1221- if (getKind () == RequirementReprKind::LayoutConstraint)
1222- return SourceRange (FirstType.getSourceRange ().Start ,
1223- SecondLayout.getSourceRange ().End );
1224- return SourceRange (FirstType.getSourceRange ().Start ,
1225- SecondType.getSourceRange ().End );
1226- }
1157+ SourceRange getSourceRange () const ;
12271158
12281159 // / Retrieve the first or subject type representation from the \c repr,
12291160 // / or \c nullptr if \c repr is null.
12301161 static TypeRepr *getFirstTypeRepr (const RequirementRepr *repr) {
12311162 if (!repr) return nullptr ;
1232- return repr->FirstType . getTypeRepr () ;
1163+ return repr->FirstType ;
12331164 }
12341165
12351166 // / Retrieve the second or constraint type representation from the \c repr,
@@ -1238,7 +1169,7 @@ class RequirementRepr {
12381169 if (!repr) return nullptr ;
12391170 assert (repr->getKind () == RequirementReprKind::TypeConstraint ||
12401171 repr->getKind () == RequirementReprKind::SameType);
1241- return repr->SecondType . getTypeRepr () ;
1172+ return repr->SecondType ;
12421173 }
12431174
12441175 SWIFT_DEBUG_DUMP;
0 commit comments