Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: AST to_string() pretty-printing does not indent properly #73

Open
2 tasks done
thetayloredman opened this issue Oct 18, 2023 · 0 comments
Open
2 tasks done
Labels
area/parser Relating to the parser severity/minor The bug may cause some undesired behavior but the compiler still functions (e.g. display bugs) type/bug Something isn't working (use type: ice for panics)

Comments

@thetayloredman
Copy link
Contributor

thetayloredman commented Oct 18, 2023

Before we begin...

  • I have updated the Zirco toolchain to the latest version
  • I have searched the issue tracker for duplicates

What happened?

Blocks like if within the AST pretty-print to string do not get indented or given newlines like they do in the TAST.

What version of Zirco are you running?

zrc version 0.1.0 (4b07b66, not tainted) built for x86_64-unknown-linux-gnu on 2023-10-18T08:46:15-07:00 (debug mode)
rustc 1.70.0 (90c541806 2023-05-31) (stable-x86_64-unknown-linux-gnu on linux-x86_64)
cargo 1.70.0 (ec8a8a0ca 2023-04-25)

How can this bug be reproduced?

After #60, run zrc --emit ast on the following:

fn main() -> i32 {
    if (2 + 2 == 5) {
        return 1;
    } else {
        return 0;
    }
}

What behavior did you expect?

fn main() -> i32 {
    if ((((2) + (2)) == (5))) {
        return (1);
    } else {
        return (0);
    }
}

What actually happened?

fn main() -> i32 {
    if ((((2) + (2)) == (5))) {return (1);} else {return (0);}
}

Other Context

It may be helpful to indent all lines except the first by a certain indentation level in all blocks?

@thetayloredman thetayloredman added type/bug Something isn't working (use type: ice for panics) status/untriaged Triage is needed. area/parser Relating to the parser severity/minor The bug may cause some undesired behavior but the compiler still functions (e.g. display bugs) and removed status/untriaged Triage is needed. labels Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/parser Relating to the parser severity/minor The bug may cause some undesired behavior but the compiler still functions (e.g. display bugs) type/bug Something isn't working (use type: ice for panics)
Projects
None yet
Development

No branches or pull requests

1 participant