Skip to content

Commit

Permalink
Fixed lazy var bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Mar 14, 2017
1 parent 2d10536 commit b96b0dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Rules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,7 @@ extension FormatRules {
}
index = nextIndex
}
continue
case let .keyword(name):
lastKeyword = name
case .startOfScope("("):
Expand Down
7 changes: 7 additions & 0 deletions Tests/RulesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3654,6 +3654,13 @@ class RulesTests: XCTestCase {
XCTAssertEqual(try format(input + "\n", rules: FormatRules.default), output + "\n")
}

func testNoRemoveSelfFromLazyVarClosure2() {
let input = "lazy var foo = { let bar = self.baz }()"
let output = "lazy var foo = { let bar = self.baz }()"
XCTAssertEqual(try format(input, rules: [FormatRules.redundantSelf]), output)
XCTAssertEqual(try format(input + "\n", rules: FormatRules.default), output + "\n")
}

// MARK: unusedArguments

// closures
Expand Down

0 comments on commit b96b0dd

Please sign in to comment.