Implement consuming and borrowing declaration-level modifiers from SE-0377.

`borrowing func`/`consuming func` control the ownership convention of `self` for
methods.
This commit is contained in:
Joe Groff
2023-02-28 21:17:08 -08:00
parent 71b0ea6351
commit 17c803724f
20 changed files with 205 additions and 35 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 = 746; // `consuming` and `borrowing` parameter modifiers
const uint16_t SWIFTMODULE_VERSION_MINOR = 747; // `consuming` and `borrowing` decl modifiers
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -405,9 +405,11 @@ using MetatypeRepresentationField = BCFixed<2>;
enum class SelfAccessKind : uint8_t {
NonMutating = 0,
Mutating,
LegacyConsuming,
Consuming,
Borrowing
};
using SelfAccessKindField = BCFixed<2>;
using SelfAccessKindField = BCFixed<3>;
/// Translates an operator decl fixity to a Serialization fixity, whose values
/// are guaranteed to be stable.