Skip to content

Commit 8e09ba8

Browse files
committed
RequirementMachine: Introduce 'concrete contraction' pre-processing pass before building rewrite system
See the comment at the top of ConcreteContraction.cpp for a detailed explanation. This can be turned off with the -disable-requirement-machine-concrete-contraction pass, mostly meant for testing. A few tests now run with this pass both enabled and disabled, to exercise code paths which are otherwise trivially avoided by concrete contraction. Fixes rdar://problem/88135912.
1 parent bbbbfba commit 8e09ba8

33 files changed

+687
-38
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ namespace swift {
530530
RequirementMachineMode RequirementMachineInferredSignatures =
531531
RequirementMachineMode::Disabled;
532532

533+
/// Disable preprocessing pass to eliminate conformance requirements
534+
/// on generic parameters which are made concrete. Usually you want this
535+
/// enabled. It can be disabled for debugging and testing.
536+
bool EnableRequirementMachineConcreteContraction = true;
537+
533538
/// Enables dumping type witness systems from associated type inference.
534539
bool DumpTypeWitnessSystems = false;
535540

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ def requirement_machine_max_concrete_nesting : Joined<["-"], "requirement-machin
355355
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
356356
HelpText<"Set the maximum concrete type nesting depth before giving up">;
357357

358+
def disable_requirement_machine_concrete_contraction : Flag<["-"], "disable-requirement-machine-concrete-contraction">,
359+
HelpText<"Disable preprocessing pass to eliminate conformance requirements "
360+
"on generic parameters which are made concrete">;
361+
358362
def dump_type_witness_systems : Flag<["-"], "dump-type-witness-systems">,
359363
HelpText<"Enables dumping type witness systems from associated type inference">;
360364

lib/AST/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ add_swift_host_library(swiftAST STATIC
7575
ProtocolConformance.cpp
7676
RawComment.cpp
7777
RequirementEnvironment.cpp
78+
RequirementMachine/ConcreteContraction.cpp
7879
RequirementMachine/ConcreteTypeWitness.cpp
7980
RequirementMachine/GenericSignatureQueries.cpp
8081
RequirementMachine/HomotopyReduction.cpp

0 commit comments

Comments
 (0)