Sema: Special-case recording of Bind constraint in PreparedOverload

This commit is contained in:
Slava Pestov
2025-07-11 17:13:28 -04:00
parent 6e212de774
commit b39d3aee57
3 changed files with 28 additions and 0 deletions

View File

@@ -71,6 +71,9 @@ struct PreparedOverloadChange {
/// A generic requirement was opened to a constraint.
AddedConstraint,
/// Special case of a Bind constraint.
AddedBindConstraint,
/// A mapping of generic parameter types to type variables
/// was recorded.
OpenedTypes,
@@ -98,6 +101,11 @@ struct PreparedOverloadChange {
/// For ChangeKind::AddedConstraint.
Constraint *TheConstraint;
struct {
TypeBase *FirstType;
TypeBase * SecondType;
} Bind;
/// For ChangeKind::OpenedTypes.
struct {
const OpenedType *Data;
@@ -192,6 +200,14 @@ struct PreparedOverloadBuilder {
Changes.push_back(change);
}
void addedBindConstraint(Type firstType, Type secondType) {
PreparedOverload::Change change;
change.Kind = PreparedOverload::Change::AddedBindConstraint;
change.Bind.FirstType = firstType.getPointer();
change.Bind.SecondType = secondType.getPointer();
Changes.push_back(change);
}
void openedTypes(ArrayRef<OpenedType> replacements) {
PreparedOverload::Change change;
change.Kind = PreparedOverload::Change::OpenedTypes;