[transferring] Change transferring to no longer be a ParamSpecifier.

Instead it is a bit on ParamDecl and SILParameterInfo. I preserve the consuming
behavior by making it so that the type checker changes the ParamSpecifier to
ImplicitlyCopyableConsuming if we have a default param specifier and
transferring is set. NOTE: The user can never write ImplicitlyCopyableConsuming.

NOTE: I had to expand the amount of flags that can be stored in ParamDecl so I
stole bits from TypeRepr and added some logic for packing option bits into
TyRepr and DefaultValue.

rdar://121324715
This commit is contained in:
Michael Gottesman
2024-02-08 16:15:28 -08:00
parent 1f0527d47f
commit bf2ec7eb85
30 changed files with 419 additions and 95 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 = 852; // SILFunctionType::ErasedIsolation
const uint16_t SWIFTMODULE_VERSION_MINOR = 853; // transferring fixes
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -359,7 +359,7 @@ enum class ParamDeclSpecifier : uint8_t {
Consuming = 3,
LegacyShared = 4,
LegacyOwned = 5,
Transferring = 6,
ImplicitlyCopyableConsuming = 6,
};
using ParamDeclSpecifierField = BCFixed<3>;
@@ -402,6 +402,7 @@ enum class SILParameterDifferentiability : uint8_t {
enum class SILParameterInfoFlags : uint8_t {
NotDifferentiable = 0x1,
Isolated = 0x2,
Transferring = 0x4,
};
using SILParameterInfoOptions = OptionSet<SILParameterInfoFlags>;
@@ -1605,6 +1606,7 @@ namespace decls_block {
BCFixed<1>, // isAutoClosure?
BCFixed<1>, // isIsolated?
BCFixed<1>, // isCompileTimeConst?
BCFixed<1>, // isTransferring?
DefaultArgumentField, // default argument kind
TypeIDField, // default argument type
ActorIsolationField, // default argument isolation