Sema: Add some asserts

This commit is contained in:
Slava Pestov
2016-12-25 13:25:59 -05:00
parent fd3101ef7c
commit 71df32fd7d
2 changed files with 7 additions and 2 deletions

View File

@@ -1387,7 +1387,9 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
bool isDynamicResult
= choice.getKind() == OverloadChoiceKind::DeclViaDynamic;
// Retrieve the type of a reference to the specific declaration choice.
if (choice.getBaseType()) {
if (auto baseTy = choice.getBaseType()) {
assert(!baseTy->hasTypeParameter());
auto getDotBase = [](const Expr *E) -> const DeclRefExpr * {
if (E == nullptr) return nullptr;
switch (E->getKind()) {
@@ -1406,7 +1408,7 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
auto anchor = locator ? locator->getAnchor() : nullptr;
auto base = getDotBase(anchor);
std::tie(openedFullType, refType)
= getTypeOfMemberReference(choice.getBaseType(), choice.getDecl(),
= getTypeOfMemberReference(baseTy, choice.getDecl(),
isTypeReference, isDynamicResult,
choice.getFunctionRefKind(),
locator, base, nullptr);