mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add experimental feature for type witness system inference
This commit is contained in:
@@ -89,6 +89,7 @@ EXPERIMENTAL_FEATURE(NamedOpaqueTypes)
|
|||||||
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures)
|
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures)
|
||||||
EXPERIMENTAL_FEATURE(MoveOnly)
|
EXPERIMENTAL_FEATURE(MoveOnly)
|
||||||
EXPERIMENTAL_FEATURE(OneWayClosureParameters)
|
EXPERIMENTAL_FEATURE(OneWayClosureParameters)
|
||||||
|
EXPERIMENTAL_FEATURE(TypeWitnessSystemInference)
|
||||||
|
|
||||||
#undef EXPERIMENTAL_FEATURE
|
#undef EXPERIMENTAL_FEATURE
|
||||||
#undef SUPPRESSIBLE_LANGUAGE_FEATURE
|
#undef SUPPRESSIBLE_LANGUAGE_FEATURE
|
||||||
|
|||||||
@@ -330,10 +330,6 @@ namespace swift {
|
|||||||
/// Enable inference of Sendable conformances for public types.
|
/// Enable inference of Sendable conformances for public types.
|
||||||
bool EnableInferPublicSendable = false;
|
bool EnableInferPublicSendable = false;
|
||||||
|
|
||||||
/// Enable experimental associated type inference using type witness
|
|
||||||
/// systems.
|
|
||||||
bool EnableExperimentalAssociatedTypeInference = false;
|
|
||||||
|
|
||||||
/// Disable the implicit import of the _Concurrency module.
|
/// Disable the implicit import of the _Concurrency module.
|
||||||
bool DisableImplicitConcurrencyModuleImport =
|
bool DisableImplicitConcurrencyModuleImport =
|
||||||
!SWIFT_IMPLICIT_CONCURRENCY_IMPORT;
|
!SWIFT_IMPLICIT_CONCURRENCY_IMPORT;
|
||||||
|
|||||||
@@ -3019,6 +3019,10 @@ static bool usesFeatureOneWayClosureParameters(Decl *decl) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool usesFeatureTypeWitnessSystemInference(Decl *decl) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
|
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
|
||||||
llvm::function_ref<void()> action) {
|
llvm::function_ref<void()> action) {
|
||||||
|
|||||||
@@ -455,9 +455,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||||||
OPT_disable_experimental_opened_existential_types,
|
OPT_disable_experimental_opened_existential_types,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
Opts.EnableExperimentalAssociatedTypeInference |=
|
|
||||||
Args.hasArg(OPT_enable_experimental_associated_type_inference);
|
|
||||||
|
|
||||||
Opts.EnableInferPublicSendable |=
|
Opts.EnableInferPublicSendable |=
|
||||||
Args.hasFlag(OPT_enable_infer_public_concurrent_value,
|
Args.hasFlag(OPT_enable_infer_public_concurrent_value,
|
||||||
OPT_disable_infer_public_concurrent_value,
|
OPT_disable_infer_public_concurrent_value,
|
||||||
@@ -655,7 +652,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||||||
Opts.Features.insert(Feature::VariadicGenerics);
|
Opts.Features.insert(Feature::VariadicGenerics);
|
||||||
if (Args.hasArg(OPT_enable_experimental_static_assert))
|
if (Args.hasArg(OPT_enable_experimental_static_assert))
|
||||||
Opts.Features.insert(Feature::StaticAssert);
|
Opts.Features.insert(Feature::StaticAssert);
|
||||||
if (Args.hasArg(OPT_enable_experimental_associated_type_inference))
|
if (Args.hasArg(OPT_enable_experimental_named_opaque_types))
|
||||||
Opts.Features.insert(Feature::NamedOpaqueTypes);
|
Opts.Features.insert(Feature::NamedOpaqueTypes);
|
||||||
if (Args.hasArg(OPT_enable_experimental_flow_sensitive_concurrent_captures))
|
if (Args.hasArg(OPT_enable_experimental_flow_sensitive_concurrent_captures))
|
||||||
Opts.Features.insert(Feature::FlowSensitiveConcurrencyCaptures);
|
Opts.Features.insert(Feature::FlowSensitiveConcurrencyCaptures);
|
||||||
@@ -663,6 +660,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||||||
Opts.Features.insert(Feature::MoveOnly);
|
Opts.Features.insert(Feature::MoveOnly);
|
||||||
if (Args.hasArg(OPT_experimental_one_way_closure_params))
|
if (Args.hasArg(OPT_experimental_one_way_closure_params))
|
||||||
Opts.Features.insert(Feature::OneWayClosureParameters);
|
Opts.Features.insert(Feature::OneWayClosureParameters);
|
||||||
|
if (Args.hasArg(OPT_enable_experimental_associated_type_inference))
|
||||||
|
Opts.Features.insert(Feature::TypeWitnessSystemInference);
|
||||||
|
|
||||||
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
|
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
|
||||||
|
|
||||||
|
|||||||
@@ -1206,7 +1206,7 @@ AssociatedTypeDecl *AssociatedTypeInference::inferAbstractTypeWitnesses(
|
|||||||
// not resolve otherwise.
|
// not resolve otherwise.
|
||||||
llvm::SmallVector<AbstractTypeWitness, 2> abstractTypeWitnesses;
|
llvm::SmallVector<AbstractTypeWitness, 2> abstractTypeWitnesses;
|
||||||
|
|
||||||
if (ctx.LangOpts.EnableExperimentalAssociatedTypeInference) {
|
if (ctx.LangOpts.hasFeature(Feature::TypeWitnessSystemInference)) {
|
||||||
TypeWitnessSystem system(unresolvedAssocTypes);
|
TypeWitnessSystem system(unresolvedAssocTypes);
|
||||||
collectAbstractTypeWitnesses(system, unresolvedAssocTypes);
|
collectAbstractTypeWitnesses(system, unresolvedAssocTypes);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user