@@ -2183,7 +2183,6 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2,
21832183 case ConstraintKind::SelfObjectOfProtocol:
21842184 case ConstraintKind::UnresolvedValueMember:
21852185 case ConstraintKind::ValueMember:
2186- case ConstraintKind::ValueWitness:
21872186 case ConstraintKind::BridgingConversion:
21882187 case ConstraintKind::OneWayEqual:
21892188 case ConstraintKind::OneWayBindParam:
@@ -2347,7 +2346,6 @@ static bool matchFunctionRepresentations(FunctionType::ExtInfo einfo1,
23472346 case ConstraintKind::SelfObjectOfProtocol:
23482347 case ConstraintKind::UnresolvedValueMember:
23492348 case ConstraintKind::ValueMember:
2350- case ConstraintKind::ValueWitness:
23512349 case ConstraintKind::OneWayEqual:
23522350 case ConstraintKind::OneWayBindParam:
23532351 case ConstraintKind::DefaultClosureType:
@@ -2794,7 +2792,6 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
27942792 case ConstraintKind::SelfObjectOfProtocol:
27952793 case ConstraintKind::UnresolvedValueMember:
27962794 case ConstraintKind::ValueMember:
2797- case ConstraintKind::ValueWitness:
27982795 case ConstraintKind::BridgingConversion:
27992796 case ConstraintKind::OneWayEqual:
28002797 case ConstraintKind::OneWayBindParam:
@@ -6036,7 +6033,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
60366033 case ConstraintKind::SelfObjectOfProtocol:
60376034 case ConstraintKind::UnresolvedValueMember:
60386035 case ConstraintKind::ValueMember:
6039- case ConstraintKind::ValueWitness:
60406036 case ConstraintKind::OneWayEqual:
60416037 case ConstraintKind::OneWayBindParam:
60426038 case ConstraintKind::DefaultClosureType:
@@ -9139,8 +9135,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
91399135 markMemberTypeAsPotentialHole(memberTy);
91409136 return SolutionKind::Solved;
91419137 }
9142- } else if ((kind == ConstraintKind::ValueMember ||
9143- kind == ConstraintKind::ValueWitness) &&
9138+ } else if (kind == ConstraintKind::ValueMember &&
91449139 baseObjTy->getMetatypeInstanceType()->isPlaceholder()) {
91459140 // If base type is a "hole" there is no reason to record any
91469141 // more "member not found" fixes for chained member references.
@@ -9562,67 +9557,6 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
95629557 return SolutionKind::Error;
95639558}
95649559
9565- ConstraintSystem::SolutionKind
9566- ConstraintSystem::simplifyValueWitnessConstraint(
9567- ConstraintKind kind, Type baseType, ValueDecl *requirement, Type memberType,
9568- DeclContext *useDC, FunctionRefKind functionRefKind,
9569- TypeMatchOptions flags, ConstraintLocatorBuilder locator) {
9570- // We'd need to record original base type because it might be a type
9571- // variable representing another missing member.
9572- auto origBaseType = baseType;
9573-
9574- auto formUnsolved = [&] {
9575- // If requested, generate a constraint.
9576- if (flags.contains(TMF_GenerateConstraints)) {
9577- auto *witnessConstraint = Constraint::createValueWitness(
9578- *this, kind, origBaseType, memberType, requirement, useDC,
9579- functionRefKind, getConstraintLocator(locator));
9580-
9581- addUnsolvedConstraint(witnessConstraint);
9582- return SolutionKind::Solved;
9583- }
9584-
9585- return SolutionKind::Unsolved;
9586- };
9587-
9588- // Resolve the base type, if we can. If we can't resolve the base type,
9589- // then we can't solve this constraint.
9590- Type baseObjectType = getFixedTypeRecursive(
9591- baseType, flags, /*wantRValue=*/true);
9592- if (baseObjectType->isTypeVariableOrMember()) {
9593- return formUnsolved();
9594- }
9595-
9596- // Check conformance to the protocol. If it doesn't conform, this constraint
9597- // fails. Don't attempt to fix it.
9598- // FIXME: Look in the constraint system to see if we've resolved the
9599- // conformance already?
9600- auto proto = requirement->getDeclContext()->getSelfProtocolDecl();
9601- assert(proto && "Value witness constraint for a non-requirement");
9602- auto conformance = useDC->getParentModule()->lookupConformance(
9603- baseObjectType, proto);
9604- if (!conformance) {
9605- // The conformance failed, so mark the member type as a "hole". We cannot
9606- // do anything further here.
9607- if (!shouldAttemptFixes())
9608- return SolutionKind::Error;
9609-
9610- recordAnyTypeVarAsPotentialHole(memberType);
9611-
9612- return SolutionKind::Solved;
9613- }
9614-
9615- // Reference the requirement.
9616- Type resolvedBaseType = simplifyType(baseType, flags);
9617- if (resolvedBaseType->isTypeVariableOrMember())
9618- return formUnsolved();
9619-
9620- auto choice = OverloadChoice(resolvedBaseType, requirement, functionRefKind);
9621- resolveOverload(getConstraintLocator(locator), memberType, choice,
9622- useDC);
9623- return SolutionKind::Solved;
9624- }
9625-
96269560ConstraintSystem::SolutionKind ConstraintSystem::simplifyDefaultableConstraint(
96279561 Type first, Type second, TypeMatchOptions flags,
96289562 ConstraintLocatorBuilder locator) {
@@ -13278,7 +13212,6 @@ ConstraintSystem::addConstraintImpl(ConstraintKind kind, Type first,
1327813212
1327913213 case ConstraintKind::ValueMember:
1328013214 case ConstraintKind::UnresolvedValueMember:
13281- case ConstraintKind::ValueWitness:
1328213215 case ConstraintKind::BindOverload:
1328313216 case ConstraintKind::Disjunction:
1328413217 case ConstraintKind::Conjunction:
@@ -13769,16 +13702,6 @@ ConstraintSystem::simplifyConstraint(const Constraint &constraint) {
1376913702 /*outerAlternatives=*/{},
1377013703 /*flags*/ None, constraint.getLocator());
1377113704
13772- case ConstraintKind::ValueWitness:
13773- return simplifyValueWitnessConstraint(constraint.getKind(),
13774- constraint.getFirstType(),
13775- constraint.getRequirement(),
13776- constraint.getSecondType(),
13777- constraint.getMemberUseDC(),
13778- constraint.getFunctionRefKind(),
13779- /*flags*/ None,
13780- constraint.getLocator());
13781-
1378213705 case ConstraintKind::Defaultable:
1378313706 return simplifyDefaultableConstraint(constraint.getFirstType(),
1378413707 constraint.getSecondType(),
0 commit comments