mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Function builders] Add one-way constraints when applying function builders
When we transform each expression or statement in a function builder, introduce a one-way constraint so that type information does not flow backwards from the context into that statement or expression. This more closely mimics the behavior of normal code, where type inference is per-statement, flowing from top to bottom. This also allows us to isolate different expressions and statements within a closure that's passed into a function builder parameter, reducing the search space and (hopefully) improving compile times for large function builder closures. For now, put this functionality behind the compiler flag `-enable-function-builder-one-way-constraints` for testing purposes; we still have both optimization and correctness work to do to turn this on by default.
This commit is contained in:
@@ -440,6 +440,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
if (Args.getLastArg(OPT_solver_disable_shrink))
|
||||
Opts.SolverDisableShrink = true;
|
||||
if (Args.getLastArg(OPT_enable_function_builder_one_way_constraints))
|
||||
Opts.FunctionBuilderOneWayConstraints = true;
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_value_recursion_threshold)) {
|
||||
unsigned threshold;
|
||||
|
||||
Reference in New Issue
Block a user