-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternative == method linkage fix #140
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -72,6 +72,16 @@ extension FilePath { | |||||
} | ||||||
} | ||||||
|
||||||
extension FilePath.Component { | ||||||
public static func == (lhs: Self, rhs: Self) -> Bool { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, this would be a newly exported symbol, so it needs to come with an availability declaration. To clean up the mess that resulted from adding |
||||||
return Self.strSliceEqual(lhs: lhs, rhs: rhs) | ||||||
} | ||||||
|
||||||
public func hash(into hasher: inout Hasher) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem here -- this is a new symbol, so it needs to either have an |
||||||
return self.strSliceHash(into: &hasher) | ||||||
} | ||||||
} | ||||||
|
||||||
@available(/*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8, *) | ||||||
extension FilePath.Component { | ||||||
|
||||||
|
@@ -166,15 +176,22 @@ extension _StrSlice { | |||||
internal var _systemString: SystemString { SystemString(_slice) } | ||||||
} | ||||||
extension _StrSlice { | ||||||
public static func == (lhs: Self, rhs: Self) -> Bool { | ||||||
public static func strSliceEqual(lhs: Self, rhs: Self) -> Bool { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to go this way, let's at least put an end to adding any new
Suggested change
|
||||||
lhs._slice.elementsEqual(rhs._slice) | ||||||
} | ||||||
public func hash(into hasher: inout Hasher) { | ||||||
public static func == (lhs: Self, rhs: Self) -> Bool { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should remove this function altogether. (After verifying that it doesn't end up getting exported somehow in the ABI stable binary.) |
||||||
return Self.strSliceEqual(lhs: lhs, rhs: rhs) | ||||||
} | ||||||
|
||||||
public func strSliceHash(into hasher: inout Hasher) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
hasher.combine(_slice.count) // discriminator | ||||||
for element in _slice { | ||||||
hasher.combine(element) | ||||||
} | ||||||
} | ||||||
public func hash(into hasher: inout Hasher) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here -- this function should not exist. |
||||||
return self.strSliceHash(into: &hasher) | ||||||
} | ||||||
} | ||||||
internal protocol _PathSlice: _StrSlice { | ||||||
var _path: FilePath { get } | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorentey would this be possible to do (without availability) as the ABI-stable build picked up the symbols?
Also, would we still need the
public func
below if we added the conformance explicitly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awaiting @lorentey input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sinking of the Equatable/Hashable conformances from
_StrSlice
toComponent
is probably fine, ABI-wise. If any other public type conformed to_StrSlice
, then it'll need to do the same._StrSlice
will need to stop conforming toEquatable
/Hashable
.