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

Formatter removes mutates keyword #49

Open
anton-trunov opened this issue Nov 5, 2024 · 0 comments
Open

Formatter removes mutates keyword #49

anton-trunov opened this issue Nov 5, 2024 · 0 comments
Assignees

Comments

@anton-trunov
Copy link
Member

The formatter would remove the mutates keyword from all of the functions. For instance, the following snippet

struct Array {
    m: map<Int as uint16, Int>;
    length: Int = 0;
}

const MaxArraySize: Int = 5_000;

extends mutates fun append(self: Array, item: Int) {
    require(self.length + 1 <= MaxArraySize, "No space in the array left for new items!");

    self.m.set(self.length, item);
    self.length += 1;
}

gets formatted as

struct Array {
  m: map<Int as uint16, Int>;
  length: Int = 0;
}
const MaxArraySize: Int = 5000;

extends fun append(self: Array, item: Int) {
  require((self.length + 1) <= MaxArraySize,
    "No space in the array left for new items!"
  );
  self.m.set(self.length, item);
  self.length += 1;
}
@verytactical verytactical self-assigned this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants