From a9bff6ac541cc66a80b11b691e5977f5379b0e60 Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Tue, 16 May 2023 08:52:14 -0500 Subject: [PATCH] Provide unique generic method parameter names This is getting warned on in the 5.9 compiler, will be an error starting in Swift 6. --- Sources/_RegexParser/Utility/TypeConstruction.swift | 12 ++++++------ Sources/_StringProcessing/Regex/AnyRegexOutput.swift | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/_RegexParser/Utility/TypeConstruction.swift b/Sources/_RegexParser/Utility/TypeConstruction.swift index 4d1765e34..54a7c9263 100644 --- a/Sources/_RegexParser/Utility/TypeConstruction.swift +++ b/Sources/_RegexParser/Utility/TypeConstruction.swift @@ -107,15 +107,15 @@ public enum TypeConstruction { var currentElementAddressUnaligned = UnsafeMutableRawPointer(baseAddress) for element in elements { // Open existential on each element type. - func initializeElement(_ element: T) { + func initializeElement(_ element: U) { currentElementAddressUnaligned = - currentElementAddressUnaligned.roundedUp(toAlignmentOf: T.self) + currentElementAddressUnaligned.roundedUp(toAlignmentOf: U.self) currentElementAddressUnaligned.bindMemory( - to: T.self, capacity: MemoryLayout.size + to: U.self, capacity: MemoryLayout.size ).initialize(to: element) // Advance to the next element (unaligned). currentElementAddressUnaligned = - currentElementAddressUnaligned.advanced(by: MemoryLayout.size) + currentElementAddressUnaligned.advanced(by: MemoryLayout.size) } _openExistential(element, do: initializeElement) } @@ -175,8 +175,8 @@ extension MemoryLayout { if byteOffset == 0 { return 0 } var currentOffset = 0 for (index, type) in elementTypes.enumerated() { - func sizeAndAlignMask(_: T.Type) -> (Int, Int) { - (MemoryLayout.size, MemoryLayout.alignment - 1) + func sizeAndAlignMask(_: U.Type) -> (Int, Int) { + (MemoryLayout.size, MemoryLayout.alignment - 1) } // The ABI of an offset-based key path only stores the byte offset, so // this doesn't work if there's a 0-sized element, e.g. `Void`, diff --git a/Sources/_StringProcessing/Regex/AnyRegexOutput.swift b/Sources/_StringProcessing/Regex/AnyRegexOutput.swift index 243c1ba01..57bf06dae 100644 --- a/Sources/_StringProcessing/Regex/AnyRegexOutput.swift +++ b/Sources/_StringProcessing/Regex/AnyRegexOutput.swift @@ -283,7 +283,7 @@ extension Regex where Output == AnyRegexOutput { /// /// - Parameter regex: A regular expression to convert to use a dynamic /// capture list. - public init(_ regex: Regex) { + public init(_ regex: Regex) { self.init(node: regex.root) } } @@ -299,7 +299,7 @@ extension Regex.Match where Output == AnyRegexOutput { /// /// - Parameter match: A regular expression match to convert to a match with /// type-erased captures. - public init(_ match: Regex.Match) { + public init(_ match: Regex.Match) { self.init( anyRegexOutput: match.anyRegexOutput, range: match.range