mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Distinguish conformance and superclass generic requirements.
As part of this, use a different enum for parsed generic requirements. NFC except that I noticed that ASTWalker wasn't visiting the second type in a conformance constraint; fixing this seems to have no effect beyond producing better IDE annotations.
This commit is contained in:
@@ -769,7 +769,7 @@ GenericParamList *ModuleFile::maybeReadGenericParams(DeclContext *DC,
|
||||
auto subject = TypeLoc::withoutLoc(getType(rawTypeIDs[0]));
|
||||
auto constraint = TypeLoc::withoutLoc(getType(rawTypeIDs[1]));
|
||||
|
||||
requirements.push_back(RequirementRepr::getConformance(subject,
|
||||
requirements.push_back(RequirementRepr::getTypeConstraint(subject,
|
||||
SourceLoc(),
|
||||
constraint));
|
||||
break;
|
||||
@@ -784,6 +784,7 @@ GenericParamList *ModuleFile::maybeReadGenericParams(DeclContext *DC,
|
||||
break;
|
||||
}
|
||||
|
||||
case GenericRequirementKind::Superclass:
|
||||
case WitnessMarker: {
|
||||
// Shouldn't happen where we have requirement representations.
|
||||
error();
|
||||
@@ -866,6 +867,14 @@ void ModuleFile::readGenericRequirements(
|
||||
subject, constraint));
|
||||
break;
|
||||
}
|
||||
case GenericRequirementKind::Superclass: {
|
||||
auto subject = getType(rawTypeIDs[0]);
|
||||
auto constraint = getType(rawTypeIDs[1]);
|
||||
|
||||
requirements.push_back(Requirement(RequirementKind::Superclass,
|
||||
subject, constraint));
|
||||
break;
|
||||
}
|
||||
case GenericRequirementKind::SameType: {
|
||||
auto first = getType(rawTypeIDs[0]);
|
||||
auto second = getType(rawTypeIDs[1]);
|
||||
|
||||
Reference in New Issue
Block a user