Skip to content

Commit baf1093

Browse files
authored
Fix bug where markTypes rule wouldn't add marks after extensions (#2191)
1 parent 303d82d commit baf1093

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

Sources/Rules/MarkTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public extension FormatRule {
152152
}
153153

154154
guard let expectedCommentBody = markForType else {
155-
return
155+
continue
156156
}
157157

158158
// When inserting a mark before the first declaration,

Tests/Rules/MarkTypesTests.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,4 +996,34 @@ class MarkTypesTests: XCTestCase {
996996

997997
testFormatting(for: input, output, rule: .markTypes)
998998
}
999+
1000+
func testMarksTypeAfterExtension() {
1001+
let input = """
1002+
extension Foo {
1003+
var foo: Foo { Foo() }
1004+
var bar: Bar { Bar() }
1005+
}
1006+
1007+
struct Baaz {
1008+
let foo: Foo
1009+
let bar: Bar
1010+
}
1011+
"""
1012+
1013+
let output = """
1014+
extension Foo {
1015+
var foo: Foo { Foo() }
1016+
var bar: Bar { Bar() }
1017+
}
1018+
1019+
// MARK: - Baaz
1020+
1021+
struct Baaz {
1022+
let foo: Foo
1023+
let bar: Bar
1024+
}
1025+
"""
1026+
1027+
testFormatting(for: input, output, rule: .markTypes)
1028+
}
9991029
}

0 commit comments

Comments
 (0)