Commit Graph

2 Commits

Author SHA1 Message Date
Allan Shortlidge
2442737a7d NFC: Fix %target-run-simple-swift invocations in a couple of tests.
The `-unavailable-decl-optimization` flag is a frontend flag and therefore
requires `-Xfrontend` when passed through the driver.
2023-07-31 17:26:34 -07:00
Allan Shortlidge
7996c5b30c Sema: Avoid decoding unavailable enum elements in derived Codable conformances.
The compiler derived implementations of `Codable` conformances for enums did
not take enum element unavailability into account. This could result in
unavailable values being instantiated at runtime, leading to a general
violation of the invariant that unavailable code is unreachable at runtime.
This problem is possible because synthesized code is not type checked; had the
conformances been hand-written, they would have been rejected for referencing
unavailable declarations inside of available declarations.

This change specifically alters derivation for the following declarations:
- `Decodable.init(from:)`
- `Encodable.encode(to:)`
- `CodingKey.init(stringValue:)`

Resolves rdar://110098469
2023-07-26 22:48:25 -07:00