From b945c13fa80e28121eaf8a190eef1d30ca53c6c7 Mon Sep 17 00:00:00 2001 From: Jarek Pendowski Date: Fri, 28 Aug 2020 18:14:01 +0200 Subject: [PATCH] Fixed error with operator precedence in Xcode 12. Removed ambiguity in the test. --- Sources/HTMLNode.m | 8 ++++---- Tests/HTMLKitTests/HTMLNodesTests.m | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Sources/HTMLNode.m b/Sources/HTMLNode.m index 1b905fe..02f000f 100644 --- a/Sources/HTMLNode.m +++ b/Sources/HTMLNode.m @@ -383,16 +383,16 @@ NSString * const RemoveChildNode = @"-removeChildNode:"; } if (self.ownerDocument != otherNode.ownerDocument) { - return (HTMLDocumentPositionDisconnected | HTMLDocumentPositionImplementationSpecific | - self.hash < otherNode.hash ? HTMLDocumentPositionPreceding : HTMLDocumentPositionFollowing); + return ((HTMLDocumentPositionDisconnected | HTMLDocumentPositionImplementationSpecific | + self.hash < otherNode.hash) ? HTMLDocumentPositionPreceding : HTMLDocumentPositionFollowing); } NSArray *ancestors1 = GetAncestorNodes(self); NSArray *ancestors2 = GetAncestorNodes(otherNode); if (ancestors1.lastObject != ancestors2.lastObject) { - return (HTMLDocumentPositionDisconnected | HTMLDocumentPositionImplementationSpecific | - self.hash < otherNode.hash ? HTMLDocumentPositionPreceding : HTMLDocumentPositionFollowing); + return ((HTMLDocumentPositionDisconnected | HTMLDocumentPositionImplementationSpecific | + self.hash < otherNode.hash) ? HTMLDocumentPositionPreceding : HTMLDocumentPositionFollowing); } NSUInteger index1 = ancestors1.count; diff --git a/Tests/HTMLKitTests/HTMLNodesTests.m b/Tests/HTMLKitTests/HTMLNodesTests.m index 94aeda2..1c2b5f7 100644 --- a/Tests/HTMLKitTests/HTMLNodesTests.m +++ b/Tests/HTMLKitTests/HTMLNodesTests.m @@ -495,9 +495,7 @@ XCTAssertTrue([paragraph compareDocumentPositionWithNode:paragraph] == HTMLDocumentPositionEquivalent); HTMLElement *element = [HTMLElement new]; - XCTAssertTrue([paragraph compareDocumentPositionWithNode:element] == - (HTMLDocumentPositionDisconnected | HTMLDocumentPositionImplementationSpecific | - paragraph.hash < element.hash ? HTMLDocumentPositionPreceding: HTMLDocumentPositionFollowing)); + XCTAssertTrue([paragraph compareDocumentPositionWithNode:element] == HTMLDocumentPositionPreceding); XCTAssertTrue([paragraph compareDocumentPositionWithNode:image] == HTMLDocumentPositionPreceding); XCTAssertTrue([anchor compareDocumentPositionWithNode:image] == HTMLDocumentPositionPreceding);