RequirementMachine: Opaque archetype support (sort of)

Complete support is behind a flag, because it can result in a non-convergent
rewrite system if the opaque result type has a recursive conformance of its
own (eg, `some View` for SwiftUI's View protocol).

Without the flag, it's good enough for simple examples; you just can't have
a requirement that mentions a nested type of a type parameter equated to
the concrete type.

Fixes rdar://problem/88135291, https://bugs.swift.org/browse/SR-15983.
This commit is contained in:
Slava Pestov
2022-03-16 13:31:08 -04:00
parent 4d531aea9c
commit 2f727d6b47
8 changed files with 175 additions and 20 deletions

View File

@@ -1004,6 +1004,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
if (Args.hasArg(OPT_enable_requirement_machine_loop_normalization))
Opts.EnableRequirementMachineLoopNormalization = true;
if (Args.hasArg(OPT_enable_requirement_machine_opaque_archetypes))
Opts.EnableRequirementMachineOpaqueArchetypes = true;
Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems);
return HadError || UnsupportedOS || UnsupportedArch;