@@ -133,20 +133,22 @@ Migrator::performAFixItMigration(version::Version SwiftLanguageVersion) {
133
133
LLVMArgs.erase (aarch64_use_tbi);
134
134
}
135
135
136
- // SE-0160: When migrating, always use the Swift 3 @objc inference rules,
137
- // which drives warnings with the "@objc" Fix-Its.
138
- Invocation.getLangOptions ().EnableSwift3ObjCInference = true ;
139
-
140
- // The default behavior of the migrator, referred to as "minimal" migration
141
- // in SE-0160, only adds @objc Fix-Its to those cases where the Objective-C
142
- // entry point is explicitly used somewhere in the source code. The user
143
- // may also select a workflow that adds @objc for every declaration that
144
- // would infer @objc under the Swift 3 rules but would no longer infer
145
- // @objc in Swift 4.
146
- Invocation.getLangOptions ().WarnSwift3ObjCInference =
147
- getMigratorOptions ().KeepObjcVisibility
148
- ? Swift3ObjCInferenceWarnings::Complete
149
- : Swift3ObjCInferenceWarnings::Minimal;
136
+ if (StartInvocation.getLangOptions ().EffectiveLanguageVersion .isVersion3 ()) {
137
+ // SE-0160: When migrating, always use the Swift 3 @objc inference rules,
138
+ // which drives warnings with the "@objc" Fix-Its.
139
+ Invocation.getLangOptions ().EnableSwift3ObjCInference = true ;
140
+
141
+ // The default behavior of the migrator, referred to as "minimal" migration
142
+ // in SE-0160, only adds @objc Fix-Its to those cases where the Objective-C
143
+ // entry point is explicitly used somewhere in the source code. The user
144
+ // may also select a workflow that adds @objc for every declaration that
145
+ // would infer @objc under the Swift 3 rules but would no longer infer
146
+ // @objc in Swift 4.
147
+ Invocation.getLangOptions ().WarnSwift3ObjCInference =
148
+ getMigratorOptions ().KeepObjcVisibility
149
+ ? Swift3ObjCInferenceWarnings::Complete
150
+ : Swift3ObjCInferenceWarnings::Minimal;
151
+ }
150
152
151
153
const auto &OrigFrontendOpts = StartInvocation.getFrontendOptions ();
152
154
0 commit comments