Skip to content

Commit 9fb064a

Browse files
committed
[CS] Remove resolveInterfaceType
Use `simplifyType` instead with the new parameter for getting an interface type. Also avoid using `resolveInterfaceType` in CSApply since we don't need the opened generic parameter mapping behavior.
1 parent 9fe4abc commit 9fb064a

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,10 +1793,6 @@ class Solution {
17931793
/// "resolved" concrete type.
17941794
Type getResolvedType(ASTNode node) const;
17951795

1796-
/// Resolve type variables present in the raw type, using generic parameter
1797-
/// types where possible.
1798-
Type resolveInterfaceType(Type type) const;
1799-
18001796
Type getContextualType(ASTNode anchor) const {
18011797
for (const auto &entry : contextualTypes) {
18021798
if (entry.first == anchor) {

lib/Sema/CSSyntacticElement.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,8 +1989,7 @@ class SyntacticElementSolutionApplication
19891989
for (auto *expected : caseStmt->getCaseBodyVariablesOrEmptyArray()) {
19901990
assert(expected->hasName());
19911991
auto prev = expected->getParentVarDecl();
1992-
auto type = solution.resolveInterfaceType(
1993-
solution.getType(prev)->mapTypeOutOfContext());
1992+
auto type = solution.getResolvedType(prev)->mapTypeOutOfContext();
19941993
expected->setInterfaceType(type);
19951994
}
19961995
}

lib/Sema/ConstraintSystem.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4022,10 +4022,6 @@ ASTNode ConstraintSystem::includingParentApply(ASTNode node) {
40224022
return node;
40234023
}
40244024

4025-
Type Solution::resolveInterfaceType(Type type) const {
4026-
return simplifyType(type, /*wantInterfaceType*/ true);
4027-
}
4028-
40294025
std::optional<FunctionArgApplyInfo>
40304026
Solution::getFunctionArgApplyInfo(ConstraintLocator *locator) const {
40314027
// It's only valid to use `&` in argument positions, but we need
@@ -4118,13 +4114,12 @@ Solution::getFunctionArgApplyInfo(ConstraintLocator *locator) const {
41184114
auto *callee = choice ? choice->getDeclOrNull() : nullptr;
41194115
if (callee && callee->hasInterfaceType()) {
41204116
// If we have a callee with an interface type, we can use it. This is
4121-
// preferable to resolveInterfaceType, as this will allow us to get a
4122-
// GenericFunctionType for generic decls.
4117+
// preferable to simplifyType for the function, as this will allow us to get
4118+
// a GenericFunctionType for generic decls.
41234119
//
41244120
// Note that it's possible to find a callee without an interface type. This
41254121
// can happen for example with closure parameters, where the interface type
4126-
// isn't set until the solution is applied. In that case, use
4127-
// resolveInterfaceType.
4122+
// isn't set until the solution is applied. In that case, use simplifyType.
41284123
fnInterfaceType = callee->getInterfaceType();
41294124

41304125
// Strip off the curried self parameter if necessary.
@@ -4145,7 +4140,7 @@ Solution::getFunctionArgApplyInfo(ConstraintLocator *locator) const {
41454140
}
41464141
#endif
41474142
} else {
4148-
fnInterfaceType = resolveInterfaceType(rawFnType);
4143+
fnInterfaceType = simplifyType(rawFnType, /*wantInterfaceType*/ true);
41494144
}
41504145

41514146
auto argIdx = applyArgElt->getArgIdx();

0 commit comments

Comments
 (0)