Skip to content

Commit 6b12faf

Browse files
committed
[NFC] TypeCheckType: Compute language mode to limit diagnostic behavior for ExistentialAny
1 parent e056c63 commit 6b12faf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6505,13 +6505,13 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
65056505
/*isAlias=*/isa<TypeAliasDecl>(decl)));
65066506
}
65076507

6508-
// If the feature is enabled in adoption mode, warn unconditionally.
6509-
// Otherwise, until Swift 7.
6510-
if (Ctx.LangOpts.getFeatureState(Feature::ExistentialAny)
6511-
.isEnabledForAdoption()) {
6508+
// If `ExistentialAny` is enabled in adoption mode, warn unconditionally.
6509+
// Otherwise, warn until the feature's coming-of-age language mode.
6510+
const auto feature = Feature::ExistentialAny;
6511+
if (Ctx.LangOpts.getFeatureState(feature).isEnabledForAdoption()) {
65126512
diag->limitBehavior(DiagnosticBehavior::Warning);
65136513
} else {
6514-
diag->warnUntilSwiftVersion(7);
6514+
diag->warnUntilSwiftVersion(getFeatureLanguageVersion(feature).value());
65156515
}
65166516

65176517
emitInsertAnyFixit(*diag, T);

0 commit comments

Comments
 (0)