Add support for multiple designated types for an operator declaration.

Add parsing, type checking, serialization, and deserialization support
for specifying multiple types as "designated" for operator lookup for
a given operator declaration.

The constraint solver still considers only the first type when
deciding the order to attempt the elements of a disjunction, so this
doesn't really change behavior yet.
This commit is contained in:
Mark Lacey
2018-10-09 11:31:36 -07:00
parent e2529703ab
commit 703341239b
11 changed files with 207 additions and 137 deletions

View File

@@ -55,7 +55,7 @@ const uint16_t 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 VERSION_MINOR = 452; // Last change: nominal types for operators
const uint16_t VERSION_MINOR = 453; // Last change: multiple nominal types for operators
using DeclIDField = BCFixed<31>;
@@ -1099,7 +1099,7 @@ namespace decls_block {
Code, // ID field
IdentifierIDField, // name
DeclContextIDField, // context decl
DeclIDField // protocol
BCArray<DeclIDField> // designated types
>;
using PrefixOperatorLayout = UnaryOperatorLayout<PREFIX_OPERATOR_DECL>;
@@ -1110,7 +1110,7 @@ namespace decls_block {
IdentifierIDField, // name
DeclContextIDField,// context decl
DeclIDField, // precedence group
DeclIDField // protocol
BCArray<DeclIDField> // designated types
>;
using PrecedenceGroupLayout = BCRecordLayout<