Sema: Remove -experimental-one-way-closure-params

This commit is contained in:
Slava Pestov
2024-12-19 13:13:14 -05:00
parent 0c128e5db7
commit bb55d9c59a
9 changed files with 7 additions and 71 deletions

View File

@@ -2181,7 +2181,6 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2,
case ConstraintKind::ValueWitness:
case ConstraintKind::BridgingConversion:
case ConstraintKind::OneWayEqual:
case ConstraintKind::OneWayBindParam:
case ConstraintKind::FallbackType:
case ConstraintKind::UnresolvedMemberChainBase:
case ConstraintKind::PropertyWrapper:
@@ -2553,7 +2552,6 @@ static bool matchFunctionRepresentations(FunctionType::ExtInfo einfo1,
case ConstraintKind::ValueMember:
case ConstraintKind::ValueWitness:
case ConstraintKind::OneWayEqual:
case ConstraintKind::OneWayBindParam:
case ConstraintKind::FallbackType:
case ConstraintKind::UnresolvedMemberChainBase:
case ConstraintKind::PropertyWrapper:
@@ -3198,7 +3196,6 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
case ConstraintKind::ValueWitness:
case ConstraintKind::BridgingConversion:
case ConstraintKind::OneWayEqual:
case ConstraintKind::OneWayBindParam:
case ConstraintKind::FallbackType:
case ConstraintKind::UnresolvedMemberChainBase:
case ConstraintKind::PropertyWrapper:
@@ -7134,7 +7131,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
case ConstraintKind::ValueMember:
case ConstraintKind::ValueWitness:
case ConstraintKind::OneWayEqual:
case ConstraintKind::OneWayBindParam:
case ConstraintKind::FallbackType:
case ConstraintKind::UnresolvedMemberChainBase:
case ConstraintKind::PropertyWrapper:
@@ -11594,14 +11590,9 @@ ConstraintSystem::simplifyOneWayConstraint(
// Translate this constraint into an equality or bind-parameter constraint,
// as appropriate.
if (kind == ConstraintKind::OneWayEqual) {
return matchTypes(first, secondSimplified, ConstraintKind::Equal, flags,
locator);
}
assert(kind == ConstraintKind::OneWayBindParam);
return matchTypes(
secondSimplified, first, ConstraintKind::BindParam, flags, locator);
ASSERT(kind == ConstraintKind::OneWayEqual);
return matchTypes(first, secondSimplified, ConstraintKind::Equal, flags,
locator);
}
ConstraintSystem::SolutionKind
@@ -11844,12 +11835,6 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
// Determine whether a result builder will be applied.
auto resultBuilderType = getOpenedResultBuilderTypeFor(*this, locator);
// Determine whether to introduce one-way constraints between the parameter's
// type as seen in the body of the closure and the external parameter
// type.
bool oneWayConstraints =
getASTContext().LangOpts.hasFeature(Feature::OneWayClosureParameters);
auto *paramList = closure->getParameters();
SmallVector<AnyFunctionType::Param, 4> parameters;
bool hasIsolatedParam = false;
@@ -11942,19 +11927,6 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
// - `Int...` -> `[Int]`,
// - `inout Int` -> `@lvalue Int`.
internalType = param.getParameterType();
// When there are type variables in the type and we have enabled
// one-way constraints, create a fresh type variable to handle the
// binding.
if (oneWayConstraints && internalType->hasTypeVariable()) {
auto *paramLoc =
getConstraintLocator(closure, LocatorPathElt::TupleElement(i));
auto *typeVar = createTypeVariable(paramLoc, TVO_CanBindToLValue |
TVO_CanBindToNoEscape);
addConstraint(
ConstraintKind::OneWayBindParam, typeVar, internalType, paramLoc);
internalType = typeVar;
}
} else {
auto *paramLoc =
getConstraintLocator(closure, LocatorPathElt::TupleElement(i));
@@ -11986,13 +11958,8 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
addConstraint(ConstraintKind::Bind, externalType, paramTy, paramLoc);
}
if (oneWayConstraints) {
addConstraint(
ConstraintKind::OneWayBindParam, typeVar, externalType, paramLoc);
} else {
addConstraint(
ConstraintKind::BindParam, externalType, typeVar, paramLoc);
}
addConstraint(
ConstraintKind::BindParam, externalType, typeVar, paramLoc);
}
hasIsolatedParam |= param.isIsolated();
@@ -15760,7 +15727,6 @@ ConstraintSystem::addConstraintImpl(ConstraintKind kind, Type first,
return simplifyPropertyWrapperConstraint(first, second, subflags, locator);
case ConstraintKind::OneWayEqual:
case ConstraintKind::OneWayBindParam:
return simplifyOneWayConstraint(kind, first, second, subflags, locator);
case ConstraintKind::UnresolvedMemberChainBase:
@@ -16341,7 +16307,6 @@ ConstraintSystem::simplifyConstraint(const Constraint &constraint) {
return SolutionKind::Unsolved;
case ConstraintKind::OneWayEqual:
case ConstraintKind::OneWayBindParam:
return simplifyOneWayConstraint(
constraint.getKind(), constraint.getFirstType(),
constraint.getSecondType(),