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
10 changes: 5 additions & 5 deletions lib/Sema/ConstraintSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ Optional<std::pair<unsigned, Expr *>> ConstraintSystem::getExprDepthAndParent(
return None;
}

Type ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound,
ConstraintLocatorBuilder locator,
OpenedTypeMap &replacements) {
Type
ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound,
ConstraintLocatorBuilder locator) {
auto unboundDecl = unbound->getDecl();
auto parentTy = unbound->getParent();
if (parentTy) {
Expand All @@ -667,6 +667,7 @@ Type ConstraintSystem::openUnboundGenericType(UnboundGenericType *unbound,
}

// Open up the generic type.
OpenedTypeMap replacements;
openGeneric(unboundDecl->getDeclContext(), unboundDecl->getGenericSignature(),
locator, replacements);

Expand Down Expand Up @@ -790,8 +791,7 @@ Type ConstraintSystem::openUnboundGenericType(

type = type.transform([&](Type type) -> Type {
if (auto unbound = type->getAs<UnboundGenericType>()) {
OpenedTypeMap replacements;
return openUnboundGenericType(unbound, locator, replacements);
return openUnboundGenericType(unbound, locator);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is NFC?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the use it seems to be, replacements are local to a particular type...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is NFC?

It has to be — there is no recursion.

}

return type;
Expand Down
3 changes: 1 addition & 2 deletions lib/Sema/ConstraintSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3411,8 +3411,7 @@ class ConstraintSystem {
///
/// \returns The opened type.
Type openUnboundGenericType(UnboundGenericType *unbound,
ConstraintLocatorBuilder locator,
OpenedTypeMap &replacements);
ConstraintLocatorBuilder locator);

/// "Open" the given type by replacing any occurrences of unbound
/// generic types with bound generic types with fresh type variables as
Expand Down