Skip to content

Commit 37c42f6

Browse files
committed
[Sema] NFC: Remove an unnecessary parameter
1 parent 022c6ac commit 37c42f6

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,10 +2533,6 @@ namespace {
25332533
/// forced downcasts.
25342534
SmallVector<InjectIntoOptionalExpr *, 4> SuspiciousOptionalInjections;
25352535

2536-
public:
2537-
/// A list of optional injections that have been diagnosed.
2538-
llvm::SmallPtrSet<InjectIntoOptionalExpr *, 4> DiagnosedOptionalInjections;
2539-
private:
25402536
/// Create a member reference to the given constructor.
25412537
Expr *applyCtorRefExpr(Expr *expr, Expr *base, SourceLoc dotLoc,
25422538
DeclNameLoc nameLoc, bool implicit,
@@ -4682,11 +4678,6 @@ namespace {
46824678

46834679
// Look at all of the suspicious optional injections
46844680
for (auto injection : SuspiciousOptionalInjections) {
4685-
// If we already diagnosed this injection, we're done.
4686-
if (DiagnosedOptionalInjections.count(injection)) {
4687-
continue;
4688-
}
4689-
46904681
auto *cast = findForcedDowncast(tc.Context, injection->getSubExpr());
46914682
if (!cast)
46924683
continue;
@@ -7728,23 +7719,13 @@ Expr *ConstraintSystem::applySolution(Solution &solution, Expr *expr,
77287719

77297720
Expr *Solution::coerceToType(Expr *expr, Type toType,
77307721
ConstraintLocator *locator,
7731-
bool ignoreTopLevelInjection,
77327722
Optional<Pattern*> typeFromPattern) const {
77337723
auto &cs = getConstraintSystem();
77347724
ExprRewriter rewriter(cs, *this, /*suppressDiagnostics=*/false);
77357725
Expr *result = rewriter.coerceToType(expr, toType, locator, typeFromPattern);
77367726
if (!result)
77377727
return nullptr;
77387728

7739-
// If we were asked to ignore top-level optional injections, mark
7740-
// the top-level injection (if any) as "diagnosed".
7741-
if (ignoreTopLevelInjection) {
7742-
if (auto injection = dyn_cast<InjectIntoOptionalExpr>(
7743-
result->getSemanticsProvidingExpr())) {
7744-
rewriter.DiagnosedOptionalInjections.insert(injection);
7745-
}
7746-
}
7747-
77487729
rewriter.finalize(result);
77497730
return result;
77507731
}

lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,12 @@ class Solution {
681681
/// \param toType The type to coerce the expression to.
682682
/// \param locator Locator used to describe the location of this expression.
683683
///
684-
/// \param ignoreTopLevelInjection Whether to suppress diagnostics
685-
/// on a suspicious top-level optional injection (because the caller already
686-
/// diagnosed it).
687-
///
688684
/// \param typeFromPattern Optionally, the caller can specify the pattern
689685
/// from where the toType is derived, so that we can deliver better fixit.
690686
///
691687
/// \returns the coerced expression, which will have type \c ToType.
692688
Expr *coerceToType(Expr *expr, Type toType,
693689
ConstraintLocator *locator,
694-
bool ignoreTopLevelInjection = false,
695690
Optional<Pattern*> typeFromPattern = None) const;
696691

697692
/// Compute the set of substitutions for a generic signature opened at the

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,8 +2672,7 @@ bool TypeChecker::typeCheckBinding(Pattern *&pattern, Expr *&initializer,
26722672

26732673
Expr *appliedSolution(Solution &solution, Expr *expr) override {
26742674
// Convert the initializer to the type of the pattern.
2675-
expr = solution.coerceToType(expr, initType, Locator,
2676-
false /* ignoreTopLevelInjection */);
2675+
expr = solution.coerceToType(expr, initType, Locator);
26772676
if (!expr)
26782677
return nullptr;
26792678

@@ -3451,7 +3450,6 @@ bool TypeChecker::convertToType(Expr *&expr, Type type, DeclContext *dc,
34513450
// Perform the conversion.
34523451
Expr *result = solution.coerceToType(expr, type,
34533452
cs.getConstraintLocator(expr),
3454-
/*ignoreTopLevelInjection*/false,
34553453
typeFromPattern);
34563454
if (!result) {
34573455
return true;

0 commit comments

Comments
 (0)