Skip to content

Commit

Permalink
Update for 0.47.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Nov 9, 2020
1 parent e0dd5c7 commit 70f5cf5
Show file tree
Hide file tree
Showing 42 changed files with 72 additions and 75 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## [0.47.3](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.47.3) (2020-11-09)

- Fixed bug with `extensionAccessControl` increasing extension access level beyond extended type
- Fixed regression with non-standard `.swift-version` contents being flagged as an error
- Fixed bug in `hoistPatternLet` rule when using `--patternlet inline`
- Fixed case where `enumNamespaces` was incorrectly applied
- Fixed indenting of wrapped line starting with a closing paren or brace
- Fixed indenting of blocks starting on same line as a switch case
- Fixed indenting of wrapped closure parameter
- Fixed bug in `--allman` inference

## [0.47.2](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.47.2) (2020-10-30)

- The `markTypes`, `organizeDeclarations` and`extensionAccessControl` rules now respect comment directives
Expand All @@ -10,7 +21,7 @@
- The `typeSugar` rule is now applied in more cases
- Fixed bug in cache logic resulting in slower formatting when using certain config options
- Fixed crash in `indent` rule
- Fixed bug in wrapped else indent
- Fixed bug in wrapped `else` indent

## [0.47.1](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.47.1) (2020-10-26)

