Closed ptal closed 8 years ago
This program is refused by the typing analysis by an error "inlining cycle detected":
grammar! neg_expr { factor = integer / unary_arith_expr unary_arith_expr = "+" factor / "-" factor > make_neg_expr integer = ["0-9"]+ > make_integer enum Expr { Number(u64), NegExpr(PExpr) } type PExpr = Box<Expr>; fn make_integer(raw_number: Vec<char>) -> PExpr { match u64::from_str(&*to_string(raw_number)).ok() { Some(x) => Box::new(Expr::number(x)), None => panic!("int literal is too large") } } fn make_neg_expr(expr: PExpr) -> PExpr { Box::new(Expr::NegExpr(expr)) } }
The type is not recursive because it just forwards the value and does not create new value during the recursive call.
This program is refused by the typing analysis by an error "inlining cycle detected":
The type is not recursive because it just forwards the value and does not create new value during the recursive call.