Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1350,10 +1350,6 @@ class alignas(1 << TypeAlignInBits) TypeBase
/// Hack to deal with ConstructorDecl interface types.
Type withCovariantResultType();

/// Deprecated in favor of the above.
Type replaceCovariantResultType(Type newResultType,
unsigned uncurryLevel);

/// Returns a new function type exactly like this one but with the self
/// parameter replaced. Only makes sense for function members of types.
Type replaceSelfParameterType(Type newSelf);
Expand Down
31 changes: 0 additions & 31 deletions lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1393,37 +1393,6 @@ Type TypeBase::withCovariantResultType() {
fnType->getExtInfo());
}

Type TypeBase::replaceCovariantResultType(Type newResultType,
unsigned uncurryLevel) {
if (uncurryLevel == 0) {
bool isLValue = is<LValueType>();

auto loadedTy = getWithoutSpecifierType();
if (auto objectType = loadedTy->getOptionalObjectType()) {
newResultType = OptionalType::get(
objectType->replaceCovariantResultType(newResultType, uncurryLevel));
}

return isLValue ? LValueType::get(newResultType) : newResultType;
}

// Determine the input and result types of this function.
auto fnType = this->castTo<AnyFunctionType>();
auto inputType = fnType->getParams();
Type resultType =
fnType->getResult()->replaceCovariantResultType(newResultType,
uncurryLevel - 1);

// Produce the resulting function type.
if (auto genericFn = dyn_cast<GenericFunctionType>(fnType)) {
return GenericFunctionType::get(genericFn->getGenericSignature(),
inputType, resultType,
fnType->getExtInfo());
}

return FunctionType::get(inputType, resultType, fnType->getExtInfo());
}

/// Whether this parameter accepts an unlabeled trailing closure argument
/// using the more-restrictive forward-scan rule.
static bool allowsUnlabeledTrailingClosureParameter(const ParamDecl *param) {
Expand Down
Loading