Expand Down
Binary file modified CommandLineTool/swiftformat
Binary file not shown.
Binary file modified EditorExtension/SwiftFormat for Xcode.app/Contents/CodeResources
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19H2</string>
<string>19H15</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
Expand Down Expand Up @@ -36,7 +36,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.47.2</string>
<string>0.47.3</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19H2</string>
<string>19H15</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.47.2</string>
<string>0.47.3</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
</data>
<key>Resources/Assets.car</key>
<data>
2YoZ0Da4mCpyFL3PmNUqjhBclNs=
TTIWe4xVphrMC6YH1bZfmAfPhOo=
</data>
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
<data>
uK0RdX+b6+vbxkOLrHaoPCs6Qjs=
G5nqQn5muMKa4p4zKHZmdmrjxEo=
</data>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<data>
BIuGtXwJ0nQ6i3Jzplnk400HNdk=
Bn4JObhT6MXI+HZ2GTUfZWtql2k=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<data>
oGw9ifNwr412P+UMqHHJw6ApbcA=
JZ/kqd07Vfly2KgaliPkcX08L9I=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
<data>
PoGRzWVI+b9U/8s1YS6Um+uHrkc=
yCCf0r408inabwo9LHE+JqzFXWQ=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<data>
u1K8Kor8nYLX5gqVMLgPw0hLx7U=
BUryZ7jyzjTBnVfeonLgAC8u10Y=
</data>
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
<data>
O4mwayiFJtYMfiUA1h3Gtd54qRc=
bTOrfjf3y5eVX/CGEx3XYkHn0GM=
</data>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<data>
Expand Down Expand Up @@ -182,7 +182,7 @@
<dict>
<key>cdhash</key>
<data>
zZ/v9o5QtoBHScfchRt5iXcOy8s=
0JJUi8QMfQkhq0lgVuecOyByUoY=
</data>
<key>requirement</key>
<string>anchor apple generic and identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "8VQKF583ED")</string>
Expand All @@ -198,49 +198,49 @@
<dict>
<key>hash2</key>
<data>
MIAZxr1q5EwSj3eZ5pzHDdZgF7eCLCnNlNtQpSulsqY=
cN8Y4tXG4NJHzWIFFfn5cl/ZGWQYWccMlk9cdpIFibY=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
<dict>
<key>hash2</key>
<data>
vjwuubSANur9RETgkHarQW5s6tFV8341IQ2KWPrYYnY=
cAJixDO8vnHRPuPlUxTSoRApM7smXTdBA8XNVfkbGKE=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<dict>
<key>hash2</key>
<data>
8sKJbJR71o+HVV9/1iVfRXocX0svNGwGDdNlUo8IZM4=
meha+4BnRJUJx1a/7Uo9hJt25m3JiWJNLUwN/DBwYfM=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<dict>
<key>hash2</key>
<data>
o/Qc9h2AuuCEroeMHtB5Q6qYbFEzAB8Pg1V3kXhKu0A=
TbAVKio9lyh/dlN2NX3C4UWBD25yQ6n73ACVmLQgsfI=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
<dict>
<key>hash2</key>
<data>
zRLyr25uGW7p+Z1laOd6Fyvkg27MnoFT8pNguJPnUpI=
+vcMmCCxUhQhR5ws5C8B6fJR/znkvMYoSFIF2rQw9LY=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<dict>
<key>hash2</key>
<data>
277VFl3yoYtkGDhHRk2yD6OtFiX9hyJwQ3cU2wTlFMA=
4KAJQYHV0ZT0s61v9YozpPYV7H/8TlnMtgaIwdmeCNk=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
<dict>
<key>hash2</key>
<data>
FCIkFV/qbvR+IeBBu1Y3YzsoA6jpuvUITbVb8KYebf0=
VZIk3ug+n6mzPkm677pon2T3xPgfuibGQ50EhYcDNl0=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ Known issues
* When using the `initCoderUnavailable` rule, if an `init` that is marked as unavailable is overridden elsewhere in the program then it will cause a compilation error. The recommended workaround is to remove the override (which shouldn't affect the program behavior if the init was really unused) or use the `// swiftformat:disable:next initCoderUnavailable` comment directive to disable the rule for the overridden init (or just disable the `initCoderUnavailable` rule completely).
* When using the `extensionAccessControl` rule with the `--extensionacl on-extension` option, if you have public methods defined on an internal or private type, the resultant public extension will no longer compile. The recommended solution is to manually remove the `public` modifier (this won't change the program behavior) or disable the `extensionAccessControl` rule.
* When using the `extensionAccessControl` rule with the `--extensionacl on-extension` option, if you have public methods defined on an internal type defined in another file, the resultant public extension will no longer compile. The recommended solution is to manually remove the `public` modifier (this won't change the program behavior) or disable the `extensionAccessControl` rule.
* When using the `preferKeyPath` rule, conversion of `compactMap { $0.foo }` to `compactMap(\.foo)` will result in code that fails to compile if `foo` is not an `Optional` property. This is due to a difference in the way that Swift handles type inference for closures vs keyPaths, as discussed [here](https://bugs.swift.org/browse/SR-13347). The recommended workaround is to replace `compactMap()` with `map()` in these cases, which will not change the behavior of the code.
Expand Down
3 changes: 1 addition & 2 deletions Snapshots/Issues/406.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ SessionManager
SessionManager
.shared
.validateSession()
.switchMap
{ _ -> Observable<SomeEntity> in
.switchMap { _ -> Observable<SomeEntity> in
someCode()
}
.switchMap {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Formatter.swift
// SwiftFormat
//
// Version 0.47.2
// Version 0.47.3
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
3 changes: 1 addition & 2 deletions Sources/Inference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,7 @@ private struct Inference {
return false // Keep looking
}
}), formatter.tokens[bodyStartIndex] == .startOfScope("{"),
let bodyEndIndex = formatter.index(of: .endOfScope("}"), after: bodyStartIndex)
else {
let bodyEndIndex = formatter.index(of: .endOfScope("}"), after: bodyStartIndex) else {
return
}
removeUsed(from: &argNames, with: &nameIndices, in: bodyStartIndex + 1 ..< bodyEndIndex)
Expand Down
15 changes: 6 additions & 9 deletions Sources/ParsingHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1417,12 +1417,11 @@ extension Formatter {
guard let commaIndex = self.index(of: .nonSpaceOrCommentOrLinebreak, before: index + 1, if: {
$0 == .delimiter(",")
}), case let lineStart = startOfLine(at: commaIndex),
let firstToken = self.index(of: .nonSpace, after: lineStart - 1),
let firstNonBrace = (firstToken ..< commaIndex).first(where: {
let token = self.tokens[$0]
return !token.isEndOfScope && !token.isSpaceOrComment
})
else {
let firstToken = self.index(of: .nonSpace, after: lineStart - 1),
let firstNonBrace = (firstToken ..< commaIndex).first(where: {
let token = self.tokens[$0]
return !token.isEndOfScope && !token.isSpaceOrComment
}) else {
return options.indent
}
if case .endOfScope = tokens[firstToken],
Expand All @@ -1434,9 +1433,7 @@ extension Formatter {
[.keyword("if"), .keyword("guard"), .keyword("while")].contains($0)
}) ?? lastIndex(in: firstNonBrace ..< commaIndex, where: {
[.keyword("let"), .keyword("var"), .keyword("case")].contains($0)
}),
let nextTokenIndex = self.index(of: .nonSpace, after: keywordIndex)
else {
}), let nextTokenIndex = self.index(of: .nonSpace, after: keywordIndex) else {
return options.indent
}
return spaceEquivalentToTokens(from: firstToken, upTo: nextTokenIndex)
Expand Down
49 changes: 20 additions & 29 deletions Sources/Rules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ public struct _FormatRules {
guard let colonIndex = formatter.index(after: i, where: {
[.delimiter(":"), .operator("=", .infix)].contains($0)
}), formatter.tokens[colonIndex] == .delimiter(":"),
let equalsIndex = formatter.index(of: .operator("=", .infix), after: colonIndex),
let endIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: equalsIndex)
let equalsIndex = formatter.index(of: .operator("=", .infix), after: colonIndex),
let endIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: equalsIndex)
else { return }

// Check types match
Expand Down Expand Up @@ -1275,10 +1275,9 @@ public struct _FormatRules {
guard let lastIndex = formatter.index(of: .nonSpaceOrComment, before: i, if: {
$0 == .endOfScope(")")
}), let startIndex = formatter.index(of: .startOfScope("("), before: lastIndex),
formatter.tokens[startIndex ..< lastIndex].contains(where: {
if case .linebreak = $0 { return true } else { return false }
})
else {
formatter.tokens[startIndex ..< lastIndex].contains(where: {
if case .linebreak = $0 { return true } else { return false }
}) else {
break
}
indentStack[indentStack.count - 1] += formatter.options.indent
Expand Down Expand Up @@ -1571,7 +1570,7 @@ public struct _FormatRules {
}), let coderIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: parenIndex, if: {
$0 == .identifier("coder")
}), let endParenIndex = formatter.index(of: .endOfScope(")"), after: coderIndex),
let braceIndex = formatter.index(of: .startOfScope("{"), after: endParenIndex)
let braceIndex = formatter.index(of: .startOfScope("{"), after: endParenIndex)
else { return }

// make sure the implementation is empty or fatalError
Expand Down Expand Up @@ -1695,8 +1694,7 @@ public struct _FormatRules {
if let endIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, before: i, if: {
$0 == .endOfScope("}")
}), let startIndex = formatter.index(of: .startOfScope("{"), before: endIndex),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: startIndex) == .keyword("repeat")
{
formatter.last(.nonSpaceOrCommentOrLinebreak, before: startIndex) == .keyword("repeat") {
fallthrough
}
case .keyword("else"):
Expand Down Expand Up @@ -2170,8 +2168,7 @@ public struct _FormatRules {
guard let nextIndex = formatter.index(of: .nonSpaceOrComment, after: i, if: {
$0 == .startOfScope("{")
}), let lastIndex = formatter.index(of: .endOfScope("}"), after: nextIndex),
formatter.index(of: .nonSpaceOrComment, before: closingIndex) == lastIndex
else {
formatter.index(of: .nonSpaceOrComment, before: closingIndex) == lastIndex else {
fallthrough
}
formatter.removeParen(at: closingIndex)
Expand Down Expand Up @@ -2392,8 +2389,7 @@ public struct _FormatRules {
), let colonIndex = formatter.index(
of: .nonSpaceOrCommentOrLinebreak, after: nameIndex, if: { $0 == .delimiter(":") }
), formatter.next(.nonSpaceOrCommentOrLinebreak, after: colonIndex) == .identifier("String"),
let braceIndex = formatter.index(of: .startOfScope("{"), after: colonIndex)
else {
let braceIndex = formatter.index(of: .startOfScope("{"), after: colonIndex) else {
return
}
var lastIndex = formatter.index(of: .keyword("case"), after: braceIndex)
Expand Down Expand Up @@ -3273,8 +3269,7 @@ public struct _FormatRules {
return false // Keep looking
}
}), formatter.tokens[bodyStartIndex] == .startOfScope("{"),
let bodyEndIndex = formatter.index(of: .endOfScope("}"), after: bodyStartIndex)
else {
let bodyEndIndex = formatter.index(of: .endOfScope("}"), after: bodyStartIndex) else {
return
}
removeUsed(from: &argNames, with: &nameIndexPairs, in: bodyStartIndex + 1 ..< bodyEndIndex)
Expand Down Expand Up @@ -3690,8 +3685,7 @@ public struct _FormatRules {
guard let endIndex = formatter.index(of: .nonSpaceOrLinebreak, after: i, if: {
$0 == .endOfScope(")")
}), let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: i),
!isArgumentToken(at: endIndex)
else {
!isArgumentToken(at: endIndex) else {
return
}
if formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) == .operator("->", .infix) {
Expand Down Expand Up @@ -3932,11 +3926,10 @@ public struct _FormatRules {
}), let openParenIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0 == .startOfScope("(")
}), let closeParenIndex = formatter.index(of: .endOfScope(")"), after: openParenIndex),
formatter.last(.nonSpaceOrCommentOrLinebreak, before: closeParenIndex) != .delimiter(":"),
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: dotIndex),
case let .identifier(name) = prevToken, let firstChar = name.first,
firstChar != "$", String(firstChar).uppercased() == String(firstChar)
else {
formatter.last(.nonSpaceOrCommentOrLinebreak, before: closeParenIndex) != .delimiter(":"),
let prevToken = formatter.last(.nonSpaceOrCommentOrLinebreak, before: dotIndex),
case let .identifier(name) = prevToken, let firstChar = name.first,
firstChar != "$", String(firstChar).uppercased() == String(firstChar) else {
return
}
formatter.removeTokens(in: dotIndex ... i)
Expand Down Expand Up @@ -4501,8 +4494,7 @@ public struct _FormatRules {
acl = $1
return aclModifiers.contains(acl)
}), let startIndex = formatter.index(of: .startOfScope("{"), after: i),
var endIndex = formatter.index(of: .endOfScope("}"), after: startIndex)
else {
var endIndex = formatter.index(of: .endOfScope("}"), after: startIndex) else {
return
}
if acl == "private" { acl = "fileprivate" }
Expand Down Expand Up @@ -4606,11 +4598,10 @@ public struct _FormatRules {
guard let nameIndex = formatter.index(of: .nonSpaceOrCommentOrLinebreak, after: i, if: {
$0.isIdentifier
}), let openBraceIndex = formatter.index(of: .startOfScope("{"), after: nameIndex),
let colonIndex =
formatter.index(of: .delimiter(":"), in: nameIndex + 1 ..< openBraceIndex),
formatter.index(of: .identifier(className), in: colonIndex + 1 ..< openBraceIndex)
!= nil
else {
let colonIndex =
formatter.index(of: .delimiter(":"), in: nameIndex + 1 ..< openBraceIndex),
formatter.index(of: .identifier(className), in: colonIndex + 1 ..< openBraceIndex)
!= nil else {
continue
}
// TODO: check if member names are actually referenced
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import Foundation

/// The current SwiftFormat version
let swiftFormatVersion = "0.47.2"
let swiftFormatVersion = "0.47.3"
public let version = swiftFormatVersion

/// The standard SwiftFormat config file name
Expand Down
2 changes: 1 addition & 1 deletion Sources/Tokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Tokenizer.swift
// SwiftFormat
//
// Version 0.47.2
// Version 0.47.3
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
4 changes: 2 additions & 2 deletions SwiftFormat.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SwiftFormat",
"version": "0.47.2",
"version": "0.47.3",
"license": {
"type": "MIT",
"file": "LICENSE.md"
Expand All @@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/SwiftFormat.git",
"tag": "0.47.2"
"tag": "0.47.3"
},
"default_subspecs": "Core",
"subspecs": [
Expand Down
Loading

0 comments on commit 70f5cf5

Please sign in to comment.