mirror of
https://github.com/Dummi26/mers.git
synced 2026-03-04 08:36:33 +01:00
Type Annotations
- Add type annotations: [type] statement - Add type definitions: [[name] type], [[name] := statement] - Add type annotations example (08) - add Quickstart.md, reference it from README
This commit is contained in:
@@ -374,16 +374,16 @@ impl Display for Type {
|
||||
if self.types.is_empty() {
|
||||
write!(f, "<unreachable>")
|
||||
} else {
|
||||
if self.types.len() > 1 {
|
||||
write!(f, "{{")?;
|
||||
}
|
||||
// if self.types.len() > 1 {
|
||||
// write!(f, "{{")?;
|
||||
// }
|
||||
write!(f, "{}", self.types[0])?;
|
||||
for t in self.types.iter().skip(1) {
|
||||
write!(f, "/{t}")?;
|
||||
}
|
||||
if self.types.len() > 1 {
|
||||
write!(f, "}}")?;
|
||||
}
|
||||
// if self.types.len() > 1 {
|
||||
// write!(f, "}}")?;
|
||||
// }
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,10 @@ impl Display for Reference {
|
||||
}
|
||||
impl Display for ReferenceT {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "&{}", self.0)
|
||||
if self.0.types.len() > 1 {
|
||||
write!(f, "&{{{}}}", self.0)
|
||||
} else {
|
||||
write!(f, "&{}", self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user