Skip to content

Commit 74a5dd5

Browse files
stepanchegfacebook-github-bot
authored andcommitted
set & should fail if RHS is not set
Reviewed By: perehonchuk Differential Revision: D63740714 fbshipit-source-id: 925d99bd96ba5f69fad161720adca071cd152e4c
1 parent f10ef49 commit 74a5dd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

starlark/src/values/types/set/value.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,13 @@ where
276276

277277
// Set intersection
278278
fn bit_and(&self, rhs: Value<'v>, heap: &'v Heap) -> crate::Result<Value<'v>> {
279+
let rhs = SetRef::unpack_value_opt(rhs)
280+
.map_or_else(|| ValueError::unsupported_with(self, "&", rhs), Ok)?;
281+
279282
let mut items = SmallSet::new();
280283
if self.0.content().is_empty() {
281284
return Ok(heap.alloc(SetData { content: items }));
282285
}
283-
let rhs = SetRef::unpack_value_opt(rhs)
284-
.map_or_else(|| ValueError::unsupported_with(self, "&", rhs), Ok)?;
285286

286287
for h in rhs.aref.iter_hashed() {
287288
if self.0.content().contains_hashed(h.as_ref()) {

0 commit comments

Comments
 (0)