mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Introduce TypeBase::isTypeVariableOrMember(). NFC
Similar to “isTypeParameter,” this new entry point determines whether the type is a type variable or a nested type of a type thereof. The latter case isn’t actually formed yet, so this is NFC staging the trivial bits of this change.
This commit is contained in:
@@ -630,7 +630,8 @@ TypeBase::gatherAllSubstitutions(Module *module,
|
||||
|
||||
// If the type is a type variable or is dependent, just fill in empty
|
||||
// conformances.
|
||||
if (replacement->is<TypeVariableType>() || replacement->isTypeParameter())
|
||||
if (replacement->isTypeVariableOrMember() ||
|
||||
replacement->isTypeParameter())
|
||||
return ProtocolConformanceRef(proto);
|
||||
|
||||
// Otherwise, find the conformance.
|
||||
@@ -743,6 +744,11 @@ Module::lookupConformance(Type type, ProtocolDecl *protocol,
|
||||
return None;
|
||||
}
|
||||
|
||||
// Type variables have trivial conformances.
|
||||
if (type->isTypeVariableOrMember()) {
|
||||
return ProtocolConformanceRef(protocol);
|
||||
}
|
||||
|
||||
// UnresolvedType is a placeholder for an unknown type used when generating
|
||||
// diagnostics. We consider it to conform to all protocols, since the
|
||||
// intended type might have.
|
||||
|
||||
Reference in New Issue
Block a user