Skip to content

Commit b3df0dc

Browse files
committed
[NFC] Basic: Do not return true in LangOptions::hasFeature if adoption mode
This check is used to enact features, whereas adoption mode should not change behavior.
1 parent b102c98 commit b3df0dc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/Basic/LangOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ bool LangOptions::isCustomConditionalCompilationFlagSet(StringRef Name) const {
295295
}
296296

297297
bool LangOptions::FeatureState::isEnabled() const {
298-
return this->state != FeatureState::Kind::Off;
298+
return this->state == FeatureState::Kind::Enabled;
299299
}
300300

301301
bool LangOptions::FeatureState::isEnabledForAdoption() const {

lib/Sema/TypeCheckType.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6411,8 +6411,10 @@ class ExistentialTypeSyntaxChecker : public ASTWalker {
64116411
return false;
64126412
}
64136413

6414-
// A missing `any` or `some` is always diagnosed if this feature is enabled.
6415-
if (ctx.LangOpts.hasFeature(Feature::ExistentialAny)) {
6414+
// A missing `any` or `some` is always diagnosed if this feature not
6415+
// disabled.
6416+
auto featureState = ctx.LangOpts.getFeatureState(Feature::ExistentialAny);
6417+
if (featureState.isEnabled() || featureState.isEnabledForAdoption()) {
64166418
return true;
64176419
}
64186420

0 commit comments

Comments
 (0)