[Serialization] Fix deserializing opaque types for computed properties and subscripts

A client shouldn't know about the underlying type of an opaque type
unless it can see the body of the naming decl. Attempting to read it can
lead to accessing a hidden dependency and a compiler crash.

This was protected by a check specific to function decls but var decls
and subscripts were not handled. To support them we have to move this
logic to the writer side where we have access to the full
AbstractStorageDecl and write in the swifmodule whether the underlying
type should be visible outside of the module.

rdar://117607906
This commit is contained in:
Alexis Laferrière
2023-10-30 14:44:20 -07:00
parent d976ea676c
commit f2d1627656
7 changed files with 237 additions and 8 deletions

View File

@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 816; // throw_addr
const uint16_t SWIFTMODULE_VERSION_MINOR = 817; // Opaque type export details
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -1641,7 +1641,8 @@ namespace decls_block {
TypeIDField, // interface type for opaque type
GenericSignatureIDField, // generic environment
SubstitutionMapIDField, // optional substitution map for underlying type
AccessLevelField // access level
AccessLevelField, // access level
BCFixed<1> // export underlying type details
// trailed by generic parameters
// trailed by conditional substitutions
>;