mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Migrator] Don't run AST passes when in Swift 4 or later
AST passes assume that you are migrating from a version earlier than Swift 4, where declaration references and type names may be unconditionally renamed if their USRs match. For example, this can happen for TypeMemberDiffItem entries where the Objective-C USR is the same in Swift 3 and Swift 4, but the type is spelled differently in Swift 4. A concrete example of this is: `NSDocumentTypeDocumentAttribute` (Swift 3) -> `NSAttributedString.DocumentAttributeKey` (Swift 4). Although this declaration is imported differently in Swift 4, its Objective-C USR is `c:@NSDocumentTypeDocumentAttribute` for both. rdar://problem/32604558
This commit is contained in:
@@ -53,9 +53,11 @@ bool migrator::updateCodeAndEmitRemap(CompilerInstance *Instance,
|
||||
}
|
||||
|
||||
// Phase 2: Syntactic Transformations
|
||||
auto FailedSyntacticPasses = M.performSyntacticPasses();
|
||||
if (FailedSyntacticPasses) {
|
||||
return true;
|
||||
if (Invocation.getLangOptions().EffectiveLanguageVersion[0] < 4) {
|
||||
auto FailedSyntacticPasses = M.performSyntacticPasses();
|
||||
if (FailedSyntacticPasses) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 3: Post Fix-it Passes
|
||||
|
||||
Reference in New Issue
Block a user