Swift 4.x (x < 2) names are obsoleted in 4.2, not 5.

In APINotes, when an unversioned name overrides
a previously declared name with a Swift version, if the
previously declared name is guarded under version 4
the obsoleted version should be 4.2, not 5.  In all other
cases, the obsoleted version is the next major Swift
version.

Fixes rdar://problem/39950937
This commit is contained in:
Ted Kremenek
2018-05-09 00:19:42 -07:00
parent 0b0671ce33
commit cc3024d7c5
5 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
Name: M
Classes:
- Name: FooID
SwiftName: Foo_ID
SwiftVersions:
- Version: 4
Classes:
- Name: FooID
SwiftName: FooID

View File

@@ -0,0 +1,3 @@
@import Foundation;
@interface FooID: NSObject
@end

View File

@@ -1,3 +1,6 @@
module APINotesTest {
header "APINotesTest.h"
}
module ObsoletedAPINotesTest {
header "ObsoletedAPINotesTest.h"
}

View File

@@ -0,0 +1,7 @@
// RUN: not %target-swift-frontend -typecheck -verify -I %S/Inputs/custom-modules -F %S/Inputs/custom-frameworks -swift-version 3 %s
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs/custom-modules -F %S/Inputs/custom-frameworks -swift-version 4.2 %s
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs/custom-modules -F %S/Inputs/custom-frameworks -swift-version 5 %s
import ObsoletedAPINotesTest
let _: FooID // expected-error{{'FooID' has been renamed to 'Foo_ID'}}
let _: Foo_ID