mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Apply the MoveOnlyAddressChecker change from
https://github.com/swiftlang/swift/pull/73358 to the
MoveOnly[Value]Checker.
After 7713eef817, before running value
checking, all lifetimes in the function are completed. That doesn't
quite work because lifetime completion expects not to encounter
reborrows or their adjacent phis.
rdar://151325025
37 lines
1.2 KiB
Swift
37 lines
1.2 KiB
Swift
// RUN: %target-build-swift %s
|
|
|
|
typealias LeagueDayOfWeek = UInt8
|
|
|
|
let settings = LeagueSettings(divisions: [.init(id: 0, dayOfWeek: 0), .init(id: 1, dayOfWeek: 0)])
|
|
let dummy = Dummy()
|
|
dummy.dummy(settings: settings)
|
|
|
|
struct LeagueSettings: Codable, Sendable {
|
|
let divisions:ContiguousArray<LeagueDivision>
|
|
}
|
|
struct LeagueEntry: Codable, Sendable {
|
|
typealias IDValue = Int
|
|
}
|
|
struct LeagueDivision: Codable, Hashable, Sendable {
|
|
typealias IDValue = Int
|
|
let id:IDValue
|
|
let dayOfWeek:LeagueDayOfWeek
|
|
}
|
|
struct Dummy: ~Copyable {
|
|
}
|
|
extension Dummy {
|
|
func dummy(settings: LeagueSettings) {
|
|
var divisionEntries:ContiguousArray<Set<LeagueEntry.IDValue>> = .init(repeating: Set(), count: settings.divisions.count)
|
|
var grouped:[LeagueDayOfWeek:Set<LeagueEntry.IDValue>] = [:]
|
|
for division in settings.divisions {
|
|
/* // OK
|
|
if grouped[division.dayOfWeek] == nil {
|
|
grouped[division.dayOfWeek] = divisionEntries[division.id]
|
|
} else {
|
|
grouped[division.dayOfWeek]!.formUnion(divisionEntries[division.id])
|
|
}*/
|
|
grouped[division.dayOfWeek, default: []].formUnion(divisionEntries[division.id]) // crashes
|
|
}
|
|
}
|
|
}
|