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

The formatter removes explicit type signatures used for bindings inside patterns #762

Open
yorickpeterse opened this issue Sep 17, 2024 · 1 comment
Labels
accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler

Comments

@yorickpeterse
Copy link
Collaborator

Please describe the bug

Code such as this:

class async Main {
  fn async main {
    match (10, 20) {
      case (a: Int, b: Int) -> {}
    }
  }
}

Is formatted into this:

class async Main {
  fn async main {
    match (10, 20) {
      case (a, b) -> {}
    }
  }
}

This isn't desired because in certain cases the type annotations may in fact be necessary (though this is rare), resulting in a semantic difference between the two bits of code.

inko fmt should be adjusted to retain (but correctly format) any explicit type signatures it finds in binding patterns.

Operating system

Fedora

Inko version

main

@yorickpeterse yorickpeterse added accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler labels Sep 17, 2024
@yorickpeterse
Copy link
Collaborator Author

The same happens when you try to define the binding as mutable, so mut foo is turned into foo, which is definitely incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler
Projects
None yet
Development

No branches or pull requests

1 participant