mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] NFC: Remove ArgumentInfoCollector which was part of designated operator work
This commit is contained in:
@@ -4905,61 +4905,6 @@ public:
|
||||
return getExpressionTooComplex(solutionMemory);
|
||||
}
|
||||
|
||||
// Utility class that can collect information about the type of an
|
||||
// argument in an apply.
|
||||
//
|
||||
// For example, when given a type variable type that represents the
|
||||
// argument of a function call, it will walk the constraint graph
|
||||
// finding any concrete types that are reachable through various
|
||||
// subtype constraints and will also collect all the literal types
|
||||
// conformed to by the types it finds on the walk.
|
||||
//
|
||||
// This makes it possible to get an idea of the kinds of literals
|
||||
// and types of arguments that are used in the subexpression rooted
|
||||
// in this argument, which we can then use to make better choices
|
||||
// for how we partition the operators in a disjunction (in order to
|
||||
// avoid visiting all the options).
|
||||
class ArgumentInfoCollector {
|
||||
ConstraintSystem &CS;
|
||||
llvm::SetVector<Type> Types;
|
||||
llvm::SetVector<ProtocolDecl *> LiteralProtocols;
|
||||
|
||||
void addType(Type ty) {
|
||||
assert(!ty->is<TypeVariableType>());
|
||||
Types.insert(ty);
|
||||
}
|
||||
|
||||
void addLiteralProtocol(ProtocolDecl *proto) {
|
||||
LiteralProtocols.insert(proto);
|
||||
}
|
||||
|
||||
void walk(Type argType);
|
||||
void minimizeLiteralProtocols();
|
||||
|
||||
public:
|
||||
ArgumentInfoCollector(ConstraintSystem &cs, FunctionType *fnTy) : CS(cs) {
|
||||
for (auto ¶m : fnTy->getParams())
|
||||
walk(param.getPlainType());
|
||||
|
||||
minimizeLiteralProtocols();
|
||||
}
|
||||
|
||||
ArgumentInfoCollector(ConstraintSystem &cs, AnyFunctionType::Param param)
|
||||
: CS(cs) {
|
||||
walk(param.getPlainType());
|
||||
minimizeLiteralProtocols();
|
||||
}
|
||||
|
||||
const llvm::SetVector<Type> &getTypes() const { return Types; }
|
||||
const llvm::SetVector<ProtocolDecl *> &getLiteralProtocols() const {
|
||||
return LiteralProtocols;
|
||||
}
|
||||
|
||||
SWIFT_DEBUG_DUMP;
|
||||
};
|
||||
|
||||
bool haveTypeInformationForAllArguments(FunctionType *fnType);
|
||||
|
||||
typedef std::function<bool(unsigned index, Constraint *)> ConstraintMatcher;
|
||||
typedef std::function<void(ArrayRef<Constraint *>, ConstraintMatcher)>
|
||||
ConstraintMatchLoop;
|
||||
|
||||
Reference in New Issue
Block a user