I'm working on the implementation of a change that would go into Swift 5. It appears that the following check is failing:
if (cs.getTypeChecker().getLangOpts().isSwiftVersionAtLeast(5)) {
// Do something
}
So it appears that the compiler does not believe that the Swift version is at least 5 on the swift-5.0-branch. Is that expected? Is there a better way to be checking for the Swift language version?
Note also that you're checking the effective language version, which takes into account compatibility mode versions. Therefore, passing the option -swift-version 5 will allow the check to succeed even though the compiler version hasn't been bumped yet.
That's true. It does mean, however, that my tests are failing because I'm writing them under the expectation of Swift 5 behavior. Is there a better way to handle this? It seems like most of the SILGen tests, at least, are just operating on the latest standard version of Swift.
It's worth noting that currently tests by default use -swift-version 4, so even if the compiler version were bumped, you would still need to pass -swift-version 5 to test a Swift 5 mode specific change.