Skip to content

Commit 63d42bf

Browse files
committed
Properly emit protocol objects with multiple protocols
1 parent 87dcf25 commit 63d42bf

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

crates/header-translator/src/rust_type.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,14 +1416,18 @@ impl Ty {
14161416
Self::GenericParam { name } => write!(f, "{name}"),
14171417
Self::AnyObject { protocols } => match &**protocols {
14181418
[] => write!(f, "AnyObject"),
1419-
[decl] => write!(f, "ProtocolObject<dyn {}>", decl.id.path()),
1420-
// TODO: Handle this better
1421-
[first, rest @ ..] => {
1422-
write!(f, "AnyObject /* {}", first.id.path())?;
1423-
for protocol in rest {
1424-
write!(f, "+ {}", protocol.id.path())?;
1419+
protocols => {
1420+
write!(f, "ProtocolObject<dyn ")?;
1421+
1422+
let mut iter = protocols.iter();
1423+
let protocol = iter.next().unwrap();
1424+
write!(f, "{}", protocol.path())?;
1425+
1426+
for protocol in iter {
1427+
write!(f, " + {}", protocol.path())?;
14251428
}
1426-
write!(f, " */")?;
1429+
1430+
write!(f, ">")?;
14271431
Ok(())
14281432
}
14291433
},

0 commit comments

Comments
 (0)