mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Version] Don't allow effective sub-versions, only major versions
Also offer a note when the major version is valid on its own.
This commit is contained in:
@@ -773,8 +773,16 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
vers.getValue().isValidEffectiveLanguageVersion()) {
|
||||
Opts.EffectiveLanguageVersion = vers.getValue();
|
||||
} else {
|
||||
// General invalid version error
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
|
||||
// Check for an unneeded minor version
|
||||
if (vers.hasValue() && !vers.getValue().empty() &&
|
||||
vers.getValue().asMajorVersion().isValidEffectiveLanguageVersion()) {
|
||||
Diags.diagnose(SourceLoc(), diag::note_swift_version_major,
|
||||
vers.getValue()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user