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:
@@ -3162,8 +3162,8 @@ bool ContextualFailure::diagnoseThrowsTypeMismatch() const {
|
||||
if (auto errorCodeProtocol =
|
||||
Ctx.getProtocol(KnownProtocolKind::ErrorCodeProtocol)) {
|
||||
Type errorCodeType = getFromType();
|
||||
auto conformance = TypeChecker::conformsToProtocol(
|
||||
errorCodeType, errorCodeProtocol, getParentModule());
|
||||
auto conformance = getParentModule()->checkConformance(
|
||||
errorCodeType, errorCodeProtocol);
|
||||
if (conformance && toErrorExistential) {
|
||||
Type errorType =
|
||||
conformance
|
||||
@@ -3403,8 +3403,7 @@ bool ContextualFailure::tryProtocolConformanceFixIt(
|
||||
SmallVector<std::string, 8> missingProtoTypeStrings;
|
||||
SmallVector<ProtocolDecl *, 8> missingProtocols;
|
||||
for (auto protocol : layout.getProtocols()) {
|
||||
if (!TypeChecker::conformsToProtocol(fromType, protocol,
|
||||
getParentModule())) {
|
||||
if (!getParentModule()->checkConformance(fromType, protocol)) {
|
||||
auto protoTy = protocol->getDeclaredInterfaceType();
|
||||
missingProtoTypeStrings.push_back(protoTy->getString());
|
||||
missingProtocols.push_back(protocol);
|
||||
@@ -9035,8 +9034,7 @@ bool CheckedCastToUnrelatedFailure::diagnoseAsError() {
|
||||
auto *protocol = TypeChecker::getLiteralProtocol(ctx, sub);
|
||||
// Special handle for literals conditional checked cast when they can
|
||||
// be statically coerced to the cast type.
|
||||
if (protocol && TypeChecker::conformsToProtocol(toType, protocol,
|
||||
dc->getParentModule())) {
|
||||
if (protocol && dc->getParentModule()->checkConformance(toType, protocol)) {
|
||||
emitDiagnostic(diag::literal_conditional_downcast_to_coercion, fromType,
|
||||
toType);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user