mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: (Mostly) check conformance availability
If a conformance is defined in an extension, we now look for references to the conformance in types and expressions and respect's the extension's availability (or deprecation, etc). The conformance checker itself still needs to check conformance availability of associated conformances and the like; that will be a separate change. Note that conformances defined on types don't require any special handling, since they are as available as the intersection of the conforming type and the protocol. By default, we diagnose conformance availability violations where the OS version is not sufficiently new as warnings, to avoid breaking source compatibility. Stricter behavior where these violations are diagnosed as errors is enabled by passing the -enable-conformance-availability-errors flag. There are test cases that run both with and without this flag. In the future, we hope to make the stricter behavior the default, since after all, violations here can result in link errors and runtime crashes. Uses of completely unavailable conformances are still always diagnosed as errors, even when this flag is not passed in. Progress on <rdar://problem/35158274>.
This commit is contained in:
@@ -391,6 +391,12 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
Opts.DisableAvailabilityChecking |=
|
||||
Args.hasArg(OPT_disable_availability_checking);
|
||||
|
||||
if (auto A = Args.getLastArg(OPT_enable_conformance_availability_errors,
|
||||
OPT_disable_conformance_availability_errors)) {
|
||||
Opts.EnableConformanceAvailabilityErrors
|
||||
= A->getOption().matches(OPT_enable_conformance_availability_errors);
|
||||
}
|
||||
|
||||
if (auto A = Args.getLastArg(OPT_enable_access_control,
|
||||
OPT_disable_access_control)) {
|
||||
Opts.EnableAccessControl
|
||||
|
||||
Reference in New Issue
Block a user