Pivot-Studio/pivot-lang

Bug: Multiple as Will Skip Type Check for Intermediate Types

Closed this issue · 1 comments

In the as_exp, it loops the casts, which skips some intermediate types:

        |(exp, casts, tail, is)| {
            let mut exp = exp;
            let start = exp.range().start;
            for (_, ty) in casts {
                let end = ty.range().end;
                let range = start.to(end);
                exp = Box::new(NodeEnum::AsNode(AsNode {
                    expr: exp,
                    ty,
                    range,
                    tail,
                }));
            }
            if let Some((_, ty)) = is {
                let end = ty.range().end;
                let range = start.to(end);
                exp = Box::new(NodeEnum::IsNode(IsNode {
                    expr: exp,
                    ty,
                    range,
                }));
            }
            res_box(exp)
        }

No such problem, so close it.