Closed Cyberbeni closed 3 years ago
Version where it was correctly working: 0.48.11
Version where I noticed the issue: 0.48.14
command: swiftformat --swiftversion 3.0 test.swift
swiftformat --swiftversion 3.0 test.swift
test.swift contents:
fileprivate struct _JSONKeyedDecodingContainer<K: CodingKey>: KeyedDecodingContainerProtocol { private let container: [String: Any] public func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> { decoder.codingPath.append(key) defer { self.decoder.codingPath.removeLast() } guard let value = self.container[key.stringValue] else { throw DecodingError.keyNotFound(key, DecodingError.Context(codingPath: codingPath, debugDescription: "Cannot get \(KeyedDecodingContainer<NestedKey>.self) -- no value found for key \(_errorDescription(of: key))")) } guard let dictionary = value as? [String: Any] else { throw DecodingError._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value) } let container = _JSONKeyedDecodingContainer<NestedKey>(referencing: decoder, wrapping: dictionary) return KeyedDecodingContainer(container) } }
self is removed from line 7, causing the following error with Xcode 8.2: use of local variable 'container' before its declaration
self
use of local variable 'container' before its declaration
@Cyberbeni fixed in 0.48.15
Version where it was correctly working: 0.48.11
Version where I noticed the issue: 0.48.14
command:
swiftformat --swiftversion 3.0 test.swift
test.swift contents:
self
is removed from line 7, causing the following error with Xcode 8.2:use of local variable 'container' before its declaration