Skip to content

Commit fa0e628

Browse files
authored
Merge pull request swiftlang#67925 from beccadax/objcimpl-warning-main
Temporarily soften @objcImpl errors into warnings
2 parents 5621ab3 + ad960a1 commit fa0e628

File tree

3 files changed

+59
-47
lines changed

3 files changed

+59
-47
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,11 @@ NOTE(objc_implementation_one_matched_requirement,none,
18001800
"'@objc(%3)' to use it}2",
18011801
(ValueDecl *, ObjCSelector, bool, StringRef))
18021802

1803+
WARNING(wrap_objc_implementation_will_become_error,none,
1804+
"%0; this will become an error before '@_objcImplementation' is "
1805+
"stabilized",
1806+
(DiagnosticInfo *))
1807+
18031808
ERROR(cdecl_not_at_top_level,none,
18041809
"@_cdecl can only be applied to global functions", ())
18051810
ERROR(cdecl_empty_name,none,

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,9 +2866,16 @@ namespace {
28662866
class ObjCImplementationChecker {
28672867
DiagnosticEngine &diags;
28682868

2869-
template<typename ...ArgTypes>
2870-
InFlightDiagnostic diagnose(ArgTypes &&...Args) {
2871-
auto diag = diags.diagnose(std::forward<ArgTypes>(Args)...);
2869+
template<typename Loc, typename ...ArgTypes>
2870+
InFlightDiagnostic diagnose(Loc loc, Diag<ArgTypes...> diagID,
2871+
typename detail::PassArgument<ArgTypes>::type... Args) {
2872+
auto diag = diags.diagnose(loc, diagID, std::forward<ArgTypes>(Args)...);
2873+
2874+
// WORKAROUND (5.9): Soften newly-introduced errors to make things easier
2875+
// for early adopters.
2876+
if (diags.declaredDiagnosticKindFor(diagID.ID) == DiagnosticKind::Error)
2877+
diag.wrapIn(diag::wrap_objc_implementation_will_become_error);
2878+
28722879
return diag;
28732880
}
28742881

0 commit comments

Comments
 (0)