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

Dafny formatter produces incorrect indentation with match statement and :| #3790

Closed
ymherklotz opened this issue Mar 23, 2023 · 2 comments · Fixed by #3802
Closed

Dafny formatter produces incorrect indentation with match statement and :| #3790

ymherklotz opened this issue Mar 23, 2023 · 2 comments · Fixed by #3802
Assignees
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: formatter Code formatter for Dafny source code

Comments

@ymherklotz
Copy link

Dafny version

4.0.0

Code to produce this issue

lemma Try(i: int)
{
  match i {
    case i' =>
      var x :| x == i';
      assert x == i';
  }
}

Command to run and resulting output

dafny format file.dfy

What happened?

When running dafny format, one gets the following result:

lemma Try(i: int)
{
  match i {
    case i' =>
      var x :| x == i';
  assert x == i';
  }
}

Instead it shouldn't change the indentation.

When adding curly braces around the case statement body, then the indentation is correct, and correctly produces the following:

lemma Try(i: int)
{
  match i {
    case i' => {
      var x :| x == i';
      assert x == i';
    }
  }
}

What type of operating system are you experiencing the problem on?

Mac

@ymherklotz ymherklotz added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Mar 23, 2023
@MikaelMayer MikaelMayer self-assigned this Mar 23, 2023
@stefan-aws
Copy link
Collaborator

Thanks for reporting, we will look at it.

@MikaelMayer
Copy link
Member

Until the formatter get fixes, here is a workaround:

lemma Try(i: int)
{
  match i {
    case i' =>
      var x :| x == i';
  /**/assert x == i';
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: formatter Code formatter for Dafny source code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants