Skip to content

Commit

Permalink
Don't override shared options with inferred value
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jul 12, 2020
1 parent f16da00 commit 1f5a2e8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/SwiftFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,12 @@ private func applyRules(

// Infer shared options
var options = options
let sharedOptions = FormatRules.sharedOptionsForRules(rules).compactMap {
FormatOptions.Descriptor.byName[$0]?.propertyName
}
let sharedOptions = FormatRules
.sharedOptionsForRules(rules)
.compactMap { FormatOptions.Descriptor.byName[$0] }
.filter { $0.defaultArgument == $0.fromOptions(options) }
.map { $0.propertyName }

inferFormatOptions(sharedOptions, from: tokens, into: &options)

// Check if required FileInfo is available
Expand Down

0 comments on commit 1f5a2e8

Please sign in to comment.