mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: TypeChecker::conformsToProtocol() => ModuleDecl::checkConformance()
This commit is contained in:
@@ -269,8 +269,7 @@ static EnumDecl *validateCodingKeysType(const DerivedConformance &derived,
|
||||
|
||||
// Ensure that the type we found conforms to the CodingKey protocol.
|
||||
auto *codingKeyProto = C.getProtocol(KnownProtocolKind::CodingKey);
|
||||
if (!TypeChecker::conformsToProtocol(codingKeysType, codingKeyProto,
|
||||
derived.getParentModule())) {
|
||||
if (!derived.getParentModule()->checkConformance(codingKeysType, codingKeyProto)) {
|
||||
// If CodingKeys is a typealias which doesn't point to a valid nominal type,
|
||||
// codingKeysTypeDecl will be nullptr here. In that case, we need to warn on
|
||||
// the location of the usage, since there isn't an underlying type to
|
||||
@@ -337,8 +336,7 @@ static bool validateCodingKeysEnum(const DerivedConformance &derived,
|
||||
// We have a property to map to. Ensure it's {En,De}codable.
|
||||
auto target = derived.getConformanceContext()->mapTypeIntoContext(
|
||||
it->second->getValueInterfaceType());
|
||||
if (TypeChecker::conformsToProtocol(target, derived.Protocol,
|
||||
derived.getParentModule())
|
||||
if (derived.getParentModule()->checkConformance(target, derived.Protocol)
|
||||
.isInvalid()) {
|
||||
TypeLoc typeLoc = {
|
||||
it->second->getTypeReprOrParentPatternTypeRepr(),
|
||||
@@ -1944,8 +1942,7 @@ static bool canSynthesize(DerivedConformance &derived, ValueDecl *requirement,
|
||||
if (auto *superclassDecl = classDecl->getSuperclassDecl()) {
|
||||
DeclName memberName;
|
||||
auto superType = superclassDecl->getDeclaredInterfaceType();
|
||||
if (TypeChecker::conformsToProtocol(superType, proto,
|
||||
derived.getParentModule())) {
|
||||
if (derived.getParentModule()->checkConformance(superType, proto)) {
|
||||
// super.init(from:) must be accessible.
|
||||
memberName = cast<ConstructorDecl>(requirement)->getName();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user