[SE-0111] Drop argument labels on references to function values.

When referencing a function in the type checker, drop argument labels
when we don't need them to type-check an immediate call to that
function. This provides the semantic behavior of SE-0111, e.g.,
references to functions as values produce unlabeled function types,
without the representational change of actually dropping argument
labels from the type system.

At the moment, this only works for bare references to functions. It
still needs to be pushed through more of the type checker and more AST
nodes to work in the general case.

Keep this work behind the frontend flag
-suppress-argument-labels-in-types for now.
This commit is contained in:
Doug Gregor
2016-07-28 11:10:53 -07:00
parent 8c7e75afa0
commit a9536906ff
23 changed files with 539 additions and 124 deletions

View File

@@ -792,6 +792,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
= A->getOption().matches(OPT_enable_testable_attr_requires_testable_module);
}
Opts.SuppressArgumentLabelsInTypes |=
Args.hasArg(OPT_suppress_argument_labels_in_types);
if (const Arg *A = Args.getLastArg(OPT_debug_constraints_attempt)) {
unsigned attempt;
if (StringRef(A->getValue()).getAsInteger(10, attempt)) {