Skip to content

Commit 522fee4

Browse files
committed
Basic: Fix a bug in LangOptions::hasFeature().
Don't skip checking if a feature is enabled for migration when the feature also has an associated language version.
1 parent d258fa7 commit 522fee4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Basic/LangOptions.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,10 @@ bool LangOptions::hasFeature(Feature feature, bool allowMigration) const {
340340
if (state.isEnabled())
341341
return true;
342342

343-
if (auto version = feature.getLanguageVersion())
344-
return isSwiftVersionAtLeast(*version);
343+
if (auto version = feature.getLanguageVersion()) {
344+
if (isSwiftVersionAtLeast(*version))
345+
return true;
346+
}
345347

346348
if (allowMigration && state.isEnabledForMigration())
347349
return true;

0 commit comments

Comments
 (0)