mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Add some asserts
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
FunctionRefKind functionRefKind)
|
||||
: BaseAndBits(base, isSpecialized ? IsSpecializedBit : 0),
|
||||
TheFunctionRefKind(functionRefKind) {
|
||||
assert(!base || !base->hasTypeParameter());
|
||||
assert((reinterpret_cast<uintptr_t>(value) & (uintptr_t)0x03) == 0 &&
|
||||
"Badly aligned decl");
|
||||
|
||||
@@ -115,6 +116,7 @@ public:
|
||||
FunctionRefKind functionRefKind)
|
||||
: BaseAndBits(base, isSpecialized ? IsSpecializedBit : 0),
|
||||
TheFunctionRefKind(functionRefKind) {
|
||||
assert(!base || !base->hasTypeParameter());
|
||||
assert((reinterpret_cast<uintptr_t>(type) & (uintptr_t)0x03) == 0
|
||||
&& "Badly aligned decl");
|
||||
DeclOrKind = reinterpret_cast<uintptr_t>(type) | 0x01;
|
||||
@@ -125,6 +127,7 @@ public:
|
||||
DeclOrKind((uintptr_t)kind << 2 | (uintptr_t)0x03),
|
||||
TheFunctionRefKind(FunctionRefKind::Unapplied) {
|
||||
assert(base && "Must have a base type for overload choice");
|
||||
assert(!base->hasTypeParameter());
|
||||
assert(kind != OverloadChoiceKind::Decl &&
|
||||
kind != OverloadChoiceKind::DeclViaDynamic &&
|
||||
kind != OverloadChoiceKind::TypeDecl &&
|
||||
|
||||
Reference in New Issue
Block a user