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

Trigger implicit_getter even if the getter is mutating #1589

Closed
rraphaeldev opened this Issue May 31, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@rraphaeldev

rraphaeldev commented May 31, 2017

In case of a mutating getter, the get keyword must be specified to add the mutating behavior but this trigger the implicit_getter warning.

struct Counter {
  private var count: Int
  
  init(start: Int = 0) {
    self.count = start
  }
  
  var next: Int? {
    mutating get { // warning: Implicit Getter Violation: Computed read-only properties should avoid using the get keyword. (implicit_getter)
      defer {
        self.count += 1
      }
      
      return self.count
    }
  }
}

Edit: swiftlint version: 0.19.0

@marcelofabri

This comment has been minimized.

Show comment
Hide comment
@marcelofabri

marcelofabri May 31, 2017

Collaborator

Similar to #1309

Collaborator

marcelofabri commented May 31, 2017

Similar to #1309

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Jul 14, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Jul 14, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Jul 14, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Jul 14, 2017

@marcelofabri

This comment has been minimized.

Show comment
Hide comment
@marcelofabri

marcelofabri Jul 14, 2017

Collaborator

Implemented in #1678.

Collaborator

marcelofabri commented Jul 14, 2017

Implemented in #1678.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment