File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -4181,14 +4181,21 @@ TypeResolver::resolveDeclRefTypeRepr(DeclRefTypeRepr *repr,
4181
4181
return ErrorType::get (getASTContext ());
4182
4182
}
4183
4183
4184
- // Do not allow unsuppressed uses of Copyable anywhere .
4184
+ // Do not allow unsuppressed uses of Copyable.
4185
4185
if (!options.contains (TypeResolutionFlags::IsSuppressed)) {
4186
4186
if (auto protoTy = result->getAs <ProtocolType>()) {
4187
4187
if (auto protoDecl = protoTy->getDecl ()) {
4188
4188
if (protoDecl->isSpecificProtocol (KnownProtocolKind::Copyable)) {
4189
- diagnose (repr->getLoc (), diag::copyable_only_suppression);
4190
- repr->setInvalid ();
4191
- return ErrorType::get (getASTContext ());
4189
+ auto diag = diagnose (repr->getLoc (), diag::copyable_only_suppression);
4190
+ // Make a special exception for the stdlib in the form of a warning
4191
+ // rather than an error. We need this temporarily to help with the
4192
+ // transition of _Copyable to Copyable.
4193
+ if (resolution.getDeclContext ()->getParentModule ()->isStdlibModule ()) {
4194
+ diag.limitBehavior (DiagnosticBehavior::Warning);
4195
+ } else {
4196
+ repr->setInvalid ();
4197
+ return ErrorType::get (getASTContext ());
4198
+ }
4192
4199
}
4193
4200
}
4194
4201
}
You can’t perform that action at this time.
0 commit comments