Skip to content

Commit f142b30

Browse files
committed
AST: Unconditional asserts in checkRequirementsImpl()
1 parent 9ddfc9e commit f142b30

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/AST/Requirement.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,28 +267,24 @@ checkRequirementsImpl(ArrayRef<Requirement> requirements,
267267
while (!worklist.empty()) {
268268
auto req = worklist.pop_back_val();
269269

270-
// Check preconditions.
271-
#ifndef NDEBUG
272-
{
270+
// Check preconditions.
273271
auto firstType = req.getFirstType();
274-
assert((allowTypeParameters || !firstType->hasTypeParameter())
272+
ASSERT((allowTypeParameters || !firstType->hasTypeParameter())
275273
&& "must take a contextual type. if you really are ok with an "
276274
"indefinite answer (and usually YOU ARE NOT), then consider whether "
277275
"you really, definitely are ok with an indefinite answer, and "
278276
"use `checkRequirementsWithoutContext` instead");
279-
assert(!firstType->hasTypeVariable());
277+
ASSERT(!firstType->hasTypeVariable());
280278

281279
if (req.getKind() != RequirementKind::Layout) {
282280
auto secondType = req.getSecondType();
283-
assert((allowTypeParameters || !secondType->hasTypeParameter())
281+
ASSERT((allowTypeParameters || !secondType->hasTypeParameter())
284282
&& "must take a contextual type. if you really are ok with an "
285283
"indefinite answer (and usually YOU ARE NOT), then consider whether "
286284
"you really, definitely are ok with an indefinite answer, and "
287285
"use `checkRequirementsWithoutContext` instead");
288-
assert(!secondType->hasTypeVariable());
286+
ASSERT(!secondType->hasTypeVariable());
289287
}
290-
}
291-
#endif
292288

293289
switch (req.checkRequirement(worklist, /*allowMissing=*/true)) {
294290
case CheckRequirementResult::Success:

0 commit comments

Comments
 (0)