Skip to content

Commit baf2760

Browse files
authored
Merge pull request #74161 from beccadax/objcimpl-not-so-minimum-deployment-target
2 parents c5cfe5b + eb1ea45 commit baf2760

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
@@ -1666,10 +1666,13 @@ visitObjCImplementationAttr(ObjCImplementationAttr *attr) {
16661666
// supported.
16671667
auto deploymentAvailability = AvailabilityContext::forDeploymentTarget(Ctx);
16681668
if (!deploymentAvailability.isContainedIn(Ctx.getSwift50Availability())) {
1669-
diagnose(attr->getLocation(),
1669+
auto diag = diagnose(attr->getLocation(),
16701670
diag::attr_objc_implementation_raise_minimum_deployment_target,
16711671
prettyPlatformString(targetPlatform(Ctx.LangOpts)),
16721672
Ctx.getSwift50Availability().getOSVersion().getLowerEndpoint());
1673+
if (attr->isEarlyAdopter()) {
1674+
diag.wrapIn(diag::wrap_objc_implementation_will_become_error);
1675+
}
16731676
}
16741677
}
16751678
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)