Skip to content

Commit 10a0558

Browse files
committed
fix opBinaryRight in StringMap
1 parent 6c42e61 commit 10a0558

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/mir/string_map.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ struct StringMap(T, U = uint)
481481
size_t index;
482482
if (!implementation.findIndex(key, index))
483483
return null;
484+
assert (index < length);
485+
index = implementation.indices[index];
486+
assert (index < length);
484487
return implementation._values + index;
485488
}
486489

@@ -953,4 +956,8 @@ unittest
953956
assert(token[`access_token`] == "secret-data");
954957
assert(token[`expires_in`] == 3599);
955958
assert(token[`token_type`] == "Bearer"); // mir/string_map.d(511): No member: token_type
959+
960+
const tkType = `token_type` in token;
961+
962+
assert((*tkType) == "Bearer"); // *tkType contains value 3599
956963
}

0 commit comments

Comments
 (0)