Skip to content

Frontend: Hide and deprecate options for Swift 3 @objc inference #70775

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 1 commit into from
Jan 9, 2024
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
4 changes: 2 additions & 2 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,12 @@ def report_errors_to_debugger : Flag<["-"], "report-errors-to-debugger">,

def enable_swift3_objc_inference : Flag<["-"], "enable-swift3-objc-inference">,
Flags<[FrontendOption, HelpHidden]>,
HelpText<"Enable Swift 3's @objc inference rules for NSObject-derived classes and 'dynamic' members (emulates Swift 3 behavior)">;
HelpText<"Deprecated">;

def disable_swift3_objc_inference :
Flag<["-"], "disable-swift3-objc-inference">,
Flags<[FrontendOption, HelpHidden]>,
HelpText<"Disable Swift 3's @objc inference rules for NSObject-derived classes and 'dynamic' members (emulates Swift 4 behavior)">;
HelpText<"Deprecated">;

def enable_implicit_dynamic : Flag<["-"], "enable-implicit-dynamic">,
Flags<[FrontendOption, NoInteractiveOption, HelpHidden]>,
Expand Down
8 changes: 4 additions & 4 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,13 @@ def continue_building_after_errors : Flag<["-"], "continue-building-after-errors

def warn_swift3_objc_inference_complete :
Flag<["-"], "warn-swift3-objc-inference-complete">,
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Warn about deprecated @objc inference in Swift 3 for every declaration that will no longer be inferred as @objc in Swift 4">;
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
HelpText<"Deprecated">;

def warn_swift3_objc_inference_minimal :
Flag<["-"], "warn-swift3-objc-inference-minimal">,
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Warn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint">;
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
HelpText<"Deprecated">;

def enable_actor_data_race_checks :
Flag<["-"], "enable-actor-data-race-checks">,
Expand Down
16 changes: 16 additions & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,14 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Args.hasFlag(OPT_enable_swift3_objc_inference,
OPT_disable_swift3_objc_inference, false);

if (Args.hasArg(OPT_enable_swift3_objc_inference))
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
"-enable-swift3-objc-inference");

if (Args.hasArg(OPT_disable_swift3_objc_inference))
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
"-disable-swift3-objc-inference");

if (const Arg *A = Args.getLastArg(OPT_library_level)) {
StringRef contents = A->getValue();
if (contents == "api") {
Expand Down Expand Up @@ -983,6 +991,14 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}

if (Args.hasArg(OPT_warn_swift3_objc_inference_minimal))
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
"-warn-swift3-objc-inference-minimal");

if (Args.hasArg(OPT_warn_swift3_objc_inference_complete))
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
"-warn-swift3-objc-inference-complete");

// Swift 6+ uses the strictest concurrency level.
if (Opts.isSwiftVersionAtLeast(6)) {
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;
Expand Down