Skip to content

Align Sendable diagnostic behavior with incremental-adoption proposal. #40346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -4601,9 +4601,9 @@ WARNING(non_sendable_keypath_access,none,
"cannot form key path that accesses non-sendable type %0",
(Type))
ERROR(non_concurrent_type_member,none,
"%select{stored property %1|associated value %1}0 of "
"'Sendable'-conforming %2 %3 has non-sendable type %4",
(bool, DeclName, DescriptiveDeclKind, DeclName, Type))
"%select{stored property %2|associated value %2}1 of "
"'Sendable'-conforming %3 %4 has non-sendable type %0",
(Type, bool, DeclName, DescriptiveDeclKind, DeclName))
ERROR(concurrent_value_class_mutable_property,none,
"stored property %0 of 'Sendable'-conforming %1 %2 is mutable",
(DeclName, DescriptiveDeclKind, DeclName))
Expand Down
10 changes: 4 additions & 6 deletions lib/Sema/TypeCheckAvailability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3526,9 +3526,9 @@ void swift::diagnoseTypeAvailability(const TypeRepr *TR, Type T, SourceLoc loc,
}

static void diagnoseMissingConformance(
SourceLoc loc, Type type, ProtocolDecl *proto, ModuleDecl *module) {
SourceLoc loc, Type type, ProtocolDecl *proto, const DeclContext *fromDC) {
assert(proto->isSpecificProtocol(KnownProtocolKind::Sendable));
diagnoseMissingSendableConformance(loc, type, module);
diagnoseMissingSendableConformance(loc, type, fromDC);
}

bool
Expand All @@ -3546,16 +3546,14 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,

// Diagnose "missing" conformances where we needed a conformance but
// didn't have one.
auto *DC = where.getDeclContext();
if (auto builtinConformance = dyn_cast<BuiltinProtocolConformance>(rootConf)){
if (builtinConformance->isMissing()) {
diagnoseMissingConformance(loc, builtinConformance->getType(),
builtinConformance->getProtocol(),
where.getDeclContext()->getParentModule());
builtinConformance->getProtocol(), DC);
}
}

auto *DC = where.getDeclContext();

auto maybeEmitAssociatedTypeNote = [&]() {
if (!depTy && !replacementTy)
return;
Expand Down
Loading