Sema: Update resolveType() for subclass existentials

If the -enable-experimental-subclass-existentials staging flag
is on, resolveType() now allows protocol compositions to contain
class types. It also diagnoses if a composition has more than one
superclass requirement.

Also, change diagnostics that talked about 'protocol composition'
to 'protocol-constrained type'.

Since such types can now contain a superclass constraint, it's not
correct to call them protocol composition.

"Protocol-constrained type" isn't quite accurate either because
'Any' has no protocols, and 'AnyObject' will have no protocols but
a general class constraint; but those are edge cases which won't
come up in these diagnostics.
This commit is contained in:
Slava Pestov
2017-04-06 15:50:56 -07:00
parent 1b2252f367
commit de323b5bef
15 changed files with 369 additions and 38 deletions

View File

@@ -871,6 +871,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableExperimentalPropertyBehaviors |=
Args.hasArg(OPT_enable_experimental_property_behaviors);
Opts.EnableExperimentalSubclassExistentials |=
Args.hasArg(OPT_enable_experimental_subclass_existentials);
Opts.EnableClassResilience |=
Args.hasArg(OPT_enable_class_resilience);