Commit Graph

4 Commits

Author SHA1 Message Date
Becca Royal-Gordon
8bbfaf38e0 Soften new unavailable conformance diagnostics
In apple/swift#41054, we fixed an oversight which caused us to not notice when a user erased a concrete type to an existential using an unavailable conformance. Unfortunately, this is source-breaking and needs to be reduced to a warning in Swift 5 mode unless the user opts in.

Fixes rdar://91940820.
2022-04-21 01:17:52 -07:00
Allan Shortlidge
1f32e83e10 [Sema] Diagnose use of unavailable protocols in type erasing expressions (e.g. let x: P = S where S conforms to P).
Resolves rdar://83731428.
2022-01-28 14:05:12 -08:00
Allan Shortlidge
9346ad87df [Sema] When walking a member reference expression, if the member is provided by a protocol conformance be sure to check the availability of conformance.
Expands conformance availability tests to include test cases covering member references and key paths.

Resolves rdar://87795154.
2022-01-27 20:39:47 -08:00
Slava Pestov
ceb8675ad1 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>.
2020-11-05 17:51:45 -05:00