mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Type checker] Eliminate the 'literalConformanceProto' state on type variables.
The 'literalConformanceProto' field of
TypeVariableType::Implementation didn't take into account equivalence
classes of type variables. Eliminate it, and either look at the actual
expressions (for optimizing constraints during constraint generation)
or the actual constraints on a given type variable (for determining
whether to include optionals in the set of potential type variable
bindings).
(cherry picked from commit 6bdd9cfae5)
This commit is contained in:
@@ -2288,6 +2288,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
return SolutionKind::Solved;
|
||||
break;
|
||||
case ConstraintKind::ConformsTo:
|
||||
case ConstraintKind::LiteralConformsTo:
|
||||
// Check whether this type conforms to the protocol.
|
||||
if (TC.conformsToProtocol(type, protocol, DC,
|
||||
ConformanceCheckFlags::InExpression))
|
||||
@@ -3467,6 +3468,7 @@ static TypeMatchKind getTypeMatchKind(ConstraintKind kind) {
|
||||
llvm_unreachable("Overload binding constraints don't involve type matches");
|
||||
|
||||
case ConstraintKind::ConformsTo:
|
||||
case ConstraintKind::LiteralConformsTo:
|
||||
case ConstraintKind::SelfObjectOfProtocol:
|
||||
llvm_unreachable("Conformance constraints don't involve type matches");
|
||||
|
||||
@@ -4126,6 +4128,7 @@ ConstraintSystem::simplifyConstraint(const Constraint &constraint) {
|
||||
return SolutionKind::Solved;
|
||||
|
||||
case ConstraintKind::ConformsTo:
|
||||
case ConstraintKind::LiteralConformsTo:
|
||||
case ConstraintKind::SelfObjectOfProtocol:
|
||||
return simplifyConformsToConstraint(
|
||||
constraint.getFirstType(),
|
||||
|
||||
Reference in New Issue
Block a user