| 68 | |
| 69 | #[derive(Clone, Debug)] |
| 70 | enum Expression { |
| 71 | /// Conditional expression. |
| 72 | /// Requirement: `cond` more concrete than bool, `cons` and `alt` compatible. |
| 73 | /// Returns: meet of `cons` and `alt`. |
| 74 | Conditional { |
| 75 | cond: Box<Expression>, |
| 76 | cons: Box<Expression>, |
| 77 | alt: Box<Expression>, |
| 78 | }, |
| 79 | /// Polymorphic function f<T_1: C_1, ..., T_n: C_n>(p_1: C_{n+1}, ..., p_m: C_{n+m}) -> T |
| 80 | /// Arguments: |
| 81 | /// `name` for illustration, |
| 82 | /// `param_constraints`: vector of parameters and their constraints if any, in this example vec![C_1, ..., C_n]. |
| 83 | /// `arg_types`: vector of type constraints on the arguments, in this example vec![C_{n+1}, ..., C_{n+m}]. May refer to parameters. |
| 84 | /// `args`: vector containing all argument expressions. |
| 85 | /// `returns`: return type. May refer to a parameter. |
| 86 | /// Requirement: each argument needs to comply with its constraint. If several arguments refer to the same parametric type, they need to be compliant. |
| 87 | /// Returns: `returns`. |
| 88 | PolyFn { |
| 89 | name: &'static str, |
| 90 | param_constraints: Vec<Option<Variant>>, |
| 91 | args: Vec<(ParamType, Expression)>, |
| 92 | returns: ParamType, |
| 93 | }, |
| 94 | ConstInt(i128), |
| 95 | ConstBool(bool), |
| 96 | ConstFixed(i64, u64), |
| 97 | } |
| 98 | |
| 99 | impl Constructable for Variant { |
| 100 | type Type = Type; |
nothing calls this directly
no outgoing calls
no test coverage detected