Frontend: Really allow any experimental feature when compiling a module interface.

The fix for https://github.com/apple/swift/pull/72632 was not sufficient
because when modules are built from textual interface that happens in a
sub-invocation which does not have typecheck-from-interface or
compile-from-interface requested action. Instead of checking a requested
action, set a language option to control whether non-production experimental
features are allowed.

Resolves rdar://125561443
This commit is contained in:
Allan Shortlidge
2024-03-28 13:28:49 -07:00
parent 233c1675cf
commit 12fccfc4e0
6 changed files with 57 additions and 9 deletions

View File

@@ -2066,6 +2066,12 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
bool StrictImplicitModuleContext =
subInvocation.getFrontendOptions().StrictImplicitModuleContext;
// It isn't appropriate to restrict use of experimental features in another
// module since it may have been built with a different compiler that allowed
// the use of the feature.
subInvocation.getLangOptions().RestrictNonProductionExperimentalFeatures =
false;
// Save the target triple from the original context.
llvm::Triple originalTargetTriple(subInvocation.getLangOptions().Target);