Build value representations for all kinds of witness (#2250)

Instead of forming a `SymbolicWitness` that contains an `Expression` when we can't directly resolve a witness to an `impl`, form different kinds of `Witness` values for the various situations:

- A `BindingWitness` witnesses that a type implements a constraint by reference to an `ImplBinding`.
- A `ConstraintWitness` witnesses that a type implements a constraint by reference to witnesses for each of the impl constraints within the constraint.
- A `ConstraintImplWitness` witnesses that a type implements a constraint by reference to a larger constraint which contains that constraint as an impl constraint.

Remove `SymbolicWitness` values and `InstantiateImpl` expressions, which are now unused. In order to remove the final usage of `SymbolicWitness`, I fixed a TODO to give `Self` the proper type within an interface declaration. I don't think this is an observable change.

No functional change intended.
This commit is contained in:
Richard Smith
2022-10-04 12:14:52 -07:00
committed by GitHub
parent 8e8e8ced60
commit 2340cb6703
13 changed files with 260 additions and 188 deletions
-7
View File
@@ -257,12 +257,6 @@ void Expression::Print(llvm::raw_ostream& out) const {
}
break;
}
case ExpressionKind::InstantiateImpl: {
// TODO: For layering reasons, we can't print out the witness and
// argument values from here.
out << "instantiate impl";
break;
}
case ExpressionKind::UnimplementedExpression: {
const auto& unimplemented = cast<UnimplementedExpression>(*this);
out << "UnimplementedExpression<" << unimplemented.label() << ">(";
@@ -347,7 +341,6 @@ void Expression::PrintID(llvm::raw_ostream& out) const {
case ExpressionKind::UnimplementedExpression:
case ExpressionKind::FunctionTypeLiteral:
case ExpressionKind::ArrayTypeLiteral:
case ExpressionKind::InstantiateImpl:
out << "...";
break;
}