Skip to content

Commit 302ad00

Browse files
committed
Cherry-pick #74161 (Soften min version for objcImpl early adopters)
1 parent 61fb9fd commit 302ad00

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,10 +1665,13 @@ visitObjCImplementationAttr(ObjCImplementationAttr *attr) {
16651665
// supported.
16661666
auto deploymentAvailability = AvailabilityContext::forDeploymentTarget(Ctx);
16671667
if (!deploymentAvailability.isContainedIn(Ctx.getSwift50Availability())) {
1668-
diagnose(attr->getLocation(),
1668+
auto diag = diagnose(attr->getLocation(),
16691669
diag::attr_objc_implementation_raise_minimum_deployment_target,
16701670
prettyPlatformString(targetPlatform(Ctx.LangOpts)),
16711671
Ctx.getSwift50Availability().getOSVersion().getLowerEndpoint());
1672+
if (attr->isEarlyAdopter()) {
1673+
diag.wrapIn(diag::wrap_objc_implementation_will_become_error);
1674+
}
16721675
}
16731676
}
16741677
else if (auto AFD = dyn_cast<AbstractFunctionDecl>(D)) {
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
// Hardcode x86_64 macOS because Apple Silicon was born ABI-stable
2-
// RUN: %target-typecheck-verify-swift -import-objc-header %S/Inputs/objc_implementation.h -target x86_64-apple-macosx10.14.3
2+
// RUN: %target-typecheck-verify-swift -import-objc-header %S/Inputs/objc_implementation.h -target x86_64-apple-macosx10.14.3 -enable-experimental-feature ObjCImplementation
33
// REQUIRES: objc_interop
44
// REQUIRES: OS=macosx
55

6-
@_objcImplementation extension ObjCImplSubclass {
6+
@objc @implementation extension ObjCImplSubclass {
77
// expected-error@-1 {{'@implementation' of an Objective-C class requires a minimum deployment target of at least macOS 10.14.4}}
88
}
99

10-
@_objcImplementation(Conformance) extension ObjCClass {
10+
@objc(Conformance) @implementation extension ObjCClass {
1111
// expected-error@-1 {{'@implementation' of an Objective-C class requires a minimum deployment target of at least macOS 10.14.4}}
1212
func requiredMethod1() {}
1313
func requiredMethod2() {}
1414
}
15+
16+
@_objcImplementation(EmptyCategory) extension ObjCClass {
17+
// expected-warning@-1 {{'@implementation' of an Objective-C class requires a minimum deployment target of at least macOS 10.14.4; this will become an error after adopting '@implementation'}}
18+
// expected-warning@-2 {{'@_objcImplementation' is deprecated; use '@implementation' instead}}
19+
}

0 commit comments

Comments
 (0)