Skip to content

Commit

Permalink
Merge remote-tracking branch 'hacker-volodya/master'
Browse files Browse the repository at this point in the history
Rexagon committed Mar 25, 2024
2 parents a154dc6 + 49495e6 commit c05cc77
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion proc/src/tl_write.rs
Original file line number Diff line number Diff line change
@@ -301,7 +301,7 @@ where

other_field.attrs.flags_bit.map(|flags_bit| {
let field_name = build_field(other_field);
quote! { ((*#field_name.is_some() as u32) << #flags_bit) }
quote! { (((#field_name).is_some() as u32) << #flags_bit) }
})
}))
.collect::<Vec<_>>();
11 changes: 11 additions & 0 deletions test_suite/tests/tl_write.rs
Original file line number Diff line number Diff line change
@@ -100,6 +100,17 @@ mod tests {
value_2: Option<bool>,
}

#[derive(TlWrite)]
enum EnumWithFlags {
Named {
#[tl(flags)]
flags: (),
#[tl(flags_bit = 0)]
value_1: Option<u32>,
},
Unnamed(#[tl(flags)] (), #[tl(flags_bit = 0)] Option<u32>),
}

#[derive(TlWrite)]
struct StructWithMultipleFlags {
#[tl(flags, default_flags = 0x40000000)]

0 comments on commit c05cc77

Please sign in to comment.