Commit Graph

6 Commits

Author SHA1 Message Date
Holly Borla
6e8a581b42 [LangOptions] Remove the option to enable/disable implicit existential
opening.
2022-06-27 18:03:20 -07:00
Doug Gregor
0927c9f2fa Restrict implicit opening of existentials based on the generic function's requirements
Rather than looking solely at the existential argument of a generic
function to determine whether it self-conforms, compare the
existential argument against each of the protocols to which the
corresponding generic parameter conforms. This better models when the
existential value itself will successfully meet the requirements of
the generic function, and therefore not require opening.

This provides far better source compatibility by not changing
semantics of existing, well-formed calls, and eliminates the need to
special-case CoW-related operations in the standard library.
2022-03-29 11:59:29 -07:00
Doug Gregor
0ca06295bc Suppress opened existentials for self-conforming existential metatype arguments 2022-03-28 18:48:17 -07:00
Doug Gregor
945790a6f5 as! and as? also indicate suppression of implicit existential opening 2022-03-28 13:33:29 -07:00
Doug Gregor
25e71a3a3b Don't open an existential argument that's completely self-conforming.
Such existential arguments will already meet the requirements of a
generic function they are passed to, but would change runtime
semantics. Therefore, don't open the existential in such cases.
2022-03-24 13:08:00 -07:00
Doug Gregor
02a13f3507 Allow explicit "as <existential-type>" to disable implicit opening of existentials 2022-03-08 10:31:35 -08:00