Skip to content

Commit

Permalink
Remove unused PolymorphicFunctionType::substGenericArgs.
Browse files Browse the repository at this point in the history
NFC.
  • Loading branch information
jckarter committed Feb 4, 2016
1 parent 77b7180 commit 54903d2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
10 changes: 0 additions & 10 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2350,16 +2350,6 @@ class PolymorphicFunctionType : public AnyFunctionType {

GenericParamList &getGenericParams() const { return *Params; }

/// Substitute the given generic arguments into this polymorphic
/// function type and return the resulting non-polymorphic type.
FunctionType *substGenericArgs(ModuleDecl *M, ArrayRef<Type> args);

/// Substitute the given generic arguments into this polymorphic
/// function type and return the resulting non-polymorphic type.
///
/// The order of Substitutions must match the order of generic archetypes.
FunctionType *substGenericArgs(ModuleDecl *M, ArrayRef<Substitution> subs);

// Implement isa/cast/dyncast/etc.
static bool classof(const TypeBase *T) {
return T->getKind() == TypeKind::PolymorphicFunction;
Expand Down
26 changes: 0 additions & 26 deletions lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2109,22 +2109,6 @@ PolymorphicFunctionType::getGenericParameters() const {
return Params->getParams();
}

FunctionType *PolymorphicFunctionType::substGenericArgs(Module *module,
ArrayRef<Type> args) {
TypeSubstitutionMap map;
for (auto &param : getGenericParams().getNestedGenericParams()) {
map.insert(std::make_pair(param->getArchetype(), args.front()));
args = args.slice(1);
}

assert(args.empty()
&& "number of args did not match number of generic params");

Type input = getInput().subst(module, map, SubstFlags::IgnoreMissing);
Type result = getResult().subst(module, map, SubstFlags::IgnoreMissing);
return FunctionType::get(input, result, getExtInfo());
}

TypeSubstitutionMap
GenericParamList::getSubstitutionMap(ArrayRef<swift::Substitution> Subs) const {
TypeSubstitutionMap map;
Expand All @@ -2140,16 +2124,6 @@ GenericParamList::getSubstitutionMap(ArrayRef<swift::Substitution> Subs) const {
return map;
}

FunctionType *PolymorphicFunctionType::substGenericArgs(Module *module,
ArrayRef<Substitution> subs) {
TypeSubstitutionMap map
= getGenericParams().getSubstitutionMap(subs);

Type input = getInput().subst(module, map, SubstFlags::IgnoreMissing);
Type result = getResult().subst(module, map, SubstFlags::IgnoreMissing);
return FunctionType::get(input, result, getExtInfo());
}

FunctionType *
GenericFunctionType::substGenericArgs(Module *M, ArrayRef<Type> args) const {
auto params = getGenericParams();
Expand Down

0 comments on commit 54903d2

Please sign in to comment.