mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Constraint solver] Clean up existential metatype handling.
Our existential metatype conversion/conformance handling in the type checker was tripped up the refactoring to lazily introduce constraints, because it dependended on the otherwise-unused TypeMatchKind::ConformsTo. Eliminate TypeMatchKind::ConformsTo and simplify the code here.
This commit is contained in:
@@ -507,6 +507,12 @@ Constraint *Constraint::create(ConstraintSystem &cs, ConstraintKind kind,
|
||||
second->getTypeVariables(typeVars);
|
||||
uniqueTypeVariables(typeVars);
|
||||
|
||||
// Conformance constraints expect a protocol on the right-hand side, always.
|
||||
assert((kind != ConstraintKind::ConformsTo &&
|
||||
kind != ConstraintKind::LiteralConformsTo &&
|
||||
kind != ConstraintKind::SelfObjectOfProtocol) ||
|
||||
second->is<ProtocolType>());
|
||||
|
||||
// Create the constraint.
|
||||
unsigned size = totalSizeToAlloc<TypeVariableType*>(typeVars.size());
|
||||
void *mem = cs.getAllocator().Allocate(size, alignof(Constraint));
|
||||
|
||||
Reference in New Issue
Block a user