Skip to content

Frontend: Obsolete -fixit-all and -emit-fixits-path #81280

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 2 commits into from
May 7, 2025
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
2 changes: 2 additions & 0 deletions include/swift/AST/DiagnosticsFrontend.def
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ ERROR(cannot_emit_ir_skipping_function_bodies,none,
WARNING(emit_reference_dependencies_without_primary_file,none,
"ignoring -emit-reference-dependencies (requires -primary-file)", ())

WARNING(ignoring_option_obsolete,none,
"ignoring '%0'; this option is obsolete", (StringRef))
WARNING(ignoring_option_requires_option,none,
"ignoring %0 (requires %1)", (StringRef, StringRef))
WARNING(warn_ignore_option_overriden_by,none,
Expand Down
5 changes: 1 addition & 4 deletions lib/Frontend/ArgsToFrontendOutputsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
options::OPT_emit_reference_dependencies_path);
auto serializedDiagnostics = getSupplementaryFilenamesFromArguments(
options::OPT_serialize_diagnostics_path);
auto fixItsOutput = getSupplementaryFilenamesFromArguments(
options::OPT_emit_fixits_path);
auto loadedModuleTrace = getSupplementaryFilenamesFromArguments(
options::OPT_emit_loaded_module_trace_path);
auto TBD = getSupplementaryFilenamesFromArguments(options::OPT_emit_tbd_path);
Expand All @@ -343,7 +341,7 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
options::OPT_save_optimization_record_path);
if (!clangHeaderOutput || !moduleOutput || !moduleDocOutput ||
!dependenciesFile || !referenceDependenciesFile ||
!serializedDiagnostics || !fixItsOutput || !loadedModuleTrace || !TBD ||
!serializedDiagnostics || !loadedModuleTrace || !TBD ||
!moduleInterfaceOutput || !privateModuleInterfaceOutput || !packageModuleInterfaceOutput ||
!moduleSourceInfoOutput || !moduleSummaryOutput || !abiDescriptorOutput ||
!moduleSemanticInfoOutput || !optRecordOutput) {
Expand All @@ -361,7 +359,6 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
sop.DependenciesFilePath = (*dependenciesFile)[i];
sop.ReferenceDependenciesFilePath = (*referenceDependenciesFile)[i];
sop.SerializedDiagnosticsPath = (*serializedDiagnostics)[i];
sop.FixItsOutputPath = (*fixItsOutput)[i];
sop.LoadedModuleTracePath = (*loadedModuleTrace)[i];
sop.TBDPath = (*TBD)[i];
sop.ModuleInterfaceOutputPath = (*moduleInterfaceOutput)[i];
Expand Down
15 changes: 14 additions & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,20 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
Opts.EmitMacroExpansionFiles = !negated;
}

Opts.FixitCodeForAllDiagnostics |= Args.hasArg(OPT_fixit_all);
{
OptSpecifier obsoleteOpts[] = {
OPT_fixit_all,
OPT_emit_fixits_path,
};

for (auto option: obsoleteOpts) {
if (auto *arg = Args.getLastArg(option)) {
Diags.diagnose(SourceLoc(), diag::ignoring_option_obsolete,
arg->getOption().getPrefixedName());
}
}
}

Opts.SuppressWarnings |= Args.hasArg(OPT_suppress_warnings);
Opts.SuppressRemarks |= Args.hasArg(OPT_suppress_remarks);
for (const Arg *arg : Args.filtered(OPT_warning_treating_Group)) {
Expand Down
2 changes: 0 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ function(get_test_dependencies SDK result_var_name)

if(NOT SWIFT_BUILT_STANDALONE)
list(APPEND deps_binaries
arcmt-test
c-arcmt-test
c-index-test
CASPluginTest
clang
Expand Down
9 changes: 9 additions & 0 deletions test/Constraints/argument_matching.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1821,3 +1821,12 @@ struct Issue75527 {
fn(0) // Make sure the argument label does not escape here.
}
}

do {
func f(p: Int, _: String) {}
// FIXME: Wrong expected argument type.
// expected-error@+2:5 {{cannot convert value of type 'Int' to expected argument type 'String'}}
// expected-error@+1:8 {{cannot convert value of type 'String' to expected argument type 'Int'}}
f(0, "")
// expected-error@-1:4 {{missing argument label 'p:' in call}}{{5-5=p: }}
}
22 changes: 22 additions & 0 deletions test/Constraints/bridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,28 @@ func forceUniversalBridgeToAnyObject<T, U: KnownClassProtocol>(a: T, b: U, c: An
_ = z
}

do {
func f(an : Any, oan: Any?) -> AnyObject? {
let a1 : AnyObject
a1 = an
// expected-error@-1:8 {{value of type 'Any' expected to be an instance of a class or class-constrained type in assignment}}{{none}}
// expected-note@-2:8 {{cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members}}{{12-12= as AnyObject}}
let a2 : AnyObject?
a2 = an
// expected-error@-1:10 {{value of type 'Any' expected to be an instance of a class or class-constrained type in assignment}}{{12-12= as AnyObject}}
let a3 : AnyObject!
a3 = an
// expected-error@-1:10 {{value of type 'Any' expected to be an instance of a class or class-constrained type in assignment}}{{12-12= as AnyObject}}

let obj: AnyObject = an
// expected-error@-1:26 {{value of type 'Any' expected to be instance of class or class-constrained type}}{{none}}
// expected-note@-2:26 {{cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members}}{{28-28= as AnyObject}}

return oan
// expected-error@-1:12 {{return expression of type 'Any' expected to be an instance of a class or class-constrained type}}{{15-15= as AnyObject}}
}
}

func bridgeAnyContainerToAnyObject(x: [Any], y: [NSObject: Any]) {
var z: AnyObject
z = x as AnyObject
Expand Down
24 changes: 0 additions & 24 deletions test/FixCode/batch-mode.swift

This file was deleted.

5 changes: 5 additions & 0 deletions test/FixCode/fixit-all.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -fixit-all -emit-fixits-path %t.remap %s 2>&1 | %FileCheck %s

// CHECK: <unknown>:0: warning: ignoring '-fixit-all'; this option is obsolete
// CHECK: <unknown>:0: warning: ignoring '-emit-fixits-path'; this option is obsolete
26 changes: 0 additions & 26 deletions test/FixCode/fixits-apply-all.swift

This file was deleted.

26 changes: 0 additions & 26 deletions test/FixCode/fixits-apply-all.swift.result

This file was deleted.

111 changes: 0 additions & 111 deletions test/FixCode/fixits-apply-objc.swift

This file was deleted.

Loading