mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: introduce SuppressedAssociatedTypesWithDefaults
This is similar to SuppressedAssociatedTypes, but infers default requirements when primary associated types of protocols are suppressed. This defaulting for the primary associated types happens in extensions of the protocol, along with generic parameters, whenever a source-written requirement states a conformance requirement for the protocol. Thus, the current scheme for this defaulting is a simplistic, driven by source-written requirements, rather than facts that are inferred while building generic signatures. Defaults are not expanded for infinitely many associated types. rdar://135168163
This commit is contained in:
@@ -1316,6 +1316,13 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
if (ParseEnabledFeatureArgs(Opts, Args, Diags, FrontendOpts))
|
||||
HadError = true;
|
||||
|
||||
// Do not allow both versions of SuppressedAssociatedTypes at the same time.
|
||||
// Pick the version with defaults if both are specified.
|
||||
if (Opts.hasFeature(SuppressedAssociatedTypes) &&
|
||||
Opts.hasFeature(SuppressedAssociatedTypesWithDefaults)) {
|
||||
Opts.disableFeature(SuppressedAssociatedTypes);
|
||||
}
|
||||
|
||||
Opts.EnableAppExtensionLibraryRestrictions |= Args.hasArg(OPT_enable_app_extension_library);
|
||||
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
|
||||
Opts.EnableAppExtensionRestrictions |= Opts.EnableAppExtensionLibraryRestrictions;
|
||||
|
||||
Reference in New Issue
Block a user