Skip to content

Commit 9b4779f

Browse files
committed
[Sema] typeCheckParameterDefault can now always fail
1 parent c667d2b commit 9b4779f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ Type TypeChecker::typeCheckExpressionImpl(Expr *&expr, DeclContext *dc,
23012301

23022302
Type TypeChecker::typeCheckParameterDefault(Expr *&defaultValue,
23032303
DeclContext *DC, Type paramType,
2304-
bool isAutoClosure, bool canFail) {
2304+
bool isAutoClosure) {
23052305
assert(paramType && !paramType->hasError());
23062306

23072307
if (isAutoClosure) {
@@ -2323,12 +2323,12 @@ Type TypeChecker::typeCheckParameterDefault(Expr *&defaultValue,
23232323
AutoClosureListener listener(fnType);
23242324
return typeCheckExpression(defaultValue, DC,
23252325
TypeLoc::withoutLoc(fnType->getResult()),
2326-
canFail ? CTP_DefaultParameter : CTP_CannotFail,
2327-
TypeCheckExprOptions(), &listener);
2326+
CTP_DefaultParameter, TypeCheckExprOptions(),
2327+
&listener);
23282328
}
23292329

23302330
return typeCheckExpression(defaultValue, DC, TypeLoc::withoutLoc(paramType),
2331-
canFail ? CTP_DefaultParameter : CTP_CannotFail);
2331+
CTP_DefaultParameter);
23322332
}
23332333

23342334
Type TypeChecker::

lib/Sema/TypeChecker.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,7 @@ class TypeChecker final {
712712
static bool typeCheckTapBody(TapExpr *expr, DeclContext *DC);
713713

714714
static Type typeCheckParameterDefault(Expr *&defaultValue, DeclContext *DC,
715-
Type paramType,
716-
bool isAutoClosure = false,
717-
bool canFail = true);
715+
Type paramType, bool isAutoClosure);
718716

719717
static void typeCheckTopLevelCodeDecl(TopLevelCodeDecl *TLCD);
720718

0 commit comments

Comments
 (0)