Skip to content

Commit 258d05a

Browse files
committed
[CS] Assert that path element info isn't truncated
1 parent b5b41a5 commit 258d05a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Sema/ConstraintLocator.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,17 @@ class ConstraintLocator : public llvm::FoldingSetNode {
314314
{
315315
assert(numNumericValuesInPathElement(kind) == 1 &&
316316
"Path element kind does not require 1 value");
317+
assert(value == getValue(0) && "value truncated");
317318
}
318319

319-
PathElement(PathElementKind kind, unsigned value1, unsigned value2)
320-
: storage(encodeStorage(kind, value1 << 16 | value2)),
320+
PathElement(PathElementKind kind, unsigned value0, unsigned value1)
321+
: storage(encodeStorage(kind, value0 << 16 | value1)),
321322
storedKind(StoredKindAndValue)
322323
{
323324
assert(numNumericValuesInPathElement(kind) == 2 &&
324325
"Path element kind does not require 2 values");
326+
assert(value0 == getValue(0) && "value0 truncated");
327+
assert(value1 == getValue(1) && "value1 truncated");
325328
}
326329

327330
PathElement(GenericSignature *sig)

0 commit comments

Comments
 (0)