microcad_lang/syntax/
type_annotation.rs1use crate::{src_ref::*, syntax::*, ty::*};
7
8#[derive(Debug, Clone, PartialEq)]
10pub struct TypeAnnotation(pub Refer<Type>);
11
12impl SrcReferrer for TypeAnnotation {
13 fn src_ref(&self) -> SrcRef {
14 self.0.src_ref()
15 }
16}
17
18impl std::fmt::Display for TypeAnnotation {
19 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
20 self.0.fmt(f)
21 }
22}
23
24impl crate::ty::Ty for TypeAnnotation {
25 fn ty(&self) -> Type {
26 self.0.value.clone()
27 }
28}
29
30impl TreeDisplay for TypeAnnotation {
31 fn tree_print(&self, f: &mut std::fmt::Formatter, depth: TreeState) -> std::fmt::Result {
32 writeln!(f, "{:depth$}TypeAnnotation: {}", "", self.0.value)
33 }
34}