Depreacted PathExplorer.real for .double

This commit is contained in:
Alexis Bridoux 2021-05-08 13:46:42 +02:00
parent a3c5ff8c73
commit 70e9a041c9
5 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,7 @@ public extension Parser {
static func character(matching condition: @escaping (Character) -> Bool) -> Parser<Character> {
Parser<Character> { input in
guard let char = input.first, condition(char) else { return nil }
guard let char = input.first, condition(char) else { return nil }
return (char, input.dropFirst())
}
}

View File

@ -269,6 +269,7 @@ extension ExplorerValue {
return double
}
@available(*, deprecated, renamed: "double")
public var real: Double? { double }
public var string: String? {

View File

@ -17,7 +17,7 @@ public struct CodablePathExplorer<Format: CodableFormat>: PathExplorer {
public var int: Int? { value.int }
@available(*, deprecated, renamed: "double")
public var real: Double? { value.real }
public var double: Double? { value.real }
public var double: Double? { value.double }
public var data: Data? { value.data }
public func array<T>(of type: T.Type) throws -> [T] where T: ExplorerValueCreatable { try value.array(of: type) }
public func dictionary<T>(of type: T.Type) throws -> [String: T] where T: ExplorerValueCreatable { try value.dictionary(of: type) }

View File

@ -29,6 +29,7 @@ where
var int: Int? { get }
/// Non `nil` if the key is of the `Double` type
@available(*, deprecated, renamed: "double")
var real: Double? { get }
/// Non `nil` if the key is of the `Double` type

View File

@ -131,7 +131,7 @@ final class PathExplorerGetTests: XCTestCase {
XCTAssertEqual(try explorer.get(0).string, "Endo")
XCTAssertEqual(try explorer.get(1).int, 1)
XCTAssertEqual(try explorer.get(2).bool, false)
XCTAssertEqual(try explorer.get(3).real, 2.5)
XCTAssertEqual(try explorer.get(3).double, 2.5)
}
func testGetIndex_LastIndex<P: EquatablePathExplorer>(_ type: P.Type) throws {