Skip to content

Provide unique generic method parameter names #669

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

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Sources/_RegexParser/Utility/TypeConstruction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public enum TypeConstruction {
var currentElementAddressUnaligned = UnsafeMutableRawPointer(baseAddress)
for element in elements {
// Open existential on each element type.
func initializeElement<T>(_ element: T) {
func initializeElement<U>(_ element: U) {
currentElementAddressUnaligned =
currentElementAddressUnaligned.roundedUp(toAlignmentOf: T.self)
currentElementAddressUnaligned.roundedUp(toAlignmentOf: U.self)
currentElementAddressUnaligned.bindMemory(
to: T.self, capacity: MemoryLayout<T>.size
to: U.self, capacity: MemoryLayout<U>.size
).initialize(to: element)
// Advance to the next element (unaligned).
currentElementAddressUnaligned =
currentElementAddressUnaligned.advanced(by: MemoryLayout<T>.size)
currentElementAddressUnaligned.advanced(by: MemoryLayout<U>.size)
}
_openExistential(element, do: initializeElement)
}
Expand Down Expand Up @@ -175,8 +175,8 @@ extension MemoryLayout {
if byteOffset == 0 { return 0 }
var currentOffset = 0
for (index, type) in elementTypes.enumerated() {
func sizeAndAlignMask<T>(_: T.Type) -> (Int, Int) {
(MemoryLayout<T>.size, MemoryLayout<T>.alignment - 1)
func sizeAndAlignMask<U>(_: U.Type) -> (Int, Int) {
(MemoryLayout<U>.size, MemoryLayout<U>.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`,
Expand Down
4 changes: 2 additions & 2 deletions Sources/_StringProcessing/Regex/AnyRegexOutput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ extension Regex where Output == AnyRegexOutput {
///
/// - Parameter regex: A regular expression to convert to use a dynamic
/// capture list.
public init<Output>(_ regex: Regex<Output>) {
public init<OtherOutput>(_ regex: Regex<OtherOutput>) {
self.init(node: regex.root)
}
}
Expand All @@ -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<Output>(_ match: Regex<Output>.Match) {
public init<OtherOutput>(_ match: Regex<OtherOutput>.Match) {
self.init(
anyRegexOutput: match.anyRegexOutput,
range: match.range
Expand Down