Closed darichey closed 2 years ago
If a let expression uses inherit, the typed api incorrectly gives the corresponding NODE_INHERIT as the body of the let.
let
inherit
NODE_INHERIT
use rnix::ast::HasEntry; fn main() { let nix_expr = "let inherit (x) y; in y"; if let rnix::ast::Expr::LetIn(let_in) = rnix::Root::parse(&nix_expr).ok().unwrap().expr().unwrap() { println!("{:?}", let_in.entries().collect::<Vec<_>>()); println!("{:?}", let_in.body()); } }
[Inherit(Inherit(NODE_INHERIT@4..18))] Some(Inherit(Inherit(NODE_INHERIT@4..18)))
The cause is the same as the cause of #121: NODE_INHERIT is both a valid Expr and Entry.
Expr
Entry
In this case, I wonder why is it an Expr?
If a
let
expression usesinherit
, the typed api incorrectly gives the correspondingNODE_INHERIT
as the body of thelet
.The cause is the same as the cause of #121:
NODE_INHERIT
is both a validExpr
andEntry
.In this case, I wonder why is it an
Expr
?