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

Method call on 0. float literals formats to incorrect code #5791

Closed
fee1-dead opened this issue Jun 20, 2023 · 3 comments · Fixed by #5794
Closed

Method call on 0. float literals formats to incorrect code #5791

fee1-dead opened this issue Jun 20, 2023 · 3 comments · Fixed by #5794
Labels
a-chains bug Panic, non-idempotency, invalid code, etc.

Comments

@fee1-dead
Copy link
Member

fee1-dead commented Jun 20, 2023

pub fn main() {
    0. .to_string();
}

formats currently to:

pub fn main() {
    0..to_string();
}

Ideally this should be reformatted to be:

pub fn main() {
    (0.).to_string();
}

so as to avoid confusion.

@ytmimi
Copy link
Contributor

ytmimi commented Jun 20, 2023

Does the following parse as a float literal and a method call? or a range?

pub fn main() {
    0..to_string();
}

If it's a range then it's definitely a bug.

@fee1-dead
Copy link
Member Author

A range.

@ytmimi
Copy link
Contributor

ytmimi commented Jun 20, 2023

Got it! Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-chains bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants