diff --git a/prototype/Doubt/Syntax.swift b/prototype/Doubt/Syntax.swift index b13af5afd..26e597fa8 100644 --- a/prototype/Doubt/Syntax.swift +++ b/prototype/Doubt/Syntax.swift @@ -31,14 +31,11 @@ public func == (left: Term, right: Term) -> Bool { /// A node in a syntax tree. Expressed algebraically to enable representation of both normal syntax trees and their diffs. public enum Syntax: CustomDebugStringConvertible, CustomDocConvertible { - case Empty case Leaf(A) case Branch(Recur) public func map(@noescape transform: Recur -> T) -> Syntax { switch self { - case .Empty: - return .Empty case let .Leaf(n): return .Leaf(n) case let .Branch(x): @@ -58,8 +55,6 @@ public enum Syntax: CustomDebugStringConvertible, CustomDocConvertible public var debugDescription: String { switch self { - case .Empty: - return ".Empty" case let .Leaf(n): return ".Leaf(\(n))" case let .Branch(x): @@ -69,8 +64,6 @@ public enum Syntax: CustomDebugStringConvertible, CustomDocConvertible public var doc: Doc { switch self { - case .Empty: - return .Empty case let .Leaf(n): return Doc(n) case let .Branch(x): @@ -82,8 +75,6 @@ public enum Syntax: CustomDebugStringConvertible, CustomDocConvertible extension Syntax where A: Equatable { public static func equals(recur: (Recur, Recur) -> Bool)(_ left: Syntax, _ right: Syntax) -> Bool { switch (left, right) { - case (.Empty, .Empty): - return true case let (.Leaf(l1), .Leaf(l2)): return l1 == l2 case let (.Branch(v1), .Branch(v2)): @@ -108,8 +99,6 @@ extension Term where A: Hashable { extension Syntax where A: Hashable { public func hash(recur: Recur -> Hash) -> Hash { switch self { - case .Empty: - return Hash("Empty") case let .Leaf(n): return Hash("Leaf", Hash(n)) case let .Branch(x): diff --git a/prototype/DoubtTests/DiffTests.swift b/prototype/DoubtTests/DiffTests.swift index 45ce48c6f..a0d8192fb 100644 --- a/prototype/DoubtTests/DiffTests.swift +++ b/prototype/DoubtTests/DiffTests.swift @@ -4,11 +4,11 @@ final class DiffTests: XCTestCase { } func testSESOverEmptyAndNonEmptyCollectionsIsInsertions() { - XCTAssertEqual(Diff.diff([], [ a, b ]), [ Diff.Patch(.Empty, a), Diff.Patch(.Empty, b) ]) + XCTAssertEqual(Diff.diff([], [ a, b ]), [ Diff.Patch(nil, a), Diff.Patch(nil, b) ]) } func testSESOverNonEmptyAndEmptyCollectionsIsDeletions() { - XCTAssertEqual(Diff.diff([ a, b ], []), [ Diff.Patch(a, .Empty), Diff.Patch(b, .Empty) ]) + XCTAssertEqual(Diff.diff([ a, b ], []), [ Diff.Patch(a, nil), Diff.Patch(b, nil) ]) } func testSESCanInsertAtHead() {