Skip to content

Commit a3286c5

Browse files
authored
Merge pull request swiftlang#70784 from tshortli/swift3-no-more
Remove `-enable-swift3-objc-inference`
2 parents 597c19f + 432e4dc commit a3286c5

34 files changed

+200
-884
lines changed

include/swift/AST/Attr.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,13 @@ class DeclAttribute : public AttributeBase {
118118
AddedByAccessNote : 1
119119
);
120120

121-
SWIFT_INLINE_BITFIELD(ObjCAttr, DeclAttribute, 1+1+1,
121+
SWIFT_INLINE_BITFIELD(ObjCAttr, DeclAttribute, 1+1,
122122
/// Whether this attribute has location information that trails the main
123123
/// record, which contains the locations of the parentheses and any names.
124124
HasTrailingLocationInfo : 1,
125125

126126
/// Whether the name is implicit, produced as the result of caching.
127-
ImplicitName : 1,
128-
129-
/// Whether the @objc was inferred using Swift 3's deprecated inference
130-
/// rules.
131-
Swift3Inferred : 1
127+
ImplicitName : 1
132128
);
133129

134130
SWIFT_INLINE_BITFIELD(DynamicReplacementAttr, DeclAttribute, 1,
@@ -823,7 +819,6 @@ class ObjCAttr final : public DeclAttribute,
823819
NameData(nullptr) {
824820
Bits.ObjCAttr.HasTrailingLocationInfo = false;
825821
Bits.ObjCAttr.ImplicitName = implicitName;
826-
Bits.ObjCAttr.Swift3Inferred = false;
827822

828823
if (name) {
829824
NameData = name->getOpaqueValue();
@@ -933,18 +928,6 @@ class ObjCAttr final : public DeclAttribute,
933928
Bits.ObjCAttr.ImplicitName = implicit;
934929
}
935930

936-
/// Determine whether this attribute was inferred based on Swift 3's
937-
/// deprecated @objc inference rules.
938-
bool isSwift3Inferred() const {
939-
return Bits.ObjCAttr.Swift3Inferred;
940-
}
941-
942-
/// Set whether this attribute was inferred based on Swift 3's deprecated
943-
/// @objc inference rules.
944-
void setSwift3Inferred(bool inferred = true) {
945-
Bits.ObjCAttr.Swift3Inferred = inferred;
946-
}
947-
948931
/// Retrieve the source locations for the names in a non-implicit
949932
/// nullary or selector attribute.
950933
ArrayRef<SourceLoc> getNameLocs() const;

include/swift/AST/Builtins.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,6 @@ BUILTIN_MISC_OPERATION(COWBufferForReading, "COWBufferForReading", "n", Special)
764764
// getObjCTypeEncoding has type <T> T.Type -> RawPointer
765765
BUILTIN_MISC_OPERATION(GetObjCTypeEncoding, "getObjCTypeEncoding", "n", Special)
766766

767-
// Swift3ImplicitObjCEntrypoint has type () -> ()
768-
BUILTIN_MISC_OPERATION(Swift3ImplicitObjCEntrypoint, "swift3ImplicitObjCEntrypoint", "", Special)
769-
770767
/// willThrow: Error -> ()
771768
BUILTIN_MISC_OPERATION(WillThrow, "willThrow", "", Special)
772769

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,6 @@ ERROR(expression_unused_keypath_result,NoUsage,
644644
ERROR(expr_keypath_non_objc_property,none,
645645
"argument of '#keyPath' refers to non-'@objc' property %0",
646646
(Identifier))
647-
WARNING(expr_keypath_swift3_objc_inference,Deprecation,
648-
"argument of '#keyPath' refers to property %0 in %1 that depends on "
649-
"'@objc' inference deprecated in Swift 4",
650-
(Identifier, Identifier))
651647
ERROR(expr_keypath_type_of_property,none,
652648
"cannot refer to type member %0 within instance of type %1",
653649
(DeclNameRef, Type))
@@ -755,10 +751,6 @@ ERROR(expr_selector_not_objc,none,
755751
NOTE(make_decl_objc,none,
756752
"add '@objc' to expose this %0 to Objective-C",
757753
(DescriptiveDeclKind))
758-
WARNING(expr_selector_swift3_objc_inference,Deprecation,
759-
"argument of '#selector' refers to %kind0 in %1 that depends on "
760-
"'@objc' inference deprecated in Swift 4",
761-
(const ValueDecl *, const ValueDecl *))
762754

763755
// Selectors-as-string-literals.
764756
WARNING(selector_literal_invalid,none,
@@ -2132,11 +2124,6 @@ ERROR(missing_unimplemented_init_runtime,none,
21322124
ERROR(missing_undefined_runtime,none,
21332125
"standard library error: missing _undefined", ())
21342126

2135-
WARNING(expr_dynamic_lookup_swift3_objc_inference,Deprecation,
2136-
"reference to %kind0 of %1 depends on '@objc' inference "
2137-
"deprecated in Swift 4",
2138-
(const ValueDecl *, Identifier))
2139-
21402127
ERROR(inherited_default_value_not_in_designated_constructor,none,
21412128
"default value inheritance via 'super' is only valid on the parameters of "
21422129
"designated initializers", ())
@@ -3450,11 +3437,6 @@ WARNING(implicitly_final_cannot_be_open_swift4,none,
34503437
"static declarations}0 are implicitly 'final'; use 'public' instead of "
34513438
"'open'", (unsigned))
34523439

3453-
WARNING(override_swift3_objc_inference,Deprecation,
3454-
"override of %kind0 from extension of %1 depends on deprecated "
3455-
"inference of '@objc'",
3456-
(const ValueDecl *, Identifier))
3457-
34583440
// Inheritance
34593441
ERROR(duplicate_inheritance,none,
34603442
"duplicate inheritance from %0", (Type))
@@ -6126,18 +6108,6 @@ ERROR(objc_operator, none,
61266108
"operator methods cannot be declared @objc", ())
61276109
ERROR(objc_operator_proto, none,
61286110
"@objc protocols must not have operator requirements", ())
6129-
WARNING(objc_inference_swift3_dynamic,Deprecation,
6130-
"inference of '@objc' for 'dynamic' members is deprecated", ())
6131-
WARNING(objc_inference_swift3_objc_derived,Deprecation,
6132-
"inference of '@objc' for members of Objective-C-derived classes is "
6133-
"deprecated", ())
6134-
6135-
NOTE(objc_inference_swift3_addobjc,none,
6136-
"add '@objc' to continue exposing an Objective-C entry point (Swift 3 "
6137-
"behavior)", ())
6138-
NOTE(objc_inference_swift3_addnonobjc,none,
6139-
"add '@nonobjc' to suppress the Objective-C entry point (Swift 4 "
6140-
"behavior)", ())
61416111

61426112
ERROR(objc_for_generic_class,none,
61436113
"generic subclasses of '@objc' classes cannot have an explicit '@objc' "
@@ -6153,10 +6123,6 @@ ERROR(objc_setter_for_nonobjc_property,none,
61536123
"'@objc' setter for non-'@objc' property", ())
61546124
ERROR(objc_setter_for_nonobjc_subscript,none,
61556125
"'@objc' setter for non-'@objc' subscript", ())
6156-
WARNING(accessor_swift3_objc_inference,Deprecation,
6157-
"%kind0 with '@objc' %select{getter|setter}1 depends on "
6158-
"deprecated inference of '@objc'",
6159-
(const AbstractStorageDecl *, bool))
61606126

61616127
ERROR(objc_enum_generic,none,
61626128
"'@objc' enum cannot be generic", ())
@@ -6187,10 +6153,6 @@ ERROR(objc_extension_not_class,none,
61876153
// If you change this, also change enum ObjCReason
61886154
#define OBJC_ATTR_SELECT "select{marked @_cdecl|marked dynamic|marked @objc|marked @objcMembers|marked @IBOutlet|marked @IBAction|marked @IBSegueAction|marked @NSManaged|a member of an @objc protocol|implicitly @objc|an @objc override|an implementation of an @objc requirement|marked @IBInspectable|marked @GKInspectable|in an @objc extension of a class (without @nonobjc)|in an @_objcImplementation extension of a class (without final or @nonobjc)|marked @objc by an access note}"
61896155

6190-
WARNING(attribute_meaningless_when_nonobjc,none,
6191-
"'@%0' attribute is meaningless on a property that cannot be "
6192-
"represented in Objective-C", (StringRef))
6193-
61946156
ERROR(objc_invalid_on_var,none,
61956157
"property cannot be %" OBJC_ATTR_SELECT "0 "
61966158
"because its type cannot be represented in Objective-C", (unsigned))
@@ -6249,10 +6211,6 @@ NOTE(objc_overriding_objc_decl,none,
62496211
NOTE(objc_witness_objc_requirement,none,
62506212
"satisfying requirement for %kind0 in protocol %1",
62516213
(const ValueDecl *, const ProtocolDecl *))
6252-
WARNING(witness_swift3_objc_inference,Deprecation,
6253-
"use of %kind0 to satisfy a requirement of protocol %1 depends on "
6254-
"'@objc' inference deprecated in Swift 4",
6255-
(const ValueDecl *, Type))
62566214

62576215
ERROR(no_opaque_return_type_of,none,
62586216
"unable to resolve type for _opaqueReturnTypeOf attribute", ())

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,6 @@ namespace swift {
5151
#include "swift/AST/PlatformConditionKinds.def"
5252
};
5353

54-
/// Describes which Swift 3 Objective-C inference warnings should be
55-
/// emitted.
56-
enum class Swift3ObjCInferenceWarnings {
57-
/// No warnings; this is the default.
58-
None,
59-
/// "Minimal" warnings driven by uses of declarations that make use of
60-
/// the Objective-C entry point directly.
61-
Minimal,
62-
/// "Complete" warnings that add "@objc" for every entry point that
63-
/// Swift 3 would have inferred as "@objc" but Swift 4 will not.
64-
Complete,
65-
};
66-
6754
/// Describes how strict concurrency checking should be.
6855
enum class StrictConcurrency {
6956
/// Enforce Sendable constraints where it has been explicitly adopted and
@@ -439,21 +426,12 @@ namespace swift {
439426
/// will be used in editor. This usually leads to more aggressive fixit.
440427
bool DiagnosticsEditorMode = false;
441428

442-
/// Whether to enable Swift 3 @objc inference, e.g., for members of
443-
/// Objective-C-derived classes and 'dynamic' members.
444-
bool EnableSwift3ObjCInference = false;
445-
446429
/// Access or distribution level of the whole module being parsed.
447430
LibraryLevel LibraryLevel = LibraryLevel::Other;
448431

449432
/// The name of the package this module belongs to.
450433
std::string PackageName;
451434

452-
/// Warn about cases where Swift 3 would infer @objc but later versions
453-
/// of Swift do not.
454-
Swift3ObjCInferenceWarnings WarnSwift3ObjCInference =
455-
Swift3ObjCInferenceWarnings::None;
456-
457435
/// Diagnose implicit 'override'.
458436
bool WarnImplicitOverrides = false;
459437

include/swift/Migrator/FixitFilter.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ struct FixitFilter {
8080
if (Info.ID == diag::could_not_find_enum_case.ID)
8181
return false;
8282

83-
// Sema suggests adding both `@objc` and `@nonobjc` as alternative fix-its
84-
// for inferring Swift-3 style @objc visibility, but we don't want the
85-
// migrator to suggest `@nonobjc`.
86-
if (Info.ID == diag::objc_inference_swift3_addnonobjc.ID) {
87-
return false;
88-
}
89-
9083
// With SE-110, the migrator may get a recommendation to add a Void
9184
// placeholder in the call to f in:
9285
// func foo(f: (Void) -> ()) {
@@ -132,10 +125,6 @@ struct FixitFilter {
132125
Info.ID == diag::deprecated_any_composition.ID ||
133126
Info.ID == diag::deprecated_operator_body.ID ||
134127
Info.ID == diag::unbound_generic_parameter_explicit_fix.ID ||
135-
Info.ID == diag::objc_inference_swift3_addobjc.ID ||
136-
Info.ID == diag::objc_inference_swift3_dynamic.ID ||
137-
Info.ID == diag::override_swift3_objc_inference.ID ||
138-
Info.ID == diag::objc_inference_swift3_objc_derived.ID ||
139128
Info.ID == diag::missing_several_cases.ID ||
140129
Info.ID == diag::missing_particular_case.ID ||
141130
Info.ID == diag::missing_unknown_case.ID ||

include/swift/Option/FrontendOptions.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,12 @@ def report_errors_to_debugger : Flag<["-"], "report-errors-to-debugger">,
677677

678678
def enable_swift3_objc_inference : Flag<["-"], "enable-swift3-objc-inference">,
679679
Flags<[FrontendOption, HelpHidden]>,
680-
HelpText<"Deprecated">;
680+
HelpText<"Deprecated, has no effect">;
681681

682682
def disable_swift3_objc_inference :
683683
Flag<["-"], "disable-swift3-objc-inference">,
684684
Flags<[FrontendOption, HelpHidden]>,
685-
HelpText<"Deprecated">;
685+
HelpText<"Deprecated, has no effect">;
686686

687687
def enable_implicit_dynamic : Flag<["-"], "enable-implicit-dynamic">,
688688
Flags<[FrontendOption, NoInteractiveOption, HelpHidden]>,

include/swift/Option/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,12 +788,12 @@ def continue_building_after_errors : Flag<["-"], "continue-building-after-errors
788788
def warn_swift3_objc_inference_complete :
789789
Flag<["-"], "warn-swift3-objc-inference-complete">,
790790
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
791-
HelpText<"Deprecated">;
791+
HelpText<"Deprecated, has no effect">;
792792

793793
def warn_swift3_objc_inference_minimal :
794794
Flag<["-"], "warn-swift3-objc-inference-minimal">,
795795
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
796-
HelpText<"Deprecated">;
796+
HelpText<"Deprecated, has no effect">;
797797

798798
def enable_actor_data_race_checks :
799799
Flag<["-"], "enable-actor-data-race-checks">,

lib/AST/Attr.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,6 @@ ObjCAttr::ObjCAttr(SourceLoc atLoc, SourceRange baseRange,
17751775
}
17761776

17771777
Bits.ObjCAttr.ImplicitName = false;
1778-
Bits.ObjCAttr.Swift3Inferred = false;
17791778
}
17801779

17811780
ObjCAttr *ObjCAttr::create(ASTContext &Ctx, llvm::Optional<ObjCSelector> name,
@@ -1853,7 +1852,6 @@ SourceLoc ObjCAttr::getRParenLoc() const {
18531852

18541853
ObjCAttr *ObjCAttr::clone(ASTContext &context) const {
18551854
auto attr = new (context) ObjCAttr(getName(), isNameImplicit());
1856-
attr->setSwift3Inferred(isSwift3Inferred());
18571855
attr->setAddedByAccessNote(getAddedByAccessNote());
18581856
return attr;
18591857
}

lib/AST/Builtins.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,11 +2983,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
29832983
case BuiltinValueKind::TSanInoutAccess:
29842984
return getTSanInoutAccess(Context, Id);
29852985

2986-
case BuiltinValueKind::Swift3ImplicitObjCEntrypoint:
2987-
return getBuiltinFunction(Id,
2988-
{},
2989-
TupleType::getEmpty(Context));
2990-
29912986
case BuiltinValueKind::TypePtrAuthDiscriminator:
29922987
return getTypePtrAuthDiscriminator(Context, Id);
29932988

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
899899
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
900900
Opts.EnableAppExtensionRestrictions |= Opts.EnableAppExtensionLibraryRestrictions;
901901

902-
Opts.EnableSwift3ObjCInference =
903-
Args.hasFlag(OPT_enable_swift3_objc_inference,
904-
OPT_disable_swift3_objc_inference, false);
905-
906902
if (Args.hasArg(OPT_enable_swift3_objc_inference))
907903
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
908904
"-enable-swift3-objc-inference");
@@ -963,17 +959,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
963959

964960
Opts.EnableSPIOnlyImports = Args.hasArg(OPT_experimental_spi_only_imports);
965961

966-
if (Opts.EnableSwift3ObjCInference) {
967-
if (const Arg *A = Args.getLastArg(
968-
OPT_warn_swift3_objc_inference_minimal,
969-
OPT_warn_swift3_objc_inference_complete)) {
970-
if (A->getOption().getID() == OPT_warn_swift3_objc_inference_minimal)
971-
Opts.WarnSwift3ObjCInference = Swift3ObjCInferenceWarnings::Minimal;
972-
else
973-
Opts.WarnSwift3ObjCInference = Swift3ObjCInferenceWarnings::Complete;
974-
}
975-
}
976-
977962
if (Args.hasArg(OPT_warn_swift3_objc_inference_minimal))
978963
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
979964
"-warn-swift3-objc-inference-minimal");

0 commit comments

Comments
 (0)