magc 0.8.0

The Mag Language Compiler
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! A set of utilities which enable static type checking in Mag.

/// An interface which is implemented by anything that has a type.
pub trait Typed {
    // / Can we assign a value of the given type to a variable of this type?
    // fn can_assign_from(&self, other: Box<dyn Typed>) -> bool;
    /// Get the type of this object as a string.
    fn get_type(&self) -> Option<String>;
}

pub struct Type;

pub enum TypeError {
    UnexpectedType {
        expected: String,
        found: Option<String>,
    },
}