Commit Graph

25 Commits

Author SHA1 Message Date
Nate Cook
af4ae6042f Add availability for diffing implementation (#84438)
The diffing implementation traffics in CollectionDifference elements,
which are availability gated. This adds the correct availability for
those APIs.

rdar://161010205
2025-09-23 16:44:00 -05:00
Evan Wilde
0a409130d3 Fix Bootstrap: diffing
The pass that tracks which control-flow positions are unreachable after
infinite loops was migrated to pure Swift in PR #79186. As a result, the
C++-only compiler used to bootstrap is unable to determine that the
code-location after loops is unreachable. Placing a fatalError after the
infinite while loop.

Fixes: rdar://160956325
2025-09-19 16:51:06 -07:00
Nate Cook
80f052e251 [stdlib] Switch to a linear-space variant of Myers diffing (#83212)
This changes the implementation for `Collection.difference(from:)` to
use a linear-space complexity variation of the same Myers algorithm. The
new version is similar in execution time to the existing one, but should
alleviate memory pressure when diffing collections where the number of
differences approaches the size of the collection. While the new
algorithm returns a set of changes that is the same size as the previous
version, the specific changes are not guaranteed to be the same.

rdar://155829876
2025-09-19 10:03:26 -07:00
Allan Shortlidge
322443d91d stdlib: Address StrictMemorySafety warnings in Array related code. 2025-03-31 16:43:01 -07:00
Doug Gregor
22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Doug Gregor
8b4fe6be18 Eliminate some unnecessary shadowing generic parameters 2023-05-17 11:04:11 -07:00
Karoy Lorentey
8ed81ae063 [stdlib] Adopt availability macros 2021-10-31 15:00:58 -07:00
Karoy Lorentey
dd40ff2929 [stdlib][NFC] Put stored properties & primary initializers before other members in struct declarations 2021-10-05 22:01:35 -07:00
Matt Zanchelli
be13b470aa Fix typos
becuase -> because
preceeds -> precedes
initalizer -> initializer
intialize -> initialize
libary -> library
notfication -> notification
reciever -> receiver
collecton -> collection
exlcusive -> exclusive
techincal -> technical
compatability -> compatibility
setps -> steps
accomodate -> accommodate
brakcet -> bracket
fraciton -> fraction
programm -> program
concequently -> consequently
ecoding -> encoding
timeIntervalforSelfEnd -> timeIntervalForSelfEnd
2020-12-21 18:44:03 -05:00
Xiaodi Wu
ae423c5bcd [NFC] Replace two uses of 'fileprivate' with 'private' 2020-02-23 12:05:39 -05:00
Karoy Lorentey
d83a4257f0 [stdlib] Don’t use assert() in the stdlib
assert() is designed to be used in user code only; the equivalent stdlib function is called _internalInvariant().

rdar://57101013
2019-12-11 19:23:46 -08:00
Scott Perry
15904df5d4 Review feedback from @lorentey 2019-08-10 09:30:25 -07:00
Scott Perry
e01e964dd9 Review feedback from @xwu 2019-08-09 12:35:32 -07:00
Scott Perry
6c992d91b2 Return nil on applying() failure instead of crashing (rdar://problem/53663769) 2019-08-08 16:50:13 -07:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
Scott Perry
3d741f7f2e Restore call to reserveCapacity 2019-06-27 16:01:17 -07:00
Scott Perry
0fc5d6ad31 Performance improvements and availability updates for Collection.difference(from:using:) 2019-06-26 16:55:29 -07:00
Nate Cook
841eb4cf5e [stdlib] Revise collection difference documentation (#24675)
* Revise CollectionDifference documentation.
2019-05-10 20:57:46 +02:00
Scott Perry
6e3139b5da Incorporate feedback from @lorentey and @moiseev 2019-02-27 14:05:06 -08:00
Karoy Lorentey
fd32a3d14e [stdlib] Set availability of diffing APIs 2019-02-22 14:28:15 -08:00
Karoy Lorentey
57f4afbf84 [stdlib] Update diffing code to match stdlib coding conventions
- Add an underscore to private/internal symbols
- Make access levels explicit, even when they’re implied from context
- Conform to max line length of 80 characters
- Conformances declared on separate extensions that implement them
- Arrange member declarations so that stored properties appear first
- Expand single-letter function and type parameter names where there is an obvious name that’s more descriptive
- RangeReplaceableCollection.fastApplicationEnumeration → CollectionDifference._fastEnumeratedApply
2019-02-22 14:27:45 -08:00
Scott Perry
b467e24a9e Apply public documentation and type modifications from proposal acceptance 2019-02-04 13:28:36 -08:00
Scott Perry
df3a058a6f s/shortestEditScript/difference/g per proposal feedback 2019-01-21 22:31:04 -08:00
Scott Perry
c0c068d663 Match indentation style 2019-01-14 15:53:24 -08:00
Scott Perry
1af14db552 Initial import of diffing package into standard library 2019-01-13 20:17:20 -08:00