Skip to content

Commit 24b9ec7

Browse files
authored
[Sema] Remove a leftover CSDiag hack (swiftlang#32990)
1 parent 35255ad commit 24b9ec7

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2578,7 +2578,6 @@ class ConstraintSystem {
25782578
Type builderType);
25792579
friend Optional<SolutionApplicationTarget>
25802580
swift::TypeChecker::typeCheckExpression(SolutionApplicationTarget &target,
2581-
bool &unresolvedTypeExprs,
25822581
TypeCheckExprOptions options);
25832582

25842583
/// Emit the fixes computed as part of the solution, returning true if we were

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,31 +2003,20 @@ Type TypeChecker::typeCheckExpression(Expr *&expr, DeclContext *dc,
20032003
SolutionApplicationTarget target(
20042004
expr, dc, convertTypePurpose, convertType,
20052005
options.contains(TypeCheckExprFlags::IsDiscarded));
2006-
bool unresolvedTypeExprs = false;
2007-
auto resultTarget = typeCheckExpression(
2008-
target, unresolvedTypeExprs, options);
2006+
auto resultTarget = typeCheckExpression(target, options);
20092007
if (!resultTarget) {
20102008
expr = target.getAsExpr();
20112009
return Type();
20122010
}
20132011

20142012
expr = resultTarget->getAsExpr();
2015-
2016-
// HACK for clients that want unresolved types.
2017-
if (unresolvedTypeExprs) {
2018-
return ErrorType::get(dc->getASTContext());
2019-
}
2020-
2021-
20222013
return expr->getType();
20232014
}
20242015

20252016
Optional<SolutionApplicationTarget>
20262017
TypeChecker::typeCheckExpression(
20272018
SolutionApplicationTarget &target,
2028-
bool &unresolvedTypeExprs,
20292019
TypeCheckExprOptions options) {
2030-
unresolvedTypeExprs = false;
20312020
Expr *expr = target.getAsExpr();
20322021
DeclContext *dc = target.getDeclContext();
20332022
auto &Context = dc->getASTContext();
@@ -2081,14 +2070,12 @@ TypeChecker::typeCheckExpression(
20812070
}
20822071

20832072
// If the client allows the solution to have unresolved type expressions,
2084-
// check for them now. We cannot apply the solution with unresolved TypeVars,
2073+
// check for them now. We cannot apply the solution with unresolved TypeVars,
20852074
// because they will leak out into arbitrary places in the resultant AST.
20862075
if (options.contains(TypeCheckExprFlags::AllowUnresolvedTypeVariables) &&
20872076
(viable->size() != 1 ||
20882077
(target.getExprConversionType() &&
20892078
target.getExprConversionType()->hasUnresolvedType()))) {
2090-
// FIXME: This hack should only be needed for CSDiag.
2091-
unresolvedTypeExprs = true;
20922079
return target;
20932080
}
20942081

@@ -2137,8 +2124,7 @@ bool TypeChecker::typeCheckBinding(
21372124
/*bindPatternVarsOneWay=*/false);
21382125

21392126
// Type-check the initializer.
2140-
bool unresolvedTypeExprs = false;
2141-
auto resultTarget = typeCheckExpression(target, unresolvedTypeExprs);
2127+
auto resultTarget = typeCheckExpression(target);
21422128

21432129
if (resultTarget) {
21442130
initializer = resultTarget->getAsExpr();
@@ -2267,8 +2253,7 @@ bool TypeChecker::typeCheckForEachBinding(DeclContext *dc, ForEachStmt *stmt) {
22672253

22682254
auto target = SolutionApplicationTarget::forForEachStmt(
22692255
stmt, sequenceProto, dc, /*bindPatternVarsOneWay=*/false);
2270-
bool unresolvedTypeExprs = false;
2271-
return !typeCheckExpression(target, unresolvedTypeExprs);
2256+
return !typeCheckExpression(target);
22722257
}
22732258

22742259
bool TypeChecker::typeCheckCondition(Expr *&expr, DeclContext *dc) {

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ Type typeCheckExpression(Expr *&expr, DeclContext *dc,
678678

679679
Optional<constraints::SolutionApplicationTarget>
680680
typeCheckExpression(constraints::SolutionApplicationTarget &target,
681-
bool &unresolvedTypeExprs,
682681
TypeCheckExprOptions options = TypeCheckExprOptions());
683682

684683
/// Return the type of operator function for specified LHS, or a null

0 commit comments

Comments
 (0)