Skip to content

Commit 0354667

Browse files
authored
Provide unique generic method parameter names (#669)
This is getting warned on in the 5.9 compiler, will be an error starting in Swift 6.
1 parent 8eafd55 commit 0354667

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/_RegexParser/Utility/TypeConstruction.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ public enum TypeConstruction {
107107
var currentElementAddressUnaligned = UnsafeMutableRawPointer(baseAddress)
108108
for element in elements {
109109
// Open existential on each element type.
110-
func initializeElement<T>(_ element: T) {
110+
func initializeElement<U>(_ element: U) {
111111
currentElementAddressUnaligned =
112-
currentElementAddressUnaligned.roundedUp(toAlignmentOf: T.self)
112+
currentElementAddressUnaligned.roundedUp(toAlignmentOf: U.self)
113113
currentElementAddressUnaligned.bindMemory(
114-
to: T.self, capacity: MemoryLayout<T>.size
114+
to: U.self, capacity: MemoryLayout<U>.size
115115
).initialize(to: element)
116116
// Advance to the next element (unaligned).
117117
currentElementAddressUnaligned =
118-
currentElementAddressUnaligned.advanced(by: MemoryLayout<T>.size)
118+
currentElementAddressUnaligned.advanced(by: MemoryLayout<U>.size)
119119
}
120120
_openExistential(element, do: initializeElement)
121121
}
@@ -175,8 +175,8 @@ extension MemoryLayout {
175175
if byteOffset == 0 { return 0 }
176176
var currentOffset = 0
177177
for (index, type) in elementTypes.enumerated() {
178-
func sizeAndAlignMask<T>(_: T.Type) -> (Int, Int) {
179-
(MemoryLayout<T>.size, MemoryLayout<T>.alignment - 1)
178+
func sizeAndAlignMask<U>(_: U.Type) -> (Int, Int) {
179+
(MemoryLayout<U>.size, MemoryLayout<U>.alignment - 1)
180180
}
181181
// The ABI of an offset-based key path only stores the byte offset, so
182182
// this doesn't work if there's a 0-sized element, e.g. `Void`,

Sources/_StringProcessing/Regex/AnyRegexOutput.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ extension Regex where Output == AnyRegexOutput {
283283
///
284284
/// - Parameter regex: A regular expression to convert to use a dynamic
285285
/// capture list.
286-
public init<Output>(_ regex: Regex<Output>) {
286+
public init<OtherOutput>(_ regex: Regex<OtherOutput>) {
287287
self.init(node: regex.root)
288288
}
289289
}
@@ -299,7 +299,7 @@ extension Regex.Match where Output == AnyRegexOutput {
299299
///
300300
/// - Parameter match: A regular expression match to convert to a match with
301301
/// type-erased captures.
302-
public init<Output>(_ match: Regex<Output>.Match) {
302+
public init<OtherOutput>(_ match: Regex<OtherOutput>.Match) {
303303
self.init(
304304
anyRegexOutput: match.anyRegexOutput,
305305
range: match.range

0 commit comments

Comments
 (0)