Skip to content

Commit a7fb2d3

Browse files
committed
VarDecl::getType always returns a type
1 parent 2a75179 commit a7fb2d3

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,10 @@ static void diagnoseFunctionParamNotRepresentable(
225225
AFD->diagnose(diag::objc_invalid_on_func_param_type,
226226
ParamIndex + 1, getObjCDiagnosticAttrKind(Reason));
227227
}
228-
if (Type ParamTy = P->getType()) {
229-
SourceRange SR;
230-
if (auto typeRepr = P->getTypeRepr())
231-
SR = typeRepr->getSourceRange();
232-
diagnoseTypeNotRepresentableInObjC(AFD, ParamTy, SR);
233-
}
228+
SourceRange SR;
229+
if (auto typeRepr = P->getTypeRepr())
230+
SR = typeRepr->getSourceRange();
231+
diagnoseTypeNotRepresentableInObjC(AFD, P->getType(), SR);
234232
describeObjCReason(AFD, Reason);
235233
}
236234

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ diagnoseMismatchedOptionals(const ValueDecl *member,
282282
Type paramTy = decl->getType();
283283
Type parentParamTy = parentDecl->getType();
284284

285-
if (!paramTy || !parentParamTy)
286-
return;
287-
288285
auto *repr = decl->getTypeRepr();
289286
if (!repr)
290287
return;

lib/Sema/TypeCheckPattern.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,10 +1488,7 @@ void TypeChecker::coerceParameterListToType(ParameterList *P, ClosureExpr *CE,
14881488
if (param->isInvalid())
14891489
return true;
14901490

1491-
if (auto type = param->getType())
1492-
return !isValidType(type);
1493-
1494-
return true;
1491+
return !isValidType(param->getType());
14951492
};
14961493

14971494
auto handleParameter = [&](ParamDecl *param, Type ty, bool forceMutable) {

lib/Sema/TypeCheckPropertyWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ PropertyWrapperBackingPropertyTypeRequest::evaluate(
546546

547547
// Compute the type of the property to plug in to the wrapper type.
548548
Type propertyType = var->getType();
549-
if (!propertyType || propertyType->hasError())
549+
if (propertyType->hasError())
550550
return Type();
551551

552552
using namespace constraints;

lib/Sema/TypeCheckStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
11661166
}
11671167
assert(isa<CaseStmt>(initialCaseVarDecl->getParentPatternStmt()));
11681168

1169-
if (initialCaseVarDecl->getType() && !initialCaseVarDecl->isInvalid() &&
1169+
if (!initialCaseVarDecl->isInvalid() &&
11701170
!vd->getType()->isEqual(initialCaseVarDecl->getType())) {
11711171
getASTContext().Diags.diagnose(vd->getLoc(), diag::type_mismatch_multiple_pattern_list,
11721172
vd->getType(), initialCaseVarDecl->getType());

0 commit comments

Comments
 (0